mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 03:51:52 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user