@@ -3,7 +3,7 @@ from collections import deque
3
3
from collections .abc import Iterable
4
4
5
5
# technically it is using _PySimpleQueue, which has the same interface as SimpleQueue
6
- from queue import Empty as Empty , Full as Full , SimpleQueue as SimpleQueue
6
+ from queue import Empty as Empty , Full as Full
7
7
from typing import Any , Generic , Literal , TypeVar , final , overload
8
8
from typing_extensions import Self
9
9
@@ -19,13 +19,14 @@ else:
19
19
20
20
_T = TypeVar ("_T" )
21
21
22
- class Queue (Generic [_T ]):
22
+ class SimpleQueue (Generic [_T ]):
23
23
@property
24
24
def hub (self ) -> Hub : ... # readonly in Cython
25
25
@property
26
26
def queue (self ) -> deque [_T ]: ... # readonly in Cython
27
27
maxsize : int | None
28
28
is_shutdown : bool
29
+
29
30
@overload
30
31
def __init__ (self , maxsize : int | None = None ) -> None : ...
31
32
@overload
@@ -42,26 +43,25 @@ class Queue(Generic[_T]):
42
43
def put (self , item : _T , block : bool = True , timeout : float | None = None ) -> None : ...
43
44
def put_nowait (self , item : _T ) -> None : ...
44
45
def qsize (self ) -> int : ...
45
- def shutdown (self , immediate : bool = False ) -> None : ...
46
46
def __bool__ (self ) -> bool : ...
47
47
def __iter__ (self ) -> Self : ...
48
48
def __len__ (self ) -> int : ...
49
49
def __next__ (self ) -> _T : ...
50
50
next = __next__
51
51
52
52
@final
53
- class UnboundQueue (Queue [_T ]):
53
+ class UnboundQueue (SimpleQueue [_T ]):
54
54
@overload
55
55
def __init__ (self , maxsize : None = None ) -> None : ...
56
56
@overload
57
57
def __init__ (self , maxsize : None , items : Iterable [_T ]) -> None : ...
58
58
@overload
59
59
def __init__ (self , maxsize : None = None , * , items : Iterable [_T ]) -> None : ...
60
60
61
- class PriorityQueue (Queue [_T ]): ...
62
- class LifoQueue (Queue [_T ]): ...
61
+ class PriorityQueue (SimpleQueue [_T ]): ...
62
+ class LifoQueue (SimpleQueue [_T ]): ...
63
63
64
- class JoinableQueue ( Queue [_T ]):
64
+ class Queue ( SimpleQueue [_T ]):
65
65
@property
66
66
def unfinished_tasks (self ) -> int : ... # readonly in Cython
67
67
@overload
@@ -72,6 +72,9 @@ class JoinableQueue(Queue[_T]):
72
72
def __init__ (self , maxsize : int | None = None , * , items : Iterable [_T ], unfinished_tasks : int | None = None ) -> None : ...
73
73
def join (self , timeout : float | None = None ) -> bool : ...
74
74
def task_done (self ) -> None : ...
75
+ def shutdown (self , immediate : bool = False ) -> None : ...
76
+
77
+ JoinableQueue = Queue
75
78
76
79
class Channel (Generic [_T ]):
77
80
@property
0 commit comments