Metadata-Version: 1.1
Name: understreck
Version: 0.3.0
Summary: A collection of nice utility functions for python
Home-page: https://github.com/cfp2000/understreck
Author: Carl-Fredrik Arvidson
Author-email: carl-fredrik@arvidson.io
License: GNU General Public License v3
Description: ===========
        Understreck
        ===========
        
        
        .. image:: https://img.shields.io/pypi/v/understreck.svg
                :target: https://pypi.python.org/pypi/understreck
        
        .. image:: https://travis-ci.com/cfp2000/understreck.svg?branch=master
                :target: https://travis-ci.com/cfp2000/understreck
        
        .. image:: https://readthedocs.org/projects/understreck/badge/?version=latest
                :target: https://understreck.readthedocs.io/en/latest/?badge=latest
                :alt: Documentation Status
        
        .. image:: https://img.shields.io/badge/code%20style-black-000000.svg
                :target: https://github.com/ambv/black
                :alt: Code style: black
        
        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 = _.get(test_dictionary, "the_top_level.second_level.third_level")  # result = "it works"
            result = _.get(test_dictionary, "the_top_level.second_level.DOES_NOT_EXIST")  # result = None
        
            # Using a list or tuple
            result = _.get(test_dictionary, ["the_top_level", "second_level", "third_level"])  # result = "it works"
            result = _.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"]]
        
        Filter example::
        
            import understreck as _
        
            users = [
                    {"user": "barney", "age": 36, "active": True},
                    {"user": "fred", "age": 40, "active": False},
                ]
        
            # Using a lambda function
            result = _.filter(users, lambda x: not x.get("active"))  # result == [{"user": "fred", "age": 40, "active": False}]
        
            # Using partial dictionary
            result = _.filter(users, {"age": 36, "active": True})  # result == [{"user": "barney", "age": 36, "active": True}]
        
            # Using a list with a property name and value
            result = _.filter(users, ["active", False])  # result == [{"user": "fred", "age": 40, "active": False}]
        
            # Using a list with a property name. The value must be truthy.
            result = _.filter(users, ["active"])  # result == [{"user": "barney", "age": 36, "active": True}]
        
        Credits
        -------
        
        I have to credit the Lodash_ project for inspiration!
        
        This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
        
        .. _Lodash: https://lodash.com
        .. _Cookiecutter: https://github.com/audreyr/cookiecutter
        .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
        
        
        =======
        History
        =======
        
        Unreleased
        ----------
        
        0.3.0 (2019-05-03)
        ------------------
        * Adds Understreck.filter with inspired by https://lodash.com/docs/4.17.11#filter
        * Updated the travis button URL
        * Replaced nested_get with get in the README. (nested_get still works)
        * Black formatting
        
        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.
        
Keywords: understreck
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: PyPy
