@@ -24,10 +24,10 @@ def func(i: int, j: int, **kwargs: object) -> MyArray[np.float64]: ...
2424assert_type (np .array (A ), _nt .Array [np .float64 ])
2525assert_type (np .array (B ), _nt .Array1D [np .float64 ])
2626assert_type (np .array (D ), _nt .Array1D [np .float64 | np .int64 ])
27- assert_type (np .array ([1 , 1.0 ]), _nt .Array [ Any ] )
28- assert_type (np .array (deque ([1 , 2 , 3 ])), _nt .Array [ Any ] )
27+ assert_type (np .array ([1 , 1.0 ]), _nt .Array )
28+ assert_type (np .array (deque ([1 , 2 , 3 ])), _nt .Array )
2929assert_type (np .array (A , dtype = np .int64 ), _nt .Array [np .int64 ])
30- assert_type (np .array (A , dtype = "c16" ), _nt .Array [ Any ] )
30+ assert_type (np .array (A , dtype = "c16" ), _nt .Array )
3131assert_type (np .array (A , like = A ), _nt .Array [np .float64 ])
3232assert_type (np .array (A , subok = True ), _nt .Array [np .float64 ])
3333assert_type (np .array (B , subok = True ), MyArray [np .float64 ])
@@ -36,68 +36,68 @@ assert_type(np.array(B, subok=True, ndmin=1), MyArray[np.float64])
3636
3737assert_type (np .zeros ([1 , 5 , 6 ]), _nt .Array [np .float64 ])
3838assert_type (np .zeros ([1 , 5 , 6 ], dtype = np .int64 ), _nt .Array [np .int64 ])
39- assert_type (np .zeros ([1 , 5 , 6 ], dtype = "c16" ), _nt .Array [ Any ] )
39+ assert_type (np .zeros ([1 , 5 , 6 ], dtype = "c16" ), _nt .Array )
4040
4141assert_type (np .empty ([1 , 5 , 6 ]), _nt .Array [np .float64 ])
4242assert_type (np .empty ([1 , 5 , 6 ], dtype = np .int64 ), _nt .Array [np .int64 ])
43- assert_type (np .empty ([1 , 5 , 6 ], dtype = "c16" ), _nt .Array [ Any ] )
43+ assert_type (np .empty ([1 , 5 , 6 ], dtype = "c16" ), _nt .Array )
4444
4545assert_type (np .concatenate (A ), _nt .Array [np .float64 ])
46- assert_type (np .concatenate ([A , A ]), _nt .Array [Any ]) # pyright : ignore[reportAssertTypeFailure ] # _nt.Array[np.float64]
47- assert_type (np .concatenate ([[1 ], A ]), _nt .Array [ Any ] )
48- assert_type (np .concatenate ([[1 ], [1 ]]), _nt .Array [ Any ] )
46+ assert_type (np .concatenate ([A , A ]), _nt .Array [np . float64 ]) # type : ignore[assert-type ] # mypy fail
47+ assert_type (np .concatenate ([[1 ], A ]), _nt .Array )
48+ assert_type (np .concatenate ([[1 ], [1 ]]), _nt .Array )
4949assert_type (np .concatenate ((A , A )), _nt .Array [np .float64 ])
50- assert_type (np .concatenate (([1 ], [1 ])), _nt .Array [ Any ] )
51- assert_type (np .concatenate ([1 , 1.0 ]), _nt .Array [ Any ] )
50+ assert_type (np .concatenate (([1 ], [1 ])), _nt .Array )
51+ assert_type (np .concatenate ([1 , 1.0 ]), _nt .Array )
5252assert_type (np .concatenate (A , dtype = np .int64 ), _nt .Array [np .int64 ])
53- assert_type (np .concatenate (A , dtype = "c16" ), _nt .Array [ Any ] )
53+ assert_type (np .concatenate (A , dtype = "c16" ), _nt .Array )
5454assert_type (np .concatenate ([1 , 1.0 ], out = A ), _nt .Array [np .float64 ])
5555
5656assert_type (np .asarray (A ), _nt .Array [np .float64 ])
5757assert_type (np .asarray (B ), _nt .Array1D [np .float64 ])
58- assert_type (np .asarray ([1 , 1.0 ]), _nt .Array [ Any ] )
58+ assert_type (np .asarray ([1 , 1.0 ]), _nt .Array )
5959assert_type (np .asarray (A , dtype = np .int64 ), _nt .Array [np .int64 ])
60- assert_type (np .asarray (A , dtype = "c16" ), _nt .Array [ Any ] )
60+ assert_type (np .asarray (A , dtype = "c16" ), _nt .Array )
6161
6262assert_type (np .asanyarray (A ), _nt .Array [np .float64 ])
6363assert_type (np .asanyarray (B ), MyArray [np .float64 ])
64- assert_type (np .asanyarray ([1 , 1.0 ]), _nt .Array [ Any ] )
64+ assert_type (np .asanyarray ([1 , 1.0 ]), _nt .Array )
6565assert_type (np .asanyarray (A , dtype = np .int64 ), _nt .Array [np .int64 ])
66- assert_type (np .asanyarray (A , dtype = "c16" ), _nt .Array [ Any ] )
66+ assert_type (np .asanyarray (A , dtype = "c16" ), _nt .Array )
6767
6868assert_type (np .ascontiguousarray (A ), _nt .Array [np .float64 ])
6969assert_type (np .ascontiguousarray (B ), _nt .Array1D [np .float64 ])
70- assert_type (np .ascontiguousarray ([1 , 1.0 ]), _nt .Array [ Any ] )
70+ assert_type (np .ascontiguousarray ([1 , 1.0 ]), _nt .Array )
7171assert_type (np .ascontiguousarray (A , dtype = np .int64 ), _nt .Array [np .int64 ])
72- assert_type (np .ascontiguousarray (A , dtype = "c16" ), _nt .Array [ Any ] )
72+ assert_type (np .ascontiguousarray (A , dtype = "c16" ), _nt .Array )
7373
7474assert_type (np .asfortranarray (A ), _nt .Array [np .float64 ])
7575assert_type (np .asfortranarray (B ), _nt .Array1D [np .float64 ])
76- assert_type (np .asfortranarray ([1 , 1.0 ]), _nt .Array [ Any ] )
76+ assert_type (np .asfortranarray ([1 , 1.0 ]), _nt .Array )
7777assert_type (np .asfortranarray (A , dtype = np .int64 ), _nt .Array [np .int64 ])
78- assert_type (np .asfortranarray (A , dtype = "c16" ), _nt .Array [ Any ] )
78+ assert_type (np .asfortranarray (A , dtype = "c16" ), _nt .Array )
7979
8080assert_type (np .fromstring ("1 1 1" , sep = " " ), _nt .Array [np .float64 ])
8181assert_type (np .fromstring (b"1 1 1" , sep = " " ), _nt .Array [np .float64 ])
8282assert_type (np .fromstring ("1 1 1" , dtype = np .int64 , sep = " " ), _nt .Array [np .int64 ])
8383assert_type (np .fromstring (b"1 1 1" , dtype = np .int64 , sep = " " ), _nt .Array [np .int64 ])
84- assert_type (np .fromstring ("1 1 1" , dtype = "c16" , sep = " " ), _nt .Array [ Any ] )
85- assert_type (np .fromstring (b"1 1 1" , dtype = "c16" , sep = " " ), _nt .Array [ Any ] )
84+ assert_type (np .fromstring ("1 1 1" , dtype = "c16" , sep = " " ), _nt .Array )
85+ assert_type (np .fromstring (b"1 1 1" , dtype = "c16" , sep = " " ), _nt .Array )
8686
8787assert_type (np .fromfile ("test.txt" , sep = " " ), _nt .Array [np .float64 ])
8888assert_type (np .fromfile ("test.txt" , dtype = np .int64 , sep = " " ), _nt .Array [np .int64 ])
89- assert_type (np .fromfile ("test.txt" , dtype = "c16" , sep = " " ), _nt .Array [ Any ] )
89+ assert_type (np .fromfile ("test.txt" , dtype = "c16" , sep = " " ), _nt .Array )
9090with open ("test.txt" , encoding = "utf-8" ) as f :
9191 assert_type (np .fromfile (f , sep = " " ), _nt .Array [np .float64 ])
9292 assert_type (np .fromfile (b"test.txt" , sep = " " ), _nt .Array [np .float64 ])
9393 assert_type (np .fromfile (Path ("test.txt" ), sep = " " ), _nt .Array [np .float64 ])
9494
9595assert_type (np .fromiter ("12345" , np .float64 ), _nt .Array [np .float64 ])
96- assert_type (np .fromiter ("12345" , float ), _nt .Array [ Any ] )
96+ assert_type (np .fromiter ("12345" , float ), _nt .Array )
9797
9898assert_type (np .frombuffer (A ), _nt .Array [np .float64 ])
9999assert_type (np .frombuffer (A , dtype = np .int64 ), _nt .Array [np .int64 ])
100- assert_type (np .frombuffer (A , dtype = "c16" ), _nt .Array [ Any ] )
100+ assert_type (np .frombuffer (A , dtype = "c16" ), _nt .Array )
101101
102102assert_type (np .arange (False , True ), _nt .Array1D [np .int_ ])
103103assert_type (np .arange (10 ), _nt .Array1D [np .int_ ])
@@ -115,7 +115,7 @@ assert_type(np.arange(0, 10, dtype="f8"), _nt.Array1D[np.float64])
115115assert_type (np .require (A ), _nt .Array [np .float64 ])
116116assert_type (np .require (B ), MyArray [np .float64 ])
117117assert_type (np .require (B , requirements = None ), MyArray [np .float64 ])
118- assert_type (np .require (B , dtype = int ), _nt .Array [ Any ] )
118+ assert_type (np .require (B , dtype = int ), _nt .Array )
119119assert_type (np .require (B , requirements = "E" ), _nt .Array [np .float64 ])
120120assert_type (np .require (B , requirements = ["ENSUREARRAY" ]), _nt .Array [np .float64 ])
121121assert_type (np .require (B , requirements = {"F" , "E" }), _nt .Array [np .float64 ])
@@ -127,28 +127,28 @@ assert_type(np.require(C), _nt.Array[np.intp])
127127assert_type (np .linspace (0 , 10 ), _nt .Array [np .floating ])
128128assert_type (np .linspace (0 , 10j ), _nt .Array [np .inexact ])
129129assert_type (np .linspace (0 , 10 , dtype = np .int64 ), _nt .Array [np .int64 ])
130- assert_type (np .linspace (0 , 10 , dtype = int ), _nt .Array [ Any ] )
130+ assert_type (np .linspace (0 , 10 , dtype = int ), _nt .Array )
131131assert_type (np .linspace (0 , 10 , retstep = True ), tuple [_nt .Array [np .floating ], np .floating ])
132132assert_type (np .linspace (0j , 10 , retstep = True ), tuple [_nt .Array [np .inexact ], np .inexact ])
133133assert_type (np .linspace (0 , 10 , retstep = True , dtype = np .int64 ), tuple [_nt .Array [np .int64 ], np .int64 ])
134- assert_type (np .linspace (0j , 10 , retstep = True , dtype = int ), tuple [_nt .Array [ Any ] , Any ])
134+ assert_type (np .linspace (0j , 10 , retstep = True , dtype = int ), tuple [_nt .Array , Any ])
135135
136136assert_type (np .logspace (0 , 10 ), _nt .Array [np .floating ])
137137assert_type (np .logspace (0 , 10j ), _nt .Array [np .inexact ])
138138assert_type (np .logspace (0 , 10 , dtype = np .int64 ), _nt .Array [np .int64 ])
139- assert_type (np .logspace (0 , 10 , dtype = int ), _nt .Array [ Any ] )
139+ assert_type (np .logspace (0 , 10 , dtype = int ), _nt .Array )
140140
141141assert_type (np .geomspace (0 , 10 ), _nt .Array [np .floating ])
142142assert_type (np .geomspace (0 , 10j ), _nt .Array [np .inexact ])
143143assert_type (np .geomspace (0 , 10 , dtype = np .int64 ), _nt .Array [np .int64 ])
144- assert_type (np .geomspace (0 , 10 , dtype = int ), _nt .Array [ Any ] )
144+ assert_type (np .geomspace (0 , 10 , dtype = int ), _nt .Array )
145145
146146assert_type (np .empty_like (A ), _nt .Array [np .float64 ])
147147assert_type (np .empty_like (A , dtype = float ), _nt .Array [np .float64 ])
148- assert_type (np .empty_like (A , shape = (2 , 2 )), _nt .Array [np .float64 , _nt . Shape2 ])
148+ assert_type (np .empty_like (A , shape = (2 , 2 )), _nt .Array2D [np .float64 ])
149149assert_type (np .empty_like (A , dtype = np .int64 ), _nt .Array [np .int64 ])
150150assert_type (np .empty_like (A , dtype = np .int64 , shape = (2 , 2 )), _nt .Array [np .int64 , _nt .Shape2 ])
151- assert_type (np .empty_like (A , dtype = "c16" ), _nt .Array [ Any ] )
151+ assert_type (np .empty_like (A , dtype = "c16" ), _nt .Array )
152152assert_type (np .empty_like (A , dtype = "c16" , shape = (2 , 2 )), np .ndarray [_nt .Shape2 , np .dtype ])
153153assert_type (np .empty_like (B ), MyArray [np .float64 ])
154154assert_type (np .empty_like (B , dtype = np .int64 ), _nt .Array [np .int64 ])
@@ -171,10 +171,10 @@ assert_type(np.empty_like([[[4j]]]), _nt.Array3D[np.complex128])
171171
172172assert_type (np .zeros_like (A ), _nt .Array [np .float64 ])
173173assert_type (np .zeros_like (A , dtype = float ), _nt .Array [np .float64 ])
174- assert_type (np .zeros_like (A , shape = (2 , 2 )), _nt .Array [np .float64 , _nt . Shape2 ])
174+ assert_type (np .zeros_like (A , shape = (2 , 2 )), _nt .Array2D [np .float64 ])
175175assert_type (np .zeros_like (A , dtype = np .int64 ), _nt .Array [np .int64 ])
176176assert_type (np .zeros_like (A , dtype = np .int64 , shape = (2 , 2 )), _nt .Array [np .int64 , _nt .Shape2 ])
177- assert_type (np .zeros_like (A , dtype = "c16" ), _nt .Array [ Any ] )
177+ assert_type (np .zeros_like (A , dtype = "c16" ), _nt .Array )
178178assert_type (np .zeros_like (A , dtype = "c16" , shape = (2 , 2 )), np .ndarray [_nt .Shape2 , np .dtype ])
179179assert_type (np .zeros_like (B ), MyArray [np .float64 ])
180180assert_type (np .zeros_like (B , dtype = np .int64 ), _nt .Array [np .int64 ])
@@ -197,10 +197,10 @@ assert_type(np.zeros_like([[[4j]]]), _nt.Array3D[np.complex128])
197197
198198assert_type (np .ones_like (A ), _nt .Array [np .float64 ])
199199assert_type (np .ones_like (A , dtype = float ), _nt .Array [np .float64 ])
200- assert_type (np .ones_like (A , shape = (2 , 2 )), _nt .Array [np .float64 , _nt . Shape2 ])
200+ assert_type (np .ones_like (A , shape = (2 , 2 )), _nt .Array2D [np .float64 ])
201201assert_type (np .ones_like (A , dtype = np .int64 ), _nt .Array [np .int64 ])
202202assert_type (np .ones_like (A , dtype = np .int64 , shape = (2 , 2 )), _nt .Array [np .int64 , _nt .Shape2 ])
203- assert_type (np .ones_like (A , dtype = "c16" ), _nt .Array [ Any ] )
203+ assert_type (np .ones_like (A , dtype = "c16" ), _nt .Array )
204204assert_type (np .ones_like (A , dtype = "c16" , shape = (2 , 2 )), np .ndarray [_nt .Shape2 , np .dtype ])
205205assert_type (np .ones_like (B ), MyArray [np .float64 ])
206206assert_type (np .ones_like (B , dtype = np .int64 ), _nt .Array [np .int64 ])
@@ -223,7 +223,7 @@ assert_type(np.ones_like([[[4j]]]), _nt.Array3D[np.complex128])
223223
224224assert_type (np .full_like (A , i8 ), _nt .Array [np .float64 ])
225225assert_type (np .full_like (C , i8 ), _nt .Array1D [np .intp ])
226- assert_type (np .full_like (A , i8 , dtype = int ), _nt .Array [ Any ] )
226+ assert_type (np .full_like (A , i8 , dtype = int ), _nt .Array )
227227assert_type (np .full_like (B , i8 ), MyArray [np .float64 ])
228228assert_type (np .full_like (B , i8 , dtype = np .int64 ), _nt .Array [np .int64 ])
229229
@@ -240,8 +240,8 @@ assert_type(np.ones(_shape_2d), _nt.Array[np.float64, _nt.Shape2])
240240assert_type (np .ones (_shape_nd ), np .ndarray [_nt .Shape , np .dtype [np .float64 ]])
241241assert_type (np .ones (_shape_1d , dtype = np .int64 ), _nt .Array1D [np .int64 ])
242242assert_type (np .ones (_shape_like ), _nt .Array [np .float64 ])
243- assert_type (np .ones (_shape_like , dtype = np .dtypes .StringDType ()), np .ndarray [Any , np .dtypes .StringDType ])
244- assert_type (np .ones (_shape_like , dtype = int ), _nt .Array [ Any ] )
243+ assert_type (np .ones (_shape_like , dtype = np .dtypes .StringDType ()), np .ndarray [_nt . AnyShape , np .dtypes .StringDType ])
244+ assert_type (np .ones (_shape_like , dtype = int ), _nt .Array )
245245
246246assert_type (np .full (_size , i8 ), _nt .Array1D [np .int64 ])
247247assert_type (np .full (_shape_2d , i8 ), _nt .Array [np .int64 , _nt .Shape2 ])
@@ -265,12 +265,12 @@ assert_type(np.identity(10, dtype=np.int64), _nt.Array2D[np.int64])
265265assert_type (np .identity (10 , dtype = int ), _nt .Array2D )
266266
267267assert_type (np .atleast_1d (A ), _nt .Array [np .float64 ])
268- assert_type (np .atleast_1d (C ), _nt .Array [ Any ] )
268+ assert_type (np .atleast_1d (C ), _nt .Array )
269269assert_type (np .atleast_1d (A , A ), tuple [_nt .Array [np .float64 ], _nt .Array [np .float64 ]])
270- assert_type (np .atleast_1d (A , C ), tuple [_nt .Array [ Any ] , _nt .Array [ Any ] ])
271- assert_type (np .atleast_1d (C , C ), tuple [_nt .Array [ Any ] , _nt .Array [ Any ] ])
270+ assert_type (np .atleast_1d (A , C ), tuple [_nt .Array , _nt .Array ])
271+ assert_type (np .atleast_1d (C , C ), tuple [_nt .Array , _nt .Array ])
272272assert_type (np .atleast_1d (A , A , A ), tuple [_nt .Array [np .float64 ], ...])
273- assert_type (np .atleast_1d (C , C , C ), tuple [_nt .Array [ Any ] , ...])
273+ assert_type (np .atleast_1d (C , C , C ), tuple [_nt .Array , ...])
274274
275275assert_type (np .atleast_2d (A ), _nt .Array [np .float64 ])
276276assert_type (np .atleast_2d (A , A ), tuple [_nt .Array [np .float64 ], _nt .Array [np .float64 ]])
@@ -280,28 +280,28 @@ assert_type(np.atleast_3d(A), _nt.Array[np.float64])
280280assert_type (np .atleast_3d (A , A ), tuple [_nt .Array [np .float64 ], _nt .Array [np .float64 ]])
281281assert_type (np .atleast_3d (A , A , A ), tuple [_nt .Array [np .float64 ], ...])
282282
283- assert_type (np .vstack ([A , A ]), _nt .Array [np .float64 ])
283+ assert_type (np .vstack ([A , A ]), _nt .Array [np .float64 ]) # type: ignore[assert-type] # mypy fail
284284assert_type (np .vstack ([A , A ], dtype = np .float32 ), _nt .Array [np .float32 ])
285- assert_type (np .vstack ([A , C ]), _nt .Array [ Any ] )
286- assert_type (np .vstack ([C , C ]), _nt .Array [ Any ] )
285+ assert_type (np .vstack ([A , C ]), _nt .Array )
286+ assert_type (np .vstack ([C , C ]), _nt .Array )
287287
288- assert_type (np .hstack ([A , A ]), _nt .Array [np .float64 ])
288+ assert_type (np .hstack ([A , A ]), _nt .Array [np .float64 ]) # type: ignore[assert-type] # mypy fail
289289assert_type (np .hstack ([A , A ], dtype = np .float32 ), _nt .Array [np .float32 ])
290290
291- assert_type (np .stack ([A , A ]), _nt .Array [np .float64 ])
291+ assert_type (np .stack ([A , A ]), _nt .Array [np .float64 ]) # type: ignore[assert-type] # mypy fail
292292assert_type (np .stack ([A , A ], dtype = np .float32 ), _nt .Array [np .float32 ])
293- assert_type (np .stack ([A , C ]), _nt .Array [ Any ] )
294- assert_type (np .stack ([C , C ]), _nt .Array [ Any ] )
295- assert_type (np .stack ([A , A ], axis = 0 ), _nt .Array [np .float64 ])
293+ assert_type (np .stack ([A , C ]), _nt .Array )
294+ assert_type (np .stack ([C , C ]), _nt .Array )
295+ assert_type (np .stack ([A , A ], axis = 0 ), _nt .Array [np .float64 ]) # type: ignore[assert-type] # mypy fail
296296assert_type (np .stack ([A , A ], out = B ), MyArray [np .float64 ])
297297
298- assert_type (np .block ([[A , A ], [A , A ]]), _nt .Array [ Any ] ) # pyright: ignore[reportAssertTypeFailure] # _nt.Array[np.float64]
299- assert_type (np .block (C ), _nt .Array [ Any ] )
298+ assert_type (np .block ([[A , A ], [A , A ]]), _nt .Array ) # pyright: ignore[reportAssertTypeFailure] # _nt.Array[np.float64]
299+ assert_type (np .block (C ), _nt .Array )
300300
301301if sys .version_info >= (3 , 12 ):
302302 from collections .abc import Buffer
303303
304- def create_array (obj : npt .ArrayLike ) -> _nt .Array [ Any ] : ...
304+ def create_array (obj : npt .ArrayLike ) -> _nt .Array : ...
305305
306306 buffer : Buffer
307- assert_type (create_array (buffer ), _nt .Array [ Any ] )
307+ assert_type (create_array (buffer ), _nt .Array )
0 commit comments