diff --git a/src/numpy-stubs/@test/static/accept/ma.pyi b/src/numpy-stubs/@test/static/accept/ma.pyi new file mode 100644 index 00000000..edc8c10b --- /dev/null +++ b/src/numpy-stubs/@test/static/accept/ma.pyi @@ -0,0 +1,12 @@ +from typing_extensions import assert_type + +import numpy as np + +m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]] + +assert_type(m.shape, tuple[int]) + +assert_type(m.dtype, np.dtype[np.float64]) + +assert_type(int(m), int) +assert_type(float(m), float) diff --git a/src/numpy-stubs/@test/static/reject/ma.pyi b/src/numpy-stubs/@test/static/reject/ma.pyi new file mode 100644 index 00000000..aef6d21b --- /dev/null +++ b/src/numpy-stubs/@test/static/reject/ma.pyi @@ -0,0 +1,6 @@ +import numpy as np + +m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]] + +m.shape = (3, 1) # type: ignore[assignment] +m.dtype = np.bool # type: ignore[assignment] # pyright: ignore[reportAttributeAccessIssue] diff --git a/src/numpy-stubs/ma/core.pyi b/src/numpy-stubs/ma/core.pyi index f1c3337c..870d0d88 100644 --- a/src/numpy-stubs/ma/core.pyi +++ b/src/numpy-stubs/ma/core.pyi @@ -466,12 +466,6 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): @override def __ipow__(self, other: Incomplete, /) -> Self: ... # type: ignore[override] - # - @override - def __int__(self) -> int: ... - @override - def __float__(self) -> float: ... - # @override def __reduce__(self) -> Incomplete: ...