We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a14286f commit 550803eCopy full SHA for 550803e
packages/service-library/src/servicelib/redis/_utils.py
@@ -1,6 +1,6 @@
1
import logging
2
from collections.abc import Awaitable
3
-from typing import Any
+from typing import ParamSpec, TypeVar
4
5
import redis.exceptions
6
from redis.asyncio.lock import Lock
@@ -28,7 +28,11 @@ async def auto_extend_lock(lock: Lock) -> None:
28
raise LockLostError(lock=lock) from exc
29
30
31
-async def handle_redis_returns_union_types(result: Any | Awaitable[Any]) -> Any:
+P = ParamSpec("P")
32
+R = TypeVar("R")
33
+
34
35
+async def handle_redis_returns_union_types(result: R | Awaitable[R]) -> R:
36
"""Used to handle mypy issues with redis 5.x return types"""
37
if isinstance(result, Awaitable):
38
return await result
0 commit comments