Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions stdlib/3/multiprocessing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import (
Any, Callable, ContextManager, Iterable, Mapping, Optional, Dict, List,
Union, TypeVar, Sequence, Tuple
Union, Sequence, Tuple
)

from logging import Logger
Expand All @@ -12,11 +12,9 @@ from multiprocessing.context import (
ProcessError, BufferTooShort, TimeoutError, AuthenticationError)
from multiprocessing.managers import SyncManager
from multiprocessing.process import current_process as current_process
import queue
from multiprocessing.queues import Queue, SimpleQueue, JoinableQueue
import sys

_T = TypeVar('_T')

# N.B. The functions below are generated at runtime by partially applying
# multiprocessing.context.BaseContext's methods, so the two signatures should
# be identical (modulo self).
Expand Down Expand Up @@ -62,19 +60,6 @@ class Process():
def is_alive(self) -> bool: ...
def join(self, timeout: Optional[float] = ...) -> None: ...

class Queue(queue.Queue[_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: ...

class Value():
value: Any = ...
def __init__(self, typecode_or_type: str, *args: Any, lock: bool = ...) -> None: ...
Expand Down
10 changes: 4 additions & 6 deletions stdlib/3/multiprocessing/context.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from logging import Logger
import multiprocessing
from multiprocessing import synchronize
from multiprocessing import queues
import sys
from typing import (
Any, Callable, Iterable, Optional, List, Mapping, Sequence, Tuple, Type,
Expand Down Expand Up @@ -51,12 +52,9 @@ class BaseContext(object):
def RLock(self) -> synchronize.RLock: ...
def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ...

# TODO: change return to Queue once a stub exists in multiprocessing.queues
def Queue(self, maxsize: int = ...) -> Any: ...
# TODO: change return to Queue once a stub exists in multiprocessing.queues
def JoinableQueue(self, maxsize: int = ...) -> Any: ...
# TODO: change return to SimpleQueue once a stub exists in multiprocessing.queues
def SimpleQueue(self) -> Any: ...
def Queue(self, maxsize: int = ...) -> queues.Queue: ...
def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue: ...
def SimpleQueue(self) -> queues.SimpleQueue: ...
def Pool(
self,
processes: Optional[int] = ...,
Expand Down
30 changes: 30 additions & 0 deletions stdlib/3/multiprocessing/queues.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from typing import Any, Generic, Optional, TypeVar

import queue

_T = TypeVar('_T')

class Queue(queue.Queue[_T]):
# FIXME: `ctx` is a circular dependency and it's not actually optional.
# It's marked as such to be able to use the generic Queue in __init__.pyi.
def __init__(self, maxsize: int = ..., *, ctx: Any = ...) -> None: ...
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
def put(self, obj: _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: ...

class JoinableQueue(Queue[_T]):
def task_done(self) -> None: ...
def join(self) -> None: ...

class SimpleQueue(Generic[_T]):
def __init__(self, *, ctx: Any = ...) -> None: ...
def empty(self) -> bool: ...
def get(self) -> _T: ...
def put(self, item: _T) -> None: ...