massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / sre_parse.pyi
1 import sys
2 from sre_constants import _NamedIntConstant as _NIC, error as _Error
3 from typing import Any, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload
4
5 SPECIAL_CHARS: str
6 REPEAT_CHARS: str
7 DIGITS: frozenset[str]
8 OCTDIGITS: frozenset[str]
9 HEXDIGITS: frozenset[str]
10 ASCIILETTERS: frozenset[str]
11 WHITESPACE: frozenset[str]
12 ESCAPES: dict[str, tuple[_NIC, int]]
13 CATEGORIES: dict[str, tuple[_NIC, _NIC] | tuple[_NIC, list[tuple[_NIC, _NIC]]]]
14 FLAGS: dict[str, int]
15 GLOBAL_FLAGS: int
16
17 class Verbose(Exception): ...
18
19 class _State:
20     flags: int
21     groupdict: dict[str, int]
22     groupwidths: list[int | None]
23     lookbehindgroups: int | None
24     def __init__(self) -> None: ...
25     @property
26     def groups(self) -> int: ...
27     def opengroup(self, name: str = ...) -> int: ...
28     def closegroup(self, gid: int, p: SubPattern) -> None: ...
29     def checkgroup(self, gid: int) -> bool: ...
30     def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ...
31
32 if sys.version_info >= (3, 8):
33     State = _State
34 else:
35     Pattern = _State
36
37 _OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]
38 _OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]
39 _OpInType = List[Tuple[_NIC, int]]
40 _OpBranchType = Tuple[None, List[SubPattern]]
41 _AvType = Union[_OpInType, _OpBranchType, Iterable[SubPattern], _OpGroupRefExistsType, _OpSubpatternType]
42 _CodeType = Tuple[_NIC, _AvType]
43
44 class SubPattern:
45     data: list[_CodeType]
46     width: int | None
47
48     if sys.version_info >= (3, 8):
49         state: State
50         def __init__(self, state: State, data: list[_CodeType] | None = ...) -> None: ...
51     else:
52         pattern: Pattern
53         def __init__(self, pattern: Pattern, data: list[_CodeType] | None = ...) -> None: ...
54     def dump(self, level: int = ...) -> None: ...
55     def __len__(self) -> int: ...
56     def __delitem__(self, index: int | slice) -> None: ...
57     def __getitem__(self, index: int | slice) -> SubPattern | _CodeType: ...
58     def __setitem__(self, index: int | slice, code: _CodeType) -> None: ...
59     def insert(self, index: int, code: _CodeType) -> None: ...
60     def append(self, code: _CodeType) -> None: ...
61     def getwidth(self) -> int: ...
62
63 class Tokenizer:
64     istext: bool
65     string: Any
66     decoded_string: str
67     index: int
68     next: str | None
69     def __init__(self, string: Any) -> None: ...
70     def match(self, char: str) -> bool: ...
71     def get(self) -> str | None: ...
72     def getwhile(self, n: int, charset: Iterable[str]) -> str: ...
73     if sys.version_info >= (3, 8):
74         def getuntil(self, terminator: str, name: str) -> str: ...
75     else:
76         def getuntil(self, terminator: str) -> str: ...
77     @property
78     def pos(self) -> int: ...
79     def tell(self) -> int: ...
80     def seek(self, index: int) -> None: ...
81     def error(self, msg: str, offset: int = ...) -> _Error: ...
82
83 def fix_flags(src: str | bytes, flags: int) -> int: ...
84
85 _TemplateType = Tuple[List[Tuple[int, int]], List[Optional[str]]]
86 _TemplateByteType = Tuple[List[Tuple[int, int]], List[Optional[bytes]]]
87 if sys.version_info >= (3, 8):
88     def parse(str: str, flags: int = ..., state: State | None = ...) -> SubPattern: ...
89     @overload
90     def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ...
91     @overload
92     def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ...
93
94 else:
95     def parse(str: str, flags: int = ..., pattern: Pattern | None = ...) -> SubPattern: ...
96     @overload
97     def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ...
98     @overload
99     def parse_template(source: bytes, pattern: _Pattern[Any]) -> _TemplateByteType: ...
100
101 def expand_template(template: _TemplateType, match: Match[Any]) -> str: ...