|
1 | 1 | # pyright: reportIncompatibleMethodOverride=false
|
2 | 2 | # ruff: noqa: ANN001, ANN002, ANN003, ANN201, ANN202 ANN204
|
3 | 3 |
|
4 |
| -from typing import Any, Literal, SupportsIndex, TypeVar, overload |
| 4 | +from typing import Any, Literal, SupportsIndex, TypeVar, overload, TypeAlias |
5 | 5 |
|
6 | 6 | from _typeshed import Incomplete
|
7 | 7 | from typing_extensions import deprecated
|
@@ -211,8 +211,10 @@ _ShapeType = TypeVar("_ShapeType", bound=tuple[int, ...])
|
211 | 211 | _ShapeType_co = TypeVar("_ShapeType_co", bound=tuple[int, ...], covariant=True)
|
212 | 212 | _DType = TypeVar("_DType", bound=dtype[Any])
|
213 | 213 | _DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True)
|
214 |
| -_ArrayType = TypeVar("_ArrayType", bound=MaskedArray[Any, Any]) |
| 214 | +_ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) |
215 | 215 | _SCT = TypeVar("_SCT", bound=generic)
|
| 216 | +# A subset of `MaskedArray` that can be parametrized w.r.t. `np.generic` |
| 217 | +_MaskedArray: TypeAlias = MaskedArray[Any, dtype[_SCT]] |
216 | 218 |
|
217 | 219 | MaskType = bool
|
218 | 220 | nomask: bool
|
@@ -466,7 +468,39 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
|
466 | 468 | def argmin(self, axis=..., fill_value=..., out=..., *, keepdims=...): ...
|
467 | 469 | def argmax(self, axis=..., fill_value=..., out=..., *, keepdims=...): ...
|
468 | 470 | def sort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., *, stable=...): ...
|
469 |
| - def min(self, axis=..., out=..., fill_value=..., keepdims=...): ... |
| 471 | + @overload |
| 472 | + def min( # type: ignore[override] |
| 473 | + self: _MaskedArray[_SCT], |
| 474 | + axis: None = None, |
| 475 | + out: None = None, |
| 476 | + fill_value: _ScalarLike_co | None = None, |
| 477 | + keepdims: Literal[False] | _NoValueType = ..., |
| 478 | + ) -> _SCT: ... |
| 479 | + @overload |
| 480 | + def min( # type: ignore[override] |
| 481 | + self, |
| 482 | + axis: _ShapeLike | None = None, |
| 483 | + out: None = None, |
| 484 | + fill_value: _ScalarLike_co | None = None, |
| 485 | + keepdims: bool | _NoValueType = ... |
| 486 | + ) -> Any: ... |
| 487 | + @overload |
| 488 | + def min( # type: ignore[override] |
| 489 | + self, |
| 490 | + axis: None, |
| 491 | + out: _ArrayType, |
| 492 | + fill_value: _ScalarLike_co | None = None, |
| 493 | + keepdims: bool | _NoValueType = ..., |
| 494 | + ) -> _ArrayType: ... |
| 495 | + @overload |
| 496 | + def min( # type: ignore[override] |
| 497 | + self, |
| 498 | + axis: _ShapeLike | None = None, |
| 499 | + *, |
| 500 | + out: _ArrayType, |
| 501 | + fill_value: _ScalarLike_co | None = None, |
| 502 | + keepdims: bool | _NoValueType = ..., |
| 503 | + ) -> _ArrayType: ... |
470 | 504 | def max(self, axis=..., out=..., fill_value=..., keepdims=...): ...
|
471 | 505 | def ptp(self, axis=..., out=..., fill_value=..., keepdims=...): ...
|
472 | 506 | def partition(self, *args, **kwargs): ...
|
|
0 commit comments