FlatDict
FlatDict and FlatterDict are a dict classes that allows 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 = flatdict2.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 = flatdict2.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 flatdict2
Note that as of 4.0, setuptools 39.2 or higher is required for installation.
Metadata
Release files for flatdict2 4.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flatdict2-4.0.4.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flatdict2-4.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / flatdict2-4.0.4.tar.gz
| Download URL | flatdict2-4.0.4.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75ffcdb8c80442456a43b89f343da704babe1c0eab1d01cee7c8991e521e33c0
|
|
BLAKE2b-256 checksum How to use checksums |
c4010db27dfb801d7ec1f7ad28c5f1789ad76ef3ac0ab1022c92867993aa414d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / flatdict2-4.0.4-py3-none-any.whl
| Download URL | flatdict2-4.0.4-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91b2b8c749d8a179d8ddcfbb70918ea282a70324338ddb6a1fdbad32f3659874
|
|
BLAKE2b-256 checksum How to use checksums |
8b879b574175856558a371e44529b913886b5655ea60e35896a05d3283e756c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|