Skip to main content

bloom filter

tests
python implementation of bloom filter

What is bloom filter? https://en.wikipedia.org/wiki/Bloom_filter

installation

$ pip install easy-bloom-filter

usage

Simple example

from easy_bloom_filter import BloomFilter, Response

bf = BloomFilter(init_size=2001, func_count=3)

bf.add_element("first")
bf.add_element("second")
bf.add_element({"num": "3"})

print(bf.query("4")     == Response.NO)     # True (not added to filter)
print(bf.query("first") == Response.MAYBE)  # True (maybe added to filter check with the source of truth)

print(bf.false_positive_probability)  # 9.09884490736791e-08
print(bf.actual_size)                 # 2000  (round to multiple of 8 for storing the data on bits)

install dev requirements

$ pip install -r requirements-dev.txt

only tests

$ pytest .

tests with coverage

$ pytest --cov-report=html --cov=py_bloom_filter tests/

Release files for easy-bloom-filter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-bloom-filter 0.1.0
File Size Uploaded
easy-bloom-filter-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easy-bloom-filter 0.1.0
File Interpreter ABI Platform
easy_bloom_filter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / easy-bloom-filter-0.1.0.tar.gz

Download URL easy-bloom-filter-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0e30d027fcc2a0a39a1f6469c1df9b8a708f2eff5d9c27924a28159de4f0f72a
BLAKE2b-256 checksum
How to use checksums
4361b059cc2f846acf2bc393663bb5451ae7cc63918e2ee9645dad06464697a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / easy_bloom_filter-0.1.0-py3-none-any.whl

Download URL easy_bloom_filter-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83bb28991439ecd30ea203b6bacd364dac913d36dcd56c41e9a37f1b47b4b15c
BLAKE2b-256 checksum
How to use checksums
2c43378f80b831f4a48dccfa8900c0943872375db2d78c0f3b62e4d1b20eadcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page