8000 builtins,numbers: harmonize float.__round__ and Real.__round__ · python/typeshed@f107320 · GitHub
[go: up one dir, main page]

Skip to content

Commit f107320

Browse files
committed
1 parent a8cbf77 commit f107320

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

stdlib/2and3/builtins.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,7 @@ class float:
245245
def __getnewargs__(self) -> Tuple[float]: ...
246246
if sys.version_info >= (3,):
247247
@overload
248-
def __round__(self) -> int: ...
249-
@overload
250-
def __round__(self, ndigits: None) -> int: ...
248+
def __round__(self, ndigits: None = ...) -> int: ...
251249
@overload
252250
def __round__(self, ndigits: int) -> float: ...
253251
def __trunc__(self) -> int: ...

stdlib/2and3/numbers.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Note: these stubs are incomplete. The more complex type
66
# signatures are currently omitted.
77

8-
from typing import Any, Optional, SupportsFloat
8+
from typing import Any, Optional, SupportsFloat, overload
99
from abc import ABCMeta, abstractmethod
1010
import sys
1111

@@ -70,7 +70,11 @@ class Real(Complex, SupportsFloat):
7070
@abstractmethod
7171
def __ceil__(self) -> int: ...
7272
@abstractmethod
73-
def __round__(self, ndigits: Optional[int] = ...): ...
73+
@overload
74+
def __round__(self, ndigits: None = ...): ...
75+
@abstractmethod
76+
@overload
77+
def __round__(self, ndigits: int): ...
7478
def __divmod__(self, other): ...
7579
def __rdivmod__(self, other): ...
7680
@abstractmethod

0 commit comments

Comments
 (0)
0