Add py2 stubs for multiprocessing.Queue (#1829)

This is basically the same API as in Python 3.
This commit is contained in:
David Zbarsky
2018-01-17 16:06:15 -08:00
committed by Ivan Levkivskyi
parent 35edccce68
commit 7f3e01550b

View File

@@ -1,11 +1,29 @@
from typing import Optional, TypeVar
from multiprocessing.process import Process as Process, current_process as current_process, active_children as active_children
from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING
from Queue import Queue as _BaseQueue
class ProcessError(Exception): ...
class BufferTooShort(ProcessError): ...
class TimeoutError(ProcessError): ...
class AuthenticationError(ProcessError): ...
_T = TypeVar('_T')
class Queue(_BaseQueue[_T]):
def __init__(self, maxsize: int = ...) -> None: ...
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
def qsize(self) -> int: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def put_nowait(self, item: _T) -> None: ...
def get_nowait(self) -> _T: ...
def close(self) -> None: ...
def join_thread(self) -> None: ...
def cancel_join_thread(self) -> None: ...
def Manager(): ...
def Pipe(duplex=True): ...
def cpu_count() -> int: ...
@@ -19,7 +37,6 @@ def Condition(lock=None): ...
def Semaphore(value=1): ...
def BoundedSemaphore(value=1): ...
def Event(): ...
def Queue(maxsize=0): ...
def JoinableQueue(maxsize=0): ...
def Pool(processes=None, initializer=None, initargs=..., maxtasksperchild=None): ...
def RawValue(typecode_or_type, *args): ...