Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
ndarray_misc.pyi50 linesDownload Raw Back to fail
1"""
2Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.
3
4More extensive tests are performed for the methods'
5function-based counterpart in `../from_numeric.py`.
6
7"""
8from typing import Never
9
10import numpy as np
11import numpy.typing as npt
12
13f8: np.float64
14AR_f8: npt.NDArray[np.float64]
15AR_M: npt.NDArray[np.datetime64]
16AR_b: npt.NDArray[np.bool]
17
18ctypes_obj = AR_f8.ctypes
19
20f8.argpartition(0)  # type: ignore[attr-defined]
21f8.partition(0)  # type: ignore[attr-defined]
22f8.dot(1)  # type: ignore[attr-defined]
23
24# NOTE: The following functions retur `Never`, causing mypy to stop analysis at that
25# point, which we circumvent by wrapping them in a function.
26
27def f8_diagonal(x: np.float64) -> Never:
28    return x.diagonal()  # type: ignore[misc]
29
30def f8_nonzero(x: np.float64) -> Never:
31    return x.nonzero()  # type: ignore[misc]
32
33def f8_setfield(x: np.float64) -> Never:
34    return x.setfield(2, np.float64)  # type: ignore[misc]
35
36def f8_sort(x: np.float64) -> Never:
37    return x.sort()  # type: ignore[misc]
38
39def f8_trace(x: np.float64) -> Never:
40    return x.trace()  # type: ignore[misc]
41
42AR_M.__complex__()  # type: ignore[misc]
43AR_b.__index__()  # type: ignore[misc]
44
45AR_f8[1.5]  # type: ignore[call-overload]
46AR_f8["field_a"]  # type: ignore[call-overload]
47AR_f8[["field_a", "field_b"]]  # type: ignore[index]
48
49AR_f8.__array_finalize__(object())  # type: ignore[arg-type]
50 
codekingpro/portable-devtools · Team Ai