1 # Stubs for numbers (Python 3.5)
\r
2 # See https://docs.python.org/2.7/library/numbers.html
\r
3 # and https://docs.python.org/3/library/numbers.html
\r
5 # Note: these stubs are incomplete. The more complex type
\r
6 # signatures are currently omitted.
\r
8 from typing import Optional, SupportsFloat
\r
9 from abc import ABCMeta, abstractmethod
\r
12 class Number(metaclass=ABCMeta):
\r
14 def __hash__(self) -> int: ...
\r
16 class Complex(Number):
\r
18 def __complex__(self) -> complex: ...
\r
19 if sys.version_info >= (3, 0):
\r
20 def __bool__(self) -> bool: ...
\r
22 def __nonzero__(self) -> bool: ...
\r
30 def __add__(self, other): ...
\r
32 def __radd__(self, other): ...
\r
34 def __neg__(self): ...
\r
36 def __pos__(self): ...
\r
37 def __sub__(self, other): ...
\r
38 def __rsub__(self, other): ...
\r
40 def __mul__(self, other): ...
\r
42 def __rmul__(self, other): ...
\r
43 if sys.version_info < (3, 0):
\r
45 def __div__(self, other): ...
\r
47 def __rdiv__(self, other): ...
\r
49 def __truediv__(self, other): ...
\r
51 def __rtruediv__(self, other): ...
\r
53 def __pow__(self, exponent): ...
\r
55 def __rpow__(self, base): ...
\r
56 def __abs__(self): ...
\r
57 def conjugate(self): ...
\r
58 def __eq__(self, other: object) -> bool: ...
\r
59 if sys.version_info < (3, 0):
\r
60 def __ne__(self, other: object) -> bool: ...
\r
62 class Real(Complex, SupportsFloat):
\r
64 def __float__(self) -> float: ...
\r
66 def __trunc__(self) -> int: ...
\r
67 if sys.version_info >= (3, 0):
\r
69 def __floor__(self) -> int: ...
\r
71 def __ceil__(self) -> int: ...
\r
73 def __round__(self, ndigits: Optional[int] = ...): ...
\r
74 def __divmod__(self, other): ...
\r
75 def __rdivmod__(self, other): ...
\r
77 def __floordiv__(self, other): ...
\r
79 def __rfloordiv__(self, other): ...
\r
81 def __mod__(self, other): ...
\r
83 def __rmod__(self, other): ...
\r
85 def __lt__(self, other) -> bool: ...
\r
87 def __le__(self, other) -> bool: ...
\r
88 def __complex__(self) -> complex: ...
\r
93 def conjugate(self): ...
\r
95 class Rational(Real):
\r
98 def numerator(self) -> int: ...
\r
101 def denominator(self) -> int: ...
\r
102 def __float__(self) -> float: ...
\r
104 class Integral(Rational):
\r
105 if sys.version_info >= (3, 0):
\r
107 def __int__(self) -> int: ...
\r
110 def __long__(self) -> long: ...
\r
111 def __index__(self) -> int: ...
\r
113 def __pow__(self, exponent, modulus=None): ...
\r
115 def __lshift__(self, other): ...
\r
117 def __rlshift__(self, other): ...
\r
119 def __rshift__(self, other): ...
\r
121 def __rrshift__(self, other): ...
\r
123 def __and__(self, other): ...
\r
125 def __rand__(self, other): ...
\r
127 def __xor__(self, other): ...
\r
129 def __rxor__(self, other): ...
\r
131 def __or__(self, other): ...
\r
133 def __ror__(self, other): ...
\r
135 def __invert__(self): ...
\r
136 def __float__(self) -> float: ...
\r
138 def numerator(self) -> int: ...
\r
140 def denominator(self) -> int: ...
\r