Skip to content

Commit 68ae1b9

Browse files
committed
✨ overloaded call signatures
1 parent 438ac56 commit 68ae1b9

File tree

2 files changed

+49
-77
lines changed

2 files changed

+49
-77
lines changed

src/numpy-stubs/@test/static/reject/ma.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ np.ma.argmin(m, out=1.0) # type: ignore[call-overload] # pyright: ignore[report
2222
np.ma.argmin(m, fill_value=lambda x: 27) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue, reportUnknownLambdaType]
2323

2424
m.argmax(axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]
25-

src/numpy-stubs/ma/core.pyi

+49-76
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,53 @@ class _frommethod:
863863
def __call__(self, a: Incomplete, *args: Incomplete, **params: Incomplete) -> Incomplete: ...
864864
def getdoc(self) -> Incomplete: ...
865865

866+
class _ArgMinMaxMethod:
867+
__name__: str
868+
__doc__: str
869+
reversed: Incomplete
870+
def __init__(self, methodname: Incomplete, reversed: Incomplete = ...) -> None: ...
871+
@overload
872+
def __call__(
873+
self,
874+
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
875+
axis: None = None,
876+
fill_value: _ScalarLike_co | None = None,
877+
out: None = None,
878+
*,
879+
keepdims: L[False] | _NoValueType = ...,
880+
) -> intp: ...
881+
@overload
882+
def __call__(
883+
self,
884+
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
885+
axis: CanIndex | None = None,
886+
fill_value: _ScalarLike_co | None = None,
887+
out: None = None,
888+
*,
889+
keepdims: bool | _NoValueType = ...,
890+
) -> Any: ...
891+
@overload
892+
def __call__(
893+
self,
894+
a: _ArrayT,
895+
axis: CanIndex | None = None,
896+
fill_value: _ScalarLike_co | None = None,
897+
*,
898+
out: _ArrayT,
899+
keepdims: bool | _NoValueType = ...,
900+
) -> _ArrayT: ...
901+
@overload
902+
def __call__(
903+
self,
904+
a: _ArrayT,
905+
axis: CanIndex | None,
906+
fill_value: _ScalarLike_co | None,
907+
out: _ArrayT,
908+
*,
909+
keepdims: bool | _NoValueType = ...,
910+
) -> _ArrayT: ...
911+
def getdoc(self) -> Incomplete: ...
912+
866913
class _convert2ma:
867914
def __init__(self, /, funcname: str, np_ret: str, np_ma_ret: str, params: dict[str, Any] | None = None) -> None: ...
868915
def __call__(self, /, *args: object, **params: object) -> Any: ...
@@ -1154,81 +1201,7 @@ swapaxes: _frommethod
11541201
trace: _frommethod
11551202
var: _frommethod
11561203
count: _frommethod
1204+
argmin: _ArgMinMaxMethod
1205+
argmax: _ArgMinMaxMethod
11571206
minimum: _extrema_operation
11581207
maximum: _extrema_operation
1159-
1160-
#
1161-
@overload
1162-
def argmin(
1163-
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
1164-
axis: None = None,
1165-
fill_value: _ScalarLike_co | None = None,
1166-
out: None = None,
1167-
*,
1168-
keepdims: L[False] | _NoValueType = ...,
1169-
) -> intp: ...
1170-
@overload
1171-
def argmin(
1172-
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
1173-
axis: CanIndex | None = None,
1174-
fill_value: _ScalarLike_co | None = None,
1175-
out: None = None,
1176-
*,
1177-
keepdims: bool | _NoValueType = ...,
1178-
) -> Any: ...
1179-
@overload
1180-
def argmin(
1181-
a: _ArrayT,
1182-
axis: CanIndex | None = None,
1183-
fill_value: _ScalarLike_co | None = None,
1184-
*,
1185-
out: _ArrayT,
1186-
keepdims: bool | _NoValueType = ...,
1187-
) -> _ArrayT: ...
1188-
@overload
1189-
def argmin(
1190-
a: _ArrayT,
1191-
axis: CanIndex | None,
1192-
fill_value: _ScalarLike_co | None,
1193-
out: _ArrayT,
1194-
*,
1195-
keepdims: bool | _NoValueType = ...,
1196-
) -> _ArrayT: ...
1197-
1198-
#
1199-
@overload
1200-
def argmax(
1201-
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
1202-
axis: None = None,
1203-
fill_value: _ScalarLike_co | None = None,
1204-
out: None = None,
1205-
*,
1206-
keepdims: L[False] | _NoValueType = ...,
1207-
) -> intp: ...
1208-
@overload
1209-
def argmax(
1210-
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
1211-
axis: CanIndex | None = None,
1212-
fill_value: _ScalarLike_co | None = None,
1213-
out: None = None,
1214-
*,
1215-
keepdims: bool | _NoValueType = ...,
1216-
) -> Any: ...
1217-
@overload
1218-
def argmax(
1219-
a: _ArrayT,
1220-
axis: CanIndex | None = None,
1221-
fill_value: _ScalarLike_co | None = None,
1222-
*,
1223-
out: _ArrayT,
1224-
keepdims: bool | _NoValueType = ...,
1225-
) -> _ArrayT: ...
1226-
@overload
1227-
def argmax(
1228-
a: _ArrayT,
1229-
axis: CanIndex | None,
1230-
fill_value: _ScalarLike_co | None,
1231-
out: _ArrayT,
1232-
*,
1233-
keepdims: bool | _NoValueType = ...,
1234-
) -> _ArrayT: ...

0 commit comments

Comments
 (0)