mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
add rich comparison bound to heapq and priorityqueues using heapq (#14419)
This commit is contained in:
+4
-5
@@ -1,18 +1,17 @@
|
||||
import sys
|
||||
from typing import Any, Final, TypeVar
|
||||
|
||||
_T = TypeVar("_T") # list items must be comparable
|
||||
from _typeshed import SupportsRichComparisonT as _T # All type variable use in this module requires comparability.
|
||||
from typing import Final
|
||||
|
||||
__about__: Final[str]
|
||||
|
||||
def heapify(heap: list[Any], /) -> None: ... # list items must be comparable
|
||||
def heapify(heap: list[_T], /) -> None: ...
|
||||
def heappop(heap: list[_T], /) -> _T: ...
|
||||
def heappush(heap: list[_T], item: _T, /) -> None: ...
|
||||
def heappushpop(heap: list[_T], item: _T, /) -> _T: ...
|
||||
def heapreplace(heap: list[_T], item: _T, /) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def heapify_max(heap: list[Any], /) -> None: ... # list items must be comparable
|
||||
def heapify_max(heap: list[_T], /) -> None: ...
|
||||
def heappop_max(heap: list[_T], /) -> _T: ...
|
||||
def heappush_max(heap: list[_T], item: _T, /) -> None: ...
|
||||
def heappushpop_max(heap: list[_T], item: _T, /) -> _T: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import SupportsRichComparisonT
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar
|
||||
@@ -50,5 +51,5 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
||||
if sys.version_info >= (3, 13):
|
||||
def shutdown(self, immediate: bool = False) -> None: ...
|
||||
|
||||
class PriorityQueue(Queue[_T]): ...
|
||||
class PriorityQueue(Queue[SupportsRichComparisonT]): ...
|
||||
class LifoQueue(Queue[_T]): ...
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from _queue import Empty as Empty, SimpleQueue as SimpleQueue
|
||||
from _typeshed import SupportsRichComparisonT
|
||||
from threading import Condition, Lock
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar
|
||||
@@ -47,8 +48,8 @@ class Queue(Generic[_T]):
|
||||
def task_done(self) -> None: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class PriorityQueue(Queue[_T]):
|
||||
queue: list[_T]
|
||||
class PriorityQueue(Queue[SupportsRichComparisonT]):
|
||||
queue: list[SupportsRichComparisonT]
|
||||
|
||||
class LifoQueue(Queue[_T]):
|
||||
queue: list[_T]
|
||||
|
||||
Reference in New Issue
Block a user