Skip to content

Commit cc8344b

Browse files
authored
[multiprocessing] fixes more incorrect types (#4289)
1 parent 4586ed9 commit cc8344b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

stdlib/3/multiprocessing/__init__.pyi

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from ctypes import _CData
33
from logging import Logger
4-
from multiprocessing import connection, pool, sharedctypes, spawn, synchronize
4+
from multiprocessing import connection, pool, sharedctypes, spawn, synchronize, queues
55
from multiprocessing.context import (
66
AuthenticationError as AuthenticationError,
77
BaseContext,
@@ -14,8 +14,7 @@ from multiprocessing.context import (
1414
)
1515
from multiprocessing.managers import SyncManager
1616
from multiprocessing.process import active_children as active_children, current_process as current_process
17-
from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue
18-
from multiprocessing.spawn import freeze_support as freeze_support, set_executable as set_executable
17+
from multiprocessing.spawn import freeze_support as freeze_support
1918
from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Type, Union, overload
2019

2120
from typing_extensions import Literal
@@ -36,9 +35,11 @@ _LockLike = Union[synchronize.Lock, synchronize.RLock]
3635
def Barrier(parties: int, action: Optional[Callable[..., Any]] = ..., timeout: Optional[float] = ...) -> synchronize.Barrier: ...
3736
def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ...
3837
def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
39-
def Event(lock: Optional[_LockLike] = ...) -> synchronize.Event: ...
38+
def Event() -> synchronize.Event: ...
39+
def JoinableQueue(maxsize: int = ...) -> queues.JoinableQueue: ...
4040
def Lock() -> synchronize.Lock: ...
4141
def RLock() -> synchronize.RLock: ...
42+
def SimpleQueue() -> queues.SimpleQueue: ...
4243
def Semaphore(value: int = ...) -> synchronize.Semaphore: ...
4344
def Pipe(duplex: bool = ...) -> Tuple[connection.Connection, connection.Connection]: ...
4445
def Pool(
@@ -47,6 +48,7 @@ def Pool(
4748
initargs: Iterable[Any] = ...,
4849
maxtasksperchild: Optional[int] = ...,
4950
) -> pool.Pool: ...
51+
def Queue(maxsize: int = ...) -> queues.Queue: ...
5052

5153
# Functions Array and Value are copied from context.pyi.
5254
# See https://github.com/python/typeshed/blob/ac234f25927634e06d9c96df98d72d54dd80dfc4/stdlib/2and3/turtle.pyi#L284-L291
@@ -60,6 +62,7 @@ def cpu_count() -> int: ...
6062
def get_logger() -> Logger: ...
6163
def log_to_stderr(level: Optional[Union[str, int]] = ...) -> Logger: ...
6264
def Manager() -> SyncManager: ...
65+
def set_executable(executable: str) -> None: ...
6366
def set_forkserver_preload(module_names: List[str]) -> None: ...
6467
def get_all_start_methods() -> List[str]: ...
6568
def get_start_method(allow_none: bool = ...) -> Optional[str]: ...

stdlib/3/multiprocessing/context.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BaseContext(object):
4040
) -> synchronize.Barrier: ...
4141
def BoundedSemaphore(self, value: int = ...) -> synchronize.BoundedSemaphore: ...
4242
def Condition(self, lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
43-
def Event(self, lock: Optional[_LockLike] = ...) -> synchronize.Event: ...
43+
def Event(self) -> synchronize.Event: ...
4444
def Lock(self) -> synchronize.Lock: ...
4545
def RLock(self) -> synchronize.RLock: ...
4646
def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ...

0 commit comments

Comments
 (0)