mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Update cachetools to 5.0.0 (#7455)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
cachetools.Cache.get
|
||||
cachetools.cache.Cache.get
|
||||
|
||||
# it looks like cachetools stubs are really out of date, so none of the modules
|
||||
# referenced exist anymore
|
||||
cachetools\..*\.__(get|set|del)item__ # has extra argument
|
||||
cachetools\..*TTLCache.__repr__
|
||||
# stubs omit defaulted arguments that are meant to be optimizations, not provided by user
|
||||
cachetools.FIFOCache.__delitem__
|
||||
cachetools.FIFOCache.__setitem__
|
||||
cachetools.LFUCache.__delitem__
|
||||
cachetools.LFUCache.__getitem__
|
||||
cachetools.LFUCache.__setitem__
|
||||
cachetools.LRUCache.__delitem__
|
||||
cachetools.LRUCache.__getitem__
|
||||
cachetools.LRUCache.__setitem__
|
||||
cachetools.MRUCache.__delitem__
|
||||
cachetools.MRUCache.__getitem__
|
||||
cachetools.MRUCache.__setitem__
|
||||
cachetools.TLRUCache.__delitem__
|
||||
cachetools.TLRUCache.__getitem__
|
||||
cachetools.TLRUCache.__setitem__
|
||||
cachetools.TTLCache.__delitem__
|
||||
cachetools.TTLCache.__getitem__
|
||||
cachetools.TTLCache.__setitem__
|
||||
cachetools._TimedCache.__len__
|
||||
cachetools._TimedCache.__repr__
|
||||
|
||||
@@ -1 +1 @@
|
||||
version = "4.2.*"
|
||||
version = "5.0.*"
|
||||
|
||||
@@ -3,6 +3,9 @@ from collections.abc import Iterator, Sequence
|
||||
from contextlib import AbstractContextManager
|
||||
from typing import Any, Callable, Generic, MutableMapping, TypeVar, overload
|
||||
|
||||
__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod")
|
||||
__version__: str
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
_T = TypeVar("_T")
|
||||
@@ -12,6 +15,7 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload # type: ignore[override]
|
||||
@@ -45,18 +49,42 @@ class RRCache(Cache[_KT, _VT]):
|
||||
@property
|
||||
def choice(self) -> Callable[[Sequence[_KT]], _KT]: ...
|
||||
|
||||
class TTLCache(Cache[_KT, _VT]):
|
||||
class _TimedCache(Cache[_KT, _VT]):
|
||||
def __init__(
|
||||
self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: Callable[[_VT], float] | None = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def currsize(self) -> float: ...
|
||||
|
||||
class _Timer:
|
||||
def __init__(self, timer: Callable[[], float]) -> None: ...
|
||||
def __call__(self) -> float: ...
|
||||
def __enter__(self) -> float: ...
|
||||
def __exit__(self, *exc: object) -> None: ...
|
||||
|
||||
@property
|
||||
def timer(self) -> _Timer: ...
|
||||
|
||||
class TTLCache(_TimedCache[_KT, _VT]):
|
||||
def __init__(
|
||||
self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: Callable[[_VT], float] | None = ...
|
||||
) -> None: ...
|
||||
@property
|
||||
def currsize(self) -> float: ...
|
||||
@property
|
||||
def timer(self) -> Callable[[], float]: ...
|
||||
@property
|
||||
def ttl(self) -> float: ...
|
||||
def expire(self, time: float | None = ...) -> None: ...
|
||||
|
||||
class TLRUCache(_TimedCache[_KT, _VT]):
|
||||
def __init__(
|
||||
self,
|
||||
maxsize: float,
|
||||
ttu: Callable[[_KT, _VT, float], float],
|
||||
timer: Callable[[], float] = ...,
|
||||
getsizeof: Callable[[_VT], float] | None = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def ttu(self) -> Callable[[_KT, _VT, float], float]: ...
|
||||
def expire(self, time: float | None = ...) -> None: ...
|
||||
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: AbstractContextManager[Any] | None = ...
|
||||
) -> IdentityFunction: ...
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import Cache as Cache
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import FIFOCache as FIFOCache
|
||||
@@ -1,6 +1,7 @@
|
||||
from _typeshed import IdentityFunction
|
||||
from typing import Callable, Sequence, TypeVar
|
||||
|
||||
__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "mru_cache", "rr_cache", "ttl_cache")
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def fifo_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ...
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from typing import Hashable
|
||||
|
||||
__all__ = ("hashkey", "typedkey")
|
||||
|
||||
def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ...
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import LFUCache as LFUCache
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import LRUCache as LRUCache
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import MRUCache as MRUCache
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import RRCache as RRCache
|
||||
@@ -1,2 +0,0 @@
|
||||
# this module is deprecated
|
||||
from . import TTLCache as TTLCache
|
||||
Reference in New Issue
Block a user