Predicate
Predicate takes the django queryset filtering language and applies it to building python native predicate functions that
you can pass to the filter builtin.
This library is mean to make creating native python filter functions readable and easy:
>>> from predicate import where
>>> people = [
... {'name': {'first': 'Joe', 'last': 'Smith'}, 'age': 25},
... {'name': {'first': 'Jane', 'last': 'Smith'}, 'age': 27},
... {'name': {'first': 'John', 'last': 'Smith'}, 'age': 33},
... {'name': {'first': 'Bill', 'last': 'Bob'}, 'age': 40},
... {'name': {'first': 'Joe', 'last': 'Bob'}, 'age': 59},
... ]
>>> young_smiths = list(filter(where(name__last__iexact='smith', age__lte=30), people))
>>> young_smiths
[{'name': {'first': 'Joe', 'last': 'Smith'}, 'age': 25}, {'name': {'first': 'Jane', 'last': 'Smith'}, 'age': 27}]
Installation
This project is distributed via pip. To get started:
pip install predicate
Metadata
Release files for predicate 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| predicate-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / predicate-0.3.0-py3-none-any.whl
| Download URL | predicate-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65c73bbaef7e87816455d709fc50348e3c4be1752faf2f0198616d774ff11b08
|
|
BLAKE2b-256 checksum How to use checksums |
c6fe359147098430ae32918cd13e99fce73113bdbbee9f41817480b3477ae815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Security for predicate 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.