A collection of nice utility functions for python
Project description
Understreck
A collection of nice utility functions for python
Free software: GNU General Public License v3
Documentation: https://understreck.readthedocs.io.
Features
Perform a safe get on a nested dictionary with the nested_get function
Nested Get example:
import understreck as _ test_dictionary = { "the_top_level": { "second_level": {"third_level": "it works", "third_level_sibling": False} } } # Using dot delimited strings result = _.nested_get(test_dictionary, "the_top_level.second_level.third_level") # result = "it works" result = _.nested_get(test_dictionary, "the_top_level.second_level.DOES_NOT_EXIST") # result = None # Using a list or tuple result = _.nested_get(test_dictionary, ["the_top_level", "second_level", "third_level"]) # result = "it works" result = _.nested_get(test_dictionary, ["the_top_level", "second_level", "DOES_NOT_EXIST"]) # result = None
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.2.0 (2018-11-12)
Add get as an alias for nested get
0.1.1 (2018-11-02)
Update the readme
0.1.0 (2018-11-02)
First release on PyPI.
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
understreck-0.2.0.tar.gz
(9.2 kB
view hashes)
Built Distribution
Close
Hashes for understreck-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c574feb20fae7a413f4c3eef1e2fa30e1f2056a90baee8bea36aacd6f96f2023 |
|
MD5 | fdd0c0c983cccd3380dbad59a76d3d9a |
|
BLAKE2b-256 | d7af7affdc14ec00a017f40f058655bca8a5cbb1cbc7bbf8ff9bd2fdca73c850 |