@@ -17,22 +17,34 @@ from numpy import (
17
17
amax ,
18
18
amin ,
19
19
bool_ ,
20
+ complex128 ,
21
+ complexfloating ,
22
+ datetime64 ,
20
23
dtype ,
21
24
expand_dims ,
22
25
float64 ,
26
+ floating ,
23
27
generic ,
24
28
int_ ,
25
29
intp ,
26
30
ndarray ,
31
+ object_ ,
32
+ signedinteger ,
33
+ timedelta64 ,
34
+ unsignedinteger ,
27
35
)
28
36
from numpy ._globals import _NoValueType
29
37
from numpy ._typing import (
30
38
ArrayLike ,
31
39
NDArray ,
32
40
_ArrayLike ,
33
41
_ArrayLikeBool_co ,
42
+ _ArrayLikeComplex_co ,
43
+ _ArrayLikeFloat_co ,
34
44
_ArrayLikeInt ,
35
45
_ArrayLikeInt_co ,
46
+ _ArrayLikeTD64_co ,
47
+ _ArrayLikeUInt_co ,
36
48
_DTypeLikeBool ,
37
49
_IntLike_co ,
38
50
_ScalarLike_co ,
@@ -456,12 +468,170 @@ class MaskedArray(ndarray[_ShapeT_co, _DTypeT_co]):
456
468
def __rfloordiv__ (self ,other ): ...
457
469
def __pow__ (self ,other ,mod :None = None ,/ ): ...
458
470
def __rpow__ (self ,other ,mod :None = None ,/ ): ...
459
- def __iadd__ (self ,other ): ...
460
- def __isub__ (self ,other ): ...
461
- def __imul__ (self ,other ): ...
462
- def __ifloordiv__ (self ,other ): ...
463
- def __itruediv__ (self ,other ): ...
464
- def __ipow__ (self ,other ): ...
471
+
472
+ # Keep in sync with `ndarray.__iadd__`, except that `_MaskedArray[unsignedinteger]` does not accept
473
+ # _IntLake_co for `other`.
474
+ @overload
475
+ def __iadd__ (
476
+ self :_MaskedArray [np .bool ],other :_ArrayLikeBool_co ,/
477
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
478
+ @overload
479
+ def __iadd__ (
480
+ self :_MaskedArray [unsignedinteger ],other :_ArrayLikeUInt_co ,/
481
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
482
+ @overload
483
+ def __iadd__ (
484
+ self :_MaskedArray [signedinteger ],other :_ArrayLikeInt_co ,/
485
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
486
+ @overload
487
+ def __iadd__ (
488
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
489
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
490
+ @overload
491
+ def __iadd__ (
492
+ self :_MaskedArray [complexfloating ],other :_ArrayLikeComplex_co ,/
493
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
494
+ @overload
495
+ def __iadd__ (
496
+ self :_MaskedArray [timedelta64 | datetime64 ],other :_ArrayLikeTD64_co ,/
497
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
498
+ @overload
499
+ def __iadd__ (
500
+ self :_MaskedArray [object_ ],other :Any ,/
501
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
502
+
503
+ # Keep in sync with `ndarray.__isub__`, except that `_MaskedArray[unsignedinteger]` does not accept
504
+ # _IntLike_co for `other`.
505
+ @overload
506
+ def __isub__ (
507
+ self :_MaskedArray [unsignedinteger ],other :_ArrayLikeUInt_co ,/
508
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
509
+ @overload
510
+ def __isub__ (
511
+ self :_MaskedArray [signedinteger ],other :_ArrayLikeInt_co ,/
512
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
513
+ @overload
514
+ def __isub__ (
515
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
516
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
517
+ @overload
518
+ def __isub__ (
519
+ self :_MaskedArray [complexfloating ],other :_ArrayLikeComplex_co ,/
520
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
521
+ @overload
522
+ def __isub__ (
523
+ self :_MaskedArray [timedelta64 | datetime64 ],other :_ArrayLikeTD64_co ,/
524
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
525
+ @overload
526
+ def __isub__ (
527
+ self :_MaskedArray [object_ ],other :Any ,/
528
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
529
+
530
+ # Keep in sync with `ndarray.__imul__`, except that `_MaskedArray[unsignedinteger]` does not accept
531
+ # _IntLike_co for `other`.
532
+ @overload
533
+ def __imul__ (
534
+ self :_MaskedArray [np .bool ],other :_ArrayLikeBool_co ,/
535
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
536
+ @overload
537
+ def __imul__ (
538
+ self :_MaskedArray [unsignedinteger ],other :_ArrayLikeUInt_co ,/
539
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
540
+ @overload
541
+ def __imul__ (
542
+ self :_MaskedArray [signedinteger ],other :_ArrayLikeInt_co ,/
543
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
544
+ @overload
545
+ def __imul__ (
546
+ self :_MaskedArray [float64 ],other :_ArrayLikeFloat_co ,/
547
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
548
+ @overload
549
+ def __imul__ (
550
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
551
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
552
+ @overload
553
+ def __imul__ (
554
+ self :_MaskedArray [complex128 ],other :_ArrayLikeComplex_co ,/
555
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
556
+ @overload
557
+ def __imul__ (
558
+ self :_MaskedArray [complexfloating ],other :_ArrayLikeComplex_co ,/
559
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
560
+ @overload
561
+ def __imul__ (
562
+ self :_MaskedArray [timedelta64 ],other :_ArrayLikeFloat_co ,/
563
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
564
+ @overload
565
+ def __imul__ (
566
+ self :_MaskedArray [object_ ],other :Any ,/
567
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
568
+
569
+ # Keep in sync with `ndarray.__ifloordiv__`, except that `_MaskedArray[unsignedinteger]` does not accept
570
+ # _IntLike_co for `other`.
571
+ @overload
572
+ def __ifloordiv__ (
573
+ self :_MaskedArray [unsignedinteger ],other :_ArrayLikeUInt_co ,/
574
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
575
+ @overload
576
+ def __ifloordiv__ (
577
+ self :_MaskedArray [signedinteger ],other :_ArrayLikeInt_co ,/
578
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
579
+ @overload
580
+ def __ifloordiv__ (
581
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
582
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
583
+ @overload
584
+ def __ifloordiv__ (
585
+ self :_MaskedArray [timedelta64 ],other :_ArrayLikeInt ,/
586
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
587
+ @overload
588
+ def __ifloordiv__ (
589
+ self :_MaskedArray [object_ ],other :Any ,/
590
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
591
+
592
+ # Keep in sync with `ndarray.__itruediv__`, except that `_MaskedArray[unsignedinteger]` does not accept
593
+ # _IntLike_co for `other`.
594
+ @overload
595
+ def __itruediv__ (
596
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
597
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
598
+ @overload
599
+ def __itruediv__ (
600
+ self :_MaskedArray [complexfloating ],
601
+ other :_ArrayLikeComplex_co ,
602
+ / ,
603
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
604
+ @overload
605
+ def __itruediv__ (
606
+ self :_MaskedArray [timedelta64 ],other :_ArrayLikeInt ,/
607
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
608
+ @overload
609
+ def __itruediv__ (
610
+ self :_MaskedArray [object_ ],other :Any ,/
611
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
612
+
613
+ # Keep in sync with `ndarray.__ipow__`, except that `_MaskedArray[unsignedinteger]` does not accept
614
+ # _IntLike_co for `other`.
615
+ @overload
616
+ def __ipow__ (
617
+ self :_MaskedArray [unsignedinteger ],other :_ArrayLikeUInt_co ,/
618
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
619
+ @overload
620
+ def __ipow__ (
621
+ self :_MaskedArray [signedinteger ],other :_ArrayLikeInt_co ,/
622
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
623
+ @overload
624
+ def __ipow__ (
625
+ self :_MaskedArray [floating ],other :_ArrayLikeFloat_co ,/
626
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
627
+ @overload
628
+ def __ipow__ (
629
+ self :_MaskedArray [complexfloating ],other :_ArrayLikeComplex_co ,/
630
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
631
+ @overload
632
+ def __ipow__ (
633
+ self :_MaskedArray [object_ ],other :Any ,/
634
+ )-> MaskedArray [_ShapeT_co ,_DTypeT_co ]: ...
465
635
@property # type: ignore[misc]
466
636
def imag (self :_HasDTypeWithRealAndImag [object ,_ScalarT ],/ )-> MaskedArray [_ShapeT_co ,dtype [_ScalarT ]]: ...
467
637
get_imag :Any