Fix linting

This commit is contained in:
yangdx 2025-06-29 15:15:49 +08:00
parent 14cda93988
commit abd9de2a63

View file

@ -88,7 +88,9 @@ class RedisKVStorage(BaseKVStorage):
cursor = 0 cursor = 0
while True: while True:
cursor, keys = await redis.scan(cursor, match=pattern, count=100) cursor, keys = await redis.scan(
cursor, match=pattern, count=100
)
if keys: if keys:
# Batch get values for these keys # Batch get values for these keys
@ -102,9 +104,14 @@ class RedisKVStorage(BaseKVStorage):
if value: if value:
try: try:
data = json.loads(value) data = json.loads(value)
if isinstance(data, dict) and data.get("cache_type") == "extract": if (
isinstance(data, dict)
and data.get("cache_type") == "extract"
):
# Extract cache key (remove namespace prefix) # Extract cache key (remove namespace prefix)
cache_key = key.replace(f"{self.namespace}:", "") cache_key = key.replace(
f"{self.namespace}:", ""
)
result[cache_key] = data result[cache_key] = data
except json.JSONDecodeError: except json.JSONDecodeError:
continue continue