Repository: numpy/numpy
File: numpy/ma/core.pyi (Python)

Code before:
    @overload
    def any(
        self,
        axis: _ShapeLike | None = None,
        *,
        out: _ArrayT,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayT: ...
    @overload
    def any(
        self,
        axis: _ShapeLike | None,
        out: _ArrayT,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayT: ...

    def nonzero(self) -> tuple[_Array1D[intp], ...]: ...
    def trace(self, offset=..., axis1=..., axis2=..., dtype=..., out=...): ...

    # Keep in sync with `ndarray.dot`.
    # 1D + 1D returns a scalar;
    # all other with at least 1 non-0D array return MaskedArray.
    @overload
    def dot(self, b: _ScalarLike_co, out: None = ..., strict: bool = ...) -> _MaskedArray[Any]: ...
    @overload
    def dot(self, b: ArrayLike, out: None = ..., strict: bool = ...) -> Any: ...  # type: ignore[misc]
    @overload
    def dot(self, b: ArrayLike, out: _ArrayT, strict: bool = ...) -> _ArrayT: ...

    def sum(self, axis=..., dtype=..., out=..., keepdims=...): ...
    def cumsum(self, axis=..., dtype=..., out=...): ...
    def prod(self, axis=..., dtype=..., out=..., keepdims=...): ...
    product: Any
    def cumprod(self, axis=..., dtype=..., out=...): ...
    def mean(self, axis=..., dtype=..., out=..., keepdims=...): ...
    def anom(self, axis=..., dtype=...): ...
    def var(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ...
    def std(self, axis=..., dtype=..., out=..., ddof=..., keepdims=...): ...
    def round(self, decimals=..., out=...): ...
    def argsort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., *, stable=...): ...

    # Keep in-sync with np.ma.argmin
    @overload  # type: ignore[override]
    def argmin(
        self,
        axis: None = None,
        fill_value: _ScalarLike_co | None = None,
        out: None = None,
        *,
        keepdims: Literal[False] | _NoValueType = ...,
    ) -> intp: ...

Review comment (suggestion):
apparently this `dot` differs from the one of `ndarray`:

```pycon
>>> import numpy as np
>>> np.array([1,2]).dot(np.array([3, 2]))
np.int64(7)
>>> np.ma.array([1,2]).dot(np.ma.array([3, 2]))
masked_array(data=7,
             mask=False,
       fill_value=999999)
>>> np.ma.array([1,2]).dot(np.array([3, 2]))
masked_array(data=7,
             mask=False,
       fill_value=999999)
>>> np.array([1,2]).dot(np.ma.array([3, 2]))
np.int64(7)
```

so `1D dot 1D` doesn't return a scalar here, which makes it easier to type :)

Code after:
    ) -> bool_ | _MaskedArray[bool_]: ...
    @overload
    def any(
        self,
        axis: _ShapeLike | None = None,
        *,
        out: _ArrayT,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayT: ...
    @overload
    def any(
        self,
        axis: _ShapeLike | None,
        out: _ArrayT,
        keepdims: bool | _NoValueType = ...,
    ) -> _ArrayT: ...

    def nonzero(self) -> tuple[_Array1D[intp], ...]: ...

    # Keep in sync with `ndarray.trace`
    @overload
    def trace(
        self,  # >= 2D MaskedArray
        offset: SupportsIndex = ...,
        axis1: SupportsIndex = ...,
        axis2: SupportsIndex = ...,
        dtype: DTypeLike = ...,
        out: None = ...,
    ) -> Any: ...
    @overload
    def trace(
        self,  # >= 2D MaskedArray
        offset: SupportsIndex = ...,
        axis1: SupportsIndex = ...,
        axis2: SupportsIndex = ...,
        dtype: DTypeLike = ...,
        *,
        out: _ArrayT,
    ) -> _ArrayT: ...
    @overload
    def trace(
        self,  # >= 2D MaskedArray
        offset: SupportsIndex,
        axis1: SupportsIndex,
        axis2: SupportsIndex,
        dtype: DTypeLike,
        out: _ArrayT,
    ) -> _ArrayT: ...

    def dot(self, b, out=..., strict=...): ...
    def sum(self, axis=..., dtype=..., out=..., keepdims=...): ...