mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 12:01:52 +08:00
cachetools: Fix invalid TypeVar usage (#8073)
This commit is contained in:
@@ -11,7 +11,10 @@ _VT = TypeVar("_VT")
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, getsizeof: None = ...) -> None: ...
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
@@ -30,29 +33,32 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@staticmethod
|
||||
def getsizeof(value: _VT) -> float: ...
|
||||
|
||||
class FIFOCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
|
||||
|
||||
class LFUCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
|
||||
|
||||
class LRUCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
|
||||
|
||||
class MRUCache(Cache[_KT, _VT]):
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float] | None = ...) -> None: ...
|
||||
class FIFOCache(Cache[_KT, _VT]): ...
|
||||
class LFUCache(Cache[_KT, _VT]): ...
|
||||
class LRUCache(Cache[_KT, _VT]): ...
|
||||
class MRUCache(Cache[_KT, _VT]): ...
|
||||
|
||||
class RRCache(Cache[_KT, _VT]):
|
||||
def __init__(
|
||||
self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT] | None = ..., getsizeof: Callable[[_VT], float] | None = ...
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: None = ..., getsizeof: None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, *, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: None, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@property
|
||||
def choice(self) -> Callable[[Sequence[_KT]], _KT]: ...
|
||||
|
||||
class _TimedCache(Cache[_KT, _VT]):
|
||||
def __init__(
|
||||
self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: Callable[[_VT], float] | None = ...
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float] = ..., *, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@property
|
||||
def currsize(self) -> float: ...
|
||||
|
||||
@@ -66,8 +72,13 @@ class _TimedCache(Cache[_KT, _VT]):
|
||||
def timer(self) -> _Timer: ...
|
||||
|
||||
class TTLCache(_TimedCache[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: Callable[[_VT], float] | None = ...
|
||||
self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., *, getsizeof: Callable[[_VT], float]
|
||||
) -> None: ...
|
||||
@property
|
||||
def ttl(self) -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user