Pure Python Bloom Filter module
Project description
Note: This project has gone unmaintained for a while, please use the more up-to-date project at: - https://github.com/remram44/python-bloom-filter - https://pypi.org/project/bloom-filter2/
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.3.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for bloom_filter-1.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 937f3e6843fd137aa8a7723c556b970e9bc8a55e2100d86d46262469ae128dd1 |
|
MD5 | e6d9c5c49b794c9ace9a6a8a544feb3f |
|
BLAKE2b-256 | b3bf6f08439d017abdbf1594f5acfdf39d0c0f2d9a16eefdb69f334a5d5e7e3a |