From bf236b7c36bbb7cceb121cb7e9af301251529632 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Sat, 24 May 2025 16:06:15 +0000 Subject: [PATCH] Bump cachetools to 6.0.* (#14131) --- stubs/cachetools/@tests/stubtest_allowlist.txt | 3 --- stubs/cachetools/METADATA.toml | 2 +- stubs/cachetools/cachetools/__init__.pyi | 17 +++++++++++++---- stubs/cachetools/cachetools/func.pyi | 5 +---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/stubs/cachetools/@tests/stubtest_allowlist.txt b/stubs/cachetools/@tests/stubtest_allowlist.txt index 077ad4553..b33b7717d 100644 --- a/stubs/cachetools/@tests/stubtest_allowlist.txt +++ b/stubs/cachetools/@tests/stubtest_allowlist.txt @@ -9,9 +9,6 @@ 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__ diff --git a/stubs/cachetools/METADATA.toml b/stubs/cachetools/METADATA.toml index de2f997c7..593de6011 100644 --- a/stubs/cachetools/METADATA.toml +++ b/stubs/cachetools/METADATA.toml @@ -1,2 +1,2 @@ -version = "5.5.*" +version = "6.0.*" upstream_repository = "https://github.com/tkem/cachetools" diff --git a/stubs/cachetools/cachetools/__init__.pyi b/stubs/cachetools/cachetools/__init__.pyi index a7c0906e0..4a8a52687 100644 --- a/stubs/cachetools/cachetools/__init__.pyi +++ b/stubs/cachetools/cachetools/__init__.pyi @@ -1,10 +1,11 @@ from _typeshed import IdentityFunction, Unused from collections.abc import Callable, Iterator, MutableMapping, Sequence from contextlib import AbstractContextManager +from threading import Condition from typing import Any, TypeVar, overload from typing_extensions import deprecated -__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "MRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod") +__all__ = ("Cache", "FIFOCache", "LFUCache", "LRUCache", "RRCache", "TLRUCache", "TTLCache", "cached", "cachedmethod") __version__: str _KT = TypeVar("_KT") @@ -38,9 +39,6 @@ class FIFOCache(Cache[_KT, _VT]): ... class LFUCache(Cache[_KT, _VT]): ... class LRUCache(Cache[_KT, _VT]): ... -@deprecated("@mru_cache is deprecated") -class MRUCache(Cache[_KT, _VT]): ... - class RRCache(Cache[_KT, _VT]): @overload def __init__(self, maxsize: float, choice: None = None, getsizeof: None = None) -> None: ... @@ -99,14 +97,25 @@ class TLRUCache(_TimedCache[_KT, _VT]): def ttu(self) -> Callable[[_KT, _VT, float], float]: ... def expire(self, time: float | None = None) -> list[tuple[_KT, _VT]]: ... +@overload def cached( cache: MutableMapping[_KT, Any] | None, key: Callable[..., _KT] = ..., lock: AbstractContextManager[Any] | None = None, + condition: Condition | None = None, info: bool = False, ) -> IdentityFunction: ... +@overload +@deprecated("Passing `info` as positional parameter is deprecated.") +def cached( + cache: MutableMapping[_KT, Any] | None, + key: Callable[..., _KT] = ..., + lock: AbstractContextManager[Any] | None = None, + condition: bool | None = None, +) -> IdentityFunction: ... def cachedmethod( cache: Callable[[Any], MutableMapping[_KT, Any] | None], key: Callable[..., _KT] = ..., lock: Callable[[Any], AbstractContextManager[Any]] | None = None, + condition: Condition | None = None, ) -> IdentityFunction: ... diff --git a/stubs/cachetools/cachetools/func.pyi b/stubs/cachetools/cachetools/func.pyi index 070383e58..8608a1060 100644 --- a/stubs/cachetools/cachetools/func.pyi +++ b/stubs/cachetools/cachetools/func.pyi @@ -1,16 +1,13 @@ from _typeshed import IdentityFunction from collections.abc import Callable, Sequence from typing import TypeVar -from typing_extensions import deprecated -__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "mru_cache", "rr_cache", "ttl_cache") +__all__ = ("fifo_cache", "lfu_cache", "lru_cache", "rr_cache", "ttl_cache") _T = TypeVar("_T") def fifo_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ... def lfu_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ... def lru_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ... -@deprecated("@mru_cache is deprecated") -def mru_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ... def rr_cache( maxsize: float | None = 128, choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = False ) -> IdentityFunction: ...