Skip to content

Commit 64c85cd

Browse files
authored
Fix cachetools decorators (#5690)
1 parent 5fe2459 commit 64c85cd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
from _typeshed import IdentityFunction
12
from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar
23

34
_KT = TypeVar("_KT")
4-
_T = TypeVar("_T", bound=Callable[..., Any])
55

66
def cached(
77
cache: Optional[MutableMapping[_KT, Any]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[Any]] = ...
8-
) -> Callable[[_T], _T]: ...
8+
) -> IdentityFunction: ...
99
def cachedmethod(
1010
cache: Callable[[Any], Optional[MutableMapping[_KT, Any]]],
1111
key: Callable[..., _KT] = ...,
1212
lock: Optional[ContextManager[Any]] = ...,
13-
) -> Callable[[_T], _T]: ...
13+
) -> IdentityFunction: ...
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from typing import Any, Callable, Optional, Sequence, TypeVar
1+
from _typeshed import IdentityFunction
2+
from typing import Callable, Optional, Sequence, TypeVar
23

34
_T = TypeVar("_T")
45

5-
_F = TypeVar("_F", bound=Callable[..., Any])
6-
_RET = Callable[[_F], _F]
7-
8-
def lfu_cache(maxsize: float = ..., typed: bool = ...) -> _RET[_F]: ...
9-
def lru_cache(maxsize: float = ..., typed: bool = ...) -> _RET[_F]: ...
10-
def rr_cache(maxsize: float = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET[_F]: ...
11-
def ttl_cache(maxsize: float = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET[_F]: ...
6+
def lfu_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ...
7+
def lru_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ...
8+
def rr_cache(
9+
maxsize: float = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...
10+
) -> IdentityFunction: ...
11+
def ttl_cache(maxsize: float = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> IdentityFunction: ...

0 commit comments

Comments
 (0)