massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / warnings.pyi
1 from _warnings import warn as warn, warn_explicit as warn_explicit
2 from types import ModuleType, TracebackType
3 from typing import Any, Sequence, TextIO, Type, overload
4 from typing_extensions import Literal
5
6 _ActionKind = Literal["default", "error", "ignore", "always", "module", "once"]
7
8 filters: Sequence[tuple[str, str | None, Type[Warning], str | None, int]]  # undocumented, do not mutate
9
10 def showwarning(
11     message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...
12 ) -> None: ...
13 def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ...
14 def filterwarnings(
15     action: _ActionKind,
16     message: str = ...,
17     category: Type[Warning] = ...,
18     module: str = ...,
19     lineno: int = ...,
20     append: bool = ...,
21 ) -> None: ...
22 def simplefilter(action: _ActionKind, category: Type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ...
23 def resetwarnings() -> None: ...
24
25 class _OptionError(Exception): ...
26
27 class WarningMessage:
28     message: Warning | str
29     category: Type[Warning]
30     filename: str
31     lineno: int
32     file: TextIO | None
33     line: str | None
34     source: Any | None
35     def __init__(
36         self,
37         message: Warning | str,
38         category: Type[Warning],
39         filename: str,
40         lineno: int,
41         file: TextIO | None = ...,
42         line: str | None = ...,
43         source: Any | None = ...,
44     ) -> None: ...
45
46 class catch_warnings:
47     @overload
48     def __new__(cls, *, record: Literal[False] = ..., module: ModuleType | None = ...) -> _catch_warnings_without_records: ...
49     @overload
50     def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ...
51     @overload
52     def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ...
53     def __enter__(self) -> list[WarningMessage] | None: ...
54     def __exit__(
55         self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
56     ) -> None: ...
57
58 class _catch_warnings_without_records(catch_warnings):
59     def __enter__(self) -> None: ...
60
61 class _catch_warnings_with_records(catch_warnings):
62     def __enter__(self) -> list[WarningMessage]: ...