dictns
simple python class that merges dictionary and object APIs
Those Namespace objects work in a similar way as javascript objects. intended to help deadling with deep json objects, and save you a lot of [‘’] in your code
usage
from dictns import Namespace
n = Namespace(dict(a=1, b=3, c=dict(d=4)))
assert(n['a'] == n.a)
assert(n['c']['d'] == n.c.d)
you can wrap dicts and lists inside Namespace
n = Namespace([dict(a=1, b=3, c=[dict(d=4)])])
assert(n[0]['a'] == n[0].a)
assert(n[0]['c'][0]['d'] == n[0].c[0].d)
you can also wrap dict subclasses like OrderedDict, but the resulting Namespace does not inherit original object characteristics (i.e. order in OrderedDict)
see unit tests for more usage examples
ChangeLog:
1.0: Initial version
1.1: Added Namespace comparaison tools
1.2: Namespace now support dict and list subclasses as input
- 1.3:
Fix for compatibility with getattr() built-in method. When an invalid key is requested, it now raises an AttributeError instead of a KeyError.
Allow initialization without arg: Namespace() is equivalent to Namespace({}).
1.4: Allow Namespace objects to be weak referenced
- 1.5:
Fix tests for 3.5 and pypy
Readme cleanups
Developing
Launch unit tests:
python test/test_namespace.py
Metadata
Release files for dictns 1.5
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 |
|---|---|---|---|---|
| dictns-1.5.tar.gz | 5.2 kB | Without provenance | Details for dictns-1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dictns-1.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for dictns-1.5-py2.py3-none-any.whl |
Total release size: 10.7 kB
Release files / dictns-1.5.tar.gz
| Download URL | dictns-1.5.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87ca212898db93164fcaa2fcff968563ba8da599cc136c85a0d6aee8867d2ec5
|
|
BLAKE2b-256 checksum How to use checksums |
902f2bb7f17294e33b5b3aad6f5a413894f70c020c44a539b50df23e87686ca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dictns-1.5-py2.py3-none-any.whl
| Download URL | dictns-1.5-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0af65dc05cc99a714ad1e26bfd6bf2fd869c7b95fdbc34d6a4eca38f9cf82707
|
|
BLAKE2b-256 checksum How to use checksums |
e8e70b105a1814d80244e5d9b5ee1d54ccf59cb3f2d3df6b27815158e3771744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for dictns 1.5
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.