From 7770fabc4e77f79585c810db66da443bc50e5061 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 8 Jul 2019 11:07:57 +0300 Subject: [PATCH] builtins: add __trunc__ to int and float See: https://docs.python.org/3/reference/datamodel.html#object.__trunc__ It also works on Python 2.7. --- stdlib/2/__builtin__.pyi | 2 ++ stdlib/2and3/builtins.pyi | 2 ++ 2 files changed, 4 insertions(+) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index daadf8fb040c..4c94058b987d 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -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: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index daadf8fb040c..4c94058b987d 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -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: ...