Add __divmod__ to numeric types (#1900)

Helps with #1889
This commit is contained in:
David Euresti
2018-02-18 16:59:12 -08:00
committed by Jelle Zijlstra
parent b6bd58268b
commit 8ecb74012a
3 changed files with 10 additions and 0 deletions

View File

@@ -101,6 +101,7 @@ class int:
def __div__(self, x: int) -> int: ...
def __truediv__(self, x: int) -> float: ...
def __mod__(self, x: int) -> int: ...
def __divmod__(self, x: int) -> Tuple[int, int]: ...
def __radd__(self, x: int) -> int: ...
def __rsub__(self, x: int) -> int: ...
def __rmul__(self, x: int) -> int: ...
@@ -108,6 +109,7 @@ class int:
def __rdiv__(self, x: int) -> int: ...
def __rtruediv__(self, x: int) -> float: ...
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int) -> Any: ...
def __and__(self, n: int) -> int: ...
@@ -153,6 +155,7 @@ class float:
def __div__(self, x: float) -> float: ...
def __truediv__(self, x: float) -> float: ...
def __mod__(self, x: float) -> float: ...
def __divmod__(self, x: float) -> Tuple[float, float]: ...
def __pow__(self, x: float) -> float: ...
def __radd__(self, x: float) -> float: ...
def __rsub__(self, x: float) -> float: ...
@@ -161,6 +164,7 @@ class float:
def __rdiv__(self, x: float) -> float: ...
def __rtruediv__(self, x: float) -> float: ...
def __rmod__(self, x: float) -> float: ...
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __eq__(self, x: object) -> bool: ...

View File

@@ -62,6 +62,8 @@ class Fraction(Rational):
def __rfloordiv__(self, other) -> int: ...
def __mod__(self, other): ...
def __rmod__(self, other): ...
def __divmod__(self, other): ...
def __rdivmod__(self, other): ...
def __pow__(self, other): ...
def __rpow__(self, other): ...

View File

@@ -121,12 +121,14 @@ class int:
def __floordiv__(self, x: int) -> int: ...
def __truediv__(self, x: int) -> float: ...
def __mod__(self, x: int) -> int: ...
def __divmod__(self, x: int) -> Tuple[int, int]: ...
def __radd__(self, x: int) -> int: ...
def __rsub__(self, x: int) -> int: ...
def __rmul__(self, x: int) -> int: ...
def __rfloordiv__(self, x: int) -> int: ...
def __rtruediv__(self, x: int) -> float: ...
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int) -> Any: ...
def __and__(self, n: int) -> int: ...
@@ -171,6 +173,7 @@ class float:
def __floordiv__(self, x: float) -> float: ...
def __truediv__(self, x: float) -> float: ...
def __mod__(self, x: float) -> float: ...
def __divmod__(self, x: float) -> Tuple[float, float]: ...
def __pow__(self, x: float) -> float: ...
def __radd__(self, x: float) -> float: ...
def __rsub__(self, x: float) -> float: ...
@@ -178,6 +181,7 @@ class float:
def __rfloordiv__(self, x: float) -> float: ...
def __rtruediv__(self, x: float) -> float: ...
def __rmod__(self, x: float) -> float: ...
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __eq__(self, x: object) -> bool: ...