massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / decimal.pyi
1 # Stubs for decimal (Python 3.4)\r
2 \r
3 from typing import (\r
4     Any, Union, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, Sequence,\r
5     Tuple, NamedTuple, Dict\r
6 )\r
7 \r
8 _Decimal = Union[Decimal, int]\r
9 _ComparableNum = Union[Decimal, int, float]\r
10 \r
11 BasicContext = ...  # type: Context\r
12 DefaultContext = ...  # type: Context\r
13 ExtendedContext = ...  # type: Context\r
14 HAVE_THREADS = ...  # type: bool\r
15 MAX_EMAX = ...  # type: int\r
16 MAX_PREC = ...  # type: int\r
17 MIN_EMIN = ...  # type: int\r
18 MIN_ETINY = ...  # type: int\r
19 ROUND_05UP = ...  # type: str\r
20 ROUND_CEILING = ...  # type: str\r
21 ROUND_DOWN = ...  # type: str\r
22 ROUND_FLOOR = ...  # type: str\r
23 ROUND_HALF_DOWN = ...  # type: str\r
24 ROUND_HALF_EVEN = ...  # type: str\r
25 ROUND_HALF_UP = ...  # type: str\r
26 ROUND_UP = ...  # type: str\r
27 \r
28 def getcontext() -> Context: ...\r
29 def localcontext(ctx: Context = ...) -> _ContextManager: ...\r
30 def setcontext(c: Context) -> None: ...\r
31 \r
32 DecimalTuple = NamedTuple('DecimalTuple',\r
33                           [('sign', int),\r
34                            ('digits', Sequence[int]),  # TODO: Use Tuple[int, ...]\r
35                            ('exponent', int)])\r
36 \r
37 class _ContextManager:\r
38     def __enter__(self) -> Context: ...\r
39     def __exit__(self, t, v, tb) -> None: ...\r
40 \r
41 class Context:\r
42     Emax = ...  # type: int\r
43     Emin = ...  # type: int\r
44     capitals = ...  # type: int\r
45     clamp = ...  # type: int\r
46     prec = ...  # type: int\r
47     rounding = ...  # type: str\r
48     traps = ...  # type: Dict[type, bool]\r
49     def __init__(self, prec: int = ..., rounding: str = ..., Emin: int = ..., Emax: int = ...,\r
50                  capitals: int = ..., clamp: int = ..., flags=..., traps=...,\r
51                  _ignored_flags=...) -> None: ...\r
52     def Etiny(self): ...\r
53     def Etop(self): ...\r
54     def abs(self, x: _Decimal) -> Decimal: ...\r
55     def add(self, x: _Decimal, y: _Decimal) -> Decimal: ...\r
56     def canonical(self, x): ...\r
57     def clear_flags(self): ...\r
58     def clear_traps(self): ...\r
59     def compare(self, x, y): ...\r
60     def compare_signal(self, x, y): ...\r
61     def compare_total(self, x, y): ...\r
62     def compare_total_mag(self, x, y): ...\r
63     def copy(self): ...\r
64     def copy_abs(self, x): ...\r
65     def copy_decimal(self, x): ...\r
66     def copy_negate(self, x): ...\r
67     def copy_sign(self, x, y): ...\r
68     def create_decimal(self, x): ...\r
69     def create_decimal_from_float(self, f): ...\r
70     def divide(self, x, y): ...\r
71     def divide_int(self, x, y): ...\r
72     def divmod(self, x, y): ...\r
73     def exp(self, x): ...\r
74     def fma(self, x, y, z): ...\r
75     def is_canonical(self, x): ...\r
76     def is_finite(self, x): ...\r
77     def is_infinite(self, x): ...\r
78     def is_nan(self, x): ...\r
79     def is_normal(self, x): ...\r
80     def is_qnan(self, x): ...\r
81     def is_signed(self, x): ...\r
82     def is_snan(self): ...\r
83     def is_subnormal(self, x): ...\r
84     def is_zero(self, x): ...\r
85     def ln(self, x): ...\r
86     def log10(self, x): ...\r
87     def logb(self, x): ...\r
88     def logical_and(self, x, y): ...\r
89     def logical_invert(self, x): ...\r
90     def logical_or(self, x, y): ...\r
91     def logical_xor(self, x, y): ...\r
92     def max(self, x, y): ...\r
93     def max_mag(self, x, y): ...\r
94     def min(self, x, y): ...\r
95     def min_mag(self, x, y): ...\r
96     def minus(self, x): ...\r
97     def multiply(self, x, y): ...\r
98     def next_minus(self, x): ...\r
99     def next_plus(self, x): ...\r
100     def next_toward(self, x): ...\r
101     def normalize(self, x): ...\r
102     def number_class(self, x): ...\r
103     def plus(self, x): ...\r
104     def power(self, x, y): ...\r
105     def quantize(self, x, y): ...\r
106     def radix(self): ...\r
107     def remainder(self, x, y): ...\r
108     def remainder_near(self, x, y): ...\r
109     def rotate(self, x, y): ...\r
110     def same_quantum(self, x, y): ...\r
111     def scaleb(self, x, y): ...\r
112     def shift(self, x, y): ...\r
113     def sqrt(self, x): ...\r
114     def subtract(self, x, y): ...\r
115     def to_eng_string(self, x): ...\r
116     def to_integral(self, x): ...\r
117     def to_integral_exact(self, x): ...\r
118     def to_integral_value(self, x): ...\r
119     def to_sci_string(self, x): ...\r
120     def __copy__(self) -> Context: ...\r
121     def __delattr__(self, name): ...\r
122     def __reduce__(self): ...\r
123 \r
124 class ConversionSyntax(InvalidOperation): ...\r
125 \r
126 class Decimal(SupportsInt, SupportsFloat, SupportsAbs[Decimal], SupportsRound[int]):\r
127     # TODO: SupportsCeil, SupportsFloor, SupportsTrunc?\r
128 \r
129     def __init__(cls, value: Union[_Decimal, float, str,\r
130                                    Tuple[int, Sequence[int], int]] = ...,\r
131                  context: Context = ...) -> None: ...\r
132 \r
133     @property\r
134     def imag(self) -> Decimal: ...\r
135     @property\r
136     def real(self) -> Decimal: ...\r
137 \r
138     def adjusted(self) -> int: ...\r
139     def as_tuple(self) -> DecimalTuple: ...\r
140     def canonical(self) -> Decimal: ...\r
141     def compare(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
142     def compare_signal(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
143     def compare_total(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
144     def compare_total_mag(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
145     def conjugate(self) -> Decimal: ...\r
146     def copy_abs(self) -> Decimal: ...\r
147     def copy_negate(self) -> Decimal: ...\r
148     def copy_sign(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
149     def exp(self, context: Context = ...) -> Decimal: ...\r
150     def fma(self, other: _Decimal, third: _Decimal, context: Context = ...) -> Decimal: ...\r
151     @classmethod\r
152     def from_float(cls, f: float) -> Decimal: ...\r
153     def is_canonical(self) -> bool: ...\r
154     def is_finite(self) -> bool: ...\r
155     def is_infinite(self) -> bool: ...\r
156     def is_nan(self) -> bool: ...\r
157     def is_normal(self, context: Context = ...) -> bool: ...\r
158     def is_qnan(self) -> bool: ...\r
159     def is_signed(self) -> bool: ...\r
160     def is_snan(self) -> bool: ...\r
161     def is_subnormal(self, context: Context = ...) -> bool: ...\r
162     def is_zero(self) -> bool: ...\r
163     def ln(self, context: Context = ...) -> Decimal: ...\r
164     def log10(self, context: Context = ...) -> Decimal: ...\r
165     def logb(self, context: Context = ...) -> Decimal: ...\r
166     def logical_and(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
167     def logical_invert(self, context: Context = ...) -> Decimal: ...\r
168     def logical_or(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
169     def logical_xor(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
170     def max(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
171     def max_mag(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
172     def min(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
173     def min_mag(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
174     def next_minus(self, context: Context = ...) -> Decimal: ...\r
175     def next_plus(self, context: Context = ...) -> Decimal: ...\r
176     def next_toward(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
177     def normalize(self, context: Context = ...) -> Decimal: ...\r
178     def number_class(self, context: Context = ...) -> str: ...\r
179     def quantize(self, exp: _Decimal, rounding: str = ...,\r
180                  context: Context = ...) -> Decimal: ...\r
181     def radix(self) -> Decimal: ...\r
182     def remainder_near(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
183     def rotate(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
184     def same_quantum(self, other: _Decimal, context: Context = ...) -> bool: ...\r
185     def scaleb(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
186     def shift(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
187     def sqrt(self, context: Context = ...) -> Decimal: ...\r
188     def to_eng_string(self, context: Context = ...) -> str: ...\r
189     def to_integral(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
190     def to_integral_exact(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
191     def to_integral_value(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
192     def __abs__(self) -> Decimal: ...\r
193     def __add__(self, other: _Decimal) -> Decimal: ...\r
194     def __bool__(self) -> bool: ...\r
195     def __ceil__(self) -> int: ...\r
196     def __complex__(self) -> complex: ...\r
197     def __copy__(self) -> Decimal: ...\r
198     def __deepcopy__(self) -> Decimal: ...\r
199     def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...\r
200     def __eq__(self, other: object) -> bool: ...\r
201     def __float__(self) -> float: ...\r
202     def __floor__(self) -> int: ...\r
203     def __floordiv__(self, other: _Decimal) -> Decimal: ...\r
204     def __format__(self, specifier, context=..., _localeconv=...) -> str: ...\r
205     def __ge__(self, other: _ComparableNum) -> bool: ...\r
206     def __gt__(self, other: _ComparableNum) -> bool: ...\r
207     def __hash__(self) -> int: ...\r
208     def __int__(self) -> int: ...\r
209     def __le__(self, other: _ComparableNum) -> bool: ...\r
210     def __lt__(self, other: _ComparableNum) -> bool: ...\r
211     def __mod__(self, other: _Decimal) -> Decimal: ...\r
212     def __mul__(self, other: _Decimal) -> Decimal: ...\r
213     def __ne__(self, other: object) -> bool: ...\r
214     def __neg__(self) -> Decimal: ...\r
215     def __pos__(self) -> Decimal: ...\r
216     def __pow__(self, other: _Decimal) -> Decimal: ...\r
217     def __radd__(self, other: int) -> Decimal: ...\r
218     def __rdivmod__(self, other: int) -> Tuple[Decimal, Decimal]: ...\r
219     def __reduce__(self): ...\r
220     def __rfloordiv__(self, other: int) -> Decimal: ...\r
221     def __rmod__(self, other: int) -> Decimal: ...\r
222     def __rmul__(self, other: int) -> Decimal: ...\r
223     def __round__(self, n=...) -> int: ...\r
224     def __rpow__(self, other: int) -> Decimal: ...\r
225     def __rsub__(self, other: int) -> Decimal: ...\r
226     def __rtruediv__(self, other: int) -> Decimal: ...\r
227     def __sub__(self, other: _Decimal) -> Decimal: ...\r
228     def __truediv__(self, other: _Decimal) -> Decimal: ...\r
229     def __trunc__(self) -> int: ...\r
230 \r
231 class DecimalException(ArithmeticError): ...\r
232 \r
233 class Clamped(DecimalException): ...\r
234 \r
235 class DivisionByZero(DecimalException, ZeroDivisionError): ...\r
236 \r
237 class DivisionImpossible(InvalidOperation): ...\r
238 \r
239 class DivisionUndefined(InvalidOperation, ZeroDivisionError): ...\r
240 \r
241 class FloatOperation(DecimalException, TypeError): ...\r
242 \r
243 class Inexact(DecimalException): ...\r
244 \r
245 class InvalidContext(InvalidOperation): ...\r
246 \r
247 class InvalidOperation(DecimalException): ...\r
248 \r
249 class Overflow(Inexact, Rounded): ...\r
250 \r
251 class Rounded(DecimalException): ...\r
252 \r
253 class Subnormal(DecimalException): ...\r
254 \r
255 class Underflow(Inexact, Rounded, Subnormal): ...\r