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}
Release files for deflate-dict 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deflate_dict-1.0.1.tar.gz | 4.1 kB | Details |
Release files / deflate_dict-1.0.1.tar.gz
| Download URL | deflate_dict-1.0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58feee3caa532e3226d03f072bac54b2cf4d311123c1911d1949527d3a14d865
|
|
BLAKE2b-256 checksum How to use checksums |
1fb7fea6824f1f74fda005b5019ca37b7f6dffeefd3cacd609395e80837cbb3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.13.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|