[multiprocessing] fixes more incorrect types (#4289)

This commit is contained in:
Vishal Kuo
2020-06-28 16:08:14 -07:00
committed by GitHub
parent 4586ed9adc
commit cc8344b8c6
2 changed files with 8 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
import sys
from ctypes import _CData
from logging import Logger
from multiprocessing import connection, pool, sharedctypes, spawn, synchronize
from multiprocessing import connection, pool, sharedctypes, spawn, synchronize, queues
from multiprocessing.context import (
AuthenticationError as AuthenticationError,
BaseContext,
@@ -14,8 +14,7 @@ from multiprocessing.context import (
)
from multiprocessing.managers import SyncManager
from multiprocessing.process import active_children as active_children, current_process as current_process
from multiprocessing.queues import JoinableQueue as JoinableQueue, Queue as Queue, SimpleQueue as SimpleQueue
from multiprocessing.spawn import freeze_support as freeze_support, set_executable as set_executable
from multiprocessing.spawn import freeze_support as freeze_support
from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, Type, Union, overload
from typing_extensions import Literal
@@ -36,9 +35,11 @@ _LockLike = Union[synchronize.Lock, synchronize.RLock]
def Barrier(parties: int, action: Optional[Callable[..., Any]] = ..., timeout: Optional[float] = ...) -> synchronize.Barrier: ...
def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ...
def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
def Event(lock: Optional[_LockLike] = ...) -> synchronize.Event: ...
def Event() -> synchronize.Event: ...
def JoinableQueue(maxsize: int = ...) -> queues.JoinableQueue: ...
def Lock() -> synchronize.Lock: ...
def RLock() -> synchronize.RLock: ...
def SimpleQueue() -> queues.SimpleQueue: ...
def Semaphore(value: int = ...) -> synchronize.Semaphore: ...
def Pipe(duplex: bool = ...) -> Tuple[connection.Connection, connection.Connection]: ...
def Pool(
@@ -47,6 +48,7 @@ def Pool(
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...,
) -> pool.Pool: ...
def Queue(maxsize: int = ...) -> queues.Queue: ...
# Functions Array and Value are copied from context.pyi.
# See https://github.com/python/typeshed/blob/ac234f25927634e06d9c96df98d72d54dd80dfc4/stdlib/2and3/turtle.pyi#L284-L291
@@ -60,6 +62,7 @@ def cpu_count() -> int: ...
def get_logger() -> Logger: ...
def log_to_stderr(level: Optional[Union[str, int]] = ...) -> Logger: ...
def Manager() -> SyncManager: ...
def set_executable(executable: str) -> None: ...
def set_forkserver_preload(module_names: List[str]) -> None: ...
def get_all_start_methods() -> List[str]: ...
def get_start_method(allow_none: bool = ...) -> Optional[str]: ...

View File

@@ -40,7 +40,7 @@ class BaseContext(object):
) -> synchronize.Barrier: ...
def BoundedSemaphore(self, value: int = ...) -> synchronize.BoundedSemaphore: ...
def Condition(self, lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
def Event(self, lock: Optional[_LockLike] = ...) -> synchronize.Event: ...
def Event(self) -> synchronize.Event: ...
def Lock(self) -> synchronize.Lock: ...
def RLock(self) -> synchronize.RLock: ...
def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ...