11from collections .abc import Callable , Iterator , MutableMapping , Sequence
22from contextlib import AbstractContextManager
33from typing import Any , Final , Generic , Literal , NamedTuple , Protocol , TypeVar , overload , type_check_only
4- from typing_extensions import Self
5-
6- from . import keys
74
85__all__ : Final = ("Cache" , "FIFOCache" , "LFUCache" , "LRUCache" , "RRCache" , "TLRUCache" , "TTLCache" , "cached" , "cachedmethod" )
96__version__ : str
@@ -75,11 +72,22 @@ class TTLCache(_TimedCache[_KT, _VT]):
7572
7673class TLRUCache (_TimedCache [_KT , _VT ]):
7774 @overload
78- def __init__ (self , maxsize : float , ttu : Callable [[_KT , _VT , _TT ], _TT ], timer : Callable [..., _TT ] = ..., getsizeof : None = None ): ...
75+ def __init__ (
76+ self , maxsize : float , ttu : Callable [[_KT , _VT , _TT ], _TT ], timer : Callable [..., _TT ] = ..., getsizeof : None = None
77+ ): ...
7978 @overload
80- def __init__ (self , maxsize : float , ttu : Callable [[_KT , _VT , _TT ], _TT ], timer : Callable [..., _TT ], getsizeof : Callable [[_VT ], float ]): ...
79+ def __init__ (
80+ self , maxsize : float , ttu : Callable [[_KT , _VT , _TT ], _TT ], timer : Callable [..., _TT ], getsizeof : Callable [[_VT ], float ]
81+ ): ...
8182 @overload
82- def __init__ (self , maxsize : float , ttu : Callable [[_KT , _VT , _TT ], _TT ], timer : Callable [..., _TT ] = ..., * , getsizeof : Callable [[_VT ], float ]): ...
83+ def __init__ (
84+ self ,
85+ maxsize : float ,
86+ ttu : Callable [[_KT , _VT , _TT ], _TT ],
87+ timer : Callable [..., _TT ] = ...,
88+ * ,
89+ getsizeof : Callable [[_VT ], float ],
90+ ): ...
8391 @property
8492 def ttu (self ) -> Callable [[_KT , _VT , _TT ], _TT ]: ...
8593 def expire (self , time : _TT | None = None ) -> list [tuple [_KT , _VT ]]: ...
@@ -92,9 +100,9 @@ class _CacheInfo(NamedTuple):
92100
93101@type_check_only
94102class _AbstractCondition (AbstractContextManager [Any ], Protocol ):
95- #def wait(self, timeout: float | None = None) -> bool: ...
103+ # def wait(self, timeout: float | None = None) -> bool: ...
96104 def wait_for (self , predicate : Callable [[], _T ], timeout : float | None = None ) -> _T : ...
97- #def notify(self, n: int = 1) -> None: ...
105+ # def notify(self, n: int = 1) -> None: ...
98106 def notify_all (self ) -> None : ...
99107
100108@type_check_only
@@ -129,7 +137,6 @@ def cached(
129137 condition : _AbstractCondition | None = None ,
130138 info : Literal [False ] = ...,
131139) -> Callable [[Callable [..., _R ]], _cached_wrapper [_R ]]: ...
132-
133140@type_check_only
134141class _cachedmethod_wrapper (Generic [_R ]):
135142 __wrapped__ : Callable [..., _R ]
0 commit comments