@@ -1095,6 +1095,11 @@ class _HasShape(Protocol[_ShapeT_co]):
1095
1095
@property
1096
1096
def shape (self , / ) -> _ShapeT_co : ...
1097
1097
1098
+ @type_check_only
1099
+ class _HasDType (Protocol [_T_co ]):
1100
+ @property
1101
+ def dtype (self , / ) -> _T_co : ...
1102
+
1098
1103
@type_check_only
1099
1104
class _HasShapeAndSupportsItem (_HasShape [_ShapeT_co ], _SupportsItem [_T_co ], Protocol [_ShapeT_co , _T_co ]): ...
1100
1105
@@ -2339,12 +2344,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]):
2339
2344
2340
2345
# `put` is technically available to `generic`,
2341
2346
# but is pointless as `generic`s are immutable
2342
- def put (
2343
- self ,
2344
- ind : _ArrayLikeInt_co ,
2345
- v : ArrayLike ,
2346
- mode : _ModeKind = ...,
2347
- ) -> None : ...
2347
+ def put (self , / , indices : _ArrayLikeInt_co , values : ArrayLike , mode : _ModeKind = "raise" ) -> None : ...
2348
2348
2349
2349
@overload
2350
2350
def searchsorted ( # type: ignore[misc]
@@ -2531,20 +2531,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]):
2531
2531
copy : builtins .bool | _CopyMode = ...,
2532
2532
) -> ndarray [_ShapeT_co , dtype [Any ]]: ...
2533
2533
2534
- @overload
2535
- def view (self ) -> Self : ...
2536
- @overload
2537
- def view (self , type : type [_ArrayT ]) -> _ArrayT : ...
2538
- @overload
2539
- def view (self , dtype : _DTypeLike [_SCT ]) -> NDArray [_SCT ]: ...
2540
- @overload
2541
- def view (self , dtype : DTypeLike ) -> NDArray [Any ]: ...
2542
- @overload
2543
- def view (
2544
- self ,
2545
- dtype : DTypeLike ,
2546
- type : type [_ArrayT ],
2547
- ) -> _ArrayT : ...
2534
+ #
2535
+ @overload # ()
2536
+ def view (self , / ) -> Self : ...
2537
+ @overload # (dtype: T)
2538
+ def view (self , / , dtype : _DType | _HasDType [_DType ]) -> ndarray [_ShapeT_co , _DType ]: ...
2539
+ @overload # (dtype: dtype[T])
2540
+ def view (self , / , dtype : _DTypeLike [_SCT ]) -> NDArray [_SCT ]: ...
2541
+ @overload # (type: T)
2542
+ def view (self , / , * , type : type [_ArrayT ]) -> _ArrayT : ...
2543
+ @overload # (_: T)
2544
+ def view (self , / , dtype : type [_ArrayT ]) -> _ArrayT : ...
2545
+ @overload # (dtype: ?)
2546
+ def view (self , / , dtype : DTypeLike ) -> ndarray [_ShapeT_co , dtype [Any ]]: ...
2547
+ @overload # (dtype: ?, type: type[T])
2548
+ def view (self , / , dtype : DTypeLike , type : type [_ArrayT ]) -> _ArrayT : ...
2548
2549
2549
2550
@overload
2550
2551
def getfield (
0 commit comments