From 00fcc50d13444f9e5f7ffe07ba0b2e9254ef2e36 Mon Sep 17 00:00:00 2001 From: Joseph Bylund Date: Mon, 17 May 2021 12:14:26 -0400 Subject: [PATCH] cachetools.Cache sizes are numerics (#5440) replace int with float for cachesize --- stubs/cachetools/cachetools/cache.pyi | 8 ++++---- stubs/cachetools/cachetools/func.pyi | 8 ++++---- stubs/cachetools/cachetools/lfu.pyi | 2 +- stubs/cachetools/cachetools/lru.pyi | 2 +- stubs/cachetools/cachetools/rr.pyi | 4 ++-- stubs/cachetools/cachetools/ttl.pyi | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/stubs/cachetools/cachetools/cache.pyi b/stubs/cachetools/cachetools/cache.pyi index f79bbd21b..fe13a5e38 100644 --- a/stubs/cachetools/cachetools/cache.pyi +++ b/stubs/cachetools/cachetools/cache.pyi @@ -6,15 +6,15 @@ _KT = TypeVar("_KT") _VT = TypeVar("_VT") class Cache(DefaultMapping[_KT, _VT], Generic[_KT, _VT]): - def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ... + def __init__(self, maxsize: float, getsizeof: Optional[Callable[[_VT], float]] = ...) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... def __delitem__(self, key: _KT) -> None: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... @property - def maxsize(self) -> int: ... + def maxsize(self) -> float: ... @property - def currsize(self) -> int: ... + def currsize(self) -> float: ... @staticmethod - def getsizeof(value: _VT) -> int: ... + def getsizeof(value: _VT) -> float: ... diff --git a/stubs/cachetools/cachetools/func.pyi b/stubs/cachetools/cachetools/func.pyi index 1fca79773..84f1323ad 100644 --- a/stubs/cachetools/cachetools/func.pyi +++ b/stubs/cachetools/cachetools/func.pyi @@ -5,7 +5,7 @@ _T = TypeVar("_T") _F = TypeVar("_F", bound=Callable[..., Any]) _RET = Callable[[_F], _F] -def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ... -def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET[_F]: ... -def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET[_F]: ... -def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET[_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]: ... diff --git a/stubs/cachetools/cachetools/lfu.pyi b/stubs/cachetools/cachetools/lfu.pyi index 5673027c9..93da665d9 100644 --- a/stubs/cachetools/cachetools/lfu.pyi +++ b/stubs/cachetools/cachetools/lfu.pyi @@ -6,7 +6,7 @@ _KT = TypeVar("_KT") _VT = TypeVar("_VT") class LFUCache(Cache[_KT, _VT]): - def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ... + def __init__(self, maxsize: float, getsizeof: Optional[Callable[[_VT], float]] = ...) -> None: ... def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ... def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ... def __delitem__(self, key: _KT, cache_delitem: Callable[[_KT], None] = ...) -> None: ... diff --git a/stubs/cachetools/cachetools/lru.pyi b/stubs/cachetools/cachetools/lru.pyi index 7fa865ac2..cac87ef3e 100644 --- a/stubs/cachetools/cachetools/lru.pyi +++ b/stubs/cachetools/cachetools/lru.pyi @@ -6,7 +6,7 @@ _KT = TypeVar("_KT") _VT = TypeVar("_VT") class LRUCache(Cache[_KT, _VT]): - def __init__(self, maxsize: int, getsizeof: Optional[Callable[[_VT], int]] = ...) -> None: ... + def __init__(self, maxsize: float, getsizeof: Optional[Callable[[_VT], float]] = ...) -> None: ... def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ... def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ... def __delitem__(self, key: _KT, cache_delitem: Callable[[_KT], None] = ...) -> None: ... diff --git a/stubs/cachetools/cachetools/rr.pyi b/stubs/cachetools/cachetools/rr.pyi index 8b34c3950..c1acdb2fe 100644 --- a/stubs/cachetools/cachetools/rr.pyi +++ b/stubs/cachetools/cachetools/rr.pyi @@ -8,9 +8,9 @@ _VT = TypeVar("_VT") class RRCache(Cache[_KT, _VT]): def __init__( self, - maxsize: int, + maxsize: float, choice: Optional[Callable[[Sequence[_KT]], _KT]] = ..., - getsizeof: Optional[Callable[[_VT], int]] = ..., + getsizeof: Optional[Callable[[_VT], float]] = ..., ) -> None: ... def __getitem__(self, key: _KT) -> _VT: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... diff --git a/stubs/cachetools/cachetools/ttl.pyi b/stubs/cachetools/cachetools/ttl.pyi index 539ed69e2..fb539aaa5 100644 --- a/stubs/cachetools/cachetools/ttl.pyi +++ b/stubs/cachetools/cachetools/ttl.pyi @@ -1,13 +1,13 @@ from typing import Callable, Iterator, Optional, TypeVar -from .cache import Cache +from .cache import Cache as Cache _KT = TypeVar("_KT") _VT = TypeVar("_VT") class TTLCache(Cache[_KT, _VT]): def __init__( - self, maxsize: int, ttl: float, timer: Callable[[], float] = ..., getsizeof: Optional[Callable[[_VT], int]] = ... + self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: Optional[Callable[[_VT], float]] = ... ) -> None: ... def __getitem__(self, key: _KT, cache_getitem: Callable[[_KT], _VT] = ...) -> _VT: ... def __setitem__(self, key: _KT, value: _VT, cache_setitem: Callable[[_KT, _VT], None] = ...) -> None: ... @@ -15,7 +15,7 @@ class TTLCache(Cache[_KT, _VT]): def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... @property - def currsize(self) -> int: ... + def currsize(self) -> float: ... @property def timer(self) -> Callable[[], float]: ... @property