mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
builtins,numbers: harmonize float.__round__ and Real.__round__ (#3193)
See: https://docs.python.org/3/reference/datamodel.html#object.__round__ https://docs.python.org/3/library/functions.html#round
This commit is contained in:
committed by
Jelle Zijlstra
parent
c0625d3280
commit
c7417e8b3f
@@ -244,9 +244,7 @@ class float:
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: None) -> int: ...
|
||||
def __round__(self, ndigits: None = ...) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> float: ...
|
||||
|
||||
|
||||
@@ -244,9 +244,7 @@ class float:
|
||||
def __trunc__(self) -> int: ...
|
||||
if sys.version_info >= (3,):
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: None) -> int: ...
|
||||
def __round__(self, ndigits: None = ...) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> float: ...
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Note: these stubs are incomplete. The more complex type
|
||||
# signatures are currently omitted.
|
||||
|
||||
from typing import Any, Optional, SupportsFloat
|
||||
from typing import Any, Optional, SupportsFloat, overload
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import sys
|
||||
|
||||
@@ -70,7 +70,11 @@ class Real(Complex, SupportsFloat):
|
||||
@abstractmethod
|
||||
def __ceil__(self) -> int: ...
|
||||
@abstractmethod
|
||||
def __round__(self, ndigits: Optional[int] = ...): ...
|
||||
@overload
|
||||
def __round__(self, ndigits: None = ...): ...
|
||||
@abstractmethod
|
||||
@overload
|
||||
def __round__(self, ndigits: int): ...
|
||||
def __divmod__(self, other): ...
|
||||
def __rdivmod__(self, other): ...
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user