mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
This attribute was removed in https://github.com/python/typeshed/pull/3879 because it is undocumented and was annotated incorrectly. Unfortunately, a surprising (?) amount of Google code uses this attribute and assumes it is a deque, so it needs to exist but can't have a more general annotation like Collection[Any]. I also removed a no-longer-used typing.Deque import.
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# Stubs for queue
|
|
|
|
# NOTE: These are incomplete!
|
|
|
|
from threading import Condition, Lock
|
|
from typing import Any, TypeVar, Generic, Optional
|
|
import sys
|
|
|
|
_T = TypeVar('_T')
|
|
|
|
class Empty(Exception): ...
|
|
class Full(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
|
|
queue: Any # undocumented
|
|
|
|
def __init__(self, maxsize: int = ...) -> None: ...
|
|
def _init(self, maxsize: int) -> None: ...
|
|
def empty(self) -> bool: ...
|
|
def full(self) -> bool: ...
|
|
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
|
|
def get_nowait(self) -> _T: ...
|
|
def _get(self) -> _T: ...
|
|
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> 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: ...
|
|
|
|
class PriorityQueue(Queue[_T]): ...
|
|
class LifoQueue(Queue[_T]): ...
|
|
|
|
if sys.version_info >= (3, 7):
|
|
class SimpleQueue(Generic[_T]):
|
|
def __init__(self) -> None: ...
|
|
def empty(self) -> bool: ...
|
|
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
|
|
def get_nowait(self) -> _T: ...
|
|
def put(self, item: _T, block: bool = ..., timeout: Optional[float] = ...) -> None: ...
|
|
def put_nowait(self, item: _T) -> None: ...
|
|
def qsize(self) -> int: ...
|