Use _typeshed.SupportsTrunc in builtins (#6326)

This commit is contained in:
Alex Waygood
2021-11-17 02:45:46 +00:00
committed by GitHub
parent aa2290e160
commit ce6458cf2b

View File

@@ -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):