Bloom filters with the standard library
Project description
dmfrbloom
Bloom filters with Python standard library.
Examples
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")
True
>>> bf.lookup("not in filter")
False
>>> bf.save("/home/daniel/filter")
>>> bf2 = BloomFilter(1, 0.1)
>>> bf2.load("/home/daniel/filter")
>>> bf2.lookup("test")
True
>>> bf2.lookup("also not in filter")
False
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")
True
>>> import time
>>> time.sleep(60)
>>> tf.lookup("asdf")
False
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dmfrbloom-0.0.6.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for dmfrbloom-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c367e86dab46c4ef0f3a3b5e4665db5e91ace0f5bf6197220e5284b3bd0512c7 |
|
MD5 | 7bfcfbacd4434629c19a612016bcc9e3 |
|
BLAKE2b-256 | 8093f8fa1a88f36f86cdcce8ba4a54e200d760c8afcf5c3d75f82e8ed7d9e823 |