1 from _typeshed import SupportsWrite
2 from reprlib import Repr
3 from types import MethodType, ModuleType, TracebackType
4 from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional, Tuple, Type
6 # the return type of sys.exc_info(), used by ErrorDuringImport.__init__
7 _Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
14 def pathdirs() -> list[str]: ...
15 def getdoc(object: object) -> str: ...
16 def splitdoc(doc: AnyStr) -> tuple[AnyStr, AnyStr]: ...
17 def classname(object: object, modname: str) -> str: ...
18 def isdata(object: object) -> bool: ...
19 def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
20 def cram(text: str, maxlen: int) -> str: ...
21 def stripid(text: str) -> str: ...
22 def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
23 def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ...
24 def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
25 def ispackage(path: str) -> bool: ...
26 def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
27 def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = ...) -> str | None: ...
29 class ErrorDuringImport(Exception):
31 exc: Type[BaseException] | None
32 value: BaseException | None
33 tb: TracebackType | None
34 def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
36 def importfile(path: str) -> ModuleType: ...
37 def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ...
41 def document(self, object: object, name: str | None = ..., *args: Any) -> str: ...
42 def fail(self, object: object, name: str | None = ..., *args: Any) -> NoReturn: ...
43 def docmodule(self, object: object, name: str | None = ..., *args: Any) -> str: ...
44 def docclass(self, object: object, name: str | None = ..., *args: Any) -> str: ...
45 def docroutine(self, object: object, name: str | None = ..., *args: Any) -> str: ...
46 def docother(self, object: object, name: str | None = ..., *args: Any) -> str: ...
47 def docproperty(self, object: object, name: str | None = ..., *args: Any) -> str: ...
48 def docdata(self, object: object, name: str | None = ..., *args: Any) -> str: ...
49 def getdocloc(self, object: object, basedir: str = ...) -> str | None: ...
57 def __init__(self) -> None: ...
58 def escape(self, text: str) -> str: ...
59 def repr(self, object: object) -> str: ...
60 def repr1(self, x: object, level: complex) -> str: ...
61 def repr_string(self, x: str, level: complex) -> str: ...
62 def repr_str(self, x: str, level: complex) -> str: ...
63 def repr_instance(self, x: object, level: complex) -> str: ...
64 def repr_unicode(self, x: AnyStr, level: complex) -> str: ...
67 repr: Callable[[object], str]
68 escape: Callable[[str], str]
69 def page(self, title: str, contents: str) -> str: ...
70 def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ...
79 marginalia: str | None = ...,
82 def bigsection(self, title: str, *args: Any) -> str: ...
83 def preformat(self, text: str) -> str: ...
84 def multicolumn(self, list: list[Any], format: Callable[[Any], str], cols: int = ...) -> str: ...
85 def grey(self, text: str) -> str: ...
86 def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ...
87 def classlink(self, object: object, modname: str) -> str: ...
88 def modulelink(self, object: object) -> str: ...
89 def modpkglink(self, modpkginfo: tuple[str, str, bool, bool]) -> str: ...
93 escape: Callable[[str], str] | None = ...,
94 funcs: Mapping[str, str] = ...,
95 classes: Mapping[str, str] = ...,
96 methods: Mapping[str, str] = ...,
99 self, tree: list[tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ...
101 def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
105 name: str | None = ...,
106 mod: str | None = ...,
107 funcs: Mapping[str, str] = ...,
108 classes: Mapping[str, str] = ...,
111 def formatvalue(self, object: object) -> str: ...
115 name: str | None = ...,
116 mod: str | None = ...,
117 funcs: Mapping[str, str] = ...,
118 classes: Mapping[str, str] = ...,
119 methods: Mapping[str, str] = ...,
120 cl: type | None = ...,
124 self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
126 def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ...
128 self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
130 def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ...
131 def filelink(self, url: str, path: str) -> str: ...
133 class TextRepr(Repr):
139 def __init__(self) -> None: ...
140 def repr1(self, x: object, level: complex) -> str: ...
141 def repr_string(self, x: str, level: complex) -> str: ...
142 def repr_str(self, x: str, level: complex) -> str: ...
143 def repr_instance(self, x: object, level: complex) -> str: ...
146 repr: Callable[[object], str]
147 def bold(self, text: str) -> str: ...
148 def indent(self, text: str, prefix: str = ...) -> str: ...
149 def section(self, title: str, contents: str) -> str: ...
151 self, tree: list[tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ...
153 def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ...
154 def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
155 def formatvalue(self, object: object) -> str: ...
157 self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
160 self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
163 self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
168 name: str | None = ...,
169 mod: str | None = ...,
170 parent: str | None = ...,
171 maxlen: int | None = ...,
172 doc: Any | None = ...,
176 def pager(text: str) -> None: ...
177 def getpager() -> Callable[[str], None]: ...
178 def plain(text: str) -> str: ...
179 def pipepager(text: str, cmd: str) -> None: ...
180 def tempfilepager(text: str, cmd: str) -> None: ...
181 def ttypager(text: str) -> None: ...
182 def plainpager(text: str) -> None: ...
183 def describe(thing: Any) -> str: ...
184 def locate(path: str, forceload: bool = ...) -> object: ...
189 class _OldStyleClass: ...
191 def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ...
192 def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ...
193 def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ...
194 def writedoc(thing: str | object, forceload: bool = ...) -> None: ...
195 def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ...
197 _list = list # "list" conflicts with method name
200 keywords: dict[str, str | tuple[str, str]]
201 symbols: dict[str, str]
202 topics: dict[str, str | Tuple[str, ...]]
203 def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ...
206 def __call__(self, request: str | Helper | object = ...) -> None: ...
207 def interact(self) -> None: ...
208 def getline(self, prompt: str) -> str: ...
209 def help(self, request: Any) -> None: ...
210 def intro(self) -> None: ...
211 def list(self, items: _list[str], columns: int = ..., width: int = ...) -> None: ...
212 def listkeywords(self) -> None: ...
213 def listsymbols(self) -> None: ...
214 def listtopics(self) -> None: ...
215 def showtopic(self, topic: str, more_xrefs: str = ...) -> None: ...
216 def showsymbol(self, symbol: str) -> None: ...
217 def listmodules(self, key: str = ...) -> None: ...
221 # See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class"
223 # roots = ... # type: Any
224 # state = ... # type: Any
225 # children = ... # type: Any
226 # descendp = ... # type: Any
227 # def __init__(self, roots, children, descendp) -> None: ...
228 # def next(self): ...
234 callback: Callable[[str | None, str, str], None],
235 key: Any | None = ...,
236 completer: Callable[[], None] | None = ...,
237 onerror: Callable[[str], None] | None = ...,
240 def apropos(key: str) -> None: ...
241 def ispath(x: Any) -> bool: ...
242 def cli() -> None: ...