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 33__all__ = ["Array" , "DType" , "Device" ]
44_all_ignore = ["np" ]
55
6- from typing import Literal , TYPE_CHECKING
6+ from typing import TYPE_CHECKING , Any , Literal , TypeAlias
77
88import numpy as np
9- from numpy import ndarray as Array
109
11- Device = Literal ["cpu" ]
10+ Device : TypeAlias = Literal ["cpu" ]
1211if TYPE_CHECKING :
1312 # 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 ]
2416 | np .float32
2517 | np .float64
2618 | np .complex64
2719 | np .complex128
28- | np .bool
2920 ]
21+ Array : TypeAlias = np .ndarray [Any , DType ]
3022else :
3123 DType = np .dtype
24+ Array = np .ndarray
You can’t perform that action at this time.
0 commit comments