[review] Add multiprocessing.Pool (#523)

This commit is contained in:
Alex Jurkiewicz
2016-10-13 10:44:37 +11:00
committed by Guido van Rossum
parent 7f7a5789bd
commit 8d10e885d1

View File

@@ -1,6 +1,6 @@
# Stubs for multiprocessing
from typing import Any, Callable, Iterable, Mapping
from typing import Any, Callable, Iterable, Mapping, Optional, Dict, List
from multiprocessing.process import current_process as current_process
@@ -8,6 +8,59 @@ class Lock():
def acquire(self, block: bool = ..., timeout: int = ...) -> None: ...
def release(self) -> None: ...
class AsyncResult():
def get(self, timeout: float = -1) -> Any: ...
def wait(self, timeout: float = -1) -> None: ...
def ready(self) -> bool: ...
def successful(self) -> bool: ...
class Pool():
def __init__(self, processes: Optional[int] = None,
initializer: Optional[Callable[..., None]] = None,
initargs: Iterable[Any] = (),
maxtasksperchild: Optional[int] = None,
context: Any = None) -> None: ...
def apply(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
kwds: Dict[str, Any]={}) -> Any: ...
def apply_async(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
kwds: Dict[str, Any]={},
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def map(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
chunksize: Optional[int] = None) -> List[Any]: ...
def map_async(self, func: Callable[..., Any],
iterable: Iterable[Any] = (),
chunksize: Optional[int] = None,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def imap(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def imap_unordered(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def starmap(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
chunksize: Optional[int] = None) -> List[Any]: ...
def starmap_async(self,
func: Callable[..., Any],
iterable: Iterable[Any] = (),
chunksize: Optional[int] = None,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def close(self) -> None: ...
def terminate(self) -> None: ...
def join(self) -> None: ...
class Process():
# TODO: set type of group to None
def __init__(self,