From 3cccf81257d8ce2a56bf7c67c5ecae11379325f3 Mon Sep 17 00:00:00 2001 From: Rajiv Bakulesh Shah Date: Sun, 8 Oct 2023 00:10:50 -0700 Subject: [PATCH] Update for loop to use walrus operator (#708) --- pottery/bloom.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pottery/bloom.py b/pottery/bloom.py index c2aae7ce..46276dfc 100644 --- a/pottery/bloom.py +++ b/pottery/bloom.py @@ -362,13 +362,7 @@ def contains_many(self, *values: JSONTypes) -> Generator[bool, None, None]: # I stole this recipe from here: # https://stackoverflow.com/a/61435714 - # - # TODO: When we drop support for Python 3.7, rewrite the following loop - # using the walrus operator, like in the Stack Overflow answer linked - # above. - bits_per_chunk = self.num_hashes() - while True: - bits_in_chunk = tuple(itertools.islice(bits, bits_per_chunk)) + while bits_in_chunk := tuple(itertools.islice(bits, self.num_hashes())): if not bits_in_chunk: break yield all(bits_in_chunk)