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,5 +1,5 @@
from _typeshed import Self
from typing import Any, Iterable, List, MutableSequence, Sequence, Text, Tuple, TypeVar, overload
from typing import Any, Iterable, MutableSequence, Sequence, Text, TypeVar, overload
_MST = TypeVar("_MST", bound=MutableString)
@@ -26,7 +26,7 @@ class UserString(Sequence[UserString]):
def count(self, sub: int, start: int = ..., end: int = ...) -> int: ...
def decode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ...
def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ...
def endswith(self, suffix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def endswith(self, suffix: Text | tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def expandtabs(self: Self, tabsize: int = ...) -> Self: ...
def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
@@ -43,17 +43,17 @@ class UserString(Sequence[UserString]):
def ljust(self: Self, width: int, *args: Any) -> Self: ...
def lower(self: Self) -> Self: ...
def lstrip(self: Self, chars: Text | None = ...) -> Self: ...
def partition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def partition(self, sep: Text) -> tuple[Text, Text, Text]: ...
def replace(self: Self, old: Text, new: Text, maxsplit: int = ...) -> Self: ...
def rfind(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Text, start: int = ..., end: int = ...) -> int: ...
def rjust(self: Self, width: int, *args: Any) -> Self: ...
def rpartition(self, sep: Text) -> Tuple[Text, Text, Text]: ...
def rpartition(self, sep: Text) -> tuple[Text, Text, Text]: ...
def rstrip(self: Self, chars: Text | None = ...) -> Self: ...
def split(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ...
def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> List[Text]: ...
def splitlines(self, keepends: int = ...) -> List[Text]: ...
def startswith(self, prefix: Text | Tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def split(self, sep: Text | None = ..., maxsplit: int = ...) -> list[Text]: ...
def rsplit(self, sep: Text | None = ..., maxsplit: int = ...) -> list[Text]: ...
def splitlines(self, keepends: int = ...) -> list[Text]: ...
def startswith(self, prefix: Text | tuple[Text, ...], start: int | None = ..., end: int | None = ...) -> bool: ...
def strip(self: Self, chars: Text | None = ...) -> Self: ...
def swapcase(self: Self) -> Self: ...
def title(self: Self) -> Self: ...