File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ from typing import (
173173 Generic ,
174174 IO ,
175175 Iterable ,
176+ Iterator ,
176177 List ,
177178 Mapping ,
178179 NoReturn ,
@@ -780,6 +781,21 @@ class nditer:
780781 buffersize : Any = ...,
781782 ) -> Any : ...
782783 def __getattr__ (self , key : str ) -> Any : ...
784+ def __enter__ (self ) -> nditer : ...
785+ def __exit__ (
786+ self ,
787+ exc_type : None | Type [BaseException ],
788+ exc_value : None | BaseException ,
789+ traceback : None | TracebackType ,
790+ ) -> None : ...
791+ def __iter__ (self ) -> Iterator [Any ]: ...
792+ def __next__ (self ) -> Any : ...
793+ def __len__ (self ) -> int : ...
794+ def __copy__ (self ) -> nditer : ...
795+ def __getitem__ (self , index : SupportsIndex | slice ) -> Any : ...
796+ def __setitem__ (self , index : SupportsIndex | slice , value : Any ) -> None : ...
797+ def __delitem__ (self , key : SupportsIndex | slice ) -> None : ...
798+
783799
784800class poly1d :
785801 def __init__ (
Original file line number Diff line number Diff line change 1+ import copy
2+ import numpy as np
3+
4+ nditer_obj : np .nditer
5+
6+ with nditer_obj as context :
7+ reveal_type (context ) # E: numpy.nditer
8+
9+ reveal_type (len (nditer_obj )) # E: builtins.int
10+ reveal_type (copy .copy (nditer_obj )) # E: numpy.nditer
11+ reveal_type (next (nditer_obj )) # E: Any
12+ reveal_type (iter (nditer_obj )) # E: typing.Iterator[Any]
13+ reveal_type (nditer_obj [1 ]) # E: Any
14+ reveal_type (nditer_obj [1 :5 ]) # E: Any
15+
16+ nditer_obj [1 ] = 1
17+ nditer_obj [1 :5 ] = 1
18+ del nditer_obj [1 ]
19+ del nditer_obj [1 :5 ]
You can’t perform that action at this time.
0 commit comments