@@ -11,7 +11,10 @@ _VT = TypeVar("_VT")
1111_T = TypeVar ("_T" )
1212
1313class Cache (MutableMapping [_KT , _VT ], Generic [_KT , _VT ]):
14- def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ] | None = ...) -> None : ...
14+ @overload
15+ def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ]) -> None : ...
16+ @overload
17+ def __init__ (self , maxsize : float , getsizeof : None = ...) -> None : ...
1518 def __getitem__ (self , key : _KT ) -> _VT : ...
1619 def __setitem__ (self , key : _KT , value : _VT ) -> None : ...
1720 def __delitem__ (self , key : _KT ) -> None : ...
@@ -30,29 +33,32 @@ class Cache(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
3033 @staticmethod
3134 def getsizeof (value : _VT ) -> float : ...
3235
33- class FIFOCache (Cache [_KT , _VT ]):
34- def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ] | None = ...) -> None : ...
35-
36- class LFUCache (Cache [_KT , _VT ]):
37- def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ] | None = ...) -> None : ...
38-
39- class LRUCache (Cache [_KT , _VT ]):
40- def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ] | None = ...) -> None : ...
41-
42- class MRUCache (Cache [_KT , _VT ]):
43- def __init__ (self , maxsize : float , getsizeof : Callable [[_VT ], float ] | None = ...) -> None : ...
36+ class FIFOCache (Cache [_KT , _VT ]): ...
37+ class LFUCache (Cache [_KT , _VT ]): ...
38+ class LRUCache (Cache [_KT , _VT ]): ...
39+ class MRUCache (Cache [_KT , _VT ]): ...
4440
4541class RRCache (Cache [_KT , _VT ]):
46- def __init__ (
47- self , maxsize : float , choice : Callable [[Sequence [_KT ]], _KT ] | None = ..., getsizeof : Callable [[_VT ], float ] | None = ...
48- ) -> None : ...
42+ @overload
43+ def __init__ (self , maxsize : float , choice : None = ..., getsizeof : None = ...) -> None : ...
44+ @overload
45+ def __init__ (self , maxsize : float , * , getsizeof : Callable [[_VT ], float ]) -> None : ...
46+ @overload
47+ def __init__ (self , maxsize : float , choice : None , getsizeof : Callable [[_VT ], float ]) -> None : ...
48+ @overload
49+ def __init__ (self , maxsize : float , choice : Callable [[Sequence [_KT ]], _KT ], getsizeof : None = ...) -> None : ...
50+ @overload
51+ def __init__ (self , maxsize : float , choice : Callable [[Sequence [_KT ]], _KT ], getsizeof : Callable [[_VT ], float ]) -> None : ...
4952 @property
5053 def choice (self ) -> Callable [[Sequence [_KT ]], _KT ]: ...
5154
5255class _TimedCache (Cache [_KT , _VT ]):
53- def __init__ (
54- self , maxsize : float , timer : Callable [[], float ] = ..., getsizeof : Callable [[_VT ], float ] | None = ...
55- ) -> None : ...
56+ @overload
57+ def __init__ (self , maxsize : float , timer : Callable [[], float ] = ..., getsizeof : None = ...) -> None : ...
58+ @overload
59+ def __init__ (self , maxsize : float , timer : Callable [[], float ], getsizeof : Callable [[_VT ], float ]) -> None : ...
60+ @overload
61+ def __init__ (self , maxsize : float , timer : Callable [[], float ] = ..., * , getsizeof : Callable [[_VT ], float ]) -> None : ...
5662 @property
5763 def currsize (self ) -> float : ...
5864
@@ -66,8 +72,13 @@ class _TimedCache(Cache[_KT, _VT]):
6672 def timer (self ) -> _Timer : ...
6773
6874class TTLCache (_TimedCache [_KT , _VT ]):
75+ @overload
76+ def __init__ (self , maxsize : float , ttl : float , timer : Callable [[], float ] = ..., getsizeof : None = ...) -> None : ...
77+ @overload
78+ def __init__ (self , maxsize : float , ttl : float , timer : Callable [[], float ], getsizeof : Callable [[_VT ], float ]) -> None : ...
79+ @overload
6980 def __init__ (
70- self , maxsize : float , ttl : float , timer : Callable [[], float ] = ..., getsizeof : Callable [[_VT ], float ] | None = ...
81+ self , maxsize : float , ttl : float , timer : Callable [[], float ] = ..., * , getsizeof : Callable [[_VT ], float ]
7182 ) -> None : ...
7283 @property
7384 def ttl (self ) -> float : ...
0 commit comments