0 purchases
roroaring64 0.1.0
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.