Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e50659

Browse files
authored
Merge pull request#28913 from charris/backport-28908
TYP: Fix non-existent ``CanIndex`` annotation in ``ndarray.setfield``
2 parents7517cd1 +c906f84 commit9e50659

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎numpy/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2551,7 +2551,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]):
25512551
@overload# (dtype: ?, type: type[T])
25522552
defview(self,/,dtype:DTypeLike,type:type[_ArrayT])->_ArrayT: ...
25532553

2554-
defsetfield(self,/,val:ArrayLike,dtype:DTypeLike,offset:CanIndex=0)->None: ...
2554+
defsetfield(self,/,val:ArrayLike,dtype:DTypeLike,offset:SupportsIndex=0)->None: ...
25552555
@overload
25562556
defgetfield(self,dtype:_DTypeLike[_SCT],offset:SupportsIndex=0)->NDArray[_SCT]: ...
25572557
@overload

‎numpy/typing/tests/data/fail/array_like.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ scalar = np.int64(1)
1414
scalar.__array__(dtype=np.float64)# E: No overload variant
1515
array=np.array([1])
1616
array.__array__(dtype=np.float64)# E: No overload variant
17+
18+
array.setfield(np.eye(1),np.int32, (0,1))# E: No overload variant

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp