@@ -629,7 +629,7 @@ _NumericArrayT = TypeVar("_NumericArrayT", bound=NDArray[number | timedelta64 |
629
629
630
630
_ShapeT = TypeVar ("_ShapeT" , bound = _nt .Shape )
631
631
_ShapeT_co = TypeVar ("_ShapeT_co" , bound = _nt .Shape , covariant = True )
632
- _ShapeT_1nd = TypeVar ("_ShapeT_1nd " , bound = _nt .Shape1N )
632
+ _Shape1NDT = TypeVar ("_Shape1NDT " , bound = _nt .Shape1N )
633
633
634
634
_ScalarT = TypeVar ("_ScalarT" , bound = generic )
635
635
_SelfScalarT = TypeVar ("_SelfScalarT" , bound = generic )
@@ -2946,19 +2946,23 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
2946
2946
@overload
2947
2947
def diagonal (
2948
2948
self : ndarray [_nt .Shape2 , _DTypeT ], / , offset : CanIndex = 0 , axis1 : CanIndex = 0 , axis2 : CanIndex = 1
2949
- ) -> ndarray [_nt .Shape1 , _DTypeT ]: ...
2949
+ ) -> ndarray [_nt .Rank1 , _DTypeT ]: ...
2950
2950
@overload
2951
2951
def diagonal (
2952
2952
self : ndarray [_nt .Shape3 , _DTypeT ], / , offset : CanIndex = 0 , axis1 : CanIndex = 0 , axis2 : CanIndex = 1
2953
- ) -> ndarray [_nt .Shape2 , _DTypeT ]: ...
2953
+ ) -> ndarray [_nt .Rank2 , _DTypeT ]: ...
2954
2954
@overload
2955
2955
def diagonal (
2956
2956
self : ndarray [_nt .Shape4 , _DTypeT ], / , offset : CanIndex = 0 , axis1 : CanIndex = 0 , axis2 : CanIndex = 1
2957
- ) -> ndarray [_nt .Shape3 , _DTypeT ]: ...
2957
+ ) -> ndarray [_nt .Rank3 , _DTypeT ]: ...
2958
+ @overload
2959
+ def diagonal (
2960
+ self : ndarray [_nt .Shape4N , _DTypeT ], / , offset : CanIndex = 0 , axis1 : CanIndex = 0 , axis2 : CanIndex = 1
2961
+ ) -> ndarray [_nt .Rank3N , _DTypeT ]: ...
2958
2962
@overload
2959
2963
def diagonal (
2960
2964
self : ndarray [_nt .Shape , _DTypeT ], / , offset : CanIndex = 0 , axis1 : CanIndex = 0 , axis2 : CanIndex = 1
2961
- ) -> ndarray [_nt . Shape , _DTypeT ]: ...
2965
+ ) -> ndarray [Any , _DTypeT ]: ...
2962
2966
2963
2967
#
2964
2968
@overload
@@ -3290,39 +3294,39 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3290
3294
) -> ndarray [_AnyShapeT , _DTypeT ]: ...
3291
3295
3292
3296
#
3293
- def flatten (self , / , order : _OrderKACF = "C" ) -> ndarray [_nt .Shape1 , _DTypeT_co ]: ...
3294
- def ravel (self , / , order : _OrderKACF = "C" ) -> ndarray [_nt .Shape1 , _DTypeT_co ]: ...
3297
+ def flatten (self , / , order : _OrderKACF = "C" ) -> ndarray [_nt .Rank1 , _DTypeT_co ]: ...
3298
+ def ravel (self , / , order : _OrderKACF = "C" ) -> ndarray [_nt .Rank1 , _DTypeT_co ]: ...
3295
3299
3296
3300
#
3297
3301
@overload # (None)
3298
3302
def reshape (self , shape : None , / , * , order : _OrderACF = "C" , copy : py_bool | None = None ) -> Self : ...
3299
3303
@overload # (empty_sequence)
3300
3304
def reshape ( # type: ignore[overload-overlap] # mypy false positive
3301
3305
self ,
3302
- shape : Sequence [Never ],
3306
+ shape : Sequence [Never ] | _nt . Shape0 ,
3303
3307
/ ,
3304
3308
* ,
3305
3309
order : _OrderACF = "C" ,
3306
3310
copy : py_bool | None = None ,
3307
- ) -> ndarray [_nt .Shape0 , _DTypeT_co ]: ...
3308
- @overload # (() | (int) | (int, int) | ....) # up to 8-d
3311
+ ) -> ndarray [_nt .Rank0 , _DTypeT_co ]: ...
3312
+ @overload # (index)
3309
3313
def reshape (
3310
3314
self ,
3311
- shape : _AnyShapeT ,
3315
+ size1 : CanIndex | _nt . Shape1 ,
3312
3316
/ ,
3313
3317
* ,
3314
3318
order : _OrderACF = "C" ,
3315
3319
copy : py_bool | None = None ,
3316
- ) -> ndarray [_AnyShapeT , _DTypeT_co ]: ...
3317
- @overload # (index)
3320
+ ) -> ndarray [_nt . Rank1 , _DTypeT_co ]: ...
3321
+ @overload # (index, index )
3318
3322
def reshape (
3319
3323
self ,
3320
- size1 : CanIndex ,
3324
+ size1 : _nt . Shape2 ,
3321
3325
/ ,
3322
3326
* ,
3323
3327
order : _OrderACF = "C" ,
3324
3328
copy : py_bool | None = None ,
3325
- ) -> ndarray [_nt .Shape1 , _DTypeT_co ]: ...
3329
+ ) -> ndarray [_nt .Rank2 , _DTypeT_co ]: ...
3326
3330
@overload # (index, index)
3327
3331
def reshape (
3328
3332
self ,
@@ -3332,7 +3336,16 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3332
3336
* ,
3333
3337
order : _OrderACF = "C" ,
3334
3338
copy : py_bool | None = None ,
3335
- ) -> ndarray [_nt .Shape2 , _DTypeT_co ]: ...
3339
+ ) -> ndarray [_nt .Rank2 , _DTypeT_co ]: ...
3340
+ @overload # (index, index, index)
3341
+ def reshape (
3342
+ self ,
3343
+ size1 : _nt .Shape3 ,
3344
+ / ,
3345
+ * ,
3346
+ order : _OrderACF = "C" ,
3347
+ copy : py_bool | None = None ,
3348
+ ) -> ndarray [_nt .Rank3 , _DTypeT_co ]: ...
3336
3349
@overload # (index, index, index)
3337
3350
def reshape (
3338
3351
self ,
@@ -3343,7 +3356,16 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3343
3356
* ,
3344
3357
order : _OrderACF = "C" ,
3345
3358
copy : py_bool | None = None ,
3346
- ) -> ndarray [_nt .Shape3 , _DTypeT_co ]: ...
3359
+ ) -> ndarray [_nt .Rank3 , _DTypeT_co ]: ...
3360
+ @overload # (index, index, index, index)
3361
+ def reshape (
3362
+ self ,
3363
+ size1 : _nt .Shape4 ,
3364
+ / ,
3365
+ * ,
3366
+ order : _OrderACF = "C" ,
3367
+ copy : py_bool | None = None ,
3368
+ ) -> ndarray [_nt .Rank4 , _DTypeT_co ]: ...
3347
3369
@overload # (index, index, index, index)
3348
3370
def reshape (
3349
3371
self ,
@@ -3355,7 +3377,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3355
3377
* ,
3356
3378
order : _OrderACF = "C" ,
3357
3379
copy : py_bool | None = None ,
3358
- ) -> ndarray [_nt .Shape4 , _DTypeT_co ]: ...
3380
+ ) -> ndarray [_nt .Rank4 , _DTypeT_co ]: ...
3359
3381
@overload # (int, *(index, ...))
3360
3382
def reshape (
3361
3383
self ,
@@ -3364,7 +3386,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3364
3386
* shape : CanIndex ,
3365
3387
order : _OrderACF = "C" ,
3366
3388
copy : py_bool | None = None ,
3367
- ) -> ndarray [_nt . Shape , _DTypeT_co ]: ...
3389
+ ) -> ndarray [Incomplete , _DTypeT_co ]: ...
3368
3390
@overload # (sequence[index])
3369
3391
def reshape (
3370
3392
self ,
@@ -3373,7 +3395,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3373
3395
* ,
3374
3396
order : _OrderACF = "C" ,
3375
3397
copy : py_bool | None = None ,
3376
- ) -> ndarray [_nt . Shape , _DTypeT_co ]: ...
3398
+ ) -> ndarray [Incomplete , _DTypeT_co ]: ...
3377
3399
3378
3400
#
3379
3401
@overload
@@ -3405,23 +3427,23 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]):
3405
3427
@overload # (dtype: dtype[T])
3406
3428
def view (self , / , dtype : _DTypeLike [_ScalarT ]) -> _nt .Array [_ScalarT , _ShapeT_co ]: ...
3407
3429
@overload # (type: matrix)
3408
- def view (self , / , * , type : type [matrix [Any , Any ]]) -> matrix [_nt .Shape2 , _DTypeT_co ]: ...
3430
+ def view (self , / , * , type : type [matrix [Any , Any ]]) -> matrix [_nt .Rank2 , _DTypeT_co ]: ...
3409
3431
@overload # (_: matrix)
3410
- def view (self , / , dtype : type [matrix [Any , Any ]]) -> matrix [_nt .Shape2 , _DTypeT_co ]: ...
3432
+ def view (self , / , dtype : type [matrix [Any , Any ]]) -> matrix [_nt .Rank2 , _DTypeT_co ]: ...
3411
3433
@overload # (dtype: T, type: matrix)
3412
3434
def view (
3413
3435
self ,
3414
3436
/ ,
3415
3437
dtype : _DTypeT | _HasDType [_DTypeT ],
3416
3438
type : type [matrix [Any , Any ]],
3417
- ) -> matrix [_nt .Shape2 , _DTypeT ]: ...
3439
+ ) -> matrix [_nt .Rank2 , _DTypeT ]: ...
3418
3440
@overload # (dtype: dtype[T], type: matrix)
3419
3441
def view (
3420
3442
self ,
3421
3443
/ ,
3422
3444
dtype : _DTypeLike [_ScalarT ],
3423
3445
type : type [matrix [Any , Any ]],
3424
- ) -> matrix [ _nt .Shape2 , dtype [_ScalarT ] ]: ...
3446
+ ) -> _nt .Matrix [_ScalarT ]: ...
3425
3447
@overload # (type: recarray)
3426
3448
def view (
3427
3449
self ,
@@ -3560,9 +3582,9 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]):
3560
3582
3561
3583
#
3562
3584
@overload
3563
- def __array__ (self , dtype : None = None , / ) -> ndarray [ _nt .Shape0 , dtype [Self ] ]: ...
3585
+ def __array__ (self , dtype : None = None , / ) -> _nt .Array0D [Self ]: ...
3564
3586
@overload
3565
- def __array__ (self , dtype : _DTypeT , / ) -> ndarray [_nt .Shape0 , _DTypeT ]: ...
3587
+ def __array__ (self , dtype : _DTypeT , / ) -> ndarray [_nt .Rank0 , _DTypeT ]: ...
3566
3588
3567
3589
#
3568
3590
@overload
@@ -3576,11 +3598,11 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]):
3576
3598
@overload
3577
3599
def __array_wrap__ (
3578
3600
self ,
3579
- array : ndarray [_ShapeT_1nd , _DTypeT ],
3601
+ array : ndarray [_Shape1NDT , _DTypeT ],
3580
3602
context : tuple [ufunc , tuple [object , ...], int ] | None = None ,
3581
3603
return_scalar : py_bool = True ,
3582
3604
/ ,
3583
- ) -> ndarray [_ShapeT_1nd , _DTypeT ]: ...
3605
+ ) -> ndarray [_Shape1NDT , _DTypeT ]: ...
3584
3606
@overload
3585
3607
def __array_wrap__ (
3586
3608
self ,
0 commit comments