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.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

bloom_filter-1.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bloom_filter-1.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bloom_filter-1.3.tar.gz
Algorithm Hash digest
SHA256 b5ccc303c61dacff7e29c653d0a81670adb0f7fa79ba4e76b447c795eb2b1c85
MD5 530ca709844d6b1683cadbc556fc0165
BLAKE2b-256 d8eddaad6ce368fb2531767eb4860346aa441b1b4aca104fe777d9a2adafc765

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bloom_filter-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4cfb395f15262dac3040d94c5a0c8f45711fe292d8ba353a726b9e4dffcb99
MD5 db97f886307de2c6443fc7a27db265ab
BLAKE2b-256 6f85c26819421801c5a04a2743e329641dde22225a55153d5477c032b4f7d40e

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