File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
import sys
2
- from typing import Any , Final , TypeVar
3
-
4
- _T = TypeVar ("_T" ) # list items must be comparable
2
+ from _typeshed import SupportsRichComparisonT as _T # All type variable use in this module requires comparability.
3
+ from typing import Final
5
4
6
5
__about__ : Final [str ]
7
6
8
- def heapify (heap : list [Any ], / ) -> None : ... # list items must be comparable
7
+ def heapify (heap : list [_T ], / ) -> None : ...
9
8
def heappop (heap : list [_T ], / ) -> _T : ...
10
9
def heappush (heap : list [_T ], item : _T , / ) -> None : ...
11
10
def heappushpop (heap : list [_T ], item : _T , / ) -> _T : ...
12
11
def heapreplace (heap : list [_T ], item : _T , / ) -> _T : ...
13
12
14
13
if sys .version_info >= (3 , 14 ):
15
- def heapify_max (heap : list [Any ], / ) -> None : ... # list items must be comparable
14
+ def heapify_max (heap : list [_T ], / ) -> None : ...
16
15
def heappop_max (heap : list [_T ], / ) -> _T : ...
17
16
def heappush_max (heap : list [_T ], item : _T , / ) -> None : ...
18
17
def heappushpop_max (heap : list [_T ], item : _T , / ) -> _T : ...
Original file line number Diff line number Diff line change 1
1
import sys
2
+ from _typeshed import SupportsRichComparisonT
2
3
from asyncio .events import AbstractEventLoop
3
4
from types import GenericAlias
4
5
from typing import Any , Generic , TypeVar
@@ -50,5 +51,5 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
50
51
if sys .version_info >= (3 , 13 ):
51
52
def shutdown (self , immediate : bool = False ) -> None : ...
52
53
53
- class PriorityQueue (Queue [_T ]): ...
54
+ class PriorityQueue (Queue [SupportsRichComparisonT ]): ...
54
55
class LifoQueue (Queue [_T ]): ...
Original file line number Diff line number Diff line change 1
1
import sys
2
2
from _queue import Empty as Empty , SimpleQueue as SimpleQueue
3
+ from _typeshed import SupportsRichComparisonT
3
4
from threading import Condition , Lock
4
5
from types import GenericAlias
5
6
from typing import Any , Generic , TypeVar
@@ -47,8 +48,8 @@ class Queue(Generic[_T]):
47
48
def task_done (self ) -> None : ...
48
49
def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
49
50
50
- class PriorityQueue (Queue [_T ]):
51
- queue : list [_T ]
51
+ class PriorityQueue (Queue [SupportsRichComparisonT ]):
52
+ queue : list [SupportsRichComparisonT ]
52
53
53
54
class LifoQueue (Queue [_T ]):
54
55
queue : list [_T ]
You can’t perform that action at this time.
0 commit comments