Add from_number for float, complex, and Fraction (3.14) (#14091)

This commit is contained in:
Max Muoto
2025-05-18 00:09:59 -05:00
committed by GitHub
parent 9430260770
commit 1c5164f069
3 changed files with 9 additions and 3 deletions
@@ -27,8 +27,6 @@ asyncio.tasks.eager_task_factory
builtins.bytearray.resize
builtins.classmethod.__annotate__
builtins.classmethod.__class_getitem__
builtins.complex.from_number
builtins.float.from_number
builtins.int.__round__
builtins.memoryview.__class_getitem__
builtins.staticmethod.__annotate__
@@ -56,7 +54,6 @@ enum.EnumType.__signature__
faulthandler.dump_c_stack
fractions.Fraction.__pow__
fractions.Fraction.__rpow__
fractions.Fraction.from_number
gzip.GzipFile.readinto
gzip.GzipFile.readinto1
gzip.compress
+6
View File
@@ -400,6 +400,9 @@ class float:
def __abs__(self) -> float: ...
def __hash__(self) -> int: ...
def __bool__(self) -> bool: ...
if sys.version_info >= (3, 14):
@classmethod
def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self: ...
class complex:
# Python doesn't currently accept SupportsComplex for the second argument
@@ -435,6 +438,9 @@ class complex:
def __bool__(self) -> bool: ...
if sys.version_info >= (3, 11):
def __complex__(self) -> complex: ...
if sys.version_info >= (3, 14):
@classmethod
def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self: ...
class _FormatMapMapping(Protocol):
def __getitem__(self, key: str, /) -> Any: ...
+3
View File
@@ -145,3 +145,6 @@ class Fraction(Rational):
@property
def imag(self) -> Literal[0]: ...
def conjugate(self) -> Fraction: ...
if sys.version_info >= (3, 14):
@classmethod
def from_number(cls, number: float | Rational | _ConvertibleToIntegerRatio) -> Self: ...