Skip to main content

Travis CI build SonarCloud Quality SonarCloud Maintainability Codacy Maintainability Maintainability Pypi project Pypi total project downloads

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:

Coveralls Coverage SonarCloud Coverage Code Climate Coverate

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)

Source distribution for deflate-dict 1.0.1
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

Release history Release notifications | RSS feed

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page