Skip to content

Commit 853b2d6

Browse files
committed
removing Union
1 parent 2c6acd5 commit 853b2d6

File tree

1 file changed

+93
-15
lines changed

1 file changed

+93
-15
lines changed

stdlib/2and3/numbers.pyi

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Stubs for numbers
22

33
from typing import (
4-
Any, Optional, Union,
4+
Any, Optional,
55
SupportsAbs, SupportsComplex, SupportsFloat, SupportsInt, SupportsRound,
66
)
77
from abc import abstractmethod
@@ -18,10 +18,10 @@ class Complex(Number, SupportsComplex, SupportsAbs[float]):
1818
@abstractmethod
1919
def imag(self) -> Complex: ...
2020
@abstractmethod
21-
def __add__(self, other: Union[Number, complex]) -> Complex: ...
21+
def __add__(self, other: Complex) -> Complex: ...
2222
def __neg__(self) -> Complex: ...
2323
@abstractmethod
24-
def __mul__(self, other: Union[Number, complex]) -> Complex: ...
24+
def __mul__(self, other: Complex) -> Complex: ...
2525
if sys.version_info >= (3,):
2626
@abstractmethod
2727
def __truediv__(self, other: Complex) -> Complex: ...
@@ -39,26 +39,38 @@ class Real(Complex, SupportsFloat, SupportsRound):
3939
@abstractmethod
4040
def __ceil__(self) -> int: ...
4141
@abstractmethod
42-
def __divmod__(self, other: Union[Real, float]) -> Real: ...
42+
def __divmod__(self, other: Real) -> Real: ...
4343
@abstractmethod
44-
def __floordiv__(self, other: Union[Real, float]) -> Real: ...
44+
def __floordiv__(self, other: Real) -> Real: ...
4545
@abstractmethod
46-
def __mod__(self, other: Union[Real, float]) -> Real: ...
46+
def __mod__(self, other: Real) -> Real: ...
4747
@abstractmethod
48-
def __lt__(self, other: Union[Real, float]) -> bool: ...
48+
def __lt__(self, other: Real) -> bool: ...
4949
@abstractmethod
50-
def __le__(self, other: Union[Real, float]) -> bool: ...
50+
def __le__(self, other: Real) -> bool: ...
5151
@abstractmethod
52-
def __gt__(self, other: Union[Real, float]) -> bool: ...
52+
def __gt__(self, other: Real) -> bool: ...
5353
@abstractmethod
54-
def __ge__(self, other: Union[Real, float]) -> bool: ...
54+
def __ge__(self, other: Real) -> bool: ...
5555
def __complex__(self) -> Complex: ... # type: ignore
5656
@property
5757
def real(self) -> Real: ...
5858
@property
5959
def imag(self) -> Real: ...
6060
def conjugate(self) -> Real: ...
6161

62+
@abstractmethod
63+
def __add__(self, other: Real) -> Real: ...
64+
def __neg__(self) -> Real: ...
65+
@abstractmethod
66+
def __mul__(self, other: Real) -> Real: ...
67+
if sys.version_info >= (3,):
68+
@abstractmethod
69+
def __truediv__(self, other: Real) -> Real: ...
70+
else:
71+
@abstractmethod
72+
def __div__(self, other: Real) -> Real: ...
73+
6274
class Rational(Real):
6375
@property
6476
@abstractmethod
@@ -68,6 +80,39 @@ class Rational(Real):
6880
def denominator(self) -> int: ...
6981
def __float__(self) -> float: ...
7082

83+
@abstractmethod
84+
def __divmod__(self, other: Rational) -> Rational: ...
85+
@abstractmethod
86+
def __floordiv__(self, other: Rational) -> Rational: ...
87+
@abstractmethod
88+
def __mod__(self, other: Rational) -> Rational: ...
89+
@abstractmethod
90+
def __lt__(self, other: Rational, float) -> bool: ...
91+
@abstractmethod
92+
def __le__(self, other: Rational) -> bool: ...
93+
@abstractmethod
94+
def __gt__(self, other: Rational) -> bool: ...
95+
@abstractmethod
96+
def __ge__(self, other: Rational) -> bool: ...
97+
def __complex__(self) -> Complex: ... # type: ignore
98+
@property
99+
def real(self) -> Rational: ...
100+
@property
101+
def imag(self) -> Rational: ...
102+
def conjugate(self) -> Rational: ...
103+
104+
@abstractmethod
105+
def __add__(self, other: Rational) -> Rational: ...
106+
def __neg__(self) -> Rational: ...
107+
@abstractmethod
108+
def __mul__(self, other: Rational) -> Rational: ...
109+
if sys.version_info >= (3,):
110+
@abstractmethod
111+
def __truediv__(self, other: Rational) -> Rational: ...
112+
else:
113+
@abstractmethod
114+
def __div__(self, other: Rational) -> Rational: ...
115+
71116
class Integral(Rational, SupportsInt, SupportsAbs[int]):
72117
@property
73118
def numerator(self) -> int: ...
@@ -77,14 +122,47 @@ class Integral(Rational, SupportsInt, SupportsAbs[int]):
77122
def __pow__(self, exponent: float,
78123
modulus: Optional[int] = ...) -> Integral: ...
79124
@abstractmethod
80-
def __lshift__(self, other: Union[int, Integral]) -> Integral: ...
125+
def __lshift__(self, other: Integral) -> Integral: ...
81126
@abstractmethod
82-
def __rshift__(self, other: Union[int, Integral]) -> Integral: ...
127+
def __rshift__(self, other: Integral) -> Integral: ...
83128
@abstractmethod
84-
def __and__(self, other: Union[int, Integral]) -> Integral: ...
129+
def __and__(self, other: Integral) -> Integral: ...
85130
@abstractmethod
86-
def __xor__(self, other: Union[int, Integral]) -> Integral: ...
131+
def __xor__(self, other: Integral) -> Integral: ...
87132
@abstractmethod
88-
def __or__(self, other: Union[int, Integral]) -> Integral: ...
133+
def __or__(self, other: Integral) -> Integral: ...
89134
@abstractmethod
90135
def __invert__(self) -> Integral: ...
136+
137+
@abstractmethod
138+
def __divmod__(self, other: Integral) -> Integral: ...
139+
@abstractmethod
140+
def __floordiv__(self, other: Integral) -> Integral: ...
141+
@abstractmethod
142+
def __mod__(self, other: Integral) -> Integral: ...
143+
@abstractmethod
144+
def __lt__(self, other: Integral) -> bool: ...
145+
@abstractmethod
146+
def __le__(self, other: Integral) -> bool: ...
147+
@abstractmethod
148+
def __gt__(self, other: Integral) -> bool: ...
149+
@abstractmethod
150+
def __ge__(self, other: Integral) -> bool: ...
151+
def __complex__(self) -> Complex: ... # type: ignore
152+
@property
153+
def real(self) -> Integral: ...
154+
@property
155+
def imag(self) -> Integral: ...
156+
def conjugate(self) -> Integral: ...
157+
158+
@abstractmethod
159+
def __add__(self, other: Integral) -> Integral: ...
160+
def __neg__(self) -> Integral: ...
161+
@abstractmethod
162+
def __mul__(self, other: Integral) -> Integral: ...
163+
if sys.version_info >= (3,):
164+
@abstractmethod
165+
def __truediv__(self, other: Integral) -> Integral: ...
166+
else:
167+
@abstractmethod
168+
def __div__(self, other: Integral) -> Integral: ...

0 commit comments

Comments
 (0)