mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import numbers
|
||||
from types import TracebackType
|
||||
from typing import Any, Container, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import Any, Container, Dict, List, NamedTuple, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
_Decimal = Union[Decimal, int]
|
||||
_DecimalNew = Union[Decimal, float, str, Tuple[int, Sequence[int], int]]
|
||||
@@ -44,18 +44,18 @@ class FloatOperation(DecimalException, TypeError): ...
|
||||
|
||||
def setcontext(__context: Context) -> None: ...
|
||||
def getcontext() -> Context: ...
|
||||
def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...
|
||||
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
|
||||
|
||||
class Decimal(object):
|
||||
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Optional[Context] = ...) -> _DecimalT: ...
|
||||
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
|
||||
@classmethod
|
||||
def from_float(cls, __f: float) -> Decimal: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def as_tuple(self) -> DecimalTuple: ...
|
||||
def as_integer_ratio(self) -> Tuple[int, int]: ...
|
||||
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...
|
||||
def to_eng_string(self, context: Context | None = ...) -> str: ...
|
||||
def __abs__(self) -> Decimal: ...
|
||||
def __add__(self, other: _Decimal) -> Decimal: ...
|
||||
def __divmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
|
||||
@@ -69,7 +69,7 @@ class Decimal(object):
|
||||
def __mul__(self, other: _Decimal) -> Decimal: ...
|
||||
def __neg__(self) -> Decimal: ...
|
||||
def __pos__(self) -> Decimal: ...
|
||||
def __pow__(self, other: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
|
||||
def __pow__(self, other: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ...
|
||||
def __radd__(self, other: _Decimal) -> Decimal: ...
|
||||
def __rdivmod__(self, other: _Decimal) -> Tuple[Decimal, Decimal]: ...
|
||||
def __rfloordiv__(self, other: _Decimal) -> Decimal: ...
|
||||
@@ -80,7 +80,7 @@ class Decimal(object):
|
||||
def __str__(self) -> str: ...
|
||||
def __sub__(self, other: _Decimal) -> Decimal: ...
|
||||
def __truediv__(self, other: _Decimal) -> Decimal: ...
|
||||
def remainder_near(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __trunc__(self) -> int: ...
|
||||
@@ -96,64 +96,64 @@ class Decimal(object):
|
||||
def __round__(self, ndigits: int) -> Decimal: ...
|
||||
def __floor__(self) -> int: ...
|
||||
def __ceil__(self) -> int: ...
|
||||
def fma(self, other: _Decimal, third: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def __rpow__(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def normalize(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def quantize(self, exp: _Decimal, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
|
||||
def same_quantum(self, other: _Decimal, context: Optional[Context] = ...) -> bool: ...
|
||||
def to_integral_exact(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
|
||||
def to_integral_value(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
|
||||
def to_integral(self, rounding: Optional[str] = ..., context: Optional[Context] = ...) -> Decimal: ...
|
||||
def sqrt(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def max(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def min(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def __rpow__(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def normalize(self, context: Context | None = ...) -> Decimal: ...
|
||||
def quantize(self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
|
||||
def same_quantum(self, other: _Decimal, context: Context | None = ...) -> bool: ...
|
||||
def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
|
||||
def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
|
||||
def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ...
|
||||
def sqrt(self, context: Context | None = ...) -> Decimal: ...
|
||||
def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def adjusted(self) -> int: ...
|
||||
def canonical(self) -> Decimal: ...
|
||||
def compare_signal(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def compare_total(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def compare_total_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def compare_total(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def compare_total_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def copy_abs(self) -> Decimal: ...
|
||||
def copy_negate(self) -> Decimal: ...
|
||||
def copy_sign(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def exp(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def copy_sign(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def exp(self, context: Context | None = ...) -> Decimal: ...
|
||||
def is_canonical(self) -> bool: ...
|
||||
def is_finite(self) -> bool: ...
|
||||
def is_infinite(self) -> bool: ...
|
||||
def is_nan(self) -> bool: ...
|
||||
def is_normal(self, context: Optional[Context] = ...) -> bool: ...
|
||||
def is_normal(self, context: Context | None = ...) -> bool: ...
|
||||
def is_qnan(self) -> bool: ...
|
||||
def is_signed(self) -> bool: ...
|
||||
def is_snan(self) -> bool: ...
|
||||
def is_subnormal(self, context: Optional[Context] = ...) -> bool: ...
|
||||
def is_subnormal(self, context: Context | None = ...) -> bool: ...
|
||||
def is_zero(self) -> bool: ...
|
||||
def ln(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def log10(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logb(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_and(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_invert(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_or(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def logical_xor(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def max_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def min_mag(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_minus(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_plus(self, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def next_toward(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def number_class(self, context: Optional[Context] = ...) -> str: ...
|
||||
def ln(self, context: Context | None = ...) -> Decimal: ...
|
||||
def log10(self, context: Context | None = ...) -> Decimal: ...
|
||||
def logb(self, context: Context | None = ...) -> Decimal: ...
|
||||
def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def logical_invert(self, context: Context | None = ...) -> Decimal: ...
|
||||
def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def next_minus(self, context: Context | None = ...) -> Decimal: ...
|
||||
def next_plus(self, context: Context | None = ...) -> Decimal: ...
|
||||
def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def number_class(self, context: Context | None = ...) -> str: ...
|
||||
def radix(self) -> Decimal: ...
|
||||
def rotate(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def scaleb(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def shift(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
|
||||
def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ...
|
||||
def __reduce__(self) -> Tuple[Type[Decimal], Tuple[str]]: ...
|
||||
def __copy__(self) -> Decimal: ...
|
||||
def __deepcopy__(self, memo: Any) -> Decimal: ...
|
||||
def __format__(self, specifier: str, context: Optional[Context] = ...) -> str: ...
|
||||
def __format__(self, specifier: str, context: Context | None = ...) -> str: ...
|
||||
|
||||
class _ContextManager(object):
|
||||
new_context: Context
|
||||
saved_context: Context
|
||||
def __init__(self, new_context: Context) -> None: ...
|
||||
def __enter__(self) -> Context: ...
|
||||
def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
|
||||
def __exit__(self, t: Type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
|
||||
_TrapType = Type[DecimalException]
|
||||
|
||||
@@ -168,15 +168,15 @@ class Context(object):
|
||||
flags: Dict[_TrapType, bool]
|
||||
def __init__(
|
||||
self,
|
||||
prec: Optional[int] = ...,
|
||||
rounding: Optional[str] = ...,
|
||||
Emin: Optional[int] = ...,
|
||||
Emax: Optional[int] = ...,
|
||||
capitals: Optional[int] = ...,
|
||||
clamp: Optional[int] = ...,
|
||||
flags: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
|
||||
traps: Union[None, Dict[_TrapType, bool], Container[_TrapType]] = ...,
|
||||
_ignored_flags: Optional[List[_TrapType]] = ...,
|
||||
prec: int | None = ...,
|
||||
rounding: str | None = ...,
|
||||
Emin: int | None = ...,
|
||||
Emax: int | None = ...,
|
||||
capitals: int | None = ...,
|
||||
clamp: int | None = ...,
|
||||
flags: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
traps: None | Dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
_ignored_flags: List[_TrapType] | None = ...,
|
||||
) -> None: ...
|
||||
# __setattr__() only allows to set a specific set of attributes,
|
||||
# already defined above.
|
||||
@@ -236,7 +236,7 @@ class Context(object):
|
||||
def normalize(self, __x: _Decimal) -> Decimal: ...
|
||||
def number_class(self, __x: _Decimal) -> str: ...
|
||||
def plus(self, __x: _Decimal) -> Decimal: ...
|
||||
def power(self, a: _Decimal, b: _Decimal, modulo: Optional[_Decimal] = ...) -> Decimal: ...
|
||||
def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ...
|
||||
def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
def radix(self) -> Decimal: ...
|
||||
def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
|
||||
|
||||
Reference in New Issue
Block a user