1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
import sys
from _queue import Empty as Empty, SimpleQueue as SimpleQueue
from threading import Condition, Lock
from typing import Any, Generic, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = ["Empty", "Full", "Queue", "PriorityQueue", "LifoQueue", "SimpleQueue"]
if sys.version_info >= (3, 13):
__all__ += ["ShutDown"]
_T = TypeVar("_T")
class Full(Exception): ...
if sys.version_info >= (3, 13):
class ShutDown(Exception): ...
class Queue(Generic[_T]):
maxsize: int
mutex: Lock # undocumented
not_empty: Condition # undocumented
not_full: Condition # undocumented
all_tasks_done: Condition # undocumented
unfinished_tasks: int # undocumented
if sys.version_info >= (3, 13):
is_shutdown: bool # undocumented
# Despite the fact that `queue` has `deque` type,
# we treat it as `Any` to allow different implementations in subtypes.
queue: Any # undocumented
def __init__(self, maxsize: int = 0) -> None: ...
def _init(self, maxsize: int) -> None: ...
def empty(self) -> bool: ...
def full(self) -> bool: ...
def get(self, block: bool = True, timeout: float | None = None) -> _T: ...
def get_nowait(self) -> _T: ...
if sys.version_info >= (3, 13):
def shutdown(self, immediate: bool = False) -> None: ...
def _get(self) -> _T: ...
def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ...
def put_nowait(self, item: _T) -> None: ...
def _put(self, item: _T) -> None: ...
def join(self) -> None: ...
def qsize(self) -> int: ...
def _qsize(self) -> int: ...
def task_done(self) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
class PriorityQueue(Queue[_T]):
queue: list[_T]
class LifoQueue(Queue[_T]):
queue: list[_T]
|