1 # Source: https://hg.python.org/cpython/file/2.7/Lib/sre_parse.py
\r
3 from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Pattern, Set, Tuple, Union
\r
5 SPECIAL_CHARS = ... # type: str
\r
6 REPEAT_CHARS = ... # type: str
\r
7 DIGITS = ... # type: Set
\r
8 OCTDIGITS = ... # type: Set
\r
9 HEXDIGITS = ... # type: Set
\r
10 WHITESPACE = ... # type: Set
\r
11 ESCAPES = ... # type: Dict[str, Tuple[str, int]]
\r
12 CATEGORIES = ... # type: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]
\r
13 FLAGS = ... # type: Dict[str, int]
\r
16 flags = ... # type: int
\r
17 open = ... # type: List[int]
\r
18 groups = ... # type: int
\r
19 groupdict = ... # type: Dict[str, int]
\r
20 lookbehind = ... # type: int
\r
21 def __init__(self) -> None: ...
\r
22 def opengroup(self, name: str = ...) -> int: ...
\r
23 def closegroup(self, gid: int) -> None: ...
\r
24 def checkgroup(self, gid: int) -> bool: ...
\r
27 _OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]
\r
28 _OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]
\r
29 _OpInType = List[Tuple[str, int]]
\r
30 _OpBranchType = Tuple[None, List[SubPattern]]
\r
31 _AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]
\r
32 _CodeType = Union[str, _AvType]
\r
35 pattern = ... # type: str
\r
36 data = ... # type: List[_CodeType]
\r
37 width = ... # type: Optional[int]
\r
38 def __init__(self, pattern, data: List[_CodeType] = ...) -> None: ...
\r
39 def dump(self, level: int = ...) -> None: ...
\r
40 def __len__(self) -> int: ...
\r
41 def __delitem__(self, index: Union[int, slice]) -> None: ...
\r
42 def __getitem__(self, index: Union[int, slice]) -> Union[SubPattern, _CodeType]: ...
\r
43 def __setitem__(self, index: Union[int, slice], code: _CodeType): ...
\r
44 def insert(self, index, code: _CodeType) -> None: ...
\r
45 def append(self, code: _CodeType) -> None: ...
\r
46 def getwidth(self) -> int: ...
\r
49 string = ... # type: str
\r
50 index = ... # type: int
\r
51 def __init__(self, string: str) -> None: ...
\r
52 def match(self, char: str, skip: int = ...) -> int: ...
\r
53 def get(self) -> Optional[str]: ...
\r
54 def tell(self) -> Tuple[int, Optional[str]]: ...
\r
55 def seek(self, index: int) -> None: ...
\r
57 def isident(char: str) -> bool: ...
\r
58 def isdigit(char: str) -> bool: ...
\r
59 def isname(name: str) -> bool: ...
\r
60 def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
\r
61 _Template = Tuple[List[Tuple[int, int]], List[Optional[int]]]
\r
62 def parse_template(source: str, pattern: _Pattern) -> _Template: ...
\r
63 def expand_template(template: _Template, match: Match) -> str: ...
\r