ncw
Nested collections wrapper
Classes to access and/or modify data in nested collections (dict or list instances)
of str, int, float, bool, or None, through a Mapping or
MutableMapping interface using direct addressing.
Usage
Use the FrozenStructure class to access data in nested collections by either
a string comprised of the segments of the keys or indexes in the "path" addressing the
substructure or value, joined together by a separator character
(usually an ASCII dot: .), or a tuple of these path segments.
>>> serialized = '{"herbs": {"common": ["basil", "oregano", "parsley", "thyme"], "disputed": ["anise", \
"coriander"]}}'
>>>
>>> import json
>>> original_data = json.loads(serialized)
>>>
>>> from ncw import FrozenStructure
>>> readonly = FrozenStructure.from_native(original_data)
>>>
>>> readonly["herbs"]
{'common': ['basil', 'oregano', 'parsley', 'thyme'], 'disputed': ['anise', 'coriander']}
>>> readonly["herbs.common"]
['basil', 'oregano', 'parsley', 'thyme']
>>> readonly["herbs", "common"]
['basil', 'oregano', 'parsley', 'thyme']
>>> readonly["herbs.common.1"]
'oregano'
>>> readonly["herbs", "common", 1]
'oregano'
The MutableStructure class additionally allows changes to the stored data, see the documentation for more details.
Metadata
Release files for ncw 0.5.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 | |
|---|---|---|---|
| ncw-0.5.5.tar.gz | 26.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ncw-0.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.7 kB
Release files / ncw-0.5.5.tar.gz
| Download URL | ncw-0.5.5.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d032e7533175d6b4224eadf83911ced01bcb87441a42189646dd65383ebc45ad
|
|
BLAKE2b-256 checksum How to use checksums |
e2a5df1bf2df7abd64abebf17281a5bb9ee6af7be3d5111f5e7fbb050d9759e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ncw-0.5.5-py3-none-any.whl
| Download URL | ncw-0.5.5-py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59ccc40b4eda2484c8d3b783c21bea5513405925eff86e26dce59ad781516a4c
|
|
BLAKE2b-256 checksum How to use checksums |
bf5659b5b57f9f39a2ed1a7dfb215fcb1a74c2fc959f6479ec959974eaaefca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|