fractions: make Fraction satisfy SupportsRound (#4697)

Helps with https://github.com/python/mypy/issues/9628

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-10-22 12:12:27 -07:00
committed by GitHub
parent 74bb849789
commit b0f4900c9f
2 changed files with 4 additions and 4 deletions

View File

@@ -143,9 +143,9 @@ class Fraction(Rational):
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
@overload
def __round__(self, ndigits: int) -> Fraction: ...
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@overload
def __round__(self, ndigits: int) -> Fraction: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: _ComparableNum) -> bool: ...

View File

@@ -71,10 +71,10 @@ class Real(Complex, SupportsFloat):
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
def __round__(self, ndigits: None = ...) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
def __round__(self, ndigits: int) -> Any: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
@abstractmethod