Skip to content

Commit 79b5462

Browse files
guan404mingMarcoGorellijorenham
authored
🚚 port type masked array shape, dtype,__int__, and __float__ (#472)
Co-authored-by: Marco Edward Gorelli <[email protected]> Co-authored-by: Joren Hammudoglu <[email protected]>
1 parent bbde5c2 commit 79b5462

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from typing_extensions import assert_type
2+
3+
import numpy as np
4+
5+
m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]]
6+
7+
assert_type(m.shape, tuple[int])
8+
9+
assert_type(m.dtype, np.dtype[np.float64])
10+
11+
assert_type(int(m), int)
12+
assert_type(float(m), float)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import numpy as np
2+
3+
m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]]
4+
5+
m.shape = (3, 1) # type: ignore[assignment]
6+
m.dtype = np.bool # type: ignore[assignment] # pyright: ignore[reportAttributeAccessIssue]

‎src/numpy-stubs/ma/core.pyi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,6 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]):
466466
@override
467467
def __ipow__(self, other: Incomplete, /) -> Self: ... # type: ignore[override]
468468

469-
#
470-
@override
471-
def __int__(self) -> int: ...
472-
@override
473-
def __float__(self) -> float: ...
474-
475469
#
476470
@override
477471
def __reduce__(self) -> Incomplete: ...

0 commit comments

Comments
 (0)