Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -10,7 +10,7 @@ HEXDIGITS: FrozenSet[str]
ASCIILETTERS: FrozenSet[str]
WHITESPACE: FrozenSet[str]
ESCAPES: Dict[str, Tuple[_NIC, int]]
CATEGORIES: Dict[str, Union[Tuple[_NIC, _NIC], Tuple[_NIC, List[Tuple[_NIC, _NIC]]]]]
CATEGORIES: Dict[str, Tuple[_NIC, _NIC] | Tuple[_NIC, List[Tuple[_NIC, _NIC]]]]
FLAGS: Dict[str, int]
GLOBAL_FLAGS: int
@@ -19,8 +19,8 @@ class Verbose(Exception): ...
class _State:
flags: int
groupdict: Dict[str, int]
groupwidths: List[Optional[int]]
lookbehindgroups: Optional[int]
groupwidths: List[int | None]
lookbehindgroups: int | None
def __init__(self) -> None: ...
@property
def groups(self) -> int: ...
@@ -43,19 +43,19 @@ _CodeType = Tuple[_NIC, _AvType]
class SubPattern:
data: List[_CodeType]
width: Optional[int]
width: int | None
if sys.version_info >= (3, 8):
state: State
def __init__(self, state: State, data: Optional[List[_CodeType]] = ...) -> None: ...
def __init__(self, state: State, data: List[_CodeType] | None = ...) -> None: ...
else:
pattern: Pattern
def __init__(self, pattern: Pattern, data: Optional[List[_CodeType]] = ...) -> None: ...
def __init__(self, pattern: Pattern, data: List[_CodeType] | None = ...) -> None: ...
def dump(self, level: int = ...) -> None: ...
def __len__(self) -> int: ...
def __delitem__(self, index: Union[int, slice]) -> None: ...
def __getitem__(self, index: Union[int, slice]) -> Union[SubPattern, _CodeType]: ...
def __setitem__(self, index: Union[int, slice], code: _CodeType) -> None: ...
def __delitem__(self, index: int | slice) -> None: ...
def __getitem__(self, index: int | slice) -> SubPattern | _CodeType: ...
def __setitem__(self, index: int | slice, code: _CodeType) -> None: ...
def insert(self, index: int, code: _CodeType) -> None: ...
def append(self, code: _CodeType) -> None: ...
def getwidth(self) -> int: ...
@@ -65,10 +65,10 @@ class Tokenizer:
string: Any
decoded_string: str
index: int
next: Optional[str]
next: str | None
def __init__(self, string: Any) -> None: ...
def match(self, char: str) -> bool: ...
def get(self) -> Optional[str]: ...
def get(self) -> str | None: ...
def getwhile(self, n: int, charset: Iterable[str]) -> str: ...
if sys.version_info >= (3, 8):
def getuntil(self, terminator: str, name: str) -> str: ...
@@ -80,19 +80,19 @@ class Tokenizer:
def seek(self, index: int) -> None: ...
def error(self, msg: str, offset: int = ...) -> _Error: ...
def fix_flags(src: Union[str, bytes], flags: int) -> int: ...
def fix_flags(src: str | bytes, flags: int) -> int: ...
_TemplateType = Tuple[List[Tuple[int, int]], List[Optional[str]]]
_TemplateByteType = Tuple[List[Tuple[int, int]], List[Optional[bytes]]]
if sys.version_info >= (3, 8):
def parse(str: str, flags: int = ..., state: Optional[State] = ...) -> SubPattern: ...
def parse(str: str, flags: int = ..., state: State | None = ...) -> SubPattern: ...
@overload
def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ...
@overload
def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ...
else:
def parse(str: str, flags: int = ..., pattern: Optional[Pattern] = ...) -> SubPattern: ...
def parse(str: str, flags: int = ..., pattern: Pattern | None = ...) -> SubPattern: ...
@overload
def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ...
@overload