From 39c777f70ce47f6d29c47fba4aa4c05d578ab9da Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 21 May 2022 08:49:39 -0700 Subject: [PATCH] pydoc: 3.11 changes (#7910) --- stdlib/pydoc.pyi | 42 ++++++++++++++++++++--------- tests/stubtest_allowlists/py311.txt | 3 --- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 6e5d3e818..6ea4a74a9 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -1,3 +1,4 @@ +import sys from _typeshed import OptExcInfo, SupportsWrite from abc import abstractmethod from builtins import list as _list # "list" conflicts with method name @@ -78,21 +79,36 @@ class HTMLDoc(Doc): repr = _repr_instance.repr escape = _repr_instance.escape def page(self, title: str, contents: str) -> str: ... - def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... - def section( - self, - title: str, - fgcol: str, - bgcol: str, - contents: str, - width: int = ..., - prelude: str = ..., - marginalia: str | None = ..., - gap: str = ..., - ) -> str: ... + if sys.version_info >= (3, 11): + def heading(self, title: str, extras: str = ...) -> str: ... + def section( + self, + title: str, + cls: str, + contents: str, + width: int = ..., + prelude: str = ..., + marginalia: str | None = ..., + gap: str = ..., + ) -> str: ... + def multicolumn(self, list: list[_T], format: Callable[[_T], str]) -> str: ... + else: + def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ... + def section( + self, + title: str, + fgcol: str, + bgcol: str, + contents: str, + width: int = ..., + prelude: str = ..., + marginalia: str | None = ..., + gap: str = ..., + ) -> str: ... + def multicolumn(self, list: list[_T], format: Callable[[_T], str], cols: int = ...) -> str: ... + def bigsection(self, title: str, *args: Any) -> str: ... def preformat(self, text: str) -> str: ... - def multicolumn(self, list: list[_T], format: Callable[[_T], str], cols: int = ...) -> str: ... def grey(self, text: str) -> str: ... def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ... def classlink(self, object: object, modname: str) -> str: ... diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 70c152a21..4b65b6245 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -73,9 +73,6 @@ platform.uname_result.__match_args__ platform.uname_result.__new__ platform.uname_result._fields platform.uname_result.processor -pydoc.HTMLDoc.heading -pydoc.HTMLDoc.multicolumn -pydoc.HTMLDoc.section queue.SimpleQueue.__init__ shutil.rmtree socketserver.UDPServer.allow_reuse_port