Python module for interacting with nested dicts as a single level dict with delimited keys.
Project description
FlatDict
FlatDict and FlatterDict are dict classes that allow for single level,
delimited key/value pair mapping of nested dictionaries. You can interact with
FlatDict and FlatterDict like a normal dictionary and access child
dictionaries as you normally would or with the composite key.
For example:
value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})
would be the same as:
value == {'foo:bar': 'baz', 'foo:qux': 'corge'}
values can be accessed as:
print(foo['foo:bar'])
# or
print(foo['foo']['bar'])
Additionally, lists and tuples are also converted into dicts using enumerate(),
using the FlatterDict class.
For example:
value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})
will be the same as:
value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
API
Documentation is available at https://flatdict.readthedocs.io
Versioning
This package attempts to use semantic versioning. API changes are indicated by the major version, non-breaking improvements by the minor, and bug fixes in the revision.
It is recommended that you pin your targets to greater or equal to the current version and less than the next major version.
Installation
pip install flatdict
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flatdict-4.1.0.tar.gz.
File metadata
- Download URL: flatdict-4.1.0.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63bcd906a0859d91d0aace44b327178706c7fcf85a88c7ccf0825628376ad66b
|
|
| MD5 |
5255ffbc576f60b525399999eccef772
|
|
| BLAKE2b-256 |
1fbae0461697020839f60741e493fc42b20a4cd3f91594ed3228f65ae9a50aee
|
Provenance
The following attestation bundles were made for flatdict-4.1.0.tar.gz:
Publisher:
deploy.yaml on gmr/flatdict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flatdict-4.1.0.tar.gz -
Subject digest:
63bcd906a0859d91d0aace44b327178706c7fcf85a88c7ccf0825628376ad66b - Sigstore transparency entry: 953587514
- Sigstore integration time:
-
Permalink:
gmr/flatdict@efd9e1b898a85156690d1691e5ac3a251af93ed1 -
Branch / Tag:
refs/tags/4.1.0 - Owner: https://github.com/gmr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@efd9e1b898a85156690d1691e5ac3a251af93ed1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file flatdict-4.1.0-py3-none-any.whl.
File metadata
- Download URL: flatdict-4.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24c3ff816733e472f91071031bd286c3826ecf2d646d5020af49fe10b20a5677
|
|
| MD5 |
c6fe1f61eb1a9ebbb9b024a6f9b06224
|
|
| BLAKE2b-256 |
12b56b6c496304047982b67d984ed2f77c183f73d69f7dbbc0cd2928252cc6b4
|
Provenance
The following attestation bundles were made for flatdict-4.1.0-py3-none-any.whl:
Publisher:
deploy.yaml on gmr/flatdict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flatdict-4.1.0-py3-none-any.whl -
Subject digest:
24c3ff816733e472f91071031bd286c3826ecf2d646d5020af49fe10b20a5677 - Sigstore transparency entry: 953587515
- Sigstore integration time:
-
Permalink:
gmr/flatdict@efd9e1b898a85156690d1691e5ac3a251af93ed1 -
Branch / Tag:
refs/tags/4.1.0 - Owner: https://github.com/gmr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yaml@efd9e1b898a85156690d1691e5ac3a251af93ed1 -
Trigger Event:
release
-
Statement type: