1
1
import sys
2
2
from _typeshed import Self
3
- from typing import Any , Callable , ContextManager , Generic , Iterable , Iterator , List , Mapping , TypeVar
3
+ from typing import Any , Callable , ContextManager , Dict , Generic , Iterable , Iterator , List , Mapping , TypeVar
4
4
5
5
if sys .version_info >= (3 , 9 ):
6
6
from types import GenericAlias
@@ -10,12 +10,17 @@ _S = TypeVar("_S")
10
10
_T = TypeVar ("_T" )
11
11
12
12
class ApplyResult (Generic [_T ]):
13
- def __init__ (
14
- self ,
15
- pool : Pool ,
16
- callback : Callable [[_T ], None ] | None = ...,
17
- error_callback : Callable [[BaseException ], None ] | None = ...,
18
- ) -> None : ...
13
+ if sys .version_info >= (3 , 8 ):
14
+ def __init__ (
15
+ self , pool : Pool , callback : Callable [[_T ], None ] | None , error_callback : Callable [[BaseException ], None ] | None
16
+ ) -> None : ...
17
+ else :
18
+ def __init__ (
19
+ self ,
20
+ cache : Dict [int , ApplyResult [Any ]],
21
+ callback : Callable [[_T ], None ] | None ,
22
+ error_callback : Callable [[BaseException ], None ] | None ,
23
+ ) -> None : ...
19
24
def get (self , timeout : float | None = ...) -> _T : ...
20
25
def wait (self , timeout : float | None = ...) -> None : ...
21
26
def ready (self ) -> bool : ...
@@ -26,9 +31,31 @@ class ApplyResult(Generic[_T]):
26
31
# alias created during issue #17805
27
32
AsyncResult = ApplyResult
28
33
29
- class MapResult (ApplyResult [List [_T ]]): ...
34
+ class MapResult (ApplyResult [List [_T ]]):
35
+ if sys .version_info >= (3 , 8 ):
36
+ def __init__ (
37
+ self ,
38
+ pool : Pool ,
39
+ chunksize : int ,
40
+ length : int ,
41
+ callback : Callable [[List [_T ]], None ] | None ,
42
+ error_callback : Callable [[BaseException ], None ] | None ,
43
+ ) -> None : ...
44
+ else :
45
+ def __init__ (
46
+ self ,
47
+ cache : Dict [int , ApplyResult [Any ]],
48
+ chunksize : int ,
49
+ length : int ,
50
+ callback : Callable [[List [_T ]], None ] | None ,
51
+ error_callback : Callable [[BaseException ], None ] | None ,
52
+ ) -> None : ...
30
53
31
54
class IMapIterator (Iterator [_T ]):
55
+ if sys .version_info >= (3 , 8 ):
56
+ def __init__ (self , pool : Pool ) -> None : ...
57
+ else :
58
+ def __init__ (self , cache : Dict [int , IMapIterator [Any ]]) -> None : ...
32
59
def __iter__ (self : _S ) -> _S : ...
33
60
def next (self , timeout : float | None = ...) -> _T : ...
34
61
def __next__ (self , timeout : float | None = ...) -> _T : ...
0 commit comments