--- /dev/null
+# Stubs for decimal (Python 2)\r
+\r
+from typing import (\r
+ Any, Dict, NamedTuple, Optional, Sequence, Tuple, Union,\r
+ SupportsAbs, SupportsFloat, SupportsInt,\r
+)\r
+\r
+_Decimal = Union[Decimal, int]\r
+_ComparableNum = Union[Decimal, int, float]\r
+\r
+DecimalTuple = NamedTuple('DecimalTuple',\r
+ [('sign', int),\r
+ ('digits', Sequence[int]), # TODO: Use Tuple[int, ...]\r
+ ('exponent', int)])\r
+\r
+ROUND_DOWN = ... # type: str\r
+ROUND_HALF_UP = ... # type: str\r
+ROUND_HALF_EVEN = ... # type: str\r
+ROUND_CEILING = ... # type: str\r
+ROUND_FLOOR = ... # type: str\r
+ROUND_UP = ... # type: str\r
+ROUND_HALF_DOWN = ... # type: str\r
+ROUND_05UP = ... # type: str\r
+\r
+class DecimalException(ArithmeticError):\r
+ def handle(self, context, *args): ...\r
+\r
+class Clamped(DecimalException): ...\r
+\r
+class InvalidOperation(DecimalException): ...\r
+\r
+class ConversionSyntax(InvalidOperation): ...\r
+\r
+class DivisionByZero(DecimalException, ZeroDivisionError): ...\r
+\r
+class DivisionImpossible(InvalidOperation): ...\r
+\r
+class DivisionUndefined(InvalidOperation, ZeroDivisionError): ...\r
+\r
+class Inexact(DecimalException): ...\r
+\r
+class InvalidContext(InvalidOperation): ...\r
+\r
+class Rounded(DecimalException): ...\r
+\r
+class Subnormal(DecimalException): ...\r
+\r
+class Overflow(Inexact, Rounded): ...\r
+\r
+class Underflow(Inexact, Rounded, Subnormal): ...\r
+\r
+def setcontext(context: Context): ...\r
+def getcontext() -> Context: ...\r
+def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...\r
+\r
+class Decimal(SupportsAbs[Decimal], SupportsFloat, SupportsInt):\r
+ def __init__(cls, value: Union[_Decimal, float, str, unicode,\r
+ Tuple[int, Sequence[int], int]] = ...,\r
+ context: Context = ...) -> None: ...\r
+ @classmethod\r
+ def from_float(cls, f: float) -> Decimal: ...\r
+ def __nonzero__(self) -> bool: ...\r
+ def __eq__(self, other: object) -> bool: ...\r
+ def __ne__(self, other: object) -> bool: ...\r
+ def __lt__(self, other: _ComparableNum) -> bool: ...\r
+ def __le__(self, other: _ComparableNum) -> bool: ...\r
+ def __gt__(self, other: _ComparableNum) -> bool: ...\r
+ def __ge__(self, other: _ComparableNum) -> bool: ...\r
+ def compare(self, other: _Decimal) -> Decimal: ...\r
+ def __hash__(self) -> int: ...\r
+ def as_tuple(self) -> DecimalTuple: ...\r
+ def to_eng_string(self, context: Context = ...) -> str: ...\r
+ def __neg__(self) -> Decimal: ...\r
+ def __pos__(self) -> Decimal: ...\r
+ def __abs__(self, round: bool = ...) -> Decimal: ...\r
+ def __add__(self, other: _Decimal) -> Decimal: ...\r
+ def __radd__(self, other: int) -> Decimal: ...\r
+ def __sub__(self, other: _Decimal) -> Decimal: ...\r
+ def __rsub__(self, other: int) -> Decimal: ...\r
+ def __mul__(self, other: _Decimal) -> Decimal: ...\r
+ def __rmul__(self, other: int) -> Decimal: ...\r
+ def __truediv__(self, other: _Decimal) -> Decimal: ...\r
+ def __rtruediv__(self, other: int) -> Decimal: ...\r
+ def __div__(self, other: _Decimal) -> Decimal: ...\r
+ def __rdiv__(self, other: int) -> Decimal: ...\r
+ def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...\r
+ def __rdivmod__(self, other: int) -> Tuple[Decimal, Decimal]: ...\r
+ def __mod__(self, other: _Decimal) -> Decimal: ...\r
+ def __rmod__(self, other: int) -> Decimal: ...\r
+ def remainder_near(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def __floordiv__(self, other: _Decimal) -> Decimal: ...\r
+ def __rfloordiv__(self, other: int) -> Decimal: ...\r
+ def __float__(self) -> float: ...\r
+ def __int__(self) -> int: ...\r
+ def __trunc__(self) -> int: ...\r
+ @property\r
+ def imag(self) -> Decimal: ...\r
+ @property\r
+ def real(self) -> Decimal: ...\r
+ def conjugate(self) -> Decimal: ...\r
+ def __complex__(self) -> complex: ...\r
+ def __long__(self) -> long: ...\r
+ def fma(self, other: _Decimal, third: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def __pow__(self, other: _Decimal) -> Decimal: ...\r
+ def __rpow__(self, other: int) -> Decimal: ...\r
+ def normalize(self, context: Context = ...) -> Decimal: ...\r
+ def quantize(self, exp: _Decimal, rounding: str = ...,\r
+ context: Context = ...) -> Decimal: ...\r
+ def same_quantum(self, other: Decimal) -> bool: ...\r
+ def to_integral(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
+ def to_integral_exact(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
+ def to_integral_value(self, rounding: str = ..., context: Context = ...) -> Decimal: ...\r
+ def sqrt(self, context: Context = ...) -> Decimal: ...\r
+ def max(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def min(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def adjusted(self) -> int: ...\r
+ def canonical(self, context: Context = ...) -> Decimal: ...\r
+ def compare_signal(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def compare_total(self, other: _Decimal) -> Decimal: ...\r
+ def compare_total_mag(self, other: _Decimal) -> Decimal: ...\r
+ def copy_abs(self) -> Decimal: ...\r
+ def copy_negate(self) -> Decimal: ...\r
+ def copy_sign(self, other: _Decimal) -> Decimal: ...\r
+ def exp(self, context: Context = ...) -> Decimal: ...\r
+ def is_canonical(self) -> bool: ...\r
+ def is_finite(self) -> bool: ...\r
+ def is_infinite(self) -> bool: ...\r
+ def is_nan(self) -> bool: ...\r
+ def is_normal(self, context: Context = ...) -> bool: ...\r
+ def is_qnan(self) -> bool: ...\r
+ def is_signed(self) -> bool: ...\r
+ def is_snan(self) -> bool: ...\r
+ def is_subnormal(self, context: Context = ...) -> bool: ...\r
+ def is_zero(self) -> bool: ...\r
+ def ln(self, context: Context = ...) -> Decimal: ...\r
+ def log10(self, context: Context = ...) -> Decimal: ...\r
+ def logb(self, context: Context = ...) -> Decimal: ...\r
+ def logical_and(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def logical_invert(self, context: Context = ...) -> Decimal: ...\r
+ def logical_or(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def logical_xor(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def max_mag(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def min_mag(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def next_minus(self, context: Context = ...) -> Decimal: ...\r
+ def next_plus(self, context: Context = ...) -> Decimal: ...\r
+ def next_toward(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def number_class(self, context: Context = ...) -> str: ...\r
+ def radix(self) -> Decimal: ...\r
+ def rotate(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def scaleb(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def shift(self, other: _Decimal, context: Context = ...) -> Decimal: ...\r
+ def __reduce__(self): ...\r
+ def __copy__(self): ...\r
+ def __deepcopy__(self, memo): ...\r
+ def __format__(self, specifier, context=None, _localeconv=None) -> str: ...\r
+\r
+class _ContextManager:\r
+ new_context = ... # type: Context\r
+ saved_context = ... # type: Context\r
+ def __init__(self, new_context: Context) -> None: ...\r
+ def __enter__(self): ...\r
+ def __exit__(self, t, v, tb): ...\r
+\r
+class Context:\r
+ prec = ... # type: int\r
+ rounding = ... # type: str\r
+ Emin = ... # type: int\r
+ Emax = ... # type: int\r
+ capitals = ... # type: int\r
+ traps = ... # type: Dict[type, bool]\r
+ flags = ... # type: Any\r
+ def __init__(self, prec=None, rounding=None, traps=None, flags=None, Emin=None, Emax=None, capitals=None, _clamp=0, _ignored_flags=None): ...\r
+ def clear_flags(self): ...\r
+ def copy(self): ...\r
+ __copy__ = ... # type: Any\r
+ __hash__ = ... # type: Any\r
+ def Etiny(self): ...\r
+ def Etop(self): ...\r
+ def create_decimal(self, num=...): ...\r
+ def create_decimal_from_float(self, f): ...\r
+ def abs(self, a): ...\r
+ def add(self, a, b): ...\r
+ def canonical(self, a): ...\r
+ def compare(self, a, b): ...\r
+ def compare_signal(self, a, b): ...\r
+ def compare_total(self, a, b): ...\r
+ def compare_total_mag(self, a, b): ...\r
+ def copy_abs(self, a): ...\r
+ def copy_decimal(self, a): ...\r
+ def copy_negate(self, a): ...\r
+ def copy_sign(self, a, b): ...\r
+ def divide(self, a, b): ...\r
+ def divide_int(self, a, b): ...\r
+ def divmod(self, a, b): ...\r
+ def exp(self, a): ...\r
+ def fma(self, a, b, c): ...\r
+ def is_canonical(self, a): ...\r
+ def is_finite(self, a): ...\r
+ def is_infinite(self, a): ...\r
+ def is_nan(self, a): ...\r
+ def is_normal(self, a): ...\r
+ def is_qnan(self, a): ...\r
+ def is_signed(self, a): ...\r
+ def is_snan(self, a): ...\r
+ def is_subnormal(self, a): ...\r
+ def is_zero(self, a): ...\r
+ def ln(self, a): ...\r
+ def log10(self, a): ...\r
+ def logb(self, a): ...\r
+ def logical_and(self, a, b): ...\r
+ def logical_invert(self, a): ...\r
+ def logical_or(self, a, b): ...\r
+ def logical_xor(self, a, b): ...\r
+ def max(self, a, b): ...\r
+ def max_mag(self, a, b): ...\r
+ def min(self, a, b): ...\r
+ def min_mag(self, a, b): ...\r
+ def minus(self, a): ...\r
+ def multiply(self, a, b): ...\r
+ def next_minus(self, a): ...\r
+ def next_plus(self, a): ...\r
+ def next_toward(self, a, b): ...\r
+ def normalize(self, a): ...\r
+ def number_class(self, a): ...\r
+ def plus(self, a): ...\r
+ def power(self, a, b, modulo=None): ...\r
+ def quantize(self, a, b): ...\r
+ def radix(self): ...\r
+ def remainder(self, a, b): ...\r
+ def remainder_near(self, a, b): ...\r
+ def rotate(self, a, b): ...\r
+ def same_quantum(self, a, b): ...\r
+ def scaleb(self, a, b): ...\r
+ def shift(self, a, b): ...\r
+ def sqrt(self, a): ...\r
+ def subtract(self, a, b): ...\r
+ def to_eng_string(self, a): ...\r
+ def to_sci_string(self, a): ...\r
+ def to_integral_exact(self, a): ...\r
+ def to_integral_value(self, a): ...\r
+ def to_integral(self, a): ...\r
+\r
+DefaultContext = ... # type: Context\r
+BasicContext = ... # type: Context\r
+ExtendedContext = ... # type: Context\r