Map Dictionary Keys
Installation
pip install map-dictionary-keys
Usage
from map_dictionary_keys import map_dictionary_keys
d = {'some_key_to_map': 'value'}
mapped_dictionary = map_dictionary_keys(d, lambda key: key.upper())
In the above example, mapped_dictionary will be mapped according to the function some_mapping_function as follows:
mapped_dictionary = {'SOME_KEY_TO_MAP': 'value'}
This function will work for all levels of nested dictionaries. In the following example, both 'sub_dictionary' and 'key_name' will be converted as per the mapping function passed to map_dictionary_keys.
dictionary = {
'sub_dictionary': {
'key_name': 'value'
}
}
It will also work for nested lists of dictionaries. For example, in the following example, 'key_name' will be mapped according to the mapping function provided to map_dictionary_keys.
dictionary = {
'list_of_dictionaries': [
{
'key_name': 'value'
}
]
}
This function will not currently work for lists nested beyond the first level. For example, in the following example, 'key_name' will not be mapped according to the mapping function provided to map_dictionary_keys.
dictionary = {
'my_list': [
[
{
'key_name': 'value'
}
]
]
}
Metadata
Release files for map-dictionary-keys 1.0.0
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 |
|---|---|---|---|---|
| map-dictionary-keys-1.0.0.tar.gz | 2.3 kB | Without provenance | Details for map-dictionary-keys-1.0.0.tar.gz |
Release files / map-dictionary-keys-1.0.0.tar.gz
| Download URL | map-dictionary-keys-1.0.0.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31fb650445cec3988f91b606b81cc9ecbace6d33db4d584ed2ecbab87bb8c878
|
|
BLAKE2b-256 checksum How to use checksums |
e5f8090a742eb13496f0d0c7147e7a204a3a53ee53e77484027fa9db14663124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Security for map-dictionary-keys 1.0.0
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.