mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
comment version-specific code
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
# Stubs for decimal (Python 3.4)
|
||||
|
||||
from typing import (
|
||||
Any, Union, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, Sequence,
|
||||
Tuple, NamedTuple, Dict
|
||||
@@ -10,11 +8,16 @@ _Decimal = Union[Decimal, int]
|
||||
BasicContext = ... # type: Context
|
||||
DefaultContext = ... # type: Context
|
||||
ExtendedContext = ... # type: Context
|
||||
|
||||
# TODO: fix when mypy supports sys.version_info checks
|
||||
# BEGIN of Python >= 3 only
|
||||
HAVE_THREADS = ... # type: bool
|
||||
MAX_EMAX = ... # type: int
|
||||
MAX_PREC = ... # type: int
|
||||
MIN_EMIN = ... # type: int
|
||||
MIN_ETINY = ... # type: int
|
||||
# END of Python >= 3 only
|
||||
|
||||
ROUND_05UP = ... # type: str
|
||||
ROUND_CEILING = ... # type: str
|
||||
ROUND_DOWN = ... # type: str
|
||||
@@ -41,20 +44,40 @@ class Context:
|
||||
Emax = ... # type: int
|
||||
Emin = ... # type: int
|
||||
capitals = ... # type: int
|
||||
clamp = ... # type: int
|
||||
prec = ... # type: int
|
||||
rounding = ... # type: str
|
||||
|
||||
# TODO: fix when mypy supports sys.version_info checks
|
||||
# TODO: BEGIN of Python >= 3 only
|
||||
clamp = ... # type: int
|
||||
traps = ... # type: Dict[type, bool]
|
||||
|
||||
def __init__(self, prec: int = ..., rounding: str = ..., Emin: int = ..., Emax: int = ...,
|
||||
capitals: int = ..., clamp: int = ..., flags=..., traps=...,
|
||||
_ignored_flags=...) -> None: ...
|
||||
# TODO: END of Python >= 3 only
|
||||
|
||||
# TODO: BEGIN of Python == 2.7 only
|
||||
# _clamp = ... # type: int
|
||||
# traps = ... # type: Dict[type, int]
|
||||
# def __init__(self, prec: int = ..., rounding: str = ..., traps=...,
|
||||
# flags=..., Emin: int = ..., Emax: int = ...,
|
||||
# capitals: int = ..., _clamp: int = ...,
|
||||
# _ignored_flags=...) -> None: ...
|
||||
# TODO: END of Python == 2.7 only
|
||||
|
||||
# TODO: Python >= 3.1 only
|
||||
def create_decimal_from_float(self, f): ...
|
||||
|
||||
# TODO: Python >= 3.3 only
|
||||
def clear_traps(self): ...
|
||||
|
||||
def Etiny(self): ...
|
||||
def Etop(self): ...
|
||||
def abs(self, x: _Decimal) -> Decimal: ...
|
||||
def add(self, x: _Decimal, y: _Decimal) -> Decimal: ...
|
||||
def canonical(self, x): ...
|
||||
def clear_flags(self): ...
|
||||
def clear_traps(self): ...
|
||||
def compare(self, x, y): ...
|
||||
def compare_signal(self, x, y): ...
|
||||
def compare_total(self, x, y): ...
|
||||
@@ -65,7 +88,6 @@ class Context:
|
||||
def copy_negate(self, x): ...
|
||||
def copy_sign(self, x, y): ...
|
||||
def create_decimal(self, x): ...
|
||||
def create_decimal_from_float(self, f): ...
|
||||
def divide(self, x, y): ...
|
||||
def divide_int(self, x, y): ...
|
||||
def divmod(self, x, y): ...
|
||||
@@ -228,6 +250,9 @@ class Decimal(SupportsInt, SupportsFloat, SupportsAbs[Decimal], SupportsRound[in
|
||||
def __truediv__(self, other: _Decimal) -> Decimal: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
|
||||
# TODO: Python >= 3 only
|
||||
class FloatOperation(DecimalException, TypeError): ...
|
||||
|
||||
class DecimalException(ArithmeticError): ...
|
||||
|
||||
class Clamped(DecimalException): ...
|
||||
@@ -238,8 +263,6 @@ class DivisionImpossible(InvalidOperation): ...
|
||||
|
||||
class DivisionUndefined(InvalidOperation, ZeroDivisionError): ...
|
||||
|
||||
class FloatOperation(DecimalException, TypeError): ...
|
||||
|
||||
class Inexact(DecimalException): ...
|
||||
|
||||
class InvalidContext(InvalidOperation): ...
|
||||
|
||||
Reference in New Issue
Block a user