diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 3e14b60da..ed4cd3477 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -5,7 +5,7 @@ from typing import ( TypeVar, Iterator, Iterable, NoReturn, overload, Container, Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, - SupportsComplex, SupportsRound, IO, BinaryIO, Union, + SupportsComplex, IO, BinaryIO, Union, ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text, Protocol, ) @@ -15,7 +15,7 @@ from types import TracebackType, CodeType import sys if sys.version_info >= (3,): - from typing import SupportsBytes + from typing import SupportsBytes, SupportsRound _T = TypeVar('_T') _T_co = TypeVar('_T_co', covariant=True) @@ -1370,9 +1370,9 @@ else: @overload def round(number: float, ndigits: int) -> float: ... @overload - def round(number: SupportsRound[_T]) -> _T: ... + def round(number: SupportsFloat) -> float: ... @overload - def round(number: SupportsRound[_T], ndigits: int) -> _T: ... + def round(number: SupportsFloat, ndigits: int) -> float: ... def setattr(object: Any, name: Text, value: Any) -> None: ... if sys.version_info >= (3,): def sorted(iterable: Iterable[_T], *, diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 7049d10bb..85678ae8b 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -86,11 +86,6 @@ class SupportsAbs(Protocol[_T_co]): @abstractmethod def __abs__(self) -> _T_co: ... -@runtime -class SupportsRound(Protocol[_T_co]): - @abstractmethod - def __round__(self, ndigits: int = ...) -> _T_co: ... - @runtime class Reversible(Protocol[_T_co]): @abstractmethod diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 3e14b60da..ed4cd3477 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -5,7 +5,7 @@ from typing import ( TypeVar, Iterator, Iterable, NoReturn, overload, Container, Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, - SupportsComplex, SupportsRound, IO, BinaryIO, Union, + SupportsComplex, IO, BinaryIO, Union, ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text, Protocol, ) @@ -15,7 +15,7 @@ from types import TracebackType, CodeType import sys if sys.version_info >= (3,): - from typing import SupportsBytes + from typing import SupportsBytes, SupportsRound _T = TypeVar('_T') _T_co = TypeVar('_T_co', covariant=True) @@ -1370,9 +1370,9 @@ else: @overload def round(number: float, ndigits: int) -> float: ... @overload - def round(number: SupportsRound[_T]) -> _T: ... + def round(number: SupportsFloat) -> float: ... @overload - def round(number: SupportsRound[_T], ndigits: int) -> _T: ... + def round(number: SupportsFloat, ndigits: int) -> float: ... def setattr(object: Any, name: Text, value: Any) -> None: ... if sys.version_info >= (3,): def sorted(iterable: Iterable[_T], *, diff --git a/stdlib/2and3/decimal.pyi b/stdlib/2and3/decimal.pyi index 6adff15d0..2018ed844 100644 --- a/stdlib/2and3/decimal.pyi +++ b/stdlib/2and3/decimal.pyi @@ -124,8 +124,6 @@ class Decimal(object): @overload def __round__(self) -> int: ... @overload - def __round__(self, ndigits: None) -> int: ... - @overload def __round__(self, ndigits: int) -> Decimal: ... def __floor__(self) -> int: ... def __ceil__(self) -> int: ... diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index afc21186c..921b63ae9 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -95,8 +95,12 @@ class SupportsAbs(Protocol[_T_co]): @runtime class SupportsRound(Protocol[_T_co]): + @overload @abstractmethod - def __round__(self, ndigits: int = ...) -> _T_co: ... + def __round__(self) -> int: ... + @overload + @abstractmethod + def __round__(self, ndigits: int) -> _T_co: ... @runtime class Reversible(Protocol[_T_co]):