File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change 3
3
__all__ = ["Array" , "DType" , "Device" ]
4
4
_all_ignore = ["np" ]
5
5
6
- from typing import Literal , TYPE_CHECKING
6
+ from typing import TYPE_CHECKING , Any , Literal , TypeAlias
7
7
8
8
import numpy as np
9
- from numpy import ndarray as Array
10
9
11
- Device = Literal ["cpu" ]
10
+ Device : TypeAlias = Literal ["cpu" ]
12
11
if TYPE_CHECKING :
13
12
# NumPy 1.x on Python 3.10 fails to parse np.dtype[]
14
- DType = np .dtype [
15
- np .intp
16
- | np .int8
17
- | np .int16
18
- | np .int32
19
- | np .int64
20
- | np .uint8
21
- | np .uint16
22
- | np .uint32
23
- | np .uint64
13
+ DType : TypeAlias = np .dtype [
14
+ np .bool_
15
+ | np .integer [Any ]
24
16
| np .float32
25
17
| np .float64
26
18
| np .complex64
27
19
| np .complex128
28
- | np .bool
29
20
]
21
+ Array : TypeAlias = np .ndarray [Any , DType ]
30
22
else :
31
23
DType = np .dtype
24
+ Array = np .ndarray
You can’t perform that action at this time.
0 commit comments