|
1 | 1 | # Stubs for multiprocessing
|
2 | 2 |
|
3 |
| -from typing import Any, Callable, Iterable, Mapping, Optional, Dict, List, Union |
| 3 | +from typing import Any, Callable, Iterable, Mapping, Optional, Dict, List, Union, TypeVar |
4 | 4 |
|
5 | 5 | from logging import Logger
|
6 | 6 | from multiprocessing.context import BaseContext
|
7 | 7 | from multiprocessing.managers import SyncManager
|
8 | 8 | from multiprocessing.pool import AsyncResult
|
9 | 9 | from multiprocessing.process import current_process as current_process
|
10 | 10 | import sys
|
| 11 | +import queue |
| 12 | + |
| 13 | +_T = TypeVar('_T') |
11 | 14 |
|
12 | 15 | class Lock():
|
13 | 16 | def acquire(self, block: bool = ..., timeout: int = ...) -> None: ...
|
@@ -93,15 +96,15 @@ class Process():
|
93 | 96 | def is_alive(self) -> bool: ...
|
94 | 97 | def join(self, timeout: Optional[float] = ...) -> None: ...
|
95 | 98 |
|
96 |
| -class Queue(): |
| 99 | +class Queue(queue.Queue[_T]): |
97 | 100 | def __init__(self, maxsize: int = ...) -> None: ...
|
98 |
| - def get(self, block: bool = ..., timeout: float = ...) -> Any: ... |
99 |
| - def put(self, item: Any, block: bool = ..., timeout: float = ...) -> None: ... |
| 101 | + def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ... |
| 102 | + def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ... |
100 | 103 | def qsize(self) -> int: ...
|
101 | 104 | def empty(self) -> bool: ...
|
102 | 105 | def full(self) -> bool: ...
|
103 |
| - def put_nowait(self, item: Any) -> None: ... |
104 |
| - def get_nowait(self) -> Any: ... |
| 106 | + def put_nowait(self, item: _T) -> None: ... |
| 107 | + def get_nowait(self) -> _T: ... |
105 | 108 | def close(self) -> None: ...
|
106 | 109 | def join_thread(self) -> None: ...
|
107 | 110 | def cancel_join_thread(self) -> None: ...
|
|
0 commit comments