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
Split a list into chunks
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
Chunks example:
import understreck as _ to_chunk = ["one", "two", "three", "four", "five"] result = _.chunks.split(to_chunk, 2) # result == [["one", "two", "three"], ["four", "five"]]
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.2.1 (2018-12-10)
Add Understreck.chunks
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.1.tar.gz
(9.8 kB
view hashes)
Built Distribution
Close
Hashes for understreck-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f460821ed13682f09238f48c104a18caf746ae8d1f103a23e0b59a37e79c1640 |
|
MD5 | 9f72b12e960097b0fd0d4c530c3cfa9b |
|
BLAKE2b-256 | 2416d0375c2ac2d5d4eef6bd7b18fab8bce0cb84915b4cdcad238f492cd990dc |