mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 22:56:55 +08:00
Improve BinOp comparison funcs in operator (#6462)
This commit is contained in:
@@ -14,6 +14,7 @@ from typing import (
|
||||
SupportsAbs,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import ParamSpec, SupportsIndex, final
|
||||
@@ -34,12 +35,27 @@ class _SupportsNeg(Protocol[_T_co]):
|
||||
class _SupportsPos(Protocol[_T_co]):
|
||||
def __pos__(self) -> _T_co: ...
|
||||
|
||||
def lt(__a: Any, __b: Any) -> Any: ...
|
||||
def le(__a: Any, __b: Any) -> Any: ...
|
||||
# Different to _typeshed.SupportsLessThan
|
||||
class _SupportsLT(Protocol):
|
||||
def __lt__(self, other: Any) -> Any: ...
|
||||
|
||||
class _SupportsGT(Protocol):
|
||||
def __gt__(self, other: Any) -> Any: ...
|
||||
|
||||
class _SupportsLE(Protocol):
|
||||
def __le__(self, other: Any) -> Any: ...
|
||||
|
||||
class _SupportsGE(Protocol):
|
||||
def __ge__(self, other: Any) -> Any: ...
|
||||
|
||||
_SupportsComparison = Union[_SupportsLE, _SupportsGE, _SupportsGT, _SupportsLT]
|
||||
|
||||
def lt(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ...
|
||||
def le(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ...
|
||||
def eq(__a: object, __b: object) -> Any: ...
|
||||
def ne(__a: object, __b: object) -> Any: ...
|
||||
def ge(__a: Any, __b: Any) -> Any: ...
|
||||
def gt(__a: Any, __b: Any) -> Any: ...
|
||||
def ge(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ...
|
||||
def gt(__a: _SupportsComparison, __b: _SupportsComparison) -> Any: ...
|
||||
def not_(__a: object) -> bool: ...
|
||||
def truth(__a: object) -> bool: ...
|
||||
def is_(__a: object, __b: object) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user