2017-10-26 12:42:03 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def read_hashset_file(filename):
|
|
|
|
with open(filename, 'r') as hashfile:
|
2017-10-28 19:54:47 +02:00
|
|
|
# TODO: Test for regression
|
|
|
|
ltest = list(hashfile.read().splitlines())
|
2017-10-26 12:42:03 +02:00
|
|
|
return ltest
|
|
|
|
|
|
|
|
|
|
|
|
def load_hashsets(path, status_callback=None):
|
|
|
|
hashsets = {}
|
|
|
|
for content in os.listdir(path):
|
|
|
|
filename = os.path.join(path, content)
|
|
|
|
if os.path.isfile(filename):
|
|
|
|
hashset = os.path.basename(filename).split('.')[0]
|
|
|
|
if status_callback:
|
2017-10-31 12:37:12 +01:00
|
|
|
status_callback.emit('Reading Hashset "{}"...'.format(hashset))
|
2017-10-26 12:42:03 +02:00
|
|
|
hashes = read_hashset_file(filename)
|
|
|
|
hashsets[hashset] = set(hashes)
|
|
|
|
return hashsets
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-10-28 19:54:47 +02:00
|
|
|
hashsets = load_hashsets('Hashsets')
|