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