mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from decimal import Decimal
|
||||
from numbers import Integral, Rational, Real
|
||||
from typing import Optional, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import Tuple, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_ComparableNum = Union[int, float, Decimal, Real]
|
||||
@@ -18,14 +18,10 @@ def gcd(a: Integral, b: Integral) -> Integral: ...
|
||||
class Fraction(Rational):
|
||||
@overload
|
||||
def __new__(
|
||||
cls: Type[_T],
|
||||
numerator: Union[int, Rational] = ...,
|
||||
denominator: Optional[Union[int, Rational]] = ...,
|
||||
*,
|
||||
_normalize: bool = ...,
|
||||
cls: Type[_T], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ...
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __value: Union[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
|
||||
@@ -36,97 +32,97 @@ class Fraction(Rational):
|
||||
@property
|
||||
def denominator(self) -> int: ...
|
||||
@overload
|
||||
def __add__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __add__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __add__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __add__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __radd__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __radd__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __radd__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __radd__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __sub__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __sub__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __sub__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __sub__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __rsub__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __rsub__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __rsub__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rsub__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __mul__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __mul__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __mul__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __mul__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __rmul__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __rmul__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __rmul__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rmul__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __truediv__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __truediv__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __truediv__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __truediv__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __rtruediv__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __rtruediv__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __rtruediv__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rtruediv__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __div__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __div__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __div__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __div__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __rdiv__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __rdiv__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __rdiv__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rdiv__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __floordiv__(self, other: Union[int, Fraction]) -> int: ...
|
||||
def __floordiv__(self, other: int | Fraction) -> int: ...
|
||||
@overload
|
||||
def __floordiv__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rfloordiv__(self, other: Union[int, Fraction]) -> int: ...
|
||||
def __rfloordiv__(self, other: int | Fraction) -> int: ...
|
||||
@overload
|
||||
def __rfloordiv__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __mod__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __mod__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __mod__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __rmod__(self, other: Union[int, Fraction]) -> Fraction: ...
|
||||
def __rmod__(self, other: int | Fraction) -> Fraction: ...
|
||||
@overload
|
||||
def __rmod__(self, other: float) -> float: ...
|
||||
@overload
|
||||
def __divmod__(self, other: Union[int, Fraction]) -> Tuple[int, Fraction]: ...
|
||||
def __divmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
|
||||
@overload
|
||||
def __divmod__(self, other: float) -> Tuple[float, Fraction]: ...
|
||||
@overload
|
||||
def __rdivmod__(self, other: Union[int, Fraction]) -> Tuple[int, Fraction]: ...
|
||||
def __rdivmod__(self, other: int | Fraction) -> Tuple[int, Fraction]: ...
|
||||
@overload
|
||||
def __rdivmod__(self, other: float) -> Tuple[float, Fraction]: ...
|
||||
@overload
|
||||
def __pow__(self, other: int) -> Fraction: ...
|
||||
@overload
|
||||
def __pow__(self, other: Union[float, Fraction]) -> float: ...
|
||||
def __pow__(self, other: float | Fraction) -> float: ...
|
||||
@overload
|
||||
def __pow__(self, other: complex) -> complex: ...
|
||||
@overload
|
||||
def __rpow__(self, other: Union[int, float, Fraction]) -> float: ...
|
||||
def __rpow__(self, other: int | float | Fraction) -> float: ...
|
||||
@overload
|
||||
def __rpow__(self, other: complex) -> complex: ...
|
||||
def __pos__(self) -> Fraction: ...
|
||||
|
||||
Reference in New Issue
Block a user