Skip to content

Commit 3f71d09

Browse files
committed
TYP: positional-only binop parameters in numpy.generic subtypes
1 parent 53cd7a0 commit 3f71d09

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

numpy/__init__.pyi

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,13 +2882,13 @@ class datetime64(generic):
28822882
format: _CharLike_co | tuple[_CharLike_co, _IntLike_co],
28832883
/,
28842884
) -> None: ...
2885-
def __add__(self, other: _TD64Like_co) -> datetime64: ...
2886-
def __radd__(self, other: _TD64Like_co) -> datetime64: ...
2885+
def __add__(self, other: _TD64Like_co, /) -> datetime64: ...
2886+
def __radd__(self, other: _TD64Like_co, /) -> datetime64: ...
28872887
@overload
2888-
def __sub__(self, other: datetime64) -> timedelta64: ...
2888+
def __sub__(self, other: datetime64, /) -> timedelta64: ...
28892889
@overload
2890-
def __sub__(self, other: _TD64Like_co) -> datetime64: ...
2891-
def __rsub__(self, other: datetime64) -> timedelta64: ...
2890+
def __sub__(self, other: _TD64Like_co, /) -> datetime64: ...
2891+
def __rsub__(self, other: datetime64, /) -> timedelta64: ...
28922892
__lt__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
28932893
__le__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
28942894
__gt__: _ComparisonOp[datetime64, _ArrayLikeDT64_co]
@@ -2911,9 +2911,9 @@ class integer(number[_NBit1]): # type: ignore
29112911
@property
29122912
def denominator(self) -> L[1]: ...
29132913
@overload
2914-
def __round__(self, ndigits: None = ...) -> int: ...
2914+
def __round__(self, ndigits: None = ..., /) -> int: ...
29152915
@overload
2916-
def __round__(self: _ScalarType, ndigits: SupportsIndex) -> _ScalarType: ...
2916+
def __round__(self: _ScalarType, ndigits: SupportsIndex, /) -> _ScalarType: ...
29172917

29182918
# NOTE: `__index__` is technically defined in the bottom-most
29192919
# sub-classes (`int64`, `uint32`, etc)
@@ -2926,20 +2926,20 @@ class integer(number[_NBit1]): # type: ignore
29262926
def __index__(self) -> int: ...
29272927
__truediv__: _IntTrueDiv[_NBit1]
29282928
__rtruediv__: _IntTrueDiv[_NBit1]
2929-
def __mod__(self, value: _IntLike_co) -> integer[Any]: ...
2930-
def __rmod__(self, value: _IntLike_co) -> integer[Any]: ...
2929+
def __mod__(self, value: _IntLike_co, /) -> integer[Any]: ...
2930+
def __rmod__(self, value: _IntLike_co, /) -> integer[Any]: ...
29312931
def __invert__(self: _IntType) -> _IntType: ...
29322932
# Ensure that objects annotated as `integer` support bit-wise operations
2933-
def __lshift__(self, other: _IntLike_co) -> integer[Any]: ...
2934-
def __rlshift__(self, other: _IntLike_co) -> integer[Any]: ...
2935-
def __rshift__(self, other: _IntLike_co) -> integer[Any]: ...
2936-
def __rrshift__(self, other: _IntLike_co) -> integer[Any]: ...
2937-
def __and__(self, other: _IntLike_co) -> integer[Any]: ...
2938-
def __rand__(self, other: _IntLike_co) -> integer[Any]: ...
2939-
def __or__(self, other: _IntLike_co) -> integer[Any]: ...
2940-
def __ror__(self, other: _IntLike_co) -> integer[Any]: ...
2941-
def __xor__(self, other: _IntLike_co) -> integer[Any]: ...
2942-
def __rxor__(self, other: _IntLike_co) -> integer[Any]: ...
2933+
def __lshift__(self, other: _IntLike_co, /) -> integer[Any]: ...
2934+
def __rlshift__(self, other: _IntLike_co, /) -> integer[Any]: ...
2935+
def __rshift__(self, other: _IntLike_co, /) -> integer[Any]: ...
2936+
def __rrshift__(self, other: _IntLike_co, /) -> integer[Any]: ...
2937+
def __and__(self, other: _IntLike_co, /) -> integer[Any]: ...
2938+
def __rand__(self, other: _IntLike_co, /) -> integer[Any]: ...
2939+
def __or__(self, other: _IntLike_co, /) -> integer[Any]: ...
2940+
def __ror__(self, other: _IntLike_co, /) -> integer[Any]: ...
2941+
def __xor__(self, other: _IntLike_co, /) -> integer[Any]: ...
2942+
def __rxor__(self, other: _IntLike_co, /) -> integer[Any]: ...
29432943

29442944
class signedinteger(integer[_NBit1]):
29452945
def __init__(self, value: _IntValue = ..., /) -> None: ...
@@ -3003,20 +3003,20 @@ class timedelta64(generic):
30033003
def __neg__(self: _ArraySelf) -> _ArraySelf: ...
30043004
def __pos__(self: _ArraySelf) -> _ArraySelf: ...
30053005
def __abs__(self: _ArraySelf) -> _ArraySelf: ...
3006-
def __add__(self, other: _TD64Like_co) -> timedelta64: ...
3007-
def __radd__(self, other: _TD64Like_co) -> timedelta64: ...
3008-
def __sub__(self, other: _TD64Like_co) -> timedelta64: ...
3009-
def __rsub__(self, other: _TD64Like_co) -> timedelta64: ...
3010-
def __mul__(self, other: _FloatLike_co) -> timedelta64: ...
3011-
def __rmul__(self, other: _FloatLike_co) -> timedelta64: ...
3006+
def __add__(self, other: _TD64Like_co, /) -> timedelta64: ...
3007+
def __radd__(self, other: _TD64Like_co, /) -> timedelta64: ...
3008+
def __sub__(self, other: _TD64Like_co, /) -> timedelta64: ...
3009+
def __rsub__(self, other: _TD64Like_co, /) -> timedelta64: ...
3010+
def __mul__(self, other: _FloatLike_co, /) -> timedelta64: ...
3011+
def __rmul__(self, other: _FloatLike_co, /) -> timedelta64: ...
30123012
__truediv__: _TD64Div[float64]
30133013
__floordiv__: _TD64Div[int64]
3014-
def __rtruediv__(self, other: timedelta64) -> float64: ...
3015-
def __rfloordiv__(self, other: timedelta64) -> int64: ...
3016-
def __mod__(self, other: timedelta64) -> timedelta64: ...
3017-
def __rmod__(self, other: timedelta64) -> timedelta64: ...
3018-
def __divmod__(self, other: timedelta64) -> tuple[int64, timedelta64]: ...
3019-
def __rdivmod__(self, other: timedelta64) -> tuple[int64, timedelta64]: ...
3014+
def __rtruediv__(self, other: timedelta64, /) -> float64: ...
3015+
def __rfloordiv__(self, other: timedelta64, /) -> int64: ...
3016+
def __mod__(self, other: timedelta64, /) -> timedelta64: ...
3017+
def __rmod__(self, other: timedelta64, /) -> timedelta64: ...
3018+
def __divmod__(self, other: timedelta64, /) -> tuple[int64, timedelta64]: ...
3019+
def __rdivmod__(self, other: timedelta64, /) -> tuple[int64, timedelta64]: ...
30203020
__lt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
30213021
__le__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
30223022
__gt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_co]
@@ -3087,9 +3087,9 @@ class floating(inexact[_NBit1]):
30873087
def __getnewargs__(self: float64) -> tuple[float]: ...
30883088
def __getformat__(self: float64, typestr: L["double", "float"], /) -> str: ...
30893089
@overload
3090-
def __round__(self, ndigits: None = ...) -> int: ...
3090+
def __round__(self, ndigits: None = ..., /) -> int: ...
30913091
@overload
3092-
def __round__(self: _ScalarType, ndigits: SupportsIndex) -> _ScalarType: ...
3092+
def __round__(self: _ScalarType, ndigits: SupportsIndex, /) -> _ScalarType: ...
30933093
__add__: _FloatOp[_NBit1]
30943094
__radd__: _FloatOp[_NBit1]
30953095
__sub__: _FloatOp[_NBit1]
@@ -3170,13 +3170,14 @@ class void(flexible):
31703170
self, val: ArrayLike, dtype: DTypeLike, offset: int = ...
31713171
) -> None: ...
31723172
@overload
3173-
def __getitem__(self, key: str | SupportsIndex) -> Any: ...
3173+
def __getitem__(self, key: str | SupportsIndex, /) -> Any: ...
31743174
@overload
3175-
def __getitem__(self, key: list[str]) -> void: ...
3175+
def __getitem__(self, key: list[str], /) -> void: ...
31763176
def __setitem__(
31773177
self,
31783178
key: str | list[str] | SupportsIndex,
31793179
value: ArrayLike,
3180+
/,
31803181
) -> None: ...
31813182

31823183
class character(flexible): # type: ignore

0 commit comments

Comments
 (0)