Metadata-Version: 2.1
Name: permissive-dict
Version: 1.0.1
Summary: Dictionary with loose rules for finding keys.
Home-page: https://github.com/Martlark/PermissiveDict
Author: Andrew Rowe
Author-email: rowe.andrew.d@gmail.com
License: Apache Software License
Download-URL: https://github.com/Martlark/PermissiveDict/archive/1.0.1.tar.gz
Keywords: dictionary dict
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2.7
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: Operating System :: POSIX
Classifier: Operating System :: MacOS
Classifier: Operating System :: Unix
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown

# PermissiveDict

Dictionary class with loose rules for returning an attribute or a requested key value.  
--------------------

Note: may resort to iterating the dict values to find the matching requested key, so is potentially slow.

Key is first directly found using the exact key, and then loose rules are used.

Rules:
------

1. Keys compared without regard to case.
2. Spaces, underscores, full-stops and dashes are equivalent in a requested key.
3. Requested key is converted to str and stripped for wild card searching.
4. Items in the list can be retrieved by, get, attribute_access, call or array requested_key.
5. First matching element is returned.
6. Default of '' is used instead of dict standard None or raising KeyError
7. Multiple keys can be supplied separated with , (comma)

Example:
--------

        from permissive_dict import PermissiveDict

        a = PermissiveDict({'A B': 2, 4: 4})
        a.get('A_b') == a['a_b'] == a['A b'] == a['A_B'] == a['a-b '] == a['a.b '] == a.a_b == a.A_b == a('a-b')

        a.get('blue,4') == 4

        a.get('4') == a[4] == a(4) == a('4')

Items with multiple wildcard keys matching in the dictionary will return the first item found.


