Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 734e2cd

Browse filesBrowse files
authored
Merge pull request #28676 from jorenham/typing/fix-mypy-error-in-ma
TYP: fix mypy test failures
2 parents 4223c88 + 6f89b0d commit 734e2cd
Copy full SHA for 734e2cd

File tree

Expand file treeCollapse file tree

1 file changed

+36
-29
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-29
lines changed

‎numpy/ma/core.pyi

Copy file name to clipboardExpand all lines: numpy/ma/core.pyi
+36-29Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# pyright: reportIncompatibleMethodOverride=false
22
# ruff: noqa: ANN001, ANN002, ANN003, ANN201, ANN202 ANN204
33

4-
from typing import Any, Literal, Sequence, SupportsIndex, TypeAlias, TypeVar, overload
4+
from collections.abc import Sequence
5+
from typing import Any, Literal, SupportsIndex, TypeAlias, TypeVar, overload
56

67
from _typeshed import Incomplete
78
from typing_extensions import deprecated
@@ -219,7 +220,6 @@ _ArrayT = TypeVar("_ArrayT", bound=ndarray[Any, Any])
219220
_SCT = TypeVar("_SCT", bound=generic)
220221
# A subset of `MaskedArray` that can be parametrized w.r.t. `np.generic`
221222
_MaskedArray: TypeAlias = MaskedArray[_Shape, dtype[_SCT]]
222-
_MaskedArrayType = TypeVar("_MaskedArrayType", bound=MaskedArray[Any, Any])
223223

224224
MaskType = bool
225225
nomask: bool
@@ -472,8 +472,8 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
472472
def argsort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., *, stable=...): ...
473473

474474
# Keep in-sync with np.ma.argmin
475-
@overload
476-
def argmin( # type: ignore[override]
475+
@overload # type: ignore[override]
476+
def argmin(
477477
self,
478478
axis: None = None,
479479
fill_value: _ScalarLike_co | None = None,
@@ -482,7 +482,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
482482
keepdims: Literal[False] | _NoValueType = ...,
483483
) -> intp: ...
484484
@overload
485-
def argmin( # type: ignore[override]
485+
def argmin(
486486
self,
487487
axis: SupportsIndex | None = None,
488488
fill_value: _ScalarLike_co | None = None,
@@ -491,7 +491,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
491491
keepdims: bool | _NoValueType = ...,
492492
) -> Any: ...
493493
@overload
494-
def argmin( # type: ignore[override]
494+
def argmin(
495495
self,
496496
axis: SupportsIndex | None = None,
497497
fill_value: _ScalarLike_co | None = None,
@@ -500,7 +500,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
500500
keepdims: bool | _NoValueType = ...,
501501
) -> _ArrayT: ...
502502
@overload
503-
def argmin( # type: ignore[override]
503+
def argmin(
504504
self,
505505
axis: SupportsIndex | None,
506506
fill_value: _ScalarLike_co | None,
@@ -510,8 +510,8 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
510510
) -> _ArrayT: ...
511511

512512
# Keep in-sync with np.ma.argmax
513-
@overload
514-
def argmax( # type: ignore[override]
513+
@overload # type: ignore[override]
514+
def argmax(
515515
self,
516516
axis: None = None,
517517
fill_value: _ScalarLike_co | None = None,
@@ -520,7 +520,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
520520
keepdims: Literal[False] | _NoValueType = ...,
521521
) -> intp: ...
522522
@overload
523-
def argmax( # type: ignore[override]
523+
def argmax(
524524
self,
525525
axis: SupportsIndex | None = None,
526526
fill_value: _ScalarLike_co | None = None,
@@ -529,7 +529,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
529529
keepdims: bool | _NoValueType = ...,
530530
) -> Any: ...
531531
@overload
532-
def argmax( # type: ignore[override]
532+
def argmax(
533533
self,
534534
axis: SupportsIndex | None = None,
535535
fill_value: _ScalarLike_co | None = None,
@@ -538,7 +538,7 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
538538
keepdims: bool | _NoValueType = ...,
539539
) -> _ArrayT: ...
540540
@overload
541-
def argmax( # type: ignore[override]
541+
def argmax(
542542
self,
543543
axis: SupportsIndex | None,
544544
fill_value: _ScalarLike_co | None,
@@ -559,106 +559,112 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
559559
stable: Literal[False] | None = False,
560560
) -> None: ...
561561

562-
#
563-
@overload
564-
def min( # type: ignore[override]
562+
#
563+
@overload # type: ignore[override]
564+
def min(
565565
self: _MaskedArray[_SCT],
566566
axis: None = None,
567567
out: None = None,
568568
fill_value: _ScalarLike_co | None = None,
569569
keepdims: Literal[False] | _NoValueType = ...,
570570
) -> _SCT: ...
571571
@overload
572-
def min( # type: ignore[override]
572+
def min(
573573
self,
574574
axis: _ShapeLike | None = None,
575575
out: None = None,
576576
fill_value: _ScalarLike_co | None = None,
577577
keepdims: bool | _NoValueType = ...
578578
) -> Any: ...
579579
@overload
580-
def min( # type: ignore[override]
580+
def min(
581581
self,
582582
axis: _ShapeLike | None,
583583
out: _ArrayT,
584584
fill_value: _ScalarLike_co | None = None,
585585
keepdims: bool | _NoValueType = ...,
586586
) -> _ArrayT: ...
587587
@overload
588-
def min( # type: ignore[override]
588+
def min(
589589
self,
590590
axis: _ShapeLike | None = None,
591591
*,
592592
out: _ArrayT,
593593
fill_value: _ScalarLike_co | None = None,
594594
keepdims: bool | _NoValueType = ...,
595595
) -> _ArrayT: ...
596-
@overload
597-
def max( # type: ignore[override]
596+
597+
#
598+
@overload # type: ignore[override]
599+
def max(
598600
self: _MaskedArray[_SCT],
599601
axis: None = None,
600602
out: None = None,
601603
fill_value: _ScalarLike_co | None = None,
602604
keepdims: Literal[False] | _NoValueType = ...,
603605
) -> _SCT: ...
604606
@overload
605-
def max( # type: ignore[override]
607+
def max(
606608
self,
607609
axis: _ShapeLike | None = None,
608610
out: None = None,
609611
fill_value: _ScalarLike_co | None = None,
610612
keepdims: bool | _NoValueType = ...
611613
) -> Any: ...
612614
@overload
613-
def max( # type: ignore[override]
615+
def max(
614616
self,
615617
axis: _ShapeLike | None,
616618
out: _ArrayT,
617619
fill_value: _ScalarLike_co | None = None,
618620
keepdims: bool | _NoValueType = ...,
619621
) -> _ArrayT: ...
620622
@overload
621-
def max( # type: ignore[override]
623+
def max(
622624
self,
623625
axis: _ShapeLike | None = None,
624626
*,
625627
out: _ArrayT,
626628
fill_value: _ScalarLike_co | None = None,
627629
keepdims: bool | _NoValueType = ...,
628630
) -> _ArrayT: ...
631+
632+
#
629633
@overload
630-
def ptp( # type: ignore[override]
634+
def ptp(
631635
self: _MaskedArray[_SCT],
632636
axis: None = None,
633637
out: None = None,
634638
fill_value: _ScalarLike_co | None = None,
635639
keepdims: Literal[False] = False,
636640
) -> _SCT: ...
637641
@overload
638-
def ptp( # type: ignore[override]
642+
def ptp(
639643
self,
640644
axis: _ShapeLike | None = None,
641645
out: None = None,
642646
fill_value: _ScalarLike_co | None = None,
643647
keepdims: bool = False,
644648
) -> Any: ...
645649
@overload
646-
def ptp( # type: ignore[override]
650+
def ptp(
647651
self,
648652
axis: _ShapeLike | None,
649653
out: _ArrayT,
650654
fill_value: _ScalarLike_co | None = None,
651655
keepdims: bool = False,
652656
) -> _ArrayT: ...
653657
@overload
654-
def ptp( # type: ignore[override]
658+
def ptp(
655659
self,
656660
axis: _ShapeLike | None = None,
657661
*,
658662
out: _ArrayT,
659663
fill_value: _ScalarLike_co | None = None,
660664
keepdims: bool = False,
661665
) -> _ArrayT: ...
666+
667+
#
662668
def partition(self, *args, **kwargs): ...
663669
def argpartition(self, *args, **kwargs): ...
664670
def take(self, indices, axis=..., out=..., mode=...): ...
@@ -931,6 +937,7 @@ def argmin(
931937
keepdims: bool | _NoValueType = ...,
932938
) -> _ArrayT: ...
933939

940+
#
934941
@overload
935942
def argmax(
936943
self: ArrayLike,
@@ -976,15 +983,15 @@ def power(a, b, third=...): ...
976983
def argsort(a, axis=..., kind=..., order=..., endwith=..., fill_value=..., *, stable=...): ...
977984
@overload
978985
def sort(
979-
a: _ArrayType,
986+
a: _ArrayT,
980987
axis: SupportsIndex = -1,
981988
kind: _SortKind | None = None,
982989
order: str | Sequence[str] | None = None,
983990
endwith: bool | None = True,
984991
fill_value: _ScalarLike_co | None = None,
985992
*,
986993
stable: Literal[False] | None = False,
987-
) -> _ArrayType: ...
994+
) -> _ArrayT: ...
988995
@overload
989996
def sort(
990997
a: ArrayLike,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.