codekingpro/portable-devtools
114k
1from typing import type_check_only
2
3import numpy as np
4import numpy.typing as npt
5
6_0d_bool: np.bool
7_nd_bool: npt.NDArray[np.bool]
8_nd_td64: npt.NDArray[np.timedelta64]
9_to_2d_bool: list[list[bool]]
10
11@type_check_only
12def func1(ar: np.ndarray, a: int) -> npt.NDArray[np.str_]: ...
13@type_check_only
14def func2(ar: np.ndarray, a: float) -> float: ...
15
16###
17
18np.eye(10, M=20.0) # type: ignore[call-overload]
19np.eye(10, k=2.5, dtype=int) # type: ignore[call-overload]
20
21np.diag(_nd_bool, k=0.5) # type: ignore[call-overload]
22np.diagflat(_nd_bool, k=0.5) # type: ignore[call-overload]
23
24np.tri(10, M=20.0) # type: ignore[call-overload]
25np.tri(10, k=2.5, dtype=int) # type: ignore[call-overload]
26
27np.tril(_nd_bool, k=0.5) # type: ignore[call-overload]
28np.triu(_nd_bool, k=0.5) # type: ignore[call-overload]
29
30np.vander(_nd_td64) # type: ignore[type-var]
31
32np.histogram2d(_nd_td64) # type: ignore[call-overload]
33
34np.mask_indices(10, func1) # type: ignore[arg-type]
35np.mask_indices(10, func2, 10.5) # type: ignore[arg-type]
36
37np.tril_indices(3.14) # type: ignore[arg-type]
38
39np.tril_indices_from(_to_2d_bool) # type: ignore[arg-type]
40 