Skip to content

Commit

Permalink
Fix python >=3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
k0t3n committed Aug 16, 2024
1 parent 029c9e6 commit 04e20f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 2 additions & 2 deletions theine/adapters/django.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions theine/theine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 04e20f1

Please sign in to comment.