From f1929d9e5a78442cc116c949fa4986f9b90419de Mon Sep 17 00:00:00 2001 From: turettn Date: Mon, 21 Sep 2020 08:15:29 -0400 Subject: [PATCH] cachetools: fix caching decorators return type (#4556) --- third_party/2and3/cachetools/func.pyi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/third_party/2and3/cachetools/func.pyi b/third_party/2and3/cachetools/func.pyi index 5fcb68fda..e1e6ac160 100644 --- a/third_party/2and3/cachetools/func.pyi +++ b/third_party/2and3/cachetools/func.pyi @@ -1,8 +1,11 @@ -from typing import Callable, Optional, Sequence, TypeVar +from typing import Any, Callable, Optional, Sequence, TypeVar _T = TypeVar("_T") -def lfu_cache(maxsize: int = ..., typed: bool = ...) -> None: ... -def lru_cache(maxsize: int = ..., typed: bool = ...) -> None: ... -def rr_cache(maxsize: int = ..., choice: Optional[Callable[[Sequence[_T]], _T]] = ..., typed: bool = ...) -> None: ... -def ttl_cache(maxsize: int = ..., ttl: int = ..., timer: float = ..., typed: bool = ...) -> None: ... +_F = TypeVar("_F", bound=Callable[..., Any]) +_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: ...