Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 280ffa0

Browse files
committed
type hints requested by boot
1 parent 3926167 commit 280ffa0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

data_structures/hashing/bloom_filter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Bloom:
1010
# number of hash functions is fixed
1111
HASH_FUNCTIONS = (sha256, md5)
1212

13-
def __init__(self, size=8):
13+
def __init__(self, size: int = 8) -> None:
1414
self.bitstring = 0b0
1515
self.size = size
1616

@@ -52,7 +52,7 @@ def hash_(self, value: str) -> int:
5252
return res
5353

5454

55-
def test_movies():
55+
def test_movies() -> None:
5656
b = Bloom()
5757
b.add("Titanic")
5858
b.add("Avatar")
@@ -66,11 +66,11 @@ def test_movies():
6666
assert b.exists("Pulp Fiction") in (True, False)
6767

6868

69-
def random_string(size):
69+
def random_string(size: int) -> str:
7070
return "".join(choices(ascii_lowercase + " ", k=size))
7171

7272

73-
def test_probability(m=64, n=20):
73+
def test_probability(m: int = 64, n: int = 20) -> None:
7474
b = Bloom(size=m)
7575

7676
k = len(b.HASH_FUNCTIONS)

0 commit comments

Comments
 (0)