|
2 | 2 |
|
3 | 3 | import sys
|
4 | 4 | from sre_constants import _NamedIntConstant as _NIC, error as _Error
|
5 |
| -from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union |
| 5 | +from typing import Any, Dict, FrozenSet, Iterable, List, Match, Optional, Pattern as _Pattern, Tuple, Union, overload |
6 | 6 |
|
7 | 7 | SPECIAL_CHARS: str
|
8 | 8 | REPEAT_CHARS: str
|
@@ -85,13 +85,20 @@ class Tokenizer:
|
85 | 85 |
|
86 | 86 | def fix_flags(src: Union[str, bytes], flags: int) -> int: ...
|
87 | 87 |
|
88 |
| -_TemplateType = Tuple[List[Tuple[int, int]], List[str]] |
| 88 | +_TemplateType = Tuple[List[Tuple[int, int]], List[Optional[str]]] |
| 89 | +_TemplateByteType = Tuple[List[Tuple[int, int]], List[Optional[bytes]]] |
89 | 90 | if sys.version_info >= (3, 8):
|
90 | 91 | def parse(str: str, flags: int = ..., state: Optional[State] = ...) -> SubPattern: ...
|
| 92 | + @overload |
91 | 93 | def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ...
|
| 94 | + @overload |
| 95 | + def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ... |
92 | 96 |
|
93 | 97 | else:
|
94 | 98 | def parse(str: str, flags: int = ..., pattern: Optional[Pattern] = ...) -> SubPattern: ...
|
| 99 | + @overload |
95 | 100 | def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ...
|
| 101 | + @overload |
| 102 | + def parse_template(source: bytes, pattern: _Pattern[Any]) -> _TemplateByteType: ... |
96 | 103 |
|
97 | 104 | def expand_template(template: _TemplateType, match: Match[Any]) -> str: ...
|
0 commit comments