11from collections .abc import MutableSequence , Sequence
2- from typing import Any , Final , TypeVar
2+ from typing import Any , Final , Literal , Protocol , TypeVar , type_check_only
33from typing_extensions import TypeAlias
44
5+ @type_check_only
6+ class _SupportsDunderLT (Protocol ):
7+ def __lt__ (self , other : Any , / ) -> bool : ...
8+
9+ @type_check_only
10+ class _SupportsDunderGT (Protocol ):
11+ def __gt__ (self , other : Any , / ) -> bool : ...
12+
13+ @type_check_only
14+ class _SupportsDunderLE (Protocol ):
15+ def __le__ (self , other : Any , / ) -> bool : ...
16+
17+ @type_check_only
18+ class _SupportsDunderGE (Protocol ):
19+ def __ge__ (self , other : Any , / ) -> bool : ...
20+
521_T = TypeVar ("_T" )
622_Mismatch : TypeAlias = tuple [_T , _T , int ]
23+ _SupportsComparison : TypeAlias = _SupportsDunderLE | _SupportsDunderGE | _SupportsDunderGT | _SupportsDunderLT
724
825_MAX_LENGTH : Final = 80
926_PLACEHOLDER_LEN : Final = 12
@@ -18,6 +35,6 @@ def safe_repr(obj: object, short: bool = False) -> str: ...
1835def strclass (cls : type ) -> str : ...
1936def sorted_list_difference (expected : Sequence [_T ], actual : Sequence [_T ]) -> tuple [list [_T ], list [_T ]]: ...
2037def unorderable_list_difference (expected : MutableSequence [_T ], actual : MutableSequence [_T ]) -> tuple [list [_T ], list [_T ]]: ...
21- def three_way_cmp (x : Any , y : Any ) -> int : ...
38+ def three_way_cmp (x : _SupportsComparison , y : _SupportsComparison ) -> Literal [ - 1 , 0 , 1 ] : ...
2239def _count_diff_all_purpose (actual : Sequence [_T ], expected : Sequence [_T ]) -> list [_Mismatch [_T ]]: ...
2340def _count_diff_hashable (actual : Sequence [_T ], expected : Sequence [_T ]) -> list [_Mismatch [_T ]]: ...
0 commit comments