1 # Stubs for multiprocessing
\r
4 Any, Callable, ContextManager, Iterable, Mapping, Optional, Dict, List,
\r
5 Union, Sequence, Tuple
\r
8 from logging import Logger
\r
9 from multiprocessing import connection, pool, synchronize
\r
10 from multiprocessing.context import (
\r
12 ProcessError as ProcessError, BufferTooShort as BufferTooShort, TimeoutError as TimeoutError, AuthenticationError as AuthenticationError)
\r
13 from multiprocessing.managers import SyncManager
\r
14 from multiprocessing.process import current_process as current_process
\r
15 from multiprocessing.queues import Queue as Queue, SimpleQueue as SimpleQueue, JoinableQueue as JoinableQueue
\r
18 # N.B. The functions below are generated at runtime by partially applying
\r
19 # multiprocessing.context.BaseContext's methods, so the two signatures should
\r
20 # be identical (modulo self).
\r
22 # Sychronization primitives
\r
23 _LockLike = Union[synchronize.Lock, synchronize.RLock]
\r
24 def Barrier(parties: int,
\r
25 action: Optional[Callable] = ...,
\r
26 timeout: Optional[float] = ...) -> synchronize.Barrier: ...
\r
27 def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ...
\r
28 def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
\r
29 def Event(lock: Optional[_LockLike] = ...) -> synchronize.Event: ...
\r
30 def Lock() -> synchronize.Lock: ...
\r
31 def RLock() -> synchronize.RLock: ...
\r
32 def Semaphore(value: int = ...) -> synchronize.Semaphore: ...
\r
34 def Pipe(duplex: bool = ...) -> Tuple[connection.Connection, connection.Connection]: ...
\r
36 def Pool(processes: Optional[int] = ...,
\r
37 initializer: Optional[Callable[..., Any]] = ...,
\r
38 initargs: Iterable[Any] = ...,
\r
39 maxtasksperchild: Optional[int] = ...) -> pool.Pool: ...
\r
45 exitcode: Optional[int]
\r
48 # TODO: set type of group to None
\r
51 target: Optional[Callable] = ...,
\r
52 name: Optional[str] = ...,
\r
53 args: Iterable[Any] = ...,
\r
54 kwargs: Mapping[Any, Any] = ...,
\r
56 daemon: Optional[bool] = ...) -> None: ...
\r
57 def start(self) -> None: ...
\r
58 def run(self) -> None: ...
\r
59 def terminate(self) -> None: ...
\r
60 if sys.version_info >= (3, 7):
\r
61 def kill(self) -> None: ...
\r
62 def close(self) -> None: ...
\r
63 def is_alive(self) -> bool: ...
\r
64 def join(self, timeout: Optional[float] = ...) -> None: ...
\r
68 def __init__(self, typecode_or_type: str, *args: Any, lock: bool = ...) -> None: ...
\r
70 # ----- multiprocessing function stubs -----
\r
71 def active_children() -> List[Process]: ...
\r
72 def allow_connection_pickling() -> None: ...
\r
73 def cpu_count() -> int: ...
\r
74 def freeze_support() -> None: ...
\r
75 def get_logger() -> Logger: ...
\r
76 def log_to_stderr(level: Optional[Union[str, int]] = ...) -> Logger: ...
\r
77 def Manager() -> SyncManager: ...
\r
78 def set_forkserver_preload(module_names: List[str]) -> None: ...
\r
79 def set_executable(executable: str) -> None: ...
\r
80 def get_all_start_methods() -> List[str]: ...
\r
81 def get_context(method: Optional[str] = ...) -> BaseContext: ...
\r
82 def get_start_method(allow_none: Optional[bool]) -> Optional[str]: ...
\r
83 def set_start_method(method: str, force: Optional[bool] = ...) -> None: ...
\r