Skip to main content

Dictionary filter

Project description

interdict

Python dictionary filter

Installation

pip install interdict

Examples

Default (inclusion False)

>>> from interdict import filter_obj
>>> obj = {'name': 'shane', 'job': {'salary': 1000000, 'role': 'master of universe'}}
>>> filter = {'name': True, 'job': {'role': True}}
>>> filter_obj(obj, filter)
{'name': 'shane', 'job': {'role': 'master of universe'}}

Inclusive (a.k.a. TMI)

>>> filter_obj(obj, filter, default=True)
{'name': 'shane', 'job': {'salary': 1000000, 'role': 'master of universe'}}

Inclusive with better filter

>>> filter = {'job': {'salary': False}}
>>> filter_obj(obj, filter, default=True)
{'name': 'shane', 'job': {'role': 'master of universe'}}

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

interdict-2020.11.0a2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interdict-2020.11.0a2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file interdict-2020.11.0a2.tar.gz.

File metadata

  • Download URL: interdict-2020.11.0a2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/4.19.128-microsoft-standard

File hashes

Hashes for interdict-2020.11.0a2.tar.gz
Algorithm Hash digest
SHA256 7055255814d84a2b38f5924d7232df458b231538c6c9e849ab176328dcb9f4e5
MD5 0e0a9e429ea15ec7de59741592d259cc
BLAKE2b-256 b3b90e2bd5ed340dba127270fe6ac412bb19bbed1b4ff24cdf9a5d9d9db3d373

See more details on using hashes here.

File details

Details for the file interdict-2020.11.0a2-py3-none-any.whl.

File metadata

  • Download URL: interdict-2020.11.0a2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/4.19.128-microsoft-standard

File hashes

Hashes for interdict-2020.11.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 a92b6920a870e90c8aef1536d0a18ad60dd2d66c477902a316246f756c3e7277
MD5 21a5ee9c7d2295f6aef7f4de91975f1a
BLAKE2b-256 dac69b3010d919d7118080e0d194e12327cffd274a44a3ab9c2646728e68ae1a

See more details on using hashes here.

Supported by

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