Skip to main content

Double underscore access notation

Project description

Library for double underscore access notation

Overscore provides a way to retrieve (and store) multi-dimensional data using a single string with double underscores.

Inspired by Django, the access string can be used as a routine argument or a URL parameter, allowing for complex access within simple contexts:

import overscore

data = {
    "things": {
        "a": {
            "b": [
                {
                    "1": "yep"
                }
            ]
        }
    }
}

overscore.get(data, "things__a__b__0____1")
# "yep"

All keys/indexes are separated by double underscores. Extra underscores dictate how to parse that place in the path.

Underscores and Behavior

Underscores

Following

Meaning

Example

Equivalent

2

letters and numbers

key

a__b

[“a”][“b”]

2

numbers

index

a__1

[“a”][1]

3

numbers

negative index

a___2

[“a”][-2]

4

numbers

numerical key

a____3

[“a”][“3”]

5

numbers

neagtive numerical key

a_____4

[“a”][“-4”]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

overscore-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

overscore-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file overscore-0.1.1.tar.gz.

File metadata

  • Download URL: overscore-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for overscore-0.1.1.tar.gz
Algorithm Hash digest
SHA256 372cc8c4abb694e465f2abc0bd362dfecc5170b2ce71883fd4ee6f8f49076fe1
MD5 b883624dd866bf72502d6e7bf3338900
BLAKE2b-256 ecf3da43bb10dc7238ec9ffa090374204eaf7aa5151dc976d776d8d701aa98bd

See more details on using hashes here.

File details

Details for the file overscore-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: overscore-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for overscore-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e08973f643651a99a3ccf363c6055a4d06706c5339b9af7aef6e037a1c7b8ef1
MD5 903e7bd9bad90a43189180a5fbac344e
BLAKE2b-256 3ab22e96484899b667a221433d748a8a6c894cf0d6a8daa47a0a15cfa8e75d6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page