MonkeyDict allows to access dict values as attributes (works recursively). A Javascript-like properties dot notation for python dicts.
USAGE
>>> from monkeydict import MonkeyDict as edict
>>> d = edict({'foo':3, 'bar':{'x':1, 'y':2}})
>>> d.foo
3
>>> d.bar.x
1
>>> d = edict(foo=3)
>>> d.foo
3
Very useful when exploiting parsed JSON content !
>>> from monkeydict import MonkeyDict as edict
>>> from simplejson import loads
>>> j = """{
"Buffer": 12,
"List1": [
{"type" : "point", "coordinates" : [100.1,54.9] },
{"type" : "point", "coordinates" : [109.4,65.1] },
{"type" : "point", "coordinates" : [115.2,80.2] },
{"type" : "point", "coordinates" : [150.9,97.8] }
]
}"""
>>> d = edict(loads(j))
>>> d.Buffer
12
>>> d.List1[0].coordinates[1]
54.9
Can set attributes as easily as getting them :
>>> d = MonkeyDict() >>> d.foo = 3 >>> d.foo 3
It is still a dict !
>>> d = MonkeyDict(log=False)
>>> d.debug = True
>>> d.items()
[('debug', True), ('log', False)]
Instance and class attributes are accessed like usual objects…
>>> class Flower(MonkeyDict):
... power = 1
...
>>> f = Flower({'height': 12})
>>> f.power
1
>>> f['power']
1
LICENSE
Lesser GNU Public License
CHANGELOG
1.0 (2021-05-21)
All references updated in all files. Testing completed.
0.1 (2021-05-21)
First version pushed to pypi (package renaming only)
EasyDict Versions (Parent Project)
1.10 (unreleased)
Nothing changed yet.
1.9 (2018-10-18)
Fix issue #3 that update and pop now work correctly on EasyDicts.
1.8 (2018-08-17)
Update package classifiers.
1.7 (2017-04-27)
Prevent copying sub-EasyDicts on assignment to fix unpickling (#7, thanks @Chronos-Sk)
1.6 (2015-01-27)
Allow setting attributes via setting items (thanks phivos)
1.5 (2014-08-07)
Allow subclassing using self instead of class name (thanks Steve Engledow)
1.4 (2011-03-13)
Access class attributes like instance attributes
1.3 (2012-02-08)
Better documentation and tests
1.2 (2011-06-08)
Fix inclusion of README
1.1 (2012-04-21)
Switch to distutils2
1.0 (2011-04-18)
Initial working version
Metadata
Release files for monkeydict 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| monkeydict-1.0.tar.gz | 7.1 kB | Without provenance | Details for monkeydict-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| monkeydict-1.0-py3-none-any.whl | Python 3 | none | any | Details for monkeydict-1.0-py3-none-any.whl |
Total release size: 13.9 kB
Release files / monkeydict-1.0.tar.gz
| Download URL | monkeydict-1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cafbd6aa6beeb0d92cf1b1876649146a4d35e6510c4dcce05004d74cafd38960
|
|
BLAKE2b-256 checksum How to use checksums |
2910619885132f1b00d91f066919a61df1afb3069fac6021825afa9a3a648646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.8.5
|
Release files / monkeydict-1.0-py3-none-any.whl
| Download URL | monkeydict-1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9da3078afab9ffa3607140d37939009c279b2d2c66a7faaeaf85b1b1e28701e7
|
|
BLAKE2b-256 checksum How to use checksums |
62f7ab72ba3b9f685d2e8078b71de61d8cf240ca1b96594f29a35a5d6f977a16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.8.5
|
Security for monkeydict 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.