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.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: overscore-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2815b717c9a65443c41163e04781de91e6974d46aa25165b2dd90abd336dec5e
MD5 43ea8965601257d82150c272e2d5b5d7
BLAKE2b-256 1fd3ea9fc7e0865844a1c44877dc607c773d80034fe96993d7d55acd62fa28f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: overscore-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 65f197611c39a9448f2cc82fbca404daff864100f05b8c2919fbf173d18c5a85
MD5 0ba03855cfeb16ca62a588bbe8597f03
BLAKE2b-256 d14e05070ce30982fb412b63ee23cbe1121070b889ff405b95a0e2343eca2ab4

See more details on using hashes here.

Supported by

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