mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Add _pydecimal and _decimal stubs (#4003)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user