massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / pydoc.pyi
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
5
6 # the return type of sys.exc_info(), used by ErrorDuringImport.__init__
7 _Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
8
9 __author__: str
10 __date__: str
11 __version__: str
12 __credits__: str
13
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: ...
28
29 class ErrorDuringImport(Exception):
30     filename: str
31     exc: Type[BaseException] | None
32     value: BaseException | None
33     tb: TracebackType | None
34     def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
35
36 def importfile(path: str) -> ModuleType: ...
37 def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ...
38
39 class Doc:
40     PYTHONDOCS: str
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: ...
50
51 class HTMLRepr(Repr):
52     maxlist: int
53     maxtuple: int
54     maxdict: int
55     maxstring: int
56     maxother: int
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: ...
65
66 class HTMLDoc(Doc):
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: ...
71     def section(
72         self,
73         title: str,
74         fgcol: str,
75         bgcol: str,
76         contents: str,
77         width: int = ...,
78         prelude: str = ...,
79         marginalia: str | None = ...,
80         gap: str = ...,
81     ) -> str: ...
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: ...
90     def markup(
91         self,
92         text: str,
93         escape: Callable[[str], str] | None = ...,
94         funcs: Mapping[str, str] = ...,
95         classes: Mapping[str, str] = ...,
96         methods: Mapping[str, str] = ...,
97     ) -> str: ...
98     def formattree(
99         self, tree: list[tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ...
100     ) -> str: ...
101     def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
102     def docclass(
103         self,
104         object: object,
105         name: str | None = ...,
106         mod: str | None = ...,
107         funcs: Mapping[str, str] = ...,
108         classes: Mapping[str, str] = ...,
109         *ignored: Any,
110     ) -> str: ...
111     def formatvalue(self, object: object) -> str: ...
112     def docroutine(
113         self,
114         object: object,
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 = ...,
121         *ignored: Any,
122     ) -> str: ...
123     def docproperty(
124         self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
125     ) -> str: ...
126     def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ...
127     def docdata(
128         self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
129     ) -> str: ...
130     def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ...
131     def filelink(self, url: str, path: str) -> str: ...
132
133 class TextRepr(Repr):
134     maxlist: int
135     maxtuple: int
136     maxdict: int
137     maxstring: int
138     maxother: int
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: ...
144
145 class TextDoc(Doc):
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: ...
150     def formattree(
151         self, tree: list[tuple[type, Tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ...
152     ) -> 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: ...
156     def docroutine(
157         self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
158     ) -> str: ...
159     def docproperty(
160         self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
161     ) -> str: ...
162     def docdata(
163         self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
164     ) -> str: ...
165     def docother(
166         self,
167         object: object,
168         name: str | None = ...,
169         mod: str | None = ...,
170         parent: str | None = ...,
171         maxlen: int | None = ...,
172         doc: Any | None = ...,
173         *ignored: Any,
174     ) -> str: ...
175
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: ...
185
186 text: TextDoc
187 html: HTMLDoc
188
189 class _OldStyleClass: ...
190
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: ...
196
197 _list = list  # "list" conflicts with method name
198
199 class Helper:
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: ...
204     input: IO[str]
205     output: IO[str]
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: ...
218
219 help: Helper
220
221 # See Python issue #11182: "remove the unused and undocumented pydoc.Scanner class"
222 # class Scanner:
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): ...
229
230 class ModuleScanner:
231     quit: bool
232     def run(
233         self,
234         callback: Callable[[str | None, str, str], None],
235         key: Any | None = ...,
236         completer: Callable[[], None] | None = ...,
237         onerror: Callable[[str], None] | None = ...,
238     ) -> None: ...
239
240 def apropos(key: str) -> None: ...
241 def ispath(x: Any) -> bool: ...
242 def cli() -> None: ...