@@ -638,6 +638,7 @@ test: PytestTester
638
638
def show_config () -> None : ...
639
639
640
640
_NdArraySubClass = TypeVar ("_NdArraySubClass" , bound = NDArray [Any ])
641
+ _NdArraySubClass_co = TypeVar ("_NdArraySubClass_co" , bound = NDArray [Any ], covariant = True )
641
642
_DTypeScalar_co = TypeVar ("_DTypeScalar_co" , covariant = True , bound = generic )
642
643
_ByteOrder : TypeAlias = L ["S" , "<" , ">" , "=" , "|" , "L" , "B" , "N" , "I" , "little" , "big" , "native" ]
643
644
@@ -904,15 +905,15 @@ _FlatIterSelf = TypeVar("_FlatIterSelf", bound=flatiter[Any])
904
905
_FlatShapeType = TypeVar ("_FlatShapeType" , bound = tuple [int ])
905
906
906
907
@final
907
- class flatiter (Generic [_NdArraySubClass ]):
908
+ class flatiter (Generic [_NdArraySubClass_co ]):
908
909
__hash__ : ClassVar [None ]
909
910
@property
910
- def base (self ) -> _NdArraySubClass : ...
911
+ def base (self ) -> _NdArraySubClass_co : ...
911
912
@property
912
913
def coords (self ) -> _Shape : ...
913
914
@property
914
915
def index (self ) -> int : ...
915
- def copy (self ) -> _NdArraySubClass : ...
916
+ def copy (self ) -> _NdArraySubClass_co : ...
916
917
def __iter__ (self : _FlatIterSelf ) -> _FlatIterSelf : ...
917
918
def __next__ (self : flatiter [NDArray [_ScalarType ]]) -> _ScalarType : ...
918
919
def __len__ (self ) -> int : ...
@@ -925,7 +926,7 @@ class flatiter(Generic[_NdArraySubClass]):
925
926
def __getitem__ (
926
927
self ,
927
928
key : _ArrayLikeInt | slice | ellipsis | tuple [_ArrayLikeInt | slice | ellipsis ],
928
- ) -> _NdArraySubClass : ...
929
+ ) -> _NdArraySubClass_co : ...
929
930
# TODO: `__setitem__` operates via `unsafe` casting rules, and can
930
931
# thus accept any type accepted by the relevant underlying `np.generic`
931
932
# constructor.
0 commit comments