massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 2and3 / lib2to3 / pytree.pyi
1 # Stubs for lib2to3.pytree (Python 3.6)\r
2 \r
3 import sys\r
4 from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union\r
5 \r
6 from lib2to3.pgen2.grammar import Grammar\r
7 \r
8 _P = TypeVar('_P')\r
9 _NL = Union[Node, Leaf]\r
10 _Context = Tuple[Text, int, int]\r
11 _Results = Dict[Text, _NL]\r
12 _RawNode = Tuple[int, Text, _Context, Optional[List[_NL]]]\r
13 _Convert = Callable[[Grammar, _RawNode], Any]\r
14 \r
15 HUGE: int\r
16 \r
17 def type_repr(type_num: int) -> Text: ...\r
18 \r
19 class Base:\r
20     type: int\r
21     parent: Optional[Node]\r
22     prefix: Text\r
23     children: List[_NL]\r
24     was_changed: bool\r
25     was_checked: bool\r
26     def __eq__(self, other: Any) -> bool: ...\r
27     def _eq(self: _P, other: _P) -> bool: ...\r
28     def clone(self: _P) -> _P: ...\r
29     def post_order(self) -> Iterator[_NL]: ...\r
30     def pre_order(self) -> Iterator[_NL]: ...\r
31     def replace(self, new: Union[_NL, List[_NL]]) -> None: ...\r
32     def get_lineno(self) -> int: ...\r
33     def changed(self) -> None: ...\r
34     def remove(self) -> Optional[int]: ...\r
35     @property\r
36     def next_sibling(self) -> Optional[_NL]: ...\r
37     @property\r
38     def prev_sibling(self) -> Optional[_NL]: ...\r
39     def leaves(self) -> Iterator[Leaf]: ...\r
40     def depth(self) -> int: ...\r
41     def get_suffix(self) -> Text: ...\r
42     if sys.version_info < (3,):\r
43         def get_prefix(self) -> Text: ...\r
44         def set_prefix(self, prefix: Text) -> None: ...\r
45 \r
46 class Node(Base):\r
47     fixers_applied: List[Any]\r
48     def __init__(self, type: int, children: List[_NL], context: Optional[Any] = ..., prefix: Optional[Text] = ..., fixers_applied: Optional[List[Any]] = ...) -> None: ...\r
49     def set_child(self, i: int, child: _NL) -> None: ...\r
50     def insert_child(self, i: int, child: _NL) -> None: ...\r
51     def append_child(self, child: _NL) -> None: ...\r
52 \r
53 class Leaf(Base):\r
54     lineno: int\r
55     column: int\r
56     value: Text\r
57     fixers_applied: List[Any]\r
58     def __init__(self, type: int, value: Text, context: Optional[_Context] = ..., prefix: Optional[Text] = ..., fixers_applied: List[Any] = ...) -> None: ...\r
59 \r
60 def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ...\r
61 \r
62 class BasePattern:\r
63     type: int\r
64     content: Optional[Text]\r
65     name: Optional[Text]\r
66     def optimize(self) -> BasePattern: ...  # sic, subclasses are free to optimize themselves into different patterns\r
67     def match(self, node: _NL, results: Optional[_Results] = ...) -> bool: ...\r
68     def match_seq(self, nodes: List[_NL], results: Optional[_Results] = ...) -> bool: ...\r
69     def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...\r
70 \r
71 class LeafPattern(BasePattern):\r
72     def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...\r
73 \r
74 class NodePattern(BasePattern):\r
75     wildcards: bool\r
76     def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...\r
77 \r
78 class WildcardPattern(BasePattern):\r
79     min: int\r
80     max: int\r
81     def __init__(self, content: Optional[Text] = ..., min: int = ..., max: int = ..., name: Optional[Text] = ...) -> None: ...\r
82 \r
83 class NegatedPattern(BasePattern):\r
84     def __init__(self, content: Optional[Text] = ...) -> None: ...\r
85 \r
86 def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...\r