@@ -2190,17 +2190,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2190
2190
axis : None | SupportsIndex = ...,
2191
2191
) -> ndarray [_Shape , _DType_co ]: ...
2192
2192
2193
- # TODO: use `tuple[int]` as shape type once covariant (#26081)
2194
- def flatten (
2195
- self ,
2196
- order : _OrderKACF = ...,
2197
- ) -> ndarray [_Shape , _DType_co ]: ...
2198
-
2199
- # TODO: use `tuple[int]` as shape type once covariant (#26081)
2200
- def ravel (
2201
- self ,
2202
- order : _OrderKACF = ...,
2203
- ) -> ndarray [_Shape , _DType_co ]: ...
2193
+ def flatten (self , / , order : _OrderKACF = "C" ) -> ndarray [tuple [int ], _DType_co ]: ...
2194
+ def ravel (self , / , order : _OrderKACF = "C" ) -> ndarray [tuple [int ], _DType_co ]: ...
2204
2195
2205
2196
@overload
2206
2197
def reshape (
@@ -3100,11 +3091,10 @@ _NBit_fc = TypeVar("_NBit_fc", _NBitHalf, _NBitSingle, _NBitDouble, _NBitLongDou
3100
3091
class generic (_ArrayOrScalarCommon ):
3101
3092
@abstractmethod
3102
3093
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
3103
- # TODO: use `tuple[()]` as shape type once covariant (#26081)
3104
3094
@overload
3105
- def __array__ (self , dtype : None = ... , / ) -> NDArray [ Self ]: ...
3095
+ def __array__ (self , dtype : None = None , / ) -> ndarray [ tuple [()], dtype [ Self ] ]: ...
3106
3096
@overload
3107
- def __array__ (self , dtype : _DType , / ) -> ndarray [_Shape , _DType ]: ...
3097
+ def __array__ (self , dtype : _DType , / ) -> ndarray [tuple [()] , _DType ]: ...
3108
3098
def __hash__ (self ) -> int : ...
3109
3099
@property
3110
3100
def base (self ) -> None : ...
@@ -3118,7 +3108,7 @@ class generic(_ArrayOrScalarCommon):
3118
3108
def strides (self ) -> tuple [()]: ...
3119
3109
def byteswap (self , inplace : L [False ] = ...) -> Self : ...
3120
3110
@property
3121
- def flat (self ) -> flatiter [NDArray [ Self ]]: ...
3111
+ def flat (self ) -> flatiter [ndarray [ tuple [ int ], dtype [ Self ] ]]: ...
3122
3112
3123
3113
if sys .version_info >= (3 , 12 ):
3124
3114
def __buffer__ (self , flags : int , / ) -> memoryview : ...
@@ -3202,8 +3192,8 @@ class generic(_ArrayOrScalarCommon):
3202
3192
) -> _NdArraySubClass : ...
3203
3193
3204
3194
def repeat (self , repeats : _ArrayLikeInt_co , axis : None | SupportsIndex = ...) -> NDArray [Self ]: ...
3205
- def flatten (self , order : _OrderKACF = ... ) -> NDArray [ Self ]: ...
3206
- def ravel (self , order : _OrderKACF = ... ) -> NDArray [ Self ]: ...
3195
+ def flatten (self , / , order : _OrderKACF = "C" ) -> ndarray [ tuple [ int ], dtype [ Self ] ]: ...
3196
+ def ravel (self , / , order : _OrderKACF = "C" ) -> ndarray [ tuple [ int ], dtype [ Self ] ]: ...
3207
3197
3208
3198
@overload
3209
3199
def reshape (self , shape : _ShapeLike , / , * , order : _OrderACF = ...) -> NDArray [Self ]: ...
@@ -4492,13 +4482,12 @@ class poly1d:
4492
4482
@coefficients .setter
4493
4483
def coefficients (self , value : NDArray [Any ]) -> None : ...
4494
4484
4495
- __hash__ : ClassVar [None ] # type: ignore
4485
+ __hash__ : ClassVar [None ] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
4496
4486
4497
- # TODO: use `tuple[int]` as shape type once covariant (#26081)
4498
4487
@overload
4499
- def __array__ (self , t : None = ... , copy : None | bool = ... ) -> NDArray [ Any ]: ...
4488
+ def __array__ (self , / , t : None = None , copy : builtins . bool | None = None ) -> ndarray [ tuple [ int ], dtype [ Any ] ]: ...
4500
4489
@overload
4501
- def __array__ (self , t : _DType , copy : None | bool = ... ) -> ndarray [_Shape , _DType ]: ...
4490
+ def __array__ (self , / , t : _DType , copy : builtins . bool | None = None ) -> ndarray [tuple [ int ] , _DType ]: ...
4502
4491
4503
4492
@overload
4504
4493
def __call__ (self , val : _ScalarLike_co ) -> Any : ...
@@ -4668,8 +4657,8 @@ class matrix(ndarray[_Shape2DType_co, _DType_co]):
4668
4657
4669
4658
def squeeze (self , axis : None | _ShapeLike = ...) -> matrix [_Shape2D , _DType_co ]: ...
4670
4659
def tolist (self : _SupportsItem [_T ]) -> list [list [_T ]]: ...
4671
- def ravel (self , order : _OrderKACF = ... ) -> matrix [_Shape2D , _DType_co ]: ...
4672
- def flatten (self , order : _OrderKACF = ... ) -> matrix [_Shape2D , _DType_co ]: ...
4660
+ def ravel (self , / , order : _OrderKACF = "C" ) -> matrix [tuple [ L [ 1 ], int ], _DType_co ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
4661
+ def flatten (self , / , order : _OrderKACF = "C" ) -> matrix [tuple [ L [ 1 ], int ], _DType_co ]: ... # pyright: ignore[reportIncompatibleMethodOverride]
4673
4662
4674
4663
@property
4675
4664
def T (self ) -> matrix [_Shape2D , _DType_co ]: ...
0 commit comments