Skip to main content

Provides Dex, a Python container for indexing objects of any type.

Project description

tests Actions Status Coverage - 100% license - MIT python - 3.7+

ducks 🦆

Provides Dex, a Python container for indexing objects of any type.

Install

pip install ducks

Usage

from ducks import Dex

objects = [{'x': 4, 'y': 1}, {'x': 6, 'y': 2}, {'x': 8, 'y': 5}]

# Create a Dex containing the objects. Index on x and y.
dex = Dex(objects, ['x', 'y'])  

# find the ones you want
dex[{                           # find objects
    'x': {'>': 5, '<': 10},     # where x is between 5 and 10
    'y': {'in': [1, 2, 3]}      # and y is 1, 2, or 3
}]
# result: [{'x': 6, 'y': 2}]

Valid operators are ==, !=, <, <=, >, >=, in, not in.

Docs

There's more to ducks than making a Dex of dicts. See the docs.

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

ducks-0.4.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

ducks-0.4.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file ducks-0.4.2.tar.gz.

File metadata

  • Download URL: ducks-0.4.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.15.55-1-MANJARO

File hashes

Hashes for ducks-0.4.2.tar.gz
Algorithm Hash digest
SHA256 96eb281d2895b105f04428e102897ff302ff97c169cf8e7928d574be803c3be3
MD5 730839b7cba52aaac34fc63179d958a5
BLAKE2b-256 5491df836bbf34d9743fdd52a67c2893c044775ddade708f05f1c465be5de016

See more details on using hashes here.

File details

Details for the file ducks-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: ducks-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.7 Linux/5.15.55-1-MANJARO

File hashes

Hashes for ducks-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1b7a222b14904fd5d319ea494d9487186488404ff3bf4f6f59dda22f8799dc
MD5 62adeb0d042d65dc24fdda4795bd838e
BLAKE2b-256 03c8e030862c197c52cc45925ada733d34921e1841b1785550e21b84e8e40b82

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