mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
[review] Add multiprocessing.Pool (#523)
This commit is contained in:
committed by
Guido van Rossum
parent
7f7a5789bd
commit
8d10e885d1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user