overscore
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 |
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”] |
Release files for overscore 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| overscore-0.1.2.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| overscore-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / overscore-0.1.2.tar.gz
| Download URL | overscore-0.1.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2815b717c9a65443c41163e04781de91e6974d46aa25165b2dd90abd336dec5e
|
|
BLAKE2b-256 checksum How to use checksums |
1fd3ea9fc7e0865844a1c44877dc607c773d80034fe96993d7d55acd62fa28f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.5
|
Release files / overscore-0.1.2-py3-none-any.whl
| Download URL | overscore-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65f197611c39a9448f2cc82fbca404daff864100f05b8c2919fbf173d18c5a85
|
|
BLAKE2b-256 checksum How to use checksums |
d14e05070ce30982fb412b63ee23cbe1121070b889ff405b95a0e2343eca2ab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.5
|