Skip to content

Commit 7f3e015

Browse files
dzbarskyilevkivskyi
authored andcommitted
Add py2 stubs for multiprocessing.Queue (#1829)
This is basically the same API as in Python 3.
1 parent 35edccc commit 7f3e015

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

stdlib/2/multiprocessing/__init__.pyi

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1+
from typing import Optional, TypeVar
2+
13
from multiprocessing.process import Process as Process, current_process as current_process, active_children as active_children
24
from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING
5+
from Queue import Queue as _BaseQueue
36

47
class ProcessError(Exception): ...
58
class BufferTooShort(ProcessError): ...
69
class TimeoutError(ProcessError): ...
710
class AuthenticationError(ProcessError): ...
811

12+
_T = TypeVar('_T')
13+
14+
class Queue(_BaseQueue[_T]):
15+
def __init__(self, maxsize: int = ...) -> None: ...
16+
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
17+
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
18+
def qsize(self) -> int: ...
19+
def empty(self) -> bool: ...
20+
def full(self) -> bool: ...
21+
def put_nowait(self, item: _T) -> None: ...
22+
def get_nowait(self) -> _T: ...
23+
def close(self) -> None: ...
24+
def join_thread(self) -> None: ...
25+
def cancel_join_thread(self) -> None: ...
26+
927
def Manager(): ...
1028
def Pipe(duplex=True): ...
1129
def cpu_count() -> int: ...
@@ -19,7 +37,6 @@ def Condition(lock=None): ...
1937
def Semaphore(value=1): ...
2038
def BoundedSemaphore(value=1): ...
2139
def Event(): ...
22-
def Queue(maxsize=0): ...
2340
def JoinableQueue(maxsize=0): ...
2441
def Pool(processes=None, initializer=None, initargs=..., maxtasksperchild=None): ...
2542
def RawValue(typecode_or_type, *args): ...

0 commit comments

Comments
 (0)