Skip to main content

Pure Python Bloom Filter module

Project description

A pure python bloom filter (low storage requirement, probabilistic set datastructure) is provided. It is known to work on CPython 2.x, CPython 3.x, Pypy and Jython.

Includes mmap, in-memory and disk-seek backends.

The user specifies the desired maximum number of elements and the desired maximum false positive probability, and the module calculates the rest.

Usage:

from bloom_filter import BloomFilter

# instantiate BloomFilter with custom settings,
# max_elements is how many elements you expect the filter to hold.
# error_rate defines accuracy; You can use defaults with
# `BloomFilter()` without any arguments. Following example
# is same as defaults:
bloom = BloomFilter(max_elements=10000, error_rate=0.1)

# Test whether the bloom-filter has seen a key:
assert "test-key" in bloom is False

# Mark the key as seen
bloom.add("test-key")

# Now check again
assert "test-key" in bloom is True

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

bloom_filter-1.3.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

bloom_filter-1.3.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file bloom_filter-1.3.2.tar.gz.

File metadata

  • Download URL: bloom_filter-1.3.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

File hashes

Hashes for bloom_filter-1.3.2.tar.gz
Algorithm Hash digest
SHA256 55539270507f7ada9ef2d852e63e9fbbc9605c07b9bb810d6d57c8b8d8f01fa8
MD5 e782524df41afdfbab0a810819ec9273
BLAKE2b-256 9036bbf1ef83e243c5d21cbd4c7e603bbddd96a9da8652579d3e07ed13e486ad

See more details on using hashes here.

File details

Details for the file bloom_filter-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: bloom_filter-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

File hashes

Hashes for bloom_filter-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2bfa62153394d3a43127e6c57ed2820497f8d6c42cb061f2323e5ae4d9b50b8a
MD5 43d5c85244e90ff3dc8bacd5f0b89e07
BLAKE2b-256 72b8806bf02deedb4dbc7eeef036c71c8e3fe6805ff06ad4524e96c74b704c42

See more details on using hashes here.

Supported by

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