fix: add type: ignore for redis.scan() mypy false positive in cache.py
redis.Redis.scan() returns a tuple at runtime but mypy infers Awaitable[Any] from the generic ResponseT return type, causing a "not iterable" error on tuple unpacking. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -113,7 +113,7 @@ def cache_delete_pattern(pattern: str) -> None:
|
|||||||
full_pattern = f"{_KEY_PREFIX}{pattern}"
|
full_pattern = f"{_KEY_PREFIX}{pattern}"
|
||||||
cursor = 0
|
cursor = 0
|
||||||
while True:
|
while True:
|
||||||
cursor, keys = client.scan(cursor, match=full_pattern, count=100)
|
cursor, keys = client.scan(cursor, match=full_pattern, count=100) # type: ignore[misc] # sync Redis returns tuple
|
||||||
if keys:
|
if keys:
|
||||||
client.delete(*keys)
|
client.delete(*keys)
|
||||||
if cursor == 0:
|
if cursor == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user