@@ -224,6 +224,7 @@ _DTypeT = TypeVar("_DTypeT", bound=dtype[Any])
224
224
_DTypeT_co = TypeVar ("_DTypeT_co" , bound = dtype [Any ], covariant = True )
225
225
_ArrayT = TypeVar ("_ArrayT" , bound = ndarray [Any , Any ])
226
226
_ScalarT = TypeVar ("_ScalarT" , bound = generic )
227
+ _ScalarT_co = TypeVar ("_ScalarT_co" , bound = generic )
227
228
# A subset of `MaskedArray` that can be parametrized w.r.t. `np.generic`
228
229
_MaskedArray : TypeAlias = MaskedArray [_Shape , dtype [_ScalarT ]]
229
230
@@ -239,7 +240,12 @@ def minimum_fill_value(obj): ...
239
240
def maximum_fill_value (obj ): ...
240
241
def set_fill_value (a , fill_value ): ...
241
242
def common_fill_value (a , b ): ...
242
- def filled (a , fill_value = ...): ...
243
+ @overload
244
+ def filled (a : ndarray [_ShapeT_co , _DTypeT_co ], fill_value : _ScalarLike_co | None = None ) -> ndarray [_ShapeT_co , _DTypeT_co ]: ...
245
+ @overload
246
+ def filled (a : _ArrayLike [_ScalarT_co ], fill_value : _ScalarLike_co | None = None ) -> NDArray [_ScalarT_co ]: ...
247
+ @overload
248
+ def filled (a : ArrayLike , fill_value : _ScalarLike_co | None = None ) -> NDArray [Any ]: ...
243
249
def getdata (a , subok = ...): ...
244
250
get_data = getdata
245
251
@@ -418,7 +424,7 @@ class MaskedArray(ndarray[_ShapeT_co, _DTypeT_co]):
418
424
def fill_value (self , value = ...): ...
419
425
get_fill_value : Any
420
426
set_fill_value : Any
421
- def filled (self , fill_value = ...) : ...
427
+ def filled (self , / , fill_value : _ScalarLike_co | None = None ) -> ndarray [ _ShapeT_co , _DTypeT_co ] : ...
422
428
def compressed (self ): ...
423
429
def compress (self , condition , axis = ..., out = ...): ...
424
430
def __eq__ (self , other ): ...
0 commit comments