Skip to content

Commit f751839

Browse files
authored
0.1.2 (#29)
* Counting Bloom Filter * Fix for pypi installation
1 parent 5cc4b98 commit f751839

File tree

16 files changed

+739
-68
lines changed

16 files changed

+739
-68
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# PyProbables Changelog
22

3+
### Version 0.1.2:
4+
* Counting Cuckoo Filter
5+
* Basic functionality: add, remove, check
6+
* Expand
7+
* Import / Export
8+
* Fix and tests for utility functions
9+
* Fix package build
10+
311
### Version 0.1.1:
412
* CuckooFilter
513
* Import / Export functionality

docs/source/code.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,17 @@ membership testing. Cuckoo filters support insertion, deletion, and lookup of
5656
elements with low overhead with few false positive results.
5757
`Further Reading <https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf>`__
5858

59+
CuckooFilter
60+
+++++++++++++++++++++++++++++++
5961
.. autoclass:: probables.CuckooFilter
6062
:members:
6163

64+
CountingCuckooFilter
65+
+++++++++++++++++++++++++++++++
66+
.. autoclass:: probables.CountingCuckooFilter
67+
:members:
68+
:inherited-members:
69+
6270

6371
Count-Min Sketches
6472
------------------

probables/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
''' pyprobables module '''
22
from __future__ import (unicode_literals, absolute_import, print_function)
3-
from .blooms import (BloomFilter, BloomFilterOnDisk, CountingBloomFilter)
4-
from .countminsketch import (CountMinSketch, HeavyHitters, StreamThreshold,
5-
CountMeanSketch, CountMeanMinSketch)
6-
from .cuckoo import (CuckooFilter)
7-
from .exceptions import (InitializationError, NotSupportedError,
8-
ProbablesBaseException, CuckooFilterFullError)
3+
from . blooms import (BloomFilter, BloomFilterOnDisk, CountingBloomFilter)
4+
from . countminsketch import (CountMinSketch, HeavyHitters, StreamThreshold,
5+
CountMeanSketch, CountMeanMinSketch)
6+
from . cuckoo import (CuckooFilter, CountingCuckooFilter)
7+
from . exceptions import (InitializationError, NotSupportedError,
8+
ProbablesBaseException, CuckooFilterFullError)
99

1010
__author__ = 'Tyler Barrus'
1111
__maintainer__ = 'Tyler Barrus'
1212
__email__ = '[email protected]'
1313
__license__ = 'MIT'
14-
__version__ = '0.1.1'
14+
__version__ = '0.1.2'
1515
__credits__ = []
1616
__url__ = 'https://github.com/barrust/pyprobables'
1717
__bugtrack_url__ = 'https://github.com/barrust/pyprobables/issues'
1818

1919
__all__ = ['BloomFilter', 'BloomFilterOnDisk', 'CountMinSketch',
2020
'HeavyHitters', 'StreamThreshold', 'CountMeanSketch',
2121
'CountMeanMinSketch', 'CountingBloomFilter', 'CuckooFilter',
22-
'CuckooFilterFullError']
22+
'CuckooFilterFullError', 'CountingCuckooFilter']

probables/blooms/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
''' Bloom Filter based data structures '''
22
from __future__ import (unicode_literals, absolute_import, print_function)
3-
from .bloom import (BloomFilter, BloomFilterOnDisk)
4-
from .countingbloom import (CountingBloomFilter)
3+
from . bloom import (BloomFilter, BloomFilterOnDisk)
4+
from . countingbloom import (CountingBloomFilter)
55

66
__all__ = ['BloomFilter', 'BloomFilterOnDisk', 'CountingBloomFilter']

probables/blooms/countingbloom.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def add_alt(self, hashes, num_els=1):
115115
j = self._get_element(k)
116116
tmp = j + num_els
117117
if tmp <= UINT32_T_MAX:
118-
self._bloom[k] = self._get_set_element(j + num_els)
118+
self.bloom[k] = self._get_set_element(j + num_els)
119119
else:
120-
self._bloom[k] = UINT32_T_MAX
121-
if self._bloom[k] < res:
122-
res = self._bloom[k]
120+
self.bloom[k] = UINT32_T_MAX
121+
if self.bloom[k] < res:
122+
res = self.bloom[k]
123123
self.elements_added += num_els
124124
if self.elements_added > UINT64_T_MAX:
125125
self.elements_added = UINT64_T_MAX
@@ -191,7 +191,7 @@ def remove_alt(self, hashes, num_els=1):
191191
for i in list(range(self.number_hashes)):
192192
k = int(hashes[i]) % self.number_bits
193193
j = self._get_element(k)
194-
self._bloom[k] = self._get_set_element(j - t_num_els)
194+
self.bloom[k] = self._get_set_element(j - t_num_els)
195195
self.elements_added -= t_num_els
196196
return tmp - t_num_els
197197

@@ -223,7 +223,7 @@ def intersection(self, second):
223223
for i in list(range(self.bloom_length)):
224224
if self._get_element(i) > 0 and second._get_element(i) > 0:
225225
tmp = self._get_element(i) + second._get_element(i)
226-
res._bloom[i] = self._get_set_element(tmp)
226+
res.bloom[i] = self._get_set_element(tmp)
227227
res.elements_added = res.estimate_elements()
228228
return res
229229

@@ -287,7 +287,7 @@ def union(self, second):
287287
hash_function=self.hash_function)
288288
for i in list(range(self.bloom_length)):
289289
tmp = self._get_element(i) + second._get_element(i)
290-
res._bloom[i] = self._get_set_element(tmp)
290+
res.bloom[i] = self._get_set_element(tmp)
291291
res.elements_added = res.estimate_elements()
292292
return res
293293

probables/countminsketch/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
''' count-min sketch submodule '''
22
from __future__ import (unicode_literals, absolute_import, print_function)
3-
from .countminsketch import (CountMinSketch, HeavyHitters, StreamThreshold,
4-
CountMeanSketch, CountMeanMinSketch)
3+
from . countminsketch import (CountMinSketch, HeavyHitters, StreamThreshold,
4+
CountMeanSketch, CountMeanMinSketch)
55

66

77
__all__ = ['CountMinSketch', 'HeavyHitters', 'StreamThreshold',

probables/cuckoo/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
''' Cuckoo Filter data structures '''
22
from __future__ import (unicode_literals, absolute_import, print_function)
33
from . cuckoo import (CuckooFilter)
4+
from . countingcuckoo import (CountingCuckooFilter)

0 commit comments

Comments
 (0)