--- /dev/null
+# Source: https://github.com/python/cpython/blob/master/Lib/sre_parse.py\r
+\r
+from typing import (\r
+ Any, Dict, FrozenSet, Iterable, List, Match,\r
+ Optional, Pattern as _Pattern, Tuple, Union\r
+)\r
+from sre_constants import _NamedIntConstant as NIC, error as _Error\r
+\r
+SPECIAL_CHARS = ... # type: str\r
+REPEAT_CHARS = ... # type: str\r
+DIGITS = ... # type: FrozenSet[str]\r
+OCTDIGITS = ... # type: FrozenSet[str]\r
+HEXDIGITS = ... # type: FrozenSet[str]\r
+ASCIILETTERS = ... # type: FrozenSet[str]\r
+WHITESPACE = ... # type: FrozenSet[str]\r
+ESCAPES = ... # type: Dict[str, Tuple[NIC, int]]\r
+CATEGORIES = ... # type: Dict[str, Union[Tuple[NIC, NIC], Tuple[NIC, List[Tuple[NIC, NIC]]]]]\r
+FLAGS = ... # type: Dict[str, int]\r
+GLOBAL_FLAGS = ... # type: int\r
+\r
+class Verbose(Exception): ...\r
+\r
+class Pattern:\r
+ flags = ... # type: int\r
+ groupdict = ... # type: Dict[str, int]\r
+ groupwidths = ... # type: List[Optional[int]]\r
+ lookbehindgroups = ... # type: Optional[int]\r
+ def __init__(self) -> None: ...\r
+ @property\r
+ def groups(self) -> int: ...\r
+ def opengroup(self, name: str = ...) -> int: ...\r
+ def closegroup(self, gid: int, p: SubPattern) -> None: ...\r
+ def checkgroup(self, gid: int) -> bool: ...\r
+ def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ...\r
+\r
+\r
+_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]\r
+_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]\r
+_OpInType = List[Tuple[NIC, int]]\r
+_OpBranchType = Tuple[None, List[SubPattern]]\r
+_AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]\r
+_CodeType = Tuple[NIC, _AvType]\r
+\r
+\r
+class SubPattern:\r
+ pattern = ... # type: Pattern\r
+ data = ... # type: List[_CodeType]\r
+ width = ... # type: Optional[int]\r
+ def __init__(self, pattern: Pattern, data: List[_CodeType] = ...) -> None: ...\r
+ def dump(self, level: int = ...) -> None: ...\r
+ def __len__(self) -> int: ...\r
+ def __delitem__(self, index: Union[int, slice]) -> None: ...\r
+ def __getitem__(self, index: Union[int, slice]) -> Union[SubPattern, _CodeType]: ...\r
+ def __setitem__(self, index: Union[int, slice], code: _CodeType) -> None: ...\r
+ def insert(self, index: int, code: _CodeType) -> None: ...\r
+ def append(self, code: _CodeType) -> None: ...\r
+ def getwidth(self) -> int: ...\r
+\r
+\r
+class Tokenizer:\r
+ istext = ... # type: bool\r
+ string = ... # type: Any\r
+ decoded_string = ... # type: str\r
+ index = ... # type: int\r
+ next = ... # type: Optional[str]\r
+ def __init__(self, string: Any) -> None: ...\r
+ def match(self, char: str) -> bool: ...\r
+ def get(self) -> Optional[str]: ...\r
+ def getwhile(self, n: int, charset: Iterable[str]) -> str: ...\r
+ def getuntil(self, terminator: str) -> str: ...\r
+ @property\r
+ def pos(self) -> int: ...\r
+ def tell(self) -> int: ...\r
+ def seek(self, index: int) -> None: ...\r
+ def error(self, msg: str, offset: int = ...) -> _Error: ...\r
+\r
+def fix_flags(src: Union[str, bytes], flag: int) -> int: ...\r
+def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...\r
+_TemplateType = Tuple[List[Tuple[int, int]], List[str]]\r
+def parse_template(source: str, pattern: _Pattern) -> _TemplateType: ...\r
+def expand_template(template: _TemplateType, match: Match) -> str: ...\r