Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)

This commit is contained in:
Alex Waygood
2022-01-18 15:14:03 +00:00
committed by GitHub
parent aa885ecd65
commit 8af5e0d340
264 changed files with 2217 additions and 2411 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, AnyStr, Callable, Iterator, List, Match, Pattern, Tuple, overload
from typing import Any, AnyStr, Callable, Iterator, Match, Pattern, overload
# ----- re variables and constants -----
DEBUG: int
@@ -32,13 +32,13 @@ def match(pattern: str | unicode, string: AnyStr, flags: int = ...) -> Match[Any
@overload
def match(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> Match[AnyStr] | None: ...
@overload
def split(pattern: str | unicode, string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
def split(pattern: str | unicode, string: AnyStr, maxsplit: int = ..., flags: int = ...) -> list[AnyStr]: ...
@overload
def split(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
def split(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> list[AnyStr]: ...
@overload
def findall(pattern: str | unicode, string: AnyStr, flags: int = ...) -> List[Any]: ...
def findall(pattern: str | unicode, string: AnyStr, flags: int = ...) -> list[Any]: ...
@overload
def findall(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> List[Any]: ...
def findall(pattern: Pattern[str] | Pattern[unicode], string: AnyStr, flags: int = ...) -> list[Any]: ...
# Return an iterator yielding match objects over all non-overlapping matches
# for the RE pattern in string. The string is scanned left-to-right, and
@@ -65,15 +65,15 @@ def sub(
flags: int = ...,
) -> AnyStr: ...
@overload
def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> Tuple[AnyStr, int]: ...
def subn(pattern: str | unicode, repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> tuple[AnyStr, int]: ...
@overload
def subn(
pattern: str | unicode, repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
) -> Tuple[AnyStr, int]: ...
) -> tuple[AnyStr, int]: ...
@overload
def subn(
pattern: Pattern[str] | Pattern[unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
) -> Tuple[AnyStr, int]: ...
) -> tuple[AnyStr, int]: ...
@overload
def subn(
pattern: Pattern[str] | Pattern[unicode],
@@ -81,7 +81,7 @@ def subn(
string: AnyStr,
count: int = ...,
flags: int = ...,
) -> Tuple[AnyStr, int]: ...
) -> tuple[AnyStr, int]: ...
def escape(string: AnyStr) -> AnyStr: ...
def purge() -> None: ...
def template(pattern: AnyStr | Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ...