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