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.
1 # Stubs for lib2to3.pytree (Python 3.6)
4 from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union
6 from blib2to3.pgen2.grammar import Grammar
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]
17 def type_repr(type_num: int) -> Text: ...
21 parent: Optional[Node]
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]: ...
36 def next_sibling(self) -> Optional[_NL]: ...
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: ...
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: ...
57 fixers_applied: List[Any]
58 def __init__(self, type: int, value: Text, context: Optional[_Context] = ..., prefix: Optional[Text] = ..., fixers_applied: List[Any] = ...) -> None: ...
60 def convert(gr: Grammar, raw_node: _RawNode) -> _NL: ...
64 content: Optional[Text]
66 def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns
67 def match(self, node: _NL, results: Optional[_Results] = ...) -> bool: ...
68 def match_seq(self, nodes: List[_NL], results: Optional[_Results] = ...) -> bool: ...
69 def generate_matches(self, nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...
71 class LeafPattern(BasePattern):
72 def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...
74 class NodePattern(BasePattern):
76 def __init__(self, type: Optional[int] = ..., content: Optional[Text] = ..., name: Optional[Text] = ...) -> None: ...
78 class WildcardPattern(BasePattern):
81 def __init__(self, content: Optional[Text] = ..., min: int = ..., max: int = ..., name: Optional[Text] = ...) -> None: ...
83 class NegatedPattern(BasePattern):
84 def __init__(self, content: Optional[Text] = ...) -> None: ...
86 def generate_matches(patterns: List[BasePattern], nodes: List[_NL]) -> Iterator[Tuple[int, _Results]]: ...