diff --git a/stubs/cachetools/cachetools/decorators.pyi b/stubs/cachetools/cachetools/decorators.pyi index 2c3802647..4a89b5888 100644 --- a/stubs/cachetools/cachetools/decorators.pyi +++ b/stubs/cachetools/cachetools/decorators.pyi @@ -1,13 +1,13 @@ +from _typeshed import IdentityFunction from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar _KT = TypeVar("_KT") -_T = TypeVar("_T", bound=Callable[..., Any]) def cached( cache: Optional[MutableMapping[_KT, Any]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[Any]] = ... -) -> Callable[[_T], _T]: ... +) -> IdentityFunction: ... def cachedmethod( cache: Callable[[Any], Optional[MutableMapping[_KT, Any]]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[Any]] = ..., -) -> Callable[[_T], _T]: ... +) -> IdentityFunction: ... diff --git a/stubs/cachetools/cachetools/func.pyi b/stubs/cachetools/cachetools/func.pyi index 84f1323ad..87dfbd12b 100644 --- a/stubs/cachetools/cachetools/func.pyi +++ b/stubs/cachetools/cachetools/func.pyi @@ -1,11 +1,11 @@ -from typing import Any, Callable, Optional, Sequence, TypeVar +from _typeshed import IdentityFunction +from typing import Callable, Optional, Sequence, TypeVar _T = TypeVar("_T") -_F = TypeVar("_F", bound=Callable[..., Any]) -_RET = Callable[[_F], _F] - -def lfu_cache(maxsize: float = ..., typed: bool = ...) -> _RET[_F]: ... -def lru_cache(maxsize: float = ..., typed: bool = ...) -> _RET[_F]: ... -def rr_cache(maxsize: float = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET[_F]: ... -def ttl_cache(maxsize: float = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET[_F]: ... +def lfu_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... +def lru_cache(maxsize: float = ..., typed: bool = ...) -> IdentityFunction: ... +def rr_cache( + maxsize: float = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ... +) -> IdentityFunction: ... +def ttl_cache(maxsize: float = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> IdentityFunction: ...