mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add SupportsRichComparison type to _typeshed (#6583)
Use it to improve types of `max()` and other functions. Also make some other tweaks to types related to comparison dunders. Fixes #6575
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from _typeshed import SupportsLessThan
|
||||
from _typeshed import SupportsRichComparison
|
||||
from typing import Any, Callable, Iterable, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -9,6 +9,6 @@ def heappushpop(__heap: list[_T], __item: _T) -> _T: ...
|
||||
def heapify(__heap: list[Any]) -> None: ...
|
||||
def heapreplace(__heap: list[_T], __item: _T) -> _T: ...
|
||||
def merge(*iterables: Iterable[_T], key: Callable[[_T], Any] | None = ..., reverse: bool = ...) -> Iterable[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsLessThan] | None = ...) -> list[_T]: ...
|
||||
def nlargest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsRichComparison] | None = ...) -> list[_T]: ...
|
||||
def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsRichComparison] | None = ...) -> list[_T]: ...
|
||||
def _heapify_max(__x: list[Any]) -> None: ... # undocumented
|
||||
|
||||
Reference in New Issue
Block a user