@@ -2,6 +2,7 @@ import sys
22import types
33from _typeshed import SupportsItems , SupportsLessThan
44from typing import Any , Callable , Generic , Hashable , Iterable , NamedTuple , Sequence , Set , Sized , Tuple , Type , TypeVar , overload
5+ from typing_extensions import ParamSpec
56
67if sys .version_info >= (3 , 9 ):
78 from types import GenericAlias
@@ -10,6 +11,7 @@ _AnyCallable = Callable[..., Any]
1011
1112_T = TypeVar ("_T" )
1213_S = TypeVar ("_S" )
14+ _P = ParamSpec ("_P" )
1315
1416@overload
1517def reduce (function : Callable [[_T , _S ], _T ], sequence : Iterable [_S ], initial : _T ) -> _T : ...
@@ -22,20 +24,20 @@ class _CacheInfo(NamedTuple):
2224 maxsize : int
2325 currsize : int
2426
25- class _lru_cache_wrapper (Generic [_T ]):
26- __wrapped__ : Callable [... , _T ]
27- def __call__ (self , * args : Hashable , ** kwargs : Hashable ) -> _T : ...
27+ class _lru_cache_wrapper (Generic [_P , _T ]): # type: ignore
28+ __wrapped__ : Callable [_P , _T ] # type: ignore
29+ def __call__ (self , * args : _P . args , ** kwargs : _P . kwargs ) -> _T : ... # type: ignore
2830 def cache_info (self ) -> _CacheInfo : ...
2931 def cache_clear (self ) -> None : ...
3032
3133if sys .version_info >= (3 , 8 ):
3234 @overload
33- def lru_cache (maxsize : int | None = ..., typed : bool = ...) -> Callable [[Callable [... , _T ]], _lru_cache_wrapper [_T ]]: ...
35+ def lru_cache (maxsize : int | None = ..., typed : bool = ...) -> Callable [[Callable [_P , _T ]], _lru_cache_wrapper [_P , _T ]]: ... # type: ignore
3436 @overload
35- def lru_cache (maxsize : Callable [... , _T ], typed : bool = ...) -> _lru_cache_wrapper [_T ]: ...
37+ def lru_cache (maxsize : Callable [_P , _T ], typed : bool = ...) -> _lru_cache_wrapper [_P , _T ]: ... # type: ignore
3638
3739else :
38- def lru_cache (maxsize : int | None = ..., typed : bool = ...) -> Callable [[Callable [... , _T ]], _lru_cache_wrapper [_T ]]: ...
40+ def lru_cache (maxsize : int | None = ..., typed : bool = ...) -> Callable [[Callable [_P , _T ]], _lru_cache_wrapper [_P , _T ]]: ... # type: ignore
3941
4042WRAPPER_ASSIGNMENTS : Sequence [str ]
4143WRAPPER_UPDATES : Sequence [str ]
@@ -115,7 +117,7 @@ if sys.version_info >= (3, 8):
115117 def __class_getitem__ (cls , item : Any ) -> GenericAlias : ...
116118
117119if sys .version_info >= (3 , 9 ):
118- def cache (__user_function : Callable [... , _T ]) -> _lru_cache_wrapper [_T ]: ...
120+ def cache (__user_function : Callable [_P , _T ]) -> _lru_cache_wrapper [_P , _T ]: ... # type: ignore
119121
120122def _make_key (
121123 args : Tuple [Hashable , ...],
0 commit comments