Skip to content

Commit

Permalink
Fix mypy version
Browse files Browse the repository at this point in the history
  • Loading branch information
k0t3n committed Aug 16, 2024
1 parent 04e20f1 commit 7907f2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ theine-core = "^0.4.3"
pytest = "^7.2.1"
pytest-benchmark = "^4.0.0"
typing-extensions = "^4.4.0"
mypy = "^1.0.0"
mypy = "1.11.1"
django = "^3.2"
pytest-django = "^4.5.2"
pytest-asyncio = "^0.20.3"
Expand Down
15 changes: 9 additions & 6 deletions theine/theine.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@
Hashable,
List,
Optional,
Tuple,
TYPE_CHECKING, Tuple,
Type,
TypeVar,
Union,
cast, )

from mypy_extensions import KwArg, VarArg
from theine_core import ClockProCore, LruCore, TlfuCore
from typing_extensions import ParamSpec, Protocol

from theine.exceptions import InvalidTTL
from theine.models import CacheStats

P = ParamSpec("P")
R = TypeVar("R", covariant=True, bound=Any)
R_A = TypeVar("R_A", covariant=True, bound=Union[Awaitable[Any], Callable[..., Any]])
if TYPE_CHECKING:
from functools import _Wrapped

sentinel = object()


Expand Down Expand Up @@ -105,10 +112,6 @@ def len(self) -> int:
"clockpro": ClockProCore,
}

P = ParamSpec("P")
R = TypeVar("R", covariant=True, bound=Any)
R_A = TypeVar("R_A", covariant=True, bound=Union[Awaitable[Any], Callable[..., Any]])


@dataclass
class EventData:
Expand Down Expand Up @@ -244,7 +247,7 @@ def __init__(
self.typed = typed
self.lock = lock

def __call__(self, fn: Callable[P, R_A]) -> Cached[P, R_A]:
def __call__(self, fn: Callable[P, R_A]) -> '_Wrapped[P, R_A, [VarArg(Any), KwArg(Any)], R_A]':
wrapper = Wrapper(fn, self.timeout, self.cache, self.typed, self.lock)
return update_wrapper(wrapper, fn)

Expand Down

0 comments on commit 7907f2b

Please sign in to comment.