mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
_typeshed: add SupportsLessThan, SupportsLessThanT (#4711)
And use it everywhere. Note there seemed to be a discrepancy between heapq in Python 2 and 3, so I changed that. It should probably be more widely used within heapq, but leaving that out of scope for this PR. Co-authored-by: hauntsaninja <>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
import array
|
||||
import mmap
|
||||
import sys
|
||||
from typing import AbstractSet, Container, Iterable, Protocol, Text, Tuple, TypeVar, Union
|
||||
from typing import AbstractSet, Any, Container, Iterable, Protocol, Text, Tuple, TypeVar, Union
|
||||
from typing_extensions import Literal, final
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -26,6 +26,11 @@ _VT_co = TypeVar("_VT_co", covariant=True)
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_T_contra = TypeVar("_T_contra", contravariant=True)
|
||||
|
||||
class SupportsLessThan(Protocol):
|
||||
def __lt__(self, __other: Any) -> bool: ...
|
||||
|
||||
SupportsLessThanT = TypeVar("SupportsLessThanT", bound=SupportsLessThan) # noqa: Y001
|
||||
|
||||
# Mapping-like protocols
|
||||
|
||||
class SupportsItems(Protocol[_KT_co, _VT_co]):
|
||||
|
||||
Reference in New Issue
Block a user