multiprocessing.spawn submodule and multiprocessing.pool stubs (#2823)

Added stub for multiprocessing.spawn submodule and updated multiprocessing.pool stub

Closes #2758
This commit is contained in:
Sean McLemon
2019-03-05 14:52:02 +01:00
committed by Sebastian Rittau
parent b80b2e4b98
commit 17cd91eeb3
3 changed files with 33 additions and 5 deletions

View File

@@ -6,13 +6,16 @@ from typing import (
)
from logging import Logger
from multiprocessing import connection, pool, synchronize
from multiprocessing import connection, pool, spawn, synchronize
from multiprocessing.context import (
BaseContext,
ProcessError as ProcessError, BufferTooShort as BufferTooShort, TimeoutError as TimeoutError, AuthenticationError as AuthenticationError)
from multiprocessing.managers import SyncManager
from multiprocessing.process import current_process as current_process
from multiprocessing.queues import Queue as Queue, SimpleQueue as SimpleQueue, JoinableQueue as JoinableQueue
from multiprocessing.spawn import freeze_support as freeze_support
from multiprocessing.spawn import set_executable as set_executable
import sys
# N.B. The functions below are generated at runtime by partially applying
@@ -71,12 +74,10 @@ class Value():
def active_children() -> List[Process]: ...
def allow_connection_pickling() -> None: ...
def cpu_count() -> int: ...
def freeze_support() -> None: ...
def get_logger() -> Logger: ...
def log_to_stderr(level: Optional[Union[str, int]] = ...) -> Logger: ...
def Manager() -> SyncManager: ...
def set_forkserver_preload(module_names: List[str]) -> None: ...
def set_executable(executable: str) -> None: ...
def get_all_start_methods() -> List[str]: ...
def get_context(method: Optional[str] = ...) -> BaseContext: ...
def get_start_method(allow_none: Optional[bool]) -> Optional[str]: ...

View File

@@ -1,18 +1,22 @@
from typing import (
Any, Callable, ContextManager, Iterable, Mapping, Optional, List,
TypeVar, Generic, Iterator
Type, TypeVar, Generic, Iterator
)
from types import TracebackType
_PT = TypeVar('_PT', bound='Pool')
_S = TypeVar('_S')
_T = TypeVar('_T')
class AsyncResult(Generic[_T]):
class ApplyResult(Generic[_T]):
def get(self, timeout: Optional[float] = ...) -> _T: ...
def wait(self, timeout: Optional[float] = ...) -> None: ...
def ready(self) -> bool: ...
def successful(self) -> bool: ...
# alias created during issue #17805
AsyncResult = ApplyResult
_IMIT = TypeVar('_IMIT', bound=IMapIterator)
class IMapIterator(Iterator[_T]):
@@ -76,3 +80,8 @@ class ThreadPool(Pool, ContextManager[ThreadPool]):
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...) -> None: ...
# undocumented
RUN: int
CLOSE: int
TERMINATE: int

View File

@@ -0,0 +1,18 @@
from typing import Any, Dict, List, Mapping, Optional, Sequence
from types import ModuleType
WINEXE: bool
WINSERVICE: bool
def set_executable(exe: str) -> None: ...
def get_executable() -> str: ...
def is_forking(argv: Sequence[str]) -> bool: ...
def freeze_support() -> None: ...
def get_command_line(**kwds: Any) -> List[str]: ...
def spawn_main(pipe_handle: int, parent_pid: Optional[int] = ..., tracker_fd: Optional[int] = ...) -> None: ...
# undocumented
def _main(fd: int) -> Any: ...
def get_preparation_data(name: str) -> Dict[str, Any]: ...
old_main_modules: List[ModuleType] = ...
def prepare(data: Mapping[str, Any]) -> None: ...
def import_main_path(main_path: str) -> None: ...