From 690864c86f5313e551a2810615689e67412e545e Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Sun, 20 Feb 2022 02:04:44 -0800 Subject: [PATCH] heapq: re-export, add __about__ (#7308) --- pyproject.toml | 1 + stdlib/_heapq.pyi | 2 ++ stdlib/heapq.pyi | 16 +++++++--------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a8e04873a..9ac47a2af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ extra_standard_library = [ "_compression", "_csv", "_curses", + "_heapq", "_markupbase", "_random", "_tkinter", diff --git a/stdlib/_heapq.pyi b/stdlib/_heapq.pyi index 87e0fe0fa..90dc28deb 100644 --- a/stdlib/_heapq.pyi +++ b/stdlib/_heapq.pyi @@ -2,6 +2,8 @@ from typing import Any, TypeVar _T = TypeVar("_T") +__about__: str + def heapify(__heap: list[Any]) -> None: ... def heappop(__heap: list[_T]) -> _T: ... def heappush(__heap: list[_T], __item: _T) -> None: ... diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index fd3c2db8a..cf2faf7bf 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -1,14 +1,12 @@ +from _heapq import * from _typeshed import SupportsRichComparison from typing import Any, Callable, Iterable, TypeVar -_T = TypeVar("_T") +_S = TypeVar("_S") -def heappush(__heap: list[_T], __item: _T) -> None: ... -def heappop(__heap: list[_T]) -> _T: ... -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], SupportsRichComparison] | None = ...) -> list[_T]: ... -def nsmallest(n: int, iterable: Iterable[_T], key: Callable[[_T], SupportsRichComparison] | None = ...) -> list[_T]: ... +__about__: str + +def merge(*iterables: Iterable[_S], key: Callable[[_S], Any] | None = ..., reverse: bool = ...) -> Iterable[_S]: ... +def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... +def nsmallest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... def _heapify_max(__x: list[Any]) -> None: ... # undocumented