massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / multiprocessing / pool.pyi
1 from typing import (\r
2     Any, Callable, ContextManager, Iterable, Mapping, Optional, List,\r
3     TypeVar, Generic,\r
4 )\r
5 \r
6 _PT = TypeVar('_PT', bound='Pool')\r
7 _S = TypeVar('_S')\r
8 _T = TypeVar('_T')\r
9 \r
10 class AsyncResult(Generic[_T]):\r
11     def get(self, timeout: Optional[float] = ...) -> _T: ...\r
12     def wait(self, timeout: Optional[float] = ...) -> None: ...\r
13     def ready(self) -> bool: ...\r
14     def successful(self) -> bool: ...\r
15 \r
16 _IMIT = TypeVar('_IMIT', bound=IMapIterator)\r
17 \r
18 class IMapIterator(Iterable[_T]):\r
19     def __iter__(self: _IMIT) -> _IMIT: ...\r
20     def next(self, timeout: Optional[float] = ...) -> _T: ...\r
21     def __next__(self, timeout: Optional[float] = ...) -> _T: ...\r
22 \r
23 class Pool(ContextManager[Pool]):\r
24     def __init__(self, processes: Optional[int] = ...,\r
25                  initializer: Optional[Callable[..., None]] = ...,\r
26                  initargs: Iterable[Any] = ...,\r
27                  maxtasksperchild: Optional[int] = ...,\r
28                  context: Optional[Any] = ...) -> None: ...\r
29     def apply(self,\r
30               func: Callable[..., _T],\r
31               args: Iterable[Any] = ...,\r
32               kwds: Mapping[str, Any] = ...) -> _T: ...\r
33     def apply_async(self,\r
34                 func: Callable[..., _T],\r
35                 args: Iterable[Any] = ...,\r
36                 kwds: Mapping[str, Any] = ...,\r
37                 callback: Optional[Callable[[_T], None]] = ...,\r
38                 error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[_T]: ...\r
39     def map(self,\r
40             func: Callable[[_S], _T],\r
41             iterable: Iterable[_S] = ...,\r
42             chunksize: Optional[int] = ...) -> List[_T]: ...\r
43     def map_async(self, func: Callable[[_S], _T],\r
44                   iterable: Iterable[_S] = ...,\r
45                   chunksize: Optional[int] = ...,\r
46                   callback: Optional[Callable[[_T], None]] = ...,\r
47                   error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[List[_T]]: ...\r
48     def imap(self,\r
49              func: Callable[[_S], _T],\r
50              iterable: Iterable[_S] = ...,\r
51              chunksize: Optional[int] = ...) -> IMapIterator[_T]: ...\r
52     def imap_unordered(self,\r
53                        func: Callable[[_S], _T],\r
54                        iterable: Iterable[_S] = ...,\r
55                        chunksize: Optional[int] = ...) -> IMapIterator[_T]: ...\r
56     def starmap(self,\r
57                 func: Callable[..., _T],\r
58                 iterable: Iterable[Iterable[Any]] = ...,\r
59                 chunksize: Optional[int] = ...) -> List[_T]: ...\r
60     def starmap_async(self,\r
61                       func: Callable[..., _T],\r
62                       iterable: Iterable[Iterable[Any]] = ...,\r
63                       chunksize: Optional[int] = ...,\r
64                       callback: Optional[Callable[[_T], None]] = ...,\r
65                       error_callback: Optional[Callable[[BaseException], None]] = ...) -> AsyncResult[List[_T]]: ...\r
66     def close(self) -> None: ...\r
67     def terminate(self) -> None: ...\r
68     def join(self) -> None: ...\r
69     def __enter__(self: _PT) -> _PT: ...\r
70 \r
71 \r
72 class ThreadPool(Pool, ContextManager[ThreadPool]):\r
73 \r
74     def __init__(self, processes: Optional[int] = ...,\r
75                  initializer: Optional[Callable[..., Any]] = ...,\r
76                  initargs: Iterable[Any] = ...) -> None: ...\r