|
1 | | -from typing import Annotated |
| 1 | +from typing import Annotated, TypeAlias |
2 | 2 |
|
3 | 3 | import numpy as np |
4 | 4 |
|
5 | 5 | from pydantic_numpy.helper.annotation import NpArrayPydanticAnnotation |
6 | 6 |
|
7 | | -NpStrict2DArrayInt64 = Annotated[ |
| 7 | +Np2DArrayInt64: TypeAlias = Annotated[ |
8 | 8 | np.ndarray[tuple[int, int], np.dtype[np.int64]], |
9 | 9 | NpArrayPydanticAnnotation.factory(data_type=np.int64, dimensions=2, strict_data_typing=True), |
10 | 10 | ] |
11 | 11 |
|
12 | | -NpStrict2DArrayInt32 = Annotated[ |
| 12 | +Np2DArrayInt32: TypeAlias = Annotated[ |
13 | 13 | np.ndarray[tuple[int, int], np.dtype[np.int32]], |
14 | 14 | NpArrayPydanticAnnotation.factory(data_type=np.int32, dimensions=2, strict_data_typing=True), |
15 | 15 | ] |
16 | 16 |
|
17 | | -NpStrict2DArrayInt16 = Annotated[ |
| 17 | +Np2DArrayInt16: TypeAlias = Annotated[ |
18 | 18 | np.ndarray[tuple[int, int], np.dtype[np.int16]], |
19 | 19 | NpArrayPydanticAnnotation.factory(data_type=np.int16, dimensions=2, strict_data_typing=True), |
20 | 20 | ] |
21 | 21 |
|
22 | | -NpStrict2DArrayInt8 = Annotated[ |
| 22 | +Np2DArrayInt8: TypeAlias = Annotated[ |
23 | 23 | np.ndarray[tuple[int, int], np.dtype[np.int8]], |
24 | 24 | NpArrayPydanticAnnotation.factory(data_type=np.int8, dimensions=2, strict_data_typing=True), |
25 | 25 | ] |
26 | 26 |
|
27 | | -NpStrict2DArrayUint64 = Annotated[ |
| 27 | +Np2DArrayUint64: TypeAlias = Annotated[ |
28 | 28 | np.ndarray[tuple[int, int], np.dtype[np.uint64]], |
29 | 29 | NpArrayPydanticAnnotation.factory(data_type=np.uint64, dimensions=2, strict_data_typing=True), |
30 | 30 | ] |
31 | 31 |
|
32 | | -NpStrict2DArrayUint32 = Annotated[ |
| 32 | +Np2DArrayUint32: TypeAlias = Annotated[ |
33 | 33 | np.ndarray[tuple[int, int], np.dtype[np.uint32]], |
34 | 34 | NpArrayPydanticAnnotation.factory(data_type=np.uint32, dimensions=2, strict_data_typing=True), |
35 | 35 | ] |
36 | 36 |
|
37 | | -NpStrict2DArrayUint16 = Annotated[ |
| 37 | +Np2DArrayUint16: TypeAlias = Annotated[ |
38 | 38 | np.ndarray[tuple[int, int], np.dtype[np.uint16]], |
39 | 39 | NpArrayPydanticAnnotation.factory(data_type=np.uint16, dimensions=2, strict_data_typing=True), |
40 | 40 | ] |
41 | 41 |
|
42 | | -NpStrict2DArrayUint8 = Annotated[ |
| 42 | +Np2DArrayUint8: TypeAlias = Annotated[ |
43 | 43 | np.ndarray[tuple[int, int], np.dtype[np.uint8]], |
44 | 44 | NpArrayPydanticAnnotation.factory(data_type=np.uint8, dimensions=2, strict_data_typing=True), |
45 | 45 | ] |
46 | 46 |
|
47 | | -NpStrict2DArrayFpLongDouble = Annotated[ |
| 47 | +Np2DArrayFpLongDouble: TypeAlias = Annotated[ |
48 | 48 | np.ndarray[tuple[int, int], np.dtype[np.longdouble]], |
49 | 49 | NpArrayPydanticAnnotation.factory(data_type=np.longdouble, dimensions=2, strict_data_typing=True), |
50 | 50 | ] |
51 | 51 |
|
52 | | -NpStrict2DArrayFp64 = Annotated[ |
| 52 | +Np2DArrayFp64: TypeAlias = Annotated[ |
53 | 53 | np.ndarray[tuple[int, int], np.dtype[np.float64]], |
54 | 54 | NpArrayPydanticAnnotation.factory(data_type=np.float64, dimensions=2, strict_data_typing=True), |
55 | 55 | ] |
56 | 56 |
|
57 | | -NpStrict2DArrayFp32 = Annotated[ |
| 57 | +Np2DArrayFp32: TypeAlias = Annotated[ |
58 | 58 | np.ndarray[tuple[int, int], np.dtype[np.float32]], |
59 | 59 | NpArrayPydanticAnnotation.factory(data_type=np.float32, dimensions=2, strict_data_typing=True), |
60 | 60 | ] |
61 | 61 |
|
62 | | -NpStrict2DArrayFp16 = Annotated[ |
| 62 | +Np2DArrayFp16: TypeAlias = Annotated[ |
63 | 63 | np.ndarray[tuple[int, int], np.dtype[np.float16]], |
64 | 64 | NpArrayPydanticAnnotation.factory(data_type=np.float16, dimensions=2, strict_data_typing=True), |
65 | 65 | ] |
66 | 66 |
|
67 | | -NpStrict2DArrayComplexLongDouble = Annotated[ |
| 67 | +Np2DArrayComplexLongDouble: TypeAlias = Annotated[ |
68 | 68 | np.ndarray[tuple[int, int], np.dtype[np.clongdouble]], |
69 | 69 | NpArrayPydanticAnnotation.factory(data_type=np.clongdouble, dimensions=2, strict_data_typing=True), |
70 | 70 | ] |
71 | 71 |
|
72 | | -NpStrict2DArrayComplex128 = Annotated[ |
| 72 | +Np2DArrayComplex128: TypeAlias = Annotated[ |
73 | 73 | np.ndarray[tuple[int, int], np.dtype[np.complex128]], |
74 | 74 | NpArrayPydanticAnnotation.factory(data_type=np.complex128, dimensions=2, strict_data_typing=True), |
75 | 75 | ] |
76 | 76 |
|
77 | | -NpStrict2DArrayComplex64 = Annotated[ |
| 77 | +Np2DArrayComplex64: TypeAlias = Annotated[ |
78 | 78 | np.ndarray[tuple[int, int], np.dtype[np.complex64]], |
79 | 79 | NpArrayPydanticAnnotation.factory(data_type=np.complex64, dimensions=2, strict_data_typing=True), |
80 | 80 | ] |
81 | 81 |
|
82 | | -NpStrict2DArrayBool = Annotated[ |
| 82 | +Np2DArrayBool: TypeAlias = Annotated[ |
83 | 83 | np.ndarray[tuple[int, int], np.dtype[np.bool_]], |
84 | 84 | NpArrayPydanticAnnotation.factory(data_type=np.bool_, dimensions=2, strict_data_typing=True), |
85 | 85 | ] |
86 | 86 |
|
87 | | -NpStrict2DArrayDatetime64 = Annotated[ |
| 87 | +Np2DArrayDatetime64: TypeAlias = Annotated[ |
88 | 88 | np.ndarray[tuple[int, int], np.dtype[np.datetime64]], |
89 | 89 | NpArrayPydanticAnnotation.factory(data_type=np.datetime64, dimensions=2, strict_data_typing=True), |
90 | 90 | ] |
91 | 91 |
|
92 | | -NpStrict2DArrayTimedelta64 = Annotated[ |
| 92 | +Np2DArrayTimedelta64: TypeAlias = Annotated[ |
93 | 93 | np.ndarray[tuple[int, int], np.dtype[np.timedelta64]], |
94 | 94 | NpArrayPydanticAnnotation.factory(data_type=np.timedelta64, dimensions=2, strict_data_typing=True), |
95 | 95 | ] |
96 | 96 |
|
97 | 97 | __all__ = [ |
98 | | - "NpStrict2DArrayInt64", |
99 | | - "NpStrict2DArrayInt32", |
100 | | - "NpStrict2DArrayInt16", |
101 | | - "NpStrict2DArrayInt8", |
102 | | - "NpStrict2DArrayUint64", |
103 | | - "NpStrict2DArrayUint32", |
104 | | - "NpStrict2DArrayUint16", |
105 | | - "NpStrict2DArrayUint8", |
106 | | - "NpStrict2DArrayFpLongDouble", |
107 | | - "NpStrict2DArrayFp64", |
108 | | - "NpStrict2DArrayFp32", |
109 | | - "NpStrict2DArrayFp16", |
110 | | - "NpStrict2DArrayComplexLongDouble", |
111 | | - "NpStrict2DArrayComplex128", |
112 | | - "NpStrict2DArrayComplex64", |
113 | | - "NpStrict2DArrayBool", |
114 | | - "NpStrict2DArrayDatetime64", |
115 | | - "NpStrict2DArrayTimedelta64", |
| 98 | + "Np2DArrayInt64", |
| 99 | + "Np2DArrayInt32", |
| 100 | + "Np2DArrayInt16", |
| 101 | + "Np2DArrayInt8", |
| 102 | + "Np2DArrayUint64", |
| 103 | + "Np2DArrayUint32", |
| 104 | + "Np2DArrayUint16", |
| 105 | + "Np2DArrayUint8", |
| 106 | + "Np2DArrayFpLongDouble", |
| 107 | + "Np2DArrayFp64", |
| 108 | + "Np2DArrayFp32", |
| 109 | + "Np2DArrayFp16", |
| 110 | + "Np2DArrayComplexLongDouble", |
| 111 | + "Np2DArrayComplex128", |
| 112 | + "Np2DArrayComplex64", |
| 113 | + "Np2DArrayBool", |
| 114 | + "Np2DArrayDatetime64", |
| 115 | + "Np2DArrayTimedelta64", |
116 | 116 | ] |
0 commit comments