Versions
Description
kmatch: A language for matching Python dictionaries =================================================== The kmatch library provides a language for matching Python dictionaries. Patterns are specified as lists of filters combined with logical operators. A quick example of kmatch is below. .. code-block:: python from kmatch import K k = K(['>=', 'k', 10]) print k.match({'k': 9}) False print k.match({'k': 10}) True More powerful expressions can be made to match more types of patterns. .. code-block:: python from kmatch import K k = K(['&', ['=~', 'k1', '.*Hello.*'], ['!=', 'k2', False] ]) # Match all a dictionary whose 'k1' key has a pattern of '.*Hello.*' and whose 'k2' key is not False k.match(...) The kmatch library can be used for a wide variety of applications. One example is filtering a list of dictionaries that match a pattern. Another example is to validate dictionaries passed to a function. Documentation ------------- Full documentation is available at http://kmatch.readthedocs.org
Repository
http://github.com/ambitioninc/kmatch.git
Project Slug
kmatch
Last Built
7 months, 3 weeks ago passed
Maintainers
Home Page
http://github.com/ambitioninc/kmatch
Badge
Tags
dictionary, matching, pattern, validation
Short URLs
kmatch.readthedocs.io
kmatch.rtfd.io
Default Version
latest
'latest' Version
master