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,6 +1,6 @@
from decimal import Decimal
from numbers import Integral, Rational, Real
from typing import Tuple, Type, TypeVar, Union, overload
from typing import TypeVar, Union, overload
from typing_extensions import Literal
_ComparableNum = Union[int, float, Decimal, Real]
@@ -18,10 +18,10 @@ def gcd(a: Integral, b: Integral) -> Integral: ...
class Fraction(Rational):
@overload
def __new__(
cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
cls: type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
) -> _T: ...
@overload
def __new__(cls: Type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
def __new__(cls: type[_T], __value: float | Decimal | str, *, _normalize: bool = ...) -> _T: ...
@classmethod
def from_float(cls, f: float) -> Fraction: ...
@classmethod
@@ -108,13 +108,13 @@ class Fraction(Rational):
@overload
def __rmod__(self, other: float) -> float: ...
@overload
def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
def __divmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __divmod__(self, other: float) -> Tuple[float, Fraction]: ...
def __divmod__(self, other: float) -> tuple[float, Fraction]: ...
@overload
def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
def __rdivmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ...
def __rdivmod__(self, other: float) -> tuple[float, Fraction]: ...
@overload
def __pow__(self, other: int) -> Fraction: ...
@overload