commit 922cf06a733ed6bab8e24950024a3e024c2a66da
parent 741df7292773cd5fd82630f33cb7a41606e6a4c0
Author: nolash <dev@holbrook.no>
Date: Fri, 30 Oct 2020 11:16:16 +0100
Rename dump to to_bytes, return bytestring
Diffstat:
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,5 @@
+- 0.0.4
+ * Make dump return bytestring
- 0.0.3
* Remove numpy dependency
* Add dump method
diff --git a/moolb/moolb.py b/moolb/moolb.py
@@ -55,8 +55,8 @@ class Bloom:
return True
- def dump(self):
- return self.filter
+ def to_bytes(self):
+ return bytes(self.filter)
def __hash(self, b, s):
diff --git a/setup.py b/setup.py
@@ -6,7 +6,7 @@ f.close()
setup(
name='moolb',
- version='0.0.3',
+ version='0.0.4',
description='Simple bloom filter with pluggable hash backend',
author='Louis Holbrook',
author_email='dev@holbrook.no',
diff --git a/tests/test_basic.py b/tests/test_basic.py
@@ -1,8 +1,12 @@
import unittest
import hashlib
+import logging
from moolb import Bloom
+logging.basicConfig(level=logging.DEBUG)
+logg = logging.getLogger()
+
def hashround(self, b, s):
logg.debug('sha1 hashing {} {}'.format(b.hex(), s.hex()))
@@ -27,6 +31,10 @@ class Test(unittest.TestCase):
self.assertTrue(f.check(b'1024'))
self.assertFalse(f.check(b'1023'))
+# def test_dump(self):
+# f = Bloom(8192 * 8, 3)
+# f.add(b'1024')
+# logg.debug(f.to_bytes().hex())
if __name__ == '__main__':
unittest.main()