Use PEP 570 syntax in stdlib (#11250)

This commit is contained in:
Shantanu
2024-03-09 14:50:16 -08:00
committed by GitHub
parent 63737acac6
commit 470a13ab09
139 changed files with 2412 additions and 2371 deletions

View File

@@ -47,7 +47,7 @@ class Overflow(Inexact, Rounded): ...
class Underflow(Inexact, Rounded, Subnormal): ...
class FloatOperation(DecimalException, TypeError): ...
def setcontext(__context: Context) -> None: ...
def setcontext(context: Context, /) -> None: ...
def getcontext() -> Context: ...
if sys.version_info >= (3, 11):
@@ -70,7 +70,7 @@ else:
class Decimal:
def __new__(cls, value: _DecimalNew = ..., context: Context | None = ...) -> Self: ...
@classmethod
def from_float(cls, __f: float) -> Self: ...
def from_float(cls, f: float, /) -> Self: ...
def __bool__(self) -> bool: ...
def compare(self, other: _Decimal, context: Context | None = None) -> Decimal: ...
def __hash__(self) -> int: ...
@@ -78,28 +78,28 @@ class Decimal:
def as_integer_ratio(self) -> tuple[int, int]: ...
def to_eng_string(self, context: Context | None = None) -> str: ...
def __abs__(self) -> Decimal: ...
def __add__(self, __value: _Decimal) -> Decimal: ...
def __divmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
def __eq__(self, __value: object) -> bool: ...
def __floordiv__(self, __value: _Decimal) -> Decimal: ...
def __ge__(self, __value: _ComparableNum) -> bool: ...
def __gt__(self, __value: _ComparableNum) -> bool: ...
def __le__(self, __value: _ComparableNum) -> bool: ...
def __lt__(self, __value: _ComparableNum) -> bool: ...
def __mod__(self, __value: _Decimal) -> Decimal: ...
def __mul__(self, __value: _Decimal) -> Decimal: ...
def __add__(self, value: _Decimal, /) -> Decimal: ...
def __divmod__(self, value: _Decimal, /) -> tuple[Decimal, Decimal]: ...
def __eq__(self, value: object, /) -> bool: ...
def __floordiv__(self, value: _Decimal, /) -> Decimal: ...
def __ge__(self, value: _ComparableNum, /) -> bool: ...
def __gt__(self, value: _ComparableNum, /) -> bool: ...
def __le__(self, value: _ComparableNum, /) -> bool: ...
def __lt__(self, value: _ComparableNum, /) -> bool: ...
def __mod__(self, value: _Decimal, /) -> Decimal: ...
def __mul__(self, value: _Decimal, /) -> Decimal: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, __value: _Decimal, __mod: _Decimal | None = None) -> Decimal: ...
def __radd__(self, __value: _Decimal) -> Decimal: ...
def __rdivmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, __value: _Decimal) -> Decimal: ...
def __rmod__(self, __value: _Decimal) -> Decimal: ...
def __rmul__(self, __value: _Decimal) -> Decimal: ...
def __rsub__(self, __value: _Decimal) -> Decimal: ...
def __rtruediv__(self, __value: _Decimal) -> Decimal: ...
def __sub__(self, __value: _Decimal) -> Decimal: ...
def __truediv__(self, __value: _Decimal) -> Decimal: ...
def __pow__(self, value: _Decimal, mod: _Decimal | None = None, /) -> Decimal: ...
def __radd__(self, value: _Decimal, /) -> Decimal: ...
def __rdivmod__(self, value: _Decimal, /) -> tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, value: _Decimal, /) -> Decimal: ...
def __rmod__(self, value: _Decimal, /) -> Decimal: ...
def __rmul__(self, value: _Decimal, /) -> Decimal: ...
def __rsub__(self, value: _Decimal, /) -> Decimal: ...
def __rtruediv__(self, value: _Decimal, /) -> Decimal: ...
def __sub__(self, value: _Decimal, /) -> Decimal: ...
def __truediv__(self, value: _Decimal, /) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context | None = None) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
@@ -113,11 +113,11 @@ class Decimal:
@overload
def __round__(self) -> int: ...
@overload
def __round__(self, __ndigits: int) -> Decimal: ...
def __round__(self, ndigits: int, /) -> Decimal: ...
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ...
def __rpow__(self, __value: _Decimal, __mod: Context | None = None) -> Decimal: ...
def __rpow__(self, value: _Decimal, mod: Context | None = None, /) -> Decimal: ...
def normalize(self, context: Context | None = None) -> Decimal: ...
def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ...
@@ -165,8 +165,8 @@ class Decimal:
def shift(self, other: _Decimal, context: Context | None = None) -> Decimal: ...
def __reduce__(self) -> tuple[type[Self], tuple[str]]: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self, __memo: Any) -> Self: ...
def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ...
def __deepcopy__(self, memo: Any, /) -> Self: ...
def __format__(self, specifier: str, context: Context | None = ..., /) -> str: ...
class _ContextManager:
new_context: Context
@@ -212,69 +212,69 @@ class Context:
__hash__: ClassVar[None] # type: ignore[assignment]
def Etiny(self) -> int: ...
def Etop(self) -> int: ...
def create_decimal(self, __num: _DecimalNew = "0") -> Decimal: ...
def create_decimal_from_float(self, __f: float) -> Decimal: ...
def abs(self, __x: _Decimal) -> Decimal: ...
def add(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def canonical(self, __x: Decimal) -> Decimal: ...
def compare(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def compare_signal(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def compare_total(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def compare_total_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def copy_abs(self, __x: _Decimal) -> Decimal: ...
def copy_decimal(self, __x: _Decimal) -> Decimal: ...
def copy_negate(self, __x: _Decimal) -> Decimal: ...
def copy_sign(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def divide(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def divide_int(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def divmod(self, __x: _Decimal, __y: _Decimal) -> tuple[Decimal, Decimal]: ...
def exp(self, __x: _Decimal) -> Decimal: ...
def fma(self, __x: _Decimal, __y: _Decimal, __z: _Decimal) -> Decimal: ...
def is_canonical(self, __x: _Decimal) -> bool: ...
def is_finite(self, __x: _Decimal) -> bool: ...
def is_infinite(self, __x: _Decimal) -> bool: ...
def is_nan(self, __x: _Decimal) -> bool: ...
def is_normal(self, __x: _Decimal) -> bool: ...
def is_qnan(self, __x: _Decimal) -> bool: ...
def is_signed(self, __x: _Decimal) -> bool: ...
def is_snan(self, __x: _Decimal) -> bool: ...
def is_subnormal(self, __x: _Decimal) -> bool: ...
def is_zero(self, __x: _Decimal) -> bool: ...
def ln(self, __x: _Decimal) -> Decimal: ...
def log10(self, __x: _Decimal) -> Decimal: ...
def logb(self, __x: _Decimal) -> Decimal: ...
def logical_and(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def logical_invert(self, __x: _Decimal) -> Decimal: ...
def logical_or(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def logical_xor(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def max(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def max_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def min(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def min_mag(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def minus(self, __x: _Decimal) -> Decimal: ...
def multiply(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def next_minus(self, __x: _Decimal) -> Decimal: ...
def next_plus(self, __x: _Decimal) -> Decimal: ...
def next_toward(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def normalize(self, __x: _Decimal) -> Decimal: ...
def number_class(self, __x: _Decimal) -> str: ...
def plus(self, __x: _Decimal) -> Decimal: ...
def create_decimal(self, num: _DecimalNew = "0", /) -> Decimal: ...
def create_decimal_from_float(self, f: float, /) -> Decimal: ...
def abs(self, x: _Decimal, /) -> Decimal: ...
def add(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def canonical(self, x: Decimal, /) -> Decimal: ...
def compare(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def compare_signal(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def compare_total(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def compare_total_mag(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def copy_abs(self, x: _Decimal, /) -> Decimal: ...
def copy_decimal(self, x: _Decimal, /) -> Decimal: ...
def copy_negate(self, x: _Decimal, /) -> Decimal: ...
def copy_sign(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def divide(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def divide_int(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def divmod(self, x: _Decimal, y: _Decimal, /) -> tuple[Decimal, Decimal]: ...
def exp(self, x: _Decimal, /) -> Decimal: ...
def fma(self, x: _Decimal, y: _Decimal, z: _Decimal, /) -> Decimal: ...
def is_canonical(self, x: _Decimal, /) -> bool: ...
def is_finite(self, x: _Decimal, /) -> bool: ...
def is_infinite(self, x: _Decimal, /) -> bool: ...
def is_nan(self, x: _Decimal, /) -> bool: ...
def is_normal(self, x: _Decimal, /) -> bool: ...
def is_qnan(self, x: _Decimal, /) -> bool: ...
def is_signed(self, x: _Decimal, /) -> bool: ...
def is_snan(self, x: _Decimal, /) -> bool: ...
def is_subnormal(self, x: _Decimal, /) -> bool: ...
def is_zero(self, x: _Decimal, /) -> bool: ...
def ln(self, x: _Decimal, /) -> Decimal: ...
def log10(self, x: _Decimal, /) -> Decimal: ...
def logb(self, x: _Decimal, /) -> Decimal: ...
def logical_and(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def logical_invert(self, x: _Decimal, /) -> Decimal: ...
def logical_or(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def logical_xor(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def max(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def max_mag(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def min(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def min_mag(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def minus(self, x: _Decimal, /) -> Decimal: ...
def multiply(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def next_minus(self, x: _Decimal, /) -> Decimal: ...
def next_plus(self, x: _Decimal, /) -> Decimal: ...
def next_toward(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
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: _Decimal | None = None) -> Decimal: ...
def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def quantize(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def radix(self) -> Decimal: ...
def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def remainder_near(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def rotate(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def same_quantum(self, __x: _Decimal, __y: _Decimal) -> bool: ...
def scaleb(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def shift(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def sqrt(self, __x: _Decimal) -> Decimal: ...
def subtract(self, __x: _Decimal, __y: _Decimal) -> Decimal: ...
def to_eng_string(self, __x: _Decimal) -> str: ...
def to_sci_string(self, __x: _Decimal) -> str: ...
def to_integral_exact(self, __x: _Decimal) -> Decimal: ...
def to_integral_value(self, __x: _Decimal) -> Decimal: ...
def to_integral(self, __x: _Decimal) -> Decimal: ...
def remainder(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def remainder_near(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def rotate(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def same_quantum(self, x: _Decimal, y: _Decimal, /) -> bool: ...
def scaleb(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def shift(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def sqrt(self, x: _Decimal, /) -> Decimal: ...
def subtract(self, x: _Decimal, y: _Decimal, /) -> Decimal: ...
def to_eng_string(self, x: _Decimal, /) -> str: ...
def to_sci_string(self, x: _Decimal, /) -> str: ...
def to_integral_exact(self, x: _Decimal, /) -> Decimal: ...
def to_integral_value(self, x: _Decimal, /) -> Decimal: ...
def to_integral(self, x: _Decimal, /) -> Decimal: ...
DefaultContext: Context
BasicContext: Context