Added type declaration for multiprocessing.pool.ThreadPool and AsyncResult. (#143)

This commit is contained in:
Yasushi Saito
2016-04-12 14:42:15 -07:00
committed by Guido van Rossum
parent 68306484ae
commit 7389610937

View File

@@ -2,5 +2,35 @@
# NOTE: These are incomplete!
from typing import Any, Callable, Iterable, List, Sequence
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 ThreadPool():
def __init__(self, processes: int = ...) -> None: ...
def apply_async(self, func: Callable[..., Any],
args: Sequence[Any]=(),
kwds: Dict[str, Any]={},
callback: Callable[..., None] = None) -> AsyncResult: ...
def apply(self, func: Callable[..., Any],
args: Sequence[Any]=(),
kwds: Dict[str, Any]={}) -> Any: ...
def map(self, func: Callable[..., Any],
iterable: Iterable[Any]=()) -> List[Any]: ...
def map_async(self, func: Callable[..., Any],
iterable: Iterable[Any] = (),
chunksize: int = -1,
callback: Callable[..., None] = None) -> AsyncResult: ...
def imap(self, func: Callable[..., Any],
iterable: Iterable[Any]=()) -> Iterable[Any]: ...
def imap_async(self, func: Callable[..., Any],
chunksize: int = -1,
iterable: Iterable[Any]=(),
callback: Callable[..., None] = None) -> AsyncResult: ...
def close(self) -> None: ...
def terminate(self) -> None: ...
def join(self) -> None: ...