builtins: add __trunc__ to int and float (#3194)

See:
https://docs.python.org/3/reference/datamodel.html#object.__trunc__

It also works on Python 2.7.
This commit is contained in:
Ran Benita
2019-08-17 17:22:03 +03:00
committed by Jelle Zijlstra
parent fab2ee0d7c
commit c0625d3280
2 changed files with 4 additions and 0 deletions

View File

@@ -183,6 +183,7 @@ class int:
def __neg__(self) -> int: ...
def __pos__(self) -> int: ...
def __invert__(self) -> int: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
def __getnewargs__(self) -> Tuple[int]: ...
@@ -240,6 +241,7 @@ class float:
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __getnewargs__(self) -> Tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
@overload
def __round__(self) -> int: ...

View File

@@ -183,6 +183,7 @@ class int:
def __neg__(self) -> int: ...
def __pos__(self) -> int: ...
def __invert__(self) -> int: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
def __getnewargs__(self) -> Tuple[int]: ...
@@ -240,6 +241,7 @@ class float:
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __getnewargs__(self) -> Tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
@overload
def __round__(self) -> int: ...