Skip to content

Commit

Permalink
add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Jan 13, 2024
1 parent 340b380 commit deffc0b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion probables/quotientfilter/quotientfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def check_alt(self, _hash: int) -> bool:
return self._contains(key_quotient, key_remainder)

def iter_hashes(self) -> Iterator[int]:
"""A generator over the hashes in the quotient filter
Yields:
int: The next hash stored in the quotient filter"""
queue: List[int] = []

# find first empty location
Expand Down Expand Up @@ -180,7 +184,11 @@ def iter_hashes(self) -> Iterator[int]:
yield (cur_quot << self._r) + self._filter[idx]

def get_hashes(self) -> List[int]:
return [x for x in self.iter_hashes()]
"""Get the hashes from the quotient filter as a list
Returns:
list(int): The hash values stored in the quotient filter"""
return list(self.iter_hashes())

def _shift_insert(self, k, v, start, j, flag):
if self._is_occupied[j] == 0 and self._is_continuation[j] == 0 and self._is_shifted[j] == 0:
Expand Down

0 comments on commit deffc0b

Please sign in to comment.