From ce6458cf2b91c82601c25f877034e8553b101d5e Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 17 Nov 2021 02:45:46 +0000 Subject: [PATCH] Use `_typeshed.SupportsTrunc` in `builtins` (#6326) --- stdlib/builtins.pyi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 895673e89..9d309dbbb 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -17,6 +17,7 @@ from _typeshed import ( SupportsLessThanT, SupportsNext, SupportsRDivMod, + SupportsTrunc, SupportsWrite, ) from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper @@ -64,9 +65,6 @@ from _collections_abc import dict_items, dict_keys, dict_values if sys.version_info >= (3, 9): from types import GenericAlias -class _SupportsTrunc(Protocol): - def __trunc__(self) -> int: ... - _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) _T_contra = TypeVar("_T_contra", contravariant=True) @@ -181,7 +179,7 @@ class super(object): class int: @overload - def __new__(cls: Type[_T], __x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ... + def __new__(cls: Type[_T], __x: str | bytes | SupportsInt | SupportsIndex | SupportsTrunc = ...) -> _T: ... @overload def __new__(cls: Type[_T], __x: str | bytes | bytearray, base: SupportsIndex) -> _T: ... if sys.version_info >= (3, 8):