@@ -10,7 +10,7 @@ from typing import (
10
10
overload ,
11
11
type_check_only ,
12
12
)
13
- from typing_extensions import Never
13
+ from typing_extensions import Never , deprecated
14
14
15
15
import numpy as np
16
16
from numpy import (
@@ -25,6 +25,7 @@ from numpy import (
25
25
timedelta64 ,
26
26
object_ ,
27
27
generic ,
28
+ _AnyShapeType ,
28
29
_OrderKACF ,
29
30
_OrderACF ,
30
31
_ModeKind ,
@@ -161,24 +162,73 @@ def take(
161
162
) -> _ArrayType : ...
162
163
163
164
@overload
165
+ def reshape ( # shape: index
166
+ a : _ArrayLike [_SCT ],
167
+ / ,
168
+ shape : SupportsIndex ,
169
+ order : _OrderACF = "C" ,
170
+ * ,
171
+ copy : bool | None = None ,
172
+ ) -> np .ndarray [tuple [int ], np .dtype [_SCT ]]: ...
173
+ @overload
174
+ def reshape ( # shape: (int, ...) @ _AnyShapeType
175
+ a : _ArrayLike [_SCT ],
176
+ / ,
177
+ shape : _AnyShapeType ,
178
+ order : _OrderACF = "C" ,
179
+ * ,
180
+ copy : bool | None = None ,
181
+ ) -> np .ndarray [_AnyShapeType , np .dtype [_SCT ]]: ...
182
+ @overload # shape: Sequence[index]
164
183
def reshape (
165
184
a : _ArrayLike [_SCT ],
166
185
/ ,
167
- shape : _ShapeLike = ... ,
168
- order : _OrderACF = ... ,
186
+ shape : Sequence [ SupportsIndex ] ,
187
+ order : _OrderACF = "C" ,
169
188
* ,
170
- newshape : _ShapeLike = ...,
171
- copy : None | bool = ...,
189
+ copy : bool | None = None ,
172
190
) -> NDArray [_SCT ]: ...
191
+ @overload # shape: index
192
+ def reshape (
193
+ a : ArrayLike ,
194
+ / ,
195
+ shape : SupportsIndex ,
196
+ order : _OrderACF = "C" ,
197
+ * ,
198
+ copy : bool | None = None ,
199
+ ) -> np .ndarray [tuple [int ], np .dtype [Any ]]: ...
173
200
@overload
201
+ def reshape ( # shape: (int, ...) @ _AnyShapeType
202
+ a : ArrayLike ,
203
+ / ,
204
+ shape : _AnyShapeType ,
205
+ order : _OrderACF = "C" ,
206
+ * ,
207
+ copy : bool | None = None ,
208
+ ) -> np .ndarray [_AnyShapeType , np .dtype [Any ]]: ...
209
+ @overload # shape: Sequence[index]
210
+ def reshape (
211
+ a : ArrayLike ,
212
+ / ,
213
+ shape : Sequence [SupportsIndex ],
214
+ order : _OrderACF = "C" ,
215
+ * ,
216
+ copy : bool | None = None ,
217
+ ) -> NDArray [Any ]: ...
218
+ @overload
219
+ @deprecated (
220
+ "`newshape` keyword argument is deprecated, "
221
+ "use `shape=...` or pass shape positionally instead. "
222
+ "(deprecated in NumPy 2.1)" ,
223
+ )
174
224
def reshape (
175
225
a : ArrayLike ,
176
226
/ ,
177
- shape : _ShapeLike = ... ,
178
- order : _OrderACF = ... ,
227
+ shape : None = None ,
228
+ order : _OrderACF = "C" ,
179
229
* ,
180
- newshape : _ShapeLike = ... ,
181
- copy : None | bool = ... ,
230
+ newshape : _ShapeLike ,
231
+ copy : bool | None = None ,
182
232
) -> NDArray [Any ]: ...
183
233
184
234
@overload
0 commit comments