mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-16 02:51:28 +08:00
Require SupportsBool instead of bool for comparisons. (#14375)
This commit is contained in:
1 parent
28f4bdf248
commit
bd17a577a5
2 files changed
+101
-5
No files matched your search
@@ -82,19 +82,21 @@ class SupportsNext(Protocol[_T_co]):
|
||||
class SupportsAnext(Protocol[_T_co]):
|
||||
def __anext__(self) -> Awaitable[_T_co]: ...
|
||||
|
||||
# Comparison protocols
|
||||
class SupportsBool(Protocol):
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
# Comparison protocols
|
||||
class SupportsDunderLT(Protocol[_T_contra]):
|
||||
def __lt__(self, other: _T_contra, /) -> bool: ...
|
||||
def __lt__(self, other: _T_contra, /) -> SupportsBool: ...
|
||||
|
||||
class SupportsDunderGT(Protocol[_T_contra]):
|
||||
def __gt__(self, other: _T_contra, /) -> bool: ...
|
||||
def __gt__(self, other: _T_contra, /) -> SupportsBool: ...
|
||||
|
||||
class SupportsDunderLE(Protocol[_T_contra]):
|
||||
def __le__(self, other: _T_contra, /) -> bool: ...
|
||||
def __le__(self, other: _T_contra, /) -> SupportsBool: ...
|
||||
|
||||
class SupportsDunderGE(Protocol[_T_contra]):
|
||||
def __ge__(self, other: _T_contra, /) -> bool: ...
|
||||
def __ge__(self, other: _T_contra, /) -> SupportsBool: ...
|
||||
|
||||
class SupportsAllComparisons(
|
||||
SupportsDunderLT[Any], SupportsDunderGT[Any], SupportsDunderLE[Any], SupportsDunderGE[Any], Protocol
|
||||
|
||||
Reference in new issue
Block a user