deflate_dict
Python package to deflate and re-inflate dictionaries.
How do I install this package?
As usual, just download it using pip:
pip install deflate_dict
Tests Coverage
Since some software handling coverages sometime get slightly different results, here’s three of them:
Deflating a dictionary
A dictionary will be deflated down to its smallest non-further iterable elements, defined as those not containing lists or dictionaries.
from deflate_dict import deflate
D = {
"a":[
{
"b":(0,1,2)
},
{
"c": [1,2,3]
}
]
}
result = deflate(D, sep="_")
# {'a_0_b': (0, 1, 2), 'a_1_c': [1, 2, 3], 'd': 4}
Inflate a dictionary
To reinflate a dictionary to its forgotten glory, just go with:
from deflate_dict import inflate
D = {"a_0_b": (0, 1, 2), "a_1_c": [1, 2, 3], "d": 4}
result = inflate(D, sep="_")
# {'a': [{'b': (0, 1, 2)}, {'c': [1, 2, 3]}], 'd': 4}
Limitations
The library, as of version 1.0.2, is unable to distinguish between reinflated numerical strings and actual numbers, since to deflate the strings the library has to convert the numbers to strings.
Metadata
Release files for deflate-dict 1.0.3
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 |
|---|---|---|---|---|
| deflate_dict-1.0.3.tar.gz | 4.4 kB | Without provenance | Details for deflate_dict-1.0.3.tar.gz |
Release files / deflate_dict-1.0.3.tar.gz
| Download URL | deflate_dict-1.0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b0ed4fe58a3378e7541e22654ce04828f48c1c8305da3f56d51ec416a06c3f
|
|
BLAKE2b-256 checksum How to use checksums |
50e6529f51601a4e6b0965a4ca8d571e568c071b1b604a424aa04fa12d9cffc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for deflate-dict 1.0.3
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.