Skip to content

Commit b5469a2

Browse files
committed
One more check in calc_n_hashes
1 parent c5452d7 commit b5469a2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

filtercascade/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def filter_with_characteristics(
147147

148148
@classmethod
149149
def calc_n_hashes(cls, falsePositiveRate):
150+
if falsePositiveRate < 0 or falsePositiveRate > 1:
151+
raise InvalidErrorRateException(falsePositiveRate=falsePositiveRate)
150152
nHashes = math.ceil(math.log2(1.0 / falsePositiveRate))
151153
assert nHashes > 0, "Always must have a positive number of hashes"
152154
return nHashes

0 commit comments

Comments
 (0)