Skip to main content

Bloom filters with the standard library

Project description


Bloom filters with Python standard library.


Normal bloom filter. Expects 10,000 elements with 99.99% accuracy:

>>> from dmfrbloom.bloomfilter import BloomFilter
>>> bf = BloomFilter(10000, 0.01)
>>> bf.add("test")
>>> bf.lookup("test")
>>> bf.lookup("not in filter")
>>> bf2 = BloomFilter(1, 0.1)
>>> bf2.load("/home/daniel/filter")
>>> bf2.lookup("test")
>>> bf2.lookup("also not in filter")

Time-based filter. 10k elements, 99.99% accuracy, results decay after 60 seconds:

>>> from dmfrbloom.timefilter import TimeFilter
>>> tf = TimeFilter(10000, 0.01, 60)
>>> tf.add("asdf")
>>> tf.lookup("asdf")
>>> import time
>>> time.sleep(60)
>>> tf.lookup("asdf")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dmfrbloom, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size dmfrbloom-0.0.7-py3-none-any.whl (9.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dmfrbloom-0.0.7.tar.gz (7.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page