Add _pydecimal and _decimal stubs (#4003)

This commit is contained in:
Rune Tynan
2020-05-27 04:10:51 -04:00
committed by GitHub
parent f1d96d97fe
commit 7ac284f641
6 changed files with 12 additions and 8 deletions

View File

@@ -35,7 +35,8 @@ if sys.version_info >= (3,):
MIN_ETINY: int
class DecimalException(ArithmeticError):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
if sys.version_info < (3,):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
class Clamped(DecimalException): ...
@@ -64,14 +65,14 @@ class Underflow(Inexact, Rounded, Subnormal): ...
if sys.version_info >= (3,):
class FloatOperation(DecimalException, TypeError): ...
def setcontext(context: Context) -> None: ...
def setcontext(__context: Context) -> None: ...
def getcontext() -> Context: ...
def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...
class Decimal(object):
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Optional[Context] = ...) -> _DecimalT: ...
@classmethod
def from_float(cls, f: float) -> Decimal: ...
def from_float(cls, __f: float) -> Decimal: ...
if sys.version_info >= (3,):
def __bool__(self) -> bool: ...
else:
@@ -83,7 +84,7 @@ class Decimal(object):
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
if sys.version_info >= (3,):
if sys.version_info >= (3, 6):
def as_integer_ratio(self) -> Tuple[int, int]: ...
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...