mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Allow math.trunc to only accept __trunc__-supporting objects (#6003)
Add SupportsTrunc protocol
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import SupportsTrunc
|
||||
from typing import Iterable, SupportsFloat, SupportsInt, Tuple, overload
|
||||
|
||||
e: float
|
||||
@@ -94,7 +95,7 @@ def sinh(__x: SupportsFloat) -> float: ...
|
||||
def sqrt(__x: SupportsFloat) -> float: ...
|
||||
def tan(__x: SupportsFloat) -> float: ...
|
||||
def tanh(__x: SupportsFloat) -> float: ...
|
||||
def trunc(__x: SupportsFloat) -> int: ...
|
||||
def trunc(__x: SupportsTrunc) -> int: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def ulp(__x: SupportsFloat) -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user