@@ -2,6 +2,7 @@ import sys
2
2
import types
3
3
from _typeshed import SupportsItems , SupportsLessThan
4
4
from typing import Any , Callable , Generic , Hashable , Iterable , NamedTuple , Sequence , Set , Sized , Tuple , Type , TypeVar , overload
5
+ from typing_extensions import ParamSpec
5
6
6
7
if sys .version_info >= (3 , 9 ):
7
8
from types import GenericAlias
@@ -10,6 +11,7 @@ _AnyCallable = Callable[..., Any]
10
11
11
12
_T = TypeVar ("_T" )
12
13
_S = TypeVar ("_S" )
14
+ _P = ParamSpec ("_P" )
13
15
14
16
@overload
15
17
def reduce (function : Callable [[_T , _S ], _T ], sequence : Iterable [_S ], initial : _T ) -> _T : ...
@@ -22,20 +24,20 @@ class _CacheInfo(NamedTuple):
22
24
maxsize : int
23
25
currsize : int
24
26
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
28
30
def cache_info (self ) -> _CacheInfo : ...
29
31
def cache_clear (self ) -> None : ...
30
32
31
33
if sys .version_info >= (3 , 8 ):
32
34
@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
34
36
@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
36
38
37
39
else :
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
39
41
40
42
WRAPPER_ASSIGNMENTS : Sequence [str ]
41
43
WRAPPER_UPDATES : Sequence [str ]
@@ -115,7 +117,7 @@ if sys.version_info >= (3, 8):
115
117
def __class_getitem__ (cls , item : Any ) -> GenericAlias : ...
116
118
117
119
if 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
119
121
120
122
def _make_key (
121
123
args : Tuple [Hashable , ...],
0 commit comments