Skip to content

Commit 4909fe6

Browse files
committed
✨ overloaded call signatures
1 parent 438ac56 commit 4909fe6

File tree

2 files changed

+50
-77
lines changed

2 files changed

+50
-77
lines changed

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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 50 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,54 @@ class _frommethod:
863863
def __call__(self, a: Incomplete, *args: Incomplete, **params: Incomplete) -> Incomplete: ...
864864
def getdoc(self) -> Incomplete: ...
865865

866+
@type_check_only
867+
class _ArgMinMaxMethod:
868+
__name__: str
869+
__doc__: str
870+
reversed: Incomplete
871+
def __init__(self, methodname: Incomplete, reversed: Incomplete = ...) -> None: ...
872+
@overload
873+
def __call__(
874+
self,
875+
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
876+
axis: None = None,
877+
fill_value: _ScalarLike_co | None = None,
878+
out: None = None,
879+
*,
880+
keepdims: L[False] | _NoValueType = ...,
881+
) -> intp: ...
882+
@overload
883+
def __call__(
884+
self,
885+
a: _ArrayT, # pyright: ignore[reportInvalidTypeVarUse]
886+
axis: CanIndex | None = None,
887+
fill_value: _ScalarLike_co | None = None,
888+
out: None = None,
889+
*,
890+
keepdims: bool | _NoValueType = ...,
891+
) -> Any: ...
892+
@overload
893+
def __call__(
894+
self,
895+
a: _ArrayT,
896+
axis: CanIndex | None = None,
897+
fill_value: _ScalarLike_co | None = None,
898+
*,
899+
out: _ArrayT,
900+
keepdims: bool | _NoValueType = ...,
901+
) -> _ArrayT: ...
902+
@overload
903+
def __call__(
904+
self,
905+
a: _ArrayT,
906+
axis: CanIndex | None,
907+
fill_value: _ScalarLike_co | None,
908+
out: _ArrayT,
909+
*,
910+
keepdims: bool | _NoValueType = ...,
911+
) -> _ArrayT: ...
912+
def getdoc(self) -> Incomplete: ...
913+
866914
class _convert2ma:
867915
def __init__(self, /, funcname: str, np_ret: str, np_ma_ret: str, params: dict[str, Any] | None = None) -> None: ...
868916
def __call__(self, /, *args: object, **params: object) -> Any: ...
@@ -1154,81 +1202,7 @@ swapaxes: _frommethod
11541202
trace: _frommethod
11551203
var: _frommethod
11561204
count: _frommethod
1205+
argmin: _ArgMinMaxMethod
1206+
argmax: _ArgMinMaxMethod
11571207
minimum: _extrema_operation
11581208
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)