diff --git a/tests/test_decorator.py b/tests/test_decorator.py index 1100588..f2c965a 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -14,7 +14,7 @@ @Memoize(Cache("tlfu", 1000), None) -def foo(id: int, m: Mock) -> dict[str, int]: +def foo(id: int, m: Mock) -> Dict[str, int]: m(id) return {"id": id} diff --git a/theine/adapters/django.py b/theine/adapters/django.py index 3366556..3dc89b5 100644 --- a/theine/adapters/django.py +++ b/theine/adapters/django.py @@ -1,6 +1,6 @@ from datetime import timedelta from threading import Lock -from typing import Any, Callable, Optional, Union +from typing import Any, Callable, Dict, Optional, Union from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT @@ -13,7 +13,7 @@ class Cache(BaseCache): - def __init__(self, name: str, params: dict[str, Any]): + def __init__(self, name: str, params: Dict[str, Any]): super().__init__(params) options = params.get("OPTIONS", {}) policy = options.get("POLICY", "tlfu") diff --git a/theine/theine.py b/theine/theine.py index 4a4b60d..70faa5f 100644 --- a/theine/theine.py +++ b/theine/theine.py @@ -64,7 +64,7 @@ def remove(self, key: str) -> Optional[int]: def access(self, key: str) -> Optional[int]: ... - def advance(self, cache: list[Any], sentinel: Any, kh: dict[int, Hashable], hk: dict[Hashable, int]) -> None: + def advance(self, cache: List[Any], sentinel: Any, kh: Dict[int, Hashable], hk: Dict[Hashable, int]) -> None: ... def clear(self) -> None: @@ -89,7 +89,7 @@ def remove(self, key: str) -> Optional[int]: def access(self, key: str) -> Optional[int]: ... - def advance(self, cache: list[Any], sentinel: Any, kh: dict[int, Hashable], hk: dict[Hashable, int]) -> None: + def advance(self, cache: List[Any], sentinel: Any, kh: Dict[int, Hashable], hk: Dict[Hashable, int]) -> None: ... def clear(self) -> None: @@ -107,7 +107,7 @@ def len(self) -> int: P = ParamSpec("P") R = TypeVar("R", covariant=True, bound=Any) -R_A = TypeVar("R_A", covariant=True, bound=Awaitable[Any] | Callable[..., Any]) +R_A = TypeVar("R_A", covariant=True, bound=Union[Awaitable[Any], Callable[..., Any]]) @dataclass