fix(cachetools): fix decorators signature typing (#4657)

Fixes #4652
This commit is contained in:
Julien Danjou
2020-10-14 17:38:30 +02:00
committed by GitHub
parent 58028a95eb
commit f35e79fd24

View File

@@ -1,11 +1,16 @@
from typing import Any, Callable, ContextManager, Optional, TypeVar
from .cache import Cache
from typing import Any, Callable, ContextManager, MutableMapping, Optional, TypeVar
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T", bound=Callable[..., Any])
_T_co = TypeVar("_T_co", covariant=True)
_T_self = TypeVar("_T_self")
def cached(cache: Cache[_KT, _VT], key: _KT = ..., lock: Optional[ContextManager[_T_co]] = ...) -> Callable[[_T], _T]: ...
def cachedmethod(cache: Cache[_KT, _VT], key: _KT = ..., lock: Optional[ContextManager[_T_co]] = ...) -> Callable[[_T], _T]: ...
def cached(
cache: Optional[MutableMapping[_KT, _VT]], key: Callable[..., _KT] = ..., lock: Optional[ContextManager[_T_co]] = ...
) -> Callable[[_T], _T]: ...
def cachedmethod(
cache: Callable[[_T_self], Optional[MutableMapping[_KT, _VT]]],
key: Callable[..., _KT] = ...,
lock: Optional[ContextManager[_T_co]] = ...,
) -> Callable[[_T], _T]: ...