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