def __init__(self, capacity, error_rate): """ :param capacity: How many items you want to store, eg. 10000 :param error_rate: The acceptable false positive rate, eg. 0.001 """ GenericBloomFilter.__init__(self, capacity, error_rate) temp_file = self.get_temp_file() self.bf = WrappedBloomFilter(capacity, error_rate, temp_file)
def setUp(self): super(TestCMmapBloomfilterSmall, self).setUp() temp_file = GenericBloomFilter.get_temp_file() self.filter = CMmapFilter(self.CAPACITY, self.ERROR_RATE, temp_file)
def setUp(self): super(TestCMmapBloomfilterSmall, self).setUp() temp_file = GenericBloomFilter.get_temp_file() self.filter = CMmapFilter(self.CAPACITY, self.ERROR_RATE, temp_file)
to make both pybloomfiltermmap and w3af better! For more information about this issue please visit [0][1]. [0] https://github.com/andresriancho/w3af/issues/485 [1] https://github.com/axiak/pybloomfiltermmap/issues/50 """ print(OSX_MSG) else: try: # This might fail since it is a C library that only works in Linux from pybloomfilter import BloomFilter as CMmapFilter # There were reports of the C mmap filter not working properly in OSX, # just in case, I'm testing here... temp_file = GenericBloomFilter.get_temp_file() try: bf = CMmapFilter(1000, 0.01, temp_file) bf.add(1) assert 1 in bf assert 2 not in bf except: WrappedBloomFilter = FileSeekFilter else: WrappedBloomFilter = CMmapFilter except: WrappedBloomFilter = FileSeekFilter class BloomFilter(GenericBloomFilter): def __init__(self, capacity, error_rate):
def setUp(self): super(TestFileSeekBloomFilterLarge, self).setUp() temp_file = GenericBloomFilter.get_temp_file() self.filter = FileSeekBloomFilter(self.CAPACITY, self.ERROR_RATE, temp_file)