massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / sys.pyi
1 import sys
2 from builtins import object as _object
3 from importlib.abc import PathEntryFinder
4 from importlib.machinery import ModuleSpec
5 from io import TextIOWrapper
6 from types import FrameType, ModuleType, TracebackType
7 from typing import (
8     Any,
9     AsyncGenerator,
10     Callable,
11     NoReturn,
12     Optional,
13     Protocol,
14     Sequence,
15     TextIO,
16     Tuple,
17     Type,
18     TypeVar,
19     Union,
20     overload,
21 )
22 from typing_extensions import Literal
23
24 _T = TypeVar("_T")
25
26 # The following type alias are stub-only and do not exist during runtime
27 _ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
28 _OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]]
29
30 # Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
31 class _MetaPathFinder(Protocol):
32     def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ...) -> ModuleSpec | None: ...
33
34 # ----- sys variables -----
35 if sys.platform != "win32":
36     abiflags: str
37 argv: list[str]
38 base_exec_prefix: str
39 base_prefix: str
40 byteorder: Literal["little", "big"]
41 builtin_module_names: Sequence[str]  # actually a tuple of strings
42 copyright: str
43 if sys.platform == "win32":
44     dllhandle: int
45 dont_write_bytecode: bool
46 displayhook: Callable[[object], Any]
47 excepthook: Callable[[Type[BaseException], BaseException, TracebackType | None], Any]
48 exec_prefix: str
49 executable: str
50 float_repr_style: str
51 hexversion: int
52 last_type: Type[BaseException] | None
53 last_value: BaseException | None
54 last_traceback: TracebackType | None
55 maxsize: int
56 maxunicode: int
57 meta_path: list[_MetaPathFinder]
58 modules: dict[str, ModuleType]
59 if sys.version_info >= (3, 10):
60     orig_argv: list[str]
61 path: list[str]
62 path_hooks: list[Any]  # TODO precise type; function, path to finder
63 path_importer_cache: dict[str, PathEntryFinder | None]
64 platform: str
65 if sys.version_info >= (3, 9):
66     platlibdir: str
67 prefix: str
68 if sys.version_info >= (3, 8):
69     pycache_prefix: str | None
70 ps1: object
71 ps2: object
72 stdin: TextIO
73 stdout: TextIO
74 stderr: TextIO
75 if sys.version_info >= (3, 10):
76     stdlib_module_names: frozenset[str]
77 __stdin__: TextIOWrapper
78 __stdout__: TextIOWrapper
79 __stderr__: TextIOWrapper
80 tracebacklimit: int
81 version: str
82 api_version: int
83 warnoptions: Any
84 #  Each entry is a tuple of the form (action, message, category, module,
85 #    lineno)
86 if sys.platform == "win32":
87     winver: str
88 _xoptions: dict[Any, Any]
89
90 flags: _flags
91
92 class _flags:
93     debug: int
94     division_warning: int
95     inspect: int
96     interactive: int
97     optimize: int
98     dont_write_bytecode: int
99     no_user_site: int
100     no_site: int
101     ignore_environment: int
102     verbose: int
103     bytes_warning: int
104     quiet: int
105     hash_randomization: int
106     if sys.version_info >= (3, 7):
107         dev_mode: int
108         utf8_mode: int
109
110 float_info: _float_info
111
112 class _float_info:
113     epsilon: float  # DBL_EPSILON
114     dig: int  # DBL_DIG
115     mant_dig: int  # DBL_MANT_DIG
116     max: float  # DBL_MAX
117     max_exp: int  # DBL_MAX_EXP
118     max_10_exp: int  # DBL_MAX_10_EXP
119     min: float  # DBL_MIN
120     min_exp: int  # DBL_MIN_EXP
121     min_10_exp: int  # DBL_MIN_10_EXP
122     radix: int  # FLT_RADIX
123     rounds: int  # FLT_ROUNDS
124
125 hash_info: _hash_info
126
127 class _hash_info:
128     width: int
129     modulus: int
130     inf: int
131     nan: int
132     imag: int
133
134 implementation: _implementation
135
136 class _implementation:
137     name: str
138     version: _version_info
139     hexversion: int
140     cache_tag: str
141     _multiarch: str
142
143 int_info: _int_info
144
145 class _int_info:
146     bits_per_digit: int
147     sizeof_digit: int
148
149 class _version_info(Tuple[int, int, int, str, int]):
150     major: int
151     minor: int
152     micro: int
153     releaselevel: str
154     serial: int
155
156 version_info: _version_info
157
158 def call_tracing(__func: Callable[..., _T], __args: Any) -> _T: ...
159 def _clear_type_cache() -> None: ...
160 def _current_frames() -> dict[int, FrameType]: ...
161 def _getframe(__depth: int = ...) -> FrameType: ...
162 def _debugmallocstats() -> None: ...
163 def __displayhook__(value: object) -> None: ...
164 def __excepthook__(type_: Type[BaseException], value: BaseException, traceback: TracebackType) -> None: ...
165 def exc_info() -> _OptExcInfo: ...
166
167 # sys.exit() accepts an optional argument of anything printable
168 def exit(__status: object = ...) -> NoReturn: ...
169 def getallocatedblocks() -> int: ...
170 def getdefaultencoding() -> str: ...
171
172 if sys.platform != "win32":
173     def getdlopenflags() -> int: ...
174
175 def getfilesystemencoding() -> str: ...
176 def getfilesystemencodeerrors() -> str: ...
177 def getrefcount(__object: Any) -> int: ...
178 def getrecursionlimit() -> int: ...
179 @overload
180 def getsizeof(obj: object) -> int: ...
181 @overload
182 def getsizeof(obj: object, default: int) -> int: ...
183 def getswitchinterval() -> float: ...
184
185 _ProfileFunc = Callable[[FrameType, str, Any], Any]
186
187 def getprofile() -> _ProfileFunc | None: ...
188 def setprofile(profilefunc: _ProfileFunc | None) -> None: ...
189
190 _TraceFunc = Callable[[FrameType, str, Any], Optional[Callable[[FrameType, str, Any], Any]]]
191
192 def gettrace() -> _TraceFunc | None: ...
193 def settrace(tracefunc: _TraceFunc | None) -> None: ...
194
195 class _WinVersion(Tuple[int, int, int, int, str, int, int, int, int, Tuple[int, int, int]]):
196     major: int
197     minor: int
198     build: int
199     platform: int
200     service_pack: str
201     service_pack_minor: int
202     service_pack_major: int
203     suite_mast: int
204     product_type: int
205     platform_version: tuple[int, int, int]
206
207 if sys.platform == "win32":
208     def getwindowsversion() -> _WinVersion: ...
209
210 def intern(__string: str) -> str: ...
211 def is_finalizing() -> bool: ...
212
213 if sys.version_info >= (3, 7):
214     __breakpointhook__: Any  # contains the original value of breakpointhook
215     def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...
216
217 if sys.platform != "win32":
218     def setdlopenflags(__flags: int) -> None: ...
219
220 def setrecursionlimit(__limit: int) -> None: ...
221 def setswitchinterval(__interval: float) -> None: ...
222 def gettotalrefcount() -> int: ...  # Debug builds only
223
224 if sys.version_info < (3, 9):
225     def getcheckinterval() -> int: ...  # deprecated
226     def setcheckinterval(__n: int) -> None: ...  # deprecated
227
228 if sys.version_info >= (3, 8):
229     # not exported by sys
230     class UnraisableHookArgs:
231         exc_type: Type[BaseException]
232         exc_value: BaseException | None
233         exc_traceback: TracebackType | None
234         err_msg: str | None
235         object: _object | None
236     unraisablehook: Callable[[UnraisableHookArgs], Any]
237     def addaudithook(hook: Callable[[str, Tuple[Any, ...]], Any]) -> None: ...
238     def audit(__event: str, *args: Any) -> None: ...
239
240 _AsyncgenHook = Optional[Callable[[AsyncGenerator[Any, Any]], None]]
241
242 class _asyncgen_hooks(Tuple[_AsyncgenHook, _AsyncgenHook]):
243     firstiter: _AsyncgenHook
244     finalizer: _AsyncgenHook
245
246 def get_asyncgen_hooks() -> _asyncgen_hooks: ...
247 def set_asyncgen_hooks(firstiter: _AsyncgenHook = ..., finalizer: _AsyncgenHook = ...) -> None: ...
248
249 if sys.version_info >= (3, 7):
250     def get_coroutine_origin_tracking_depth() -> int: ...
251     def set_coroutine_origin_tracking_depth(depth: int) -> None: ...