mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-16 15:02:26 +08:00
Add defaults for third-party stubs A-D (#9952)
This commit is contained in:
@@ -14,7 +14,7 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, maxsize: float, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, getsizeof: None = ...) -> None: ...
|
||||
def __init__(self, maxsize: float, getsizeof: None = None) -> None: ...
|
||||
def __getitem__(self, key: _KT) -> _VT: ...
|
||||
def __setitem__(self, key: _KT, value: _VT) -> None: ...
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
@@ -25,7 +25,7 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def pop(self, key: _KT) -> _VT: ...
|
||||
@overload
|
||||
def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ...
|
||||
def setdefault(self, key: _KT, default: _VT | None = ...) -> _VT: ...
|
||||
def setdefault(self, key: _KT, default: _VT | None = None) -> _VT: ...
|
||||
@property
|
||||
def maxsize(self) -> float: ...
|
||||
@property
|
||||
@@ -40,13 +40,13 @@ class MRUCache(Cache[_KT, _VT]): ...
|
||||
|
||||
class RRCache(Cache[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: None = ..., getsizeof: None = ...) -> None: ...
|
||||
def __init__(self, maxsize: float, choice: None = None, getsizeof: None = None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, *, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: None, getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: None = ...) -> None: ...
|
||||
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: None = None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, choice: Callable[[Sequence[_KT]], _KT], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@property
|
||||
@@ -54,7 +54,7 @@ class RRCache(Cache[_KT, _VT]):
|
||||
|
||||
class _TimedCache(Cache[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ...
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float] = ..., getsizeof: None = None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
@@ -73,7 +73,7 @@ class _TimedCache(Cache[_KT, _VT]):
|
||||
|
||||
class TTLCache(_TimedCache[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: None = ...) -> None: ...
|
||||
def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float] = ..., getsizeof: None = None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, maxsize: float, ttl: float, timer: Callable[[], float], getsizeof: Callable[[_VT], float]) -> None: ...
|
||||
@overload
|
||||
@@ -82,7 +82,7 @@ class TTLCache(_TimedCache[_KT, _VT]):
|
||||
) -> None: ...
|
||||
@property
|
||||
def ttl(self) -> float: ...
|
||||
def expire(self, time: float | None = ...) -> None: ...
|
||||
def expire(self, time: float | None = None) -> None: ...
|
||||
|
||||
class TLRUCache(_TimedCache[_KT, _VT]):
|
||||
def __init__(
|
||||
@@ -90,11 +90,11 @@ class TLRUCache(_TimedCache[_KT, _VT]):
|
||||
maxsize: float,
|
||||
ttu: Callable[[_KT, _VT, float], float],
|
||||
timer: Callable[[], float] = ...,
|
||||
getsizeof: Callable[[_VT], float] | None = ...,
|
||||
getsizeof: Callable[[_VT], float] | None = None,
|
||||
) -> None: ...
|
||||
@property
|
||||
def ttu(self) -> Callable[[_KT, _VT, float], float]: ...
|
||||
def expire(self, time: float | None = ...) -> None: ...
|
||||
def expire(self, time: float | None = None) -> None: ...
|
||||
|
||||
def cached(
|
||||
cache: MutableMapping[_KT, Any] | None,
|
||||
@@ -105,5 +105,5 @@ def cached(
|
||||
def cachedmethod(
|
||||
cache: Callable[[Any], MutableMapping[_KT, Any] | None],
|
||||
key: Callable[..., _KT] = ...,
|
||||
lock: Callable[[Any], AbstractContextManager[Any]] | None = ...,
|
||||
lock: Callable[[Any], AbstractContextManager[Any]] | None = None,
|
||||
) -> IdentityFunction: ...
|
||||
|
||||
@@ -5,13 +5,13 @@ from typing import 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: ...
|
||||
def lfu_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ...
|
||||
def lru_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ...
|
||||
def mru_cache(maxsize: float | None = ..., typed: bool = ...) -> IdentityFunction: ...
|
||||
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: ...
|
||||
def mru_cache(maxsize: float | None = 128, typed: bool = False) -> IdentityFunction: ...
|
||||
def rr_cache(
|
||||
maxsize: float | None = ..., choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = ...
|
||||
maxsize: float | None = 128, choice: Callable[[Sequence[_T]], _T] | None = ..., typed: bool = False
|
||||
) -> IdentityFunction: ...
|
||||
def ttl_cache(
|
||||
maxsize: float | None = ..., ttl: float = ..., timer: Callable[[], float] = ..., typed: bool = ...
|
||||
maxsize: float | None = 128, ttl: float = 600, timer: Callable[[], float] = ..., typed: bool = False
|
||||
) -> IdentityFunction: ...
|
||||
|
||||
Reference in New Issue
Block a user