Format: application/octet-stream
1 import sys
2 from _typeshed import SupportsWrite
3 from types import MethodType, ModuleType, TracebackType
4 from typing import (
5 IO,
6 Any,
7 AnyStr,
8 Callable,
9 Container,
10 Dict,
11 List,
12 Mapping,
13 MutableMapping,
14 NoReturn,
15 Optional,
16 Text,
17 Tuple,
18 Type,
19 Union,
20 )
21
22 if sys.version_info >= (3,):
23 from reprlib import Repr
24 else:
25 from repr import Repr
26
27 # the return type of sys.exc_info(), used by ErrorDuringImport.__init__
28 _Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
29
30 __author__: str
31 __date__: str
32 __version__: str
33 __credits__: str
34
35 def pathdirs() -> List[str]: ...
36 def getdoc(object: object) -> Text: ...
37 def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
38 def classname(object: object, modname: str) -> str: ...
39 def isdata(object: object) -> bool: ...
40 def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
41 def cram(text: str, maxlen: int) -> str: ...
42 def stripid(text: str) -> str: ...
43 def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
44 def visiblename(name: str, all: Optional[Container[str]] = ..., obj: Optional[object] = ...) -> bool: ...
45 def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ...
46 def ispackage(path: str) -> bool: ...
47 def source_synopsis(file: IO[AnyStr]) -> Optional[AnyStr]: ...
48 def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> Optional[str]: ...
49
50 class ErrorDuringImport(Exception):
51 filename: str
52 exc: Optional[Type[BaseException]]
53 value: Optional[BaseException]
54 tb: Optional[TracebackType]
55 def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
56
57 def importfile(path: str) -> ModuleType: ...
58 def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ...
59
60 class Doc:
61 PYTHONDOCS: str
62 def document(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
63 def fail(self, object: object, name: Optional[str] = ..., *args: Any) -> NoReturn: ...
64 def docmodule(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
65 def docclass(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
66 def docroutine(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
67 def docother(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
68 def docproperty(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
69 def docdata(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
70 def getdocloc(self, object: object, basedir: str = ...) -> Optional[str]: ...
71
72 class HTMLRepr(Repr):
73 maxlist: int
74 maxtuple: int
75 maxdict: int
76 maxstring: int
77 maxother: int
78 def __init__(self) -> None: ...
79 def escape(self, text: str) -> str: ...
80 def repr(self, object: object) -> str: ...
81 def repr1(self, x: object, level: complex) -> str: ...
82 def repr_string(self, x: Text, level: complex) -> str: ...
83 def repr_str(self, x: Text, level: complex) -> str: ...
84 def repr_instance(self, x: object, level: complex) -> str: ...
85 def repr_unicode(self, x: AnyStr, level: complex) -> str: ...
86
87 class HTMLDoc(Doc):
88 repr: Callable[[object], str]
89 escape: Callable[[str], str]
90 def page(self, title: str, contents: str) -> str: ...
91 def heading(self, title: str, fgcol: str, bgcol: str, extras: str = ...) -> str: ...
92 def section(
93 self,
94 title: str,
95 fgcol: str,
96 bgcol: str,
97 contents: str,
98 width: int = ...,
99 prelude: str = ...,
100 marginalia: Optional[str] = ...,
101 gap: str = ...,
102 ) -> str: ...
103 def bigsection(self, title: str, *args: Any) -> str: ...
104 def preformat(self, text: str) -> str: ...
105 def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ...
106 def grey(self, text: str) -> str: ...
107 def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ...
108 def classlink(self, object: object, modname: str) -> str: ...
109 def modulelink(self, object: object) -> str: ...
110 def modpkglink(self, modpkginfo: Tuple[str, str, bool, bool]) -> str: ...
111 def markup(
112 self,
113 text: str,
114 escape: Optional[Callable[[str], str]] = ...,
115 funcs: Mapping[str, str] = ...,
116 classes: Mapping[str, str] = ...,
117 methods: Mapping[str, str] = ...,
118 ) -> str: ...
119 def formattree(
120 self, tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]], modname: str, parent: Optional[type] = ...
121 ) -> str: ...
122 def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored: Any) -> str: ...
123 def docclass(
124 self,
125 object: object,
126 name: Optional[str] = ...,
127 mod: Optional[str] = ...,
128 funcs: Mapping[str, str] = ...,
129 classes: Mapping[str, str] = ...,
130 *ignored: Any,
131 ) -> str: ...
132 def formatvalue(self, object: object) -> str: ...
133 def docroutine(
134 self,
135 object: object,
136 name: Optional[str] = ...,
137 mod: Optional[str] = ...,
138 funcs: Mapping[str, str] = ...,
139 classes: Mapping[str, str] = ...,
140 methods: Mapping[str, str] = ...,
141 cl: Optional[type] = ...,
142 *ignored: Any,
143 ) -> str: ...
144 def docproperty(
145 self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
146 ) -> str: ...
147 def docother(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored: Any) -> str: ...
148 def docdata(
149 self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored: Any
150 ) -> str: ...
151 def index(self, dir: str, shadowed: Optional[MutableMapping[str, bool]] = ...) -> str: ...
152 def filelink(self, url: str, path: str) -> str: ...
153
154 class TextRepr(Repr):
155 maxlist: int
156 maxtuple: int
157 maxdict: int
158 maxstring: int
159 maxother: int
160 def __init__(self) -> None: ...
161 def repr1(self, x: object, level: complex) -> str: ...
162 def repr_string(self, x: str, level: complex) -> str: ...
163 def repr_str(self, x: str, level: complex) -> str: ...
164 def repr_instance(self, x: object, level: complex) -> str: ...
165
166 class TextDoc(Doc):
167 repr: Callable[[object], str]
168 def bold(self, text: str) -> str: ...
169 def indent(self, text: str, prefix: str = ...) -> str: ...
170 def section(self, title: str, contents: str) -> str: ...
171 def formattree(
172 self,
173 tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]],
174 modname: str,
175 parent: Optional[type] = ...,
176 prefix: str = ...,
177 ) -> str: ...
178 def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored: Any) -> str: ...
179 def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored: Any) -> str: ...
180 def formatvalue(self, object: object) -> str: ...
181 def docroutine(
182 self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
183 ) -> str: ...
184 def docproperty(
185 self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored: Any
186 ) -> str: ...
187 def docdata(
188 self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
189 ) -> str: ...
190 def docother(
191 self,
192 object: object,
193 name: Optional[str] = ...,
194 mod: Optional[str] = ...,
195 parent: Optional[str] = ...,
196 maxlen: Optional[int] = ...,
197 doc: Optional[Any] = ...,
198 *ignored: Any,
199 ) -> str: ...
200
201 def pager(text: str) -> None: ...
202 def getpager() -> Callable[[str], None]: ...
203 def plain(text: str) -> str: ...
204 def pipepager(text: str, cmd: str) -> None: ...
205 def tempfilepager(text: str, cmd: str) -> None: ...
206 def ttypager(text: str) -> None: ...
207 def plainpager(text: str) -> None: ...
208 def describe(thing: Any) -> str: ...
209 def locate(path: str, forceload: bool = ...) -> object: ...
210
211 text: TextDoc
212 html: HTMLDoc
213
214 class _OldStyleClass: ...
215
216 def resolve(thing: Union[str, object], forceload: bool = ...) -> Optional[Tuple[object, str]]: ...
217 def render_doc(thing: Union[str, object], title: str = ..., forceload: bool = ..., renderer: Optional[Doc] = ...) -> str: ...
218 def doc(
219 thing: Union[str, object], title: str = ..., forceload: bool = ..., output: Optional[SupportsWrite[str]] = ...
220 ) -> None: ...
221 def writedoc(thing: Union[str, object], forceload: bool = ...) -> None: ...
222 def writedocs(dir: str, pkgpath: str = ..., done: Optional[Any] = ...) -> None: ...
223
224 class Helper:
225 keywords: Dict[str, Union[str, Tuple[str, str]]]
226 symbols: Dict[str, str]
227 topics: Dict[str, Union[str, Tuple[str, ...]]]
228 def __init__(self, input: Optional[IO[str]] = ..., output: Optional[IO[str]] = ...) -> None: ...
229 input: IO[str]
230 output: IO[str]
231 def __call__(self, request: Union[str, Helper, object] = ...) -> None: ...
232 def interact(self) -> None: ...
233 def getline(self, prompt: str) -> str: ...
234 def help(self, request: Any) -> None: ...
235 def intro(self) -> None: ...
236 def list(self, items: List[str], columns: int = ..., width: int = ...) -> None: ...
237 def listkeywords(self) -> None: ...
238 def listsymbols(self) -> None: ...
239 def listtopics(self) -> None: ...
240 def showtopic(self, topic: str, more_xrefs: str = ...) -> None: ...
241 def showsymbol(self, symbol: str) -> None: ...
242 def listmodules(self, key: str = ...) -> None: ...
243
244 help: Helper
245
246 # See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class"
247 # class Scanner:
248 # roots = ... # type: Any
249 # state = ... # type: Any
250 # children = ... # type: Any
251 # descendp = ... # type: Any
252 # def __init__(self, roots, children, descendp) -> None: ...
253 # def next(self): ...
254
255 class ModuleScanner:
256 quit: bool
257 def run(
258 self,
259 callback: Callable[[Optional[str], str, str], None],
260 key: Optional[Any] = ...,
261 completer: Optional[Callable[[], None]] = ...,
262 onerror: Optional[Callable[[str], None]] = ...,
263 ) -> None: ...
264
265 def apropos(key: str) -> None: ...
266 def ispath(x: Any) -> bool: ...
267 def cli() -> None: ...
268
269 if sys.version_info < (3,):
270 def serve(
271 port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...
272 ) -> None: ...
273 def gui() -> None: ...
274