Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stubs/cachetools/cachetools/decorators.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
16 changes: 8 additions & 8 deletions stubs/cachetools/cachetools/func.pyi
Original file line number Diff line number Diff line change
@@ -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: ...