Skip to main content

A collection of nice utility functions for python

Project description

Understreck

https://img.shields.io/pypi/v/understreck.svg https://img.shields.io/travis/cfp2000/understreck.svg Documentation Status Updates

A collection of nice utility functions for python

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.1.1 (2018-11-02)

  • Update the readme

0.1.0 (2018-11-02)

  • First release on PyPI.

Project details


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.1.1.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

understreck-0.1.1-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page