massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / lib2to3 / refactor.pyi
1 from collections.abc import Container, Generator, Iterable, Mapping
2 from logging import Logger
3 from typing import Any, ClassVar, NoReturn
4
5 from .pgen2.grammar import Grammar
6
7 _Driver = Any  # really lib2to3.driver.Driver
8 _BottomMatcher = Any  # really lib2to3.btm_matcher.BottomMatcher
9
10 def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = ...) -> list[str]: ...
11 def get_fixers_from_package(pkg_name: str) -> list[str]: ...
12
13 class FixerError(Exception): ...
14
15 class RefactoringTool:
16     CLASS_PREFIX: ClassVar[str]
17     FILE_PREFIX: ClassVar[str]
18     fixers: Iterable[str]
19     explicit: Container[str]
20     options: dict[str, Any]
21     grammar: Grammar
22     write_unchanged_files: bool
23     errors: list[Any]
24     logger: Logger
25     fixer_log: list[Any]
26     wrote: bool
27     driver: _Driver
28     pre_order: Any
29     post_order: Any
30     files: list[Any]
31     BM: _BottomMatcher
32     bmi_pre_order: list[Any]
33     bmi_post_order: list[Any]
34     def __init__(
35         self, fixer_names: Iterable[str], options: Mapping[str, Any] | None = ..., explicit: Container[str] | None = ...
36     ) -> None: ...
37     def get_fixers(self) -> tuple[list[Any], list[Any]]: ...
38     def log_error(self, msg: str, *args: Any, **kwds: Any) -> NoReturn: ...
39     def log_message(self, msg: str, *args: Any) -> None: ...
40     def log_debug(self, msg: str, *args: Any) -> None: ...
41     def print_output(self, old_text: str, new_text: str, filename: str, equal): ...
42     def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ...) -> None: ...
43     def refactor_dir(self, dir_name: str, write: bool = ..., doctests_only: bool = ...) -> None: ...
44     def _read_python_source(self, filename: str) -> tuple[str, str]: ...
45     def refactor_file(self, filename: str, write: bool = ..., doctests_only: bool = ...) -> None: ...
46     def refactor_string(self, data: str, name: str): ...
47     def refactor_stdin(self, doctests_only: bool = ...) -> None: ...
48     def refactor_tree(self, tree, name: str) -> bool: ...
49     def traverse_by(self, fixers, traversal) -> None: ...
50     def processed_file(
51         self, new_text: str, filename: str, old_text: str | None = ..., write: bool = ..., encoding: str | None = ...
52     ) -> None: ...
53     def write_file(self, new_text: str, filename: str, old_text: str, encoding: str | None = ...) -> None: ...
54     PS1: ClassVar[str]
55     PS2: ClassVar[str]
56     def refactor_docstring(self, input: str, filename: str) -> str: ...
57     def refactor_doctest(self, block: list[str], lineno: int, indent: int, filename: str) -> list[str]: ...
58     def summarize(self) -> None: ...
59     def parse_block(self, block: Iterable[str], lineno: int, indent: int): ...
60     def wrap_toks(
61         self, block: Iterable[str], lineno: int, indent: int
62     ) -> Generator[tuple[Any, Any, tuple[int, int], tuple[int, int], str], None, None]: ...
63     def gen_lines(self, block: Iterable[str], indent: int) -> Generator[str, None, None]: ...
64
65 class MultiprocessingUnsupported(Exception): ...
66
67 class MultiprocessRefactoringTool(RefactoringTool):
68     queue: Any | None
69     output_lock: Any | None
70     def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ..., num_processes: int = ...) -> None: ...