Yet another bloomfilter implementation in Python
Project description
# bloomfilter-py Yet another Bloomfilter implementation in Python, compatible with Java’s Guava library.
I was looking for a Python library which is capable of reading what Bloomfilter of Java’s Guava library serializes and is also able to output byte array which is recognizable by Java. But unfortunately failed. Hence I developed this library by borrowing how Guava implements Bloomfilter a lot to deal with Bloomfilters on both Python and Java sides.
For Bloomfilter usage in Java world, please refer to [this post](https://www.baeldung.com/guava-bloom-filter).
## Install ` pip install bloomfilter-py `
## Usage Examples
### Basic Usage `Python >>> from bloomfilter import BloomFilter >>> bloom_filter = BloomFilter(500, 0.01) >>> for i in range(100): ... bloom_filter.put(i) ... >>> 1 in bloom_filter True >>> 100 in bloom_filter False >>> `
### Serialize Bloomfilter `Python >>> dumps = bloom_filter.dumps() >>> with open("dumps.out", "wb") as f: ... f.write(dumps) ... >>> `
### Deserialize Bloomfilter `Python >>> with open("dumps.out", "rb") as f: ... bf = BloomFilter.loads(f.read()) ... >>> 1 in bf True >>> 100 in bf 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
Built Distribution
File details
Details for the file bloomfilter-py-0.0.2.tar.gz
.
File metadata
- Download URL: bloomfilter-py-0.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec054a548f36e198e7bd08678a4898988ed2d3b37bdcc789abae84ec2fbfe731 |
|
MD5 | 5253f1c5ce2e11e9a5371a9debdf9d19 |
|
BLAKE2b-256 | fe159b9fb71e5d16ad44161d068ba0a60d517d68fdfa5baf942571baaf422941 |
File details
Details for the file bloomfilter_py-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: bloomfilter_py-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a72ed2158d5cb54d384a050ce2a6a571b17b833d88412e62e82a3938e4e37f9 |
|
MD5 | 77029756d86fc2c107a79ea94e6376ac |
|
BLAKE2b-256 | 0db6aec80ced6e6e09034ceafcc7e9adaf1bc81c93308c1cb2ae720fc6a9f4de |