]> git.madduck.net Git - etc/vim.git/blob - blib2to3/pytree.pyi

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

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