|
1 | 1 | import sys |
2 | 2 | from _typeshed import SupportsTrunc |
3 | | -from typing import Iterable, SupportsFloat, SupportsInt, overload |
| 3 | +from typing import Iterable, SupportsFloat, Union, overload |
| 4 | +from typing_extensions import SupportsIndex |
| 5 | + |
| 6 | +_SupportsFloatOrIndex = Union[SupportsFloat, SupportsIndex] |
4 | 7 |
|
5 | 8 | e: float |
6 | 9 | pi: float |
7 | 10 | inf: float |
8 | 11 | nan: float |
9 | 12 | tau: float |
10 | 13 |
|
11 | | -def acos(__x: SupportsFloat) -> float: ... |
12 | | -def acosh(__x: SupportsFloat) -> float: ... |
13 | | -def asin(__x: SupportsFloat) -> float: ... |
14 | | -def asinh(__x: SupportsFloat) -> float: ... |
15 | | -def atan(__x: SupportsFloat) -> float: ... |
16 | | -def atan2(__y: SupportsFloat, __x: SupportsFloat) -> float: ... |
17 | | -def atanh(__x: SupportsFloat) -> float: ... |
18 | | -def ceil(__x: SupportsFloat) -> int: ... |
| 14 | +def acos(__x: _SupportsFloatOrIndex) -> float: ... |
| 15 | +def acosh(__x: _SupportsFloatOrIndex) -> float: ... |
| 16 | +def asin(__x: _SupportsFloatOrIndex) -> float: ... |
| 17 | +def asinh(__x: _SupportsFloatOrIndex) -> float: ... |
| 18 | +def atan(__x: _SupportsFloatOrIndex) -> float: ... |
| 19 | +def atan2(__y: _SupportsFloatOrIndex, __x: _SupportsFloatOrIndex) -> float: ... |
| 20 | +def atanh(__x: _SupportsFloatOrIndex) -> float: ... |
| 21 | +def ceil(__x: _SupportsFloatOrIndex) -> int: ... |
19 | 22 |
|
20 | 23 | if sys.version_info >= (3, 8): |
21 | | - def comb(__n: int, __k: int) -> int: ... |
| 24 | + def comb(__n: SupportsIndex, __k: SupportsIndex) -> int: ... |
22 | 25 |
|
23 | | -def copysign(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
24 | | -def cos(__x: SupportsFloat) -> float: ... |
25 | | -def cosh(__x: SupportsFloat) -> float: ... |
26 | | -def degrees(__x: SupportsFloat) -> float: ... |
| 26 | +def copysign(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
| 27 | +def cos(__x: _SupportsFloatOrIndex) -> float: ... |
| 28 | +def cosh(__x: _SupportsFloatOrIndex) -> float: ... |
| 29 | +def degrees(__x: _SupportsFloatOrIndex) -> float: ... |
27 | 30 |
|
28 | 31 | if sys.version_info >= (3, 8): |
29 | | - def dist(__p: Iterable[SupportsFloat], __q: Iterable[SupportsFloat]) -> float: ... |
30 | | - |
31 | | -def erf(__x: SupportsFloat) -> float: ... |
32 | | -def erfc(__x: SupportsFloat) -> float: ... |
33 | | -def exp(__x: SupportsFloat) -> float: ... |
34 | | -def expm1(__x: SupportsFloat) -> float: ... |
35 | | -def fabs(__x: SupportsFloat) -> float: ... |
36 | | -def factorial(__x: SupportsInt) -> int: ... |
37 | | -def floor(__x: SupportsFloat) -> int: ... |
38 | | -def fmod(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
39 | | -def frexp(__x: SupportsFloat) -> tuple[float, int]: ... |
40 | | -def fsum(__seq: Iterable[float]) -> float: ... |
41 | | -def gamma(__x: SupportsFloat) -> float: ... |
| 32 | + def dist(__p: Iterable[_SupportsFloatOrIndex], __q: Iterable[_SupportsFloatOrIndex]) -> float: ... |
| 33 | + |
| 34 | +def erf(__x: _SupportsFloatOrIndex) -> float: ... |
| 35 | +def erfc(__x: _SupportsFloatOrIndex) -> float: ... |
| 36 | +def exp(__x: _SupportsFloatOrIndex) -> float: ... |
| 37 | +def expm1(__x: _SupportsFloatOrIndex) -> float: ... |
| 38 | +def fabs(__x: _SupportsFloatOrIndex) -> float: ... |
| 39 | +def factorial(__x: SupportsIndex) -> int: ... |
| 40 | +def floor(__x: _SupportsFloatOrIndex) -> int: ... |
| 41 | +def fmod(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
| 42 | +def frexp(__x: _SupportsFloatOrIndex) -> tuple[float, int]: ... |
| 43 | +def fsum(__seq: Iterable[_SupportsFloatOrIndex]) -> float: ... |
| 44 | +def gamma(__x: _SupportsFloatOrIndex) -> float: ... |
42 | 45 |
|
43 | 46 | if sys.version_info >= (3, 9): |
44 | | - def gcd(*integers: int) -> int: ... |
| 47 | + def gcd(*integers: SupportsIndex) -> int: ... |
45 | 48 |
|
46 | 49 | else: |
47 | | - def gcd(__x: int, __y: int) -> int: ... |
| 50 | + def gcd(__x: SupportsIndex, __y: SupportsIndex) -> int: ... |
48 | 51 |
|
49 | 52 | if sys.version_info >= (3, 8): |
50 | | - def hypot(*coordinates: SupportsFloat) -> float: ... |
| 53 | + def hypot(*coordinates: _SupportsFloatOrIndex) -> float: ... |
51 | 54 |
|
52 | 55 | else: |
53 | | - def hypot(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
54 | | - |
55 | | -def isclose(a: SupportsFloat, b: SupportsFloat, *, rel_tol: SupportsFloat = ..., abs_tol: SupportsFloat = ...) -> bool: ... |
56 | | -def isinf(__x: SupportsFloat) -> bool: ... |
57 | | -def isfinite(__x: SupportsFloat) -> bool: ... |
58 | | -def isnan(__x: SupportsFloat) -> bool: ... |
| 56 | + def hypot(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
| 57 | + |
| 58 | +def isclose( |
| 59 | + a: _SupportsFloatOrIndex, |
| 60 | + b: _SupportsFloatOrIndex, |
| 61 | + *, |
| 62 | + rel_tol: _SupportsFloatOrIndex = ..., |
| 63 | + abs_tol: _SupportsFloatOrIndex = ..., |
| 64 | +) -> bool: ... |
| 65 | +def isinf(__x: _SupportsFloatOrIndex) -> bool: ... |
| 66 | +def isfinite(__x: _SupportsFloatOrIndex) -> bool: ... |
| 67 | +def isnan(__x: _SupportsFloatOrIndex) -> bool: ... |
59 | 68 |
|
60 | 69 | if sys.version_info >= (3, 8): |
61 | | - def isqrt(__n: int) -> int: ... |
| 70 | + def isqrt(__n: SupportsIndex) -> int: ... |
62 | 71 |
|
63 | 72 | if sys.version_info >= (3, 9): |
64 | | - def lcm(*integers: int) -> int: ... |
| 73 | + def lcm(*integers: SupportsIndex) -> int: ... |
65 | 74 |
|
66 | | -def ldexp(__x: SupportsFloat, __i: int) -> float: ... |
67 | | -def lgamma(__x: SupportsFloat) -> float: ... |
68 | | -def log(x: SupportsFloat, base: SupportsFloat = ...) -> float: ... |
69 | | -def log10(__x: SupportsFloat) -> float: ... |
70 | | -def log1p(__x: SupportsFloat) -> float: ... |
71 | | -def log2(__x: SupportsFloat) -> float: ... |
72 | | -def modf(__x: SupportsFloat) -> tuple[float, float]: ... |
| 75 | +def ldexp(__x: _SupportsFloatOrIndex, __i: int) -> float: ... |
| 76 | +def lgamma(__x: _SupportsFloatOrIndex) -> float: ... |
| 77 | +def log(x: _SupportsFloatOrIndex, base: _SupportsFloatOrIndex = ...) -> float: ... |
| 78 | +def log10(__x: _SupportsFloatOrIndex) -> float: ... |
| 79 | +def log1p(__x: _SupportsFloatOrIndex) -> float: ... |
| 80 | +def log2(__x: _SupportsFloatOrIndex) -> float: ... |
| 81 | +def modf(__x: _SupportsFloatOrIndex) -> tuple[float, float]: ... |
73 | 82 |
|
74 | 83 | if sys.version_info >= (3, 9): |
75 | | - def nextafter(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
| 84 | + def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
76 | 85 |
|
77 | 86 | if sys.version_info >= (3, 8): |
78 | | - def perm(__n: int, __k: int | None = ...) -> int: ... |
| 87 | + def perm(__n: SupportsIndex, __k: SupportsIndex | None = ...) -> int: ... |
79 | 88 |
|
80 | | -def pow(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
| 89 | +def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
81 | 90 |
|
82 | 91 | if sys.version_info >= (3, 8): |
83 | 92 | @overload |
84 | | - def prod(__iterable: Iterable[int], *, start: int = ...) -> int: ... # type: ignore |
| 93 | + def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = ...) -> int: ... # type: ignore |
85 | 94 | @overload |
86 | | - def prod(__iterable: Iterable[SupportsFloat], *, start: SupportsFloat = ...) -> float: ... |
| 95 | + def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = ...) -> float: ... |
87 | 96 |
|
88 | | -def radians(__x: SupportsFloat) -> float: ... |
| 97 | +def radians(__x: _SupportsFloatOrIndex) -> float: ... |
89 | 98 |
|
90 | 99 | if sys.version_info >= (3, 7): |
91 | | - def remainder(__x: SupportsFloat, __y: SupportsFloat) -> float: ... |
| 100 | + def remainder(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... |
92 | 101 |
|
93 | | -def sin(__x: SupportsFloat) -> float: ... |
94 | | -def sinh(__x: SupportsFloat) -> float: ... |
95 | | -def sqrt(__x: SupportsFloat) -> float: ... |
96 | | -def tan(__x: SupportsFloat) -> float: ... |
97 | | -def tanh(__x: SupportsFloat) -> float: ... |
| 102 | +def sin(__x: _SupportsFloatOrIndex) -> float: ... |
| 103 | +def sinh(__x: _SupportsFloatOrIndex) -> float: ... |
| 104 | +def sqrt(__x: _SupportsFloatOrIndex) -> float: ... |
| 105 | +def tan(__x: _SupportsFloatOrIndex) -> float: ... |
| 106 | +def tanh(__x: _SupportsFloatOrIndex) -> float: ... |
98 | 107 | def trunc(__x: SupportsTrunc) -> int: ... |
99 | 108 |
|
100 | 109 | if sys.version_info >= (3, 9): |
101 | | - def ulp(__x: SupportsFloat) -> float: ... |
| 110 | + def ulp(__x: _SupportsFloatOrIndex) -> float: ... |
0 commit comments