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,19 +1,4 @@
from typing import (
Any,
AnyStr,
Callable,
Generic,
Iterable,
Iterator,
List,
NamedTuple,
Sequence,
Text,
Tuple,
TypeVar,
Union,
overload,
)
from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, Text, TypeVar, Union, overload
_T = TypeVar("_T")
@@ -35,9 +20,9 @@ class SequenceMatcher(Generic[_T]):
def set_seq1(self, a: Sequence[_T]) -> None: ...
def set_seq2(self, b: Sequence[_T]) -> None: ...
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def get_matching_blocks(self) -> List[Match]: ...
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ...
def get_matching_blocks(self) -> list[Match]: ...
def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[tuple[str, int, int, int, int]]]: ...
def ratio(self) -> float: ...
def quick_ratio(self) -> float: ...
def real_quick_ratio(self) -> float: ...
@@ -46,11 +31,11 @@ class SequenceMatcher(Generic[_T]):
@overload
def get_close_matches( # type: ignore
word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...
) -> List[AnyStr]: ...
) -> list[AnyStr]: ...
@overload
def get_close_matches(
word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ...
) -> List[Sequence[_T]]: ...
) -> list[Sequence[_T]]: ...
class Differ:
def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ...