cachetools ttl should be float (#4668)

This commit is contained in:
crusaderky
2020-10-14 16:31:18 +01:00
committed by GitHub
parent 3a16ebb463
commit 58028a95eb
2 changed files with 3 additions and 3 deletions

View File

@@ -8,4 +8,4 @@ _RET = Callable[[_F], _F]
def lfu_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
def lru_cache(maxsize: int = ..., typed: bool = ...) -> _RET: ...
def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> _RET: ...
def ttl_cache(maxsize: int = ..., ttl: int = ..., timer: float = ..., typed: bool = ...) -> _RET: ...
def ttl_cache(maxsize: int = ..., ttl: float = ..., timer: float = ..., typed: bool = ...) -> _RET: ...

View File

@@ -7,7 +7,7 @@ _VT = TypeVar("_VT")
class TTLCache(Cache[_KT, _VT]):
def __init__(
self, maxsize: int, ttl: int, timer: Callable[[], float] = ..., getsizeof: Optional[Callable[[_VT], int]] = ...
self, maxsize: int, ttl: float, timer: Callable[[], float] = ..., getsizeof: Optional[Callable[[_VT], int]] = ...
) -> 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: ...
@@ -19,5 +19,5 @@ class TTLCache(Cache[_KT, _VT]):
@property
def timer(self) -> Callable[[], float]: ...
@property
def ttl(self) -> int: ...
def ttl(self) -> float: ...
def expire(self, time: Optional[Callable[[], float]] = ...) -> None: ...