Skip to content

Commit 7528163

Browse files
committed
Add main.py
1 parent 2cf0bd6 commit 7528163

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

main.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from BloomFilter import BloomFilter
2+
3+
# Note to be implemented using Command line arguments
4+
5+
filename = "BloomFilter.py"
6+
user_file_content = []
7+
8+
9+
with open(filename) as user_file:
10+
11+
for line in user_file:
12+
user_file_content.append(line)
13+
14+
user_file_NOL = len(user_file_content)
15+
16+
bloom_filter = BloomFilter(user_file_NOL)
17+
18+
for blocks in user_file_content:
19+
bloom_filter.insert(blocks)
20+
21+
print(bloom_filter.getBloomFilter())
22+
print(bloom_filter.getSize())
23+
print(bloom_filter.getNumberOfHashFunctions())
24+
25+
print(user_file_content[1])
26+
print(bloom_filter.validate(user_file_content[1]))
27+
28+
29+
with open("test", "wb") as f:
30+
for i in bloom_filter.getBloomFilter():
31+
if i == 0:
32+
f.write(b"0")
33+
else:
34+
f.write(b"1")

0 commit comments

Comments
 (0)