functools: use protocol for cmp_to_key return type (#4492)

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-08-29 17:25:11 -07:00
committed by GitHub
parent bbd8c96e34
commit 48c922e54a

View File

@@ -9,6 +9,7 @@ from typing import (
Mapping,
NamedTuple,
Optional,
Protocol,
Sequence,
Tuple,
Type,
@@ -57,7 +58,11 @@ def wraps(
wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...
) -> Callable[[_AnyCallable], _AnyCallable]: ...
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
class _SupportsLessThan(Protocol):
def __lt__(self, __other: Any) -> bool: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], _SupportsLessThan]: ...
class partial(Generic[_T]):
func: Callable[..., _T]