Metadata-Version: 2.1
Name: easy-bloom-filter
Version: 0.1.0
Summary: python implementation of bloom filter
Home-page: https://github.com/hvuhsg/py-bloom-filter
Author: yehoyada.sht
Author-email: yehoyada.sht@gmail.com
Maintainer: yehoyada.sht
Maintainer-email: yehoyada.sht@gmail.com
License: MIT
Keywords: bloom,filter
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# bloom filter
[![tests](https://github.com/hvuhsg/py-bloom-filter/actions/workflows/tests.yml/badge.svg)](https://github.com/hvuhsg/py-bloom-filter/actions/workflows/tests.yml)  
python implementation of bloom filter  
  
What is bloom filter? https://en.wikipedia.org/wiki/Bloom_filter

## installation
```shell
$ pip install easy-bloom-filter
```

## usage
Simple example

```python
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
```shell
$ pip install -r requirements-dev.txt
```

#### only tests
```shell
$ pytest .
```

#### tests with coverage
```shell
$ pytest --cov-report=html --cov=py_bloom_filter tests/
```

