Deserializer for 64 bit Roaring Bitmaps.
Project description
Deserialize 64 bit roaring bitmaps into a Python set of integers. roroaring64
is a lightweight Python binding on top of the CRoaring library.
Note: roroaring64
has only been testing on Linux, so OSX and Windows users, your mileage may vary.
Motivation
brotchie@ built this library to deserialized the 64 bit roaring bitmaps turbo-geth uses in its database model.
API
The roroaring64
module exposes a single method:
def deserialize(serialized: bytes) -> Set[int]:
...
deserialize
takes the byte representation of a 64 bit roaring bitmap serialized from the Go, Java, or C++ reference roaring bitmap implementations. It returns a Python set of all 64 bit integers contained within the input bitmap.
Example Usage
>>> import roroaring64
>>> hex_bitmap = "0100000000000000000000003a300000010000004700040010000000e64ee84ee94eea4eeb4e"
>>> values = roroaring64.deserialize(bytes.fromhex(hex_bitmap))
>>> print(values)
{4673254, 4673256, 4673257, 4673258, 4673259}
Installation
$ pip install roroaring64
Tests
$ python test.py
Manual Compilation
$ python setup.py build_ext -i
Credits
Thanks to the authors of CRoaring and to ezibenroc@, the author of PyRoaringBitmap, whose project I looked at to work out Cython packaging.
License
MIT License
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
File details
Details for the file roroaring64-0.1.0.tar.gz
.
File metadata
- Download URL: roroaring64-0.1.0.tar.gz
- Upload date:
- Size: 157.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8ba42f5c80cb72b4c778aa01bbcfda03195bc340301362df40f97b7e204a53c9
|
|
MD5 |
8d9b8df28a3922e34213db534fde1f99
|
|
BLAKE2b-256 |
ab5fd76f472febca9479ac1d25f935b0d34e3ba45dfc8e0c23a1f137145c38f5
|