summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-08-31 08:26:20 -0600
committerGitHub <noreply@github.com>2021-08-31 08:26:20 -0600
commit0656fc493591be2200b0b0df5e14fb547aa4702f (patch)
treeb067648dccb3d19241f4fb4d6ce6c420d2401103
parent160ccdb79ec429e9bab1fabb549e1351ada956f0 (diff)
parent82396851773c37220b0ac543c51b7a896ea75d96 (diff)
downloadnumpy-0656fc493591be2200b0b0df5e14fb547aa4702f.tar.gz
Merge pull request #19802 from BvB93/pep-457
STY: Use the new PEP 457 positional-only syntax for typing
-rw-r--r--numpy/__init__.pyi115
-rw-r--r--numpy/core/_ufunc_config.pyi2
-rw-r--r--numpy/core/einsumfunc.pyi27
-rw-r--r--numpy/core/multiarray.pyi93
-rw-r--r--numpy/core/shape_base.pyi12
-rw-r--r--numpy/lib/arraypad.pyi9
-rw-r--r--numpy/lib/npyio.pyi7
-rw-r--r--numpy/lib/shape_base.pyi10
-rw-r--r--numpy/lib/utils.pyi5
-rw-r--r--numpy/testing/_private/utils.pyi23
-rw-r--r--numpy/typing/_callable.py178
-rw-r--r--numpy/typing/_ufunc.pyi24
12 files changed, 270 insertions, 235 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index f398f67b7..ca13cffb8 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -1184,9 +1184,9 @@ class flatiter(Generic[_NdArraySubClass]):
self, key: Union[_ArrayLikeInt, slice, ellipsis],
) -> _NdArraySubClass: ...
@overload
- def __array__(self: flatiter[ndarray[Any, _DType]], __dtype: None = ...) -> ndarray[Any, _DType]: ...
+ def __array__(self: flatiter[ndarray[Any, _DType]], dtype: None = ..., /) -> ndarray[Any, _DType]: ...
@overload
- def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
+ def __array__(self, dtype: _DType, /) -> ndarray[Any, _DType]: ...
_OrderKACF = Optional[L["K", "A", "C", "F"]]
_OrderACF = Optional[L["A", "C", "F"]]
@@ -1215,7 +1215,7 @@ class _ArrayOrScalarCommon:
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def __copy__(self: _ArraySelf) -> _ArraySelf: ...
- def __deepcopy__(self: _ArraySelf, __memo: Optional[dict] = ...) -> _ArraySelf: ...
+ def __deepcopy__(self: _ArraySelf, memo: None | dict = ..., /) -> _ArraySelf: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def copy(self: _ArraySelf, order: _OrderKACF = ...) -> _ArraySelf: ...
@@ -1238,7 +1238,7 @@ class _ArrayOrScalarCommon:
def __array_priority__(self) -> float: ...
@property
def __array_struct__(self): ...
- def __setstate__(self, __state): ...
+ def __setstate__(self, state, /): ...
# a `bool_` is returned when `keepdims=True` and `self` is a 0d array
@overload
@@ -1648,7 +1648,7 @@ _ArrayNumber_co = NDArray[Union[bool_, number[Any]]]
_ArrayTD64_co = NDArray[Union[bool_, integer[Any], timedelta64]]
class _SupportsItem(Protocol[_T_co]):
- def item(self, __args: Any) -> _T_co: ...
+ def item(self, args: Any, /) -> _T_co: ...
class _SupportsReal(Protocol[_T_co]):
@property
@@ -1687,20 +1687,22 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
order: _OrderKACF = ...,
) -> _ArraySelf: ...
@overload
- def __array__(self, __dtype: None = ...) -> ndarray[Any, _DType_co]: ...
+ def __array__(self, dtype: None = ..., /) -> ndarray[Any, _DType_co]: ...
@overload
- def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
+ def __array__(self, dtype: _DType, /) -> ndarray[Any, _DType]: ...
def __array_wrap__(
self,
- __array: ndarray[_ShapeType2, _DType],
- __context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ array: ndarray[_ShapeType2, _DType],
+ context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ /,
) -> ndarray[_ShapeType2, _DType]: ...
def __array_prepare__(
self,
- __array: ndarray[_ShapeType2, _DType],
- __context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ array: ndarray[_ShapeType2, _DType],
+ context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ /,
) -> ndarray[_ShapeType2, _DType]: ...
@property
@@ -1727,16 +1729,17 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def item(
self: ndarray[Any, dtype[_SupportsItem[_T]]], # type: ignore[type-var]
- __args: Tuple[SupportsIndex, ...],
+ args: Tuple[SupportsIndex, ...],
+ /,
) -> _T: ...
@overload
- def itemset(self, __value: Any) -> None: ...
+ def itemset(self, value: Any, /) -> None: ...
@overload
- def itemset(self, __item: _ShapeLike, __value: Any) -> None: ...
+ def itemset(self, item: _ShapeLike, value: Any, /) -> None: ...
@overload
- def resize(self, __new_shape: _ShapeLike, *, refcheck: bool = ...) -> None: ...
+ def resize(self, new_shape: _ShapeLike, /, *, refcheck: bool = ...) -> None: ...
@overload
def resize(self, *new_shape: SupportsIndex, refcheck: bool = ...) -> None: ...
@@ -1756,7 +1759,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
) -> ndarray[Any, _DType_co]: ...
@overload
- def transpose(self: _ArraySelf, __axes: _ShapeLike) -> _ArraySelf: ...
+ def transpose(self: _ArraySelf, axes: _ShapeLike, /) -> _ArraySelf: ...
@overload
def transpose(self: _ArraySelf, *axes: SupportsIndex) -> _ArraySelf: ...
@@ -1895,7 +1898,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def reshape(
- self, __shape: _ShapeLike, *, order: _OrderACF = ...
+ self, shape: _ShapeLike, /, *, order: _OrderACF = ...
) -> ndarray[Any, _DType_co]: ...
@overload
def reshape(
@@ -2901,9 +2904,9 @@ class generic(_ArrayOrScalarCommon):
@abstractmethod
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
@overload
- def __array__(self: _ScalarType, __dtype: None = ...) -> ndarray[Any, dtype[_ScalarType]]: ...
+ def __array__(self: _ScalarType, dtype: None = ..., /) -> ndarray[Any, dtype[_ScalarType]]: ...
@overload
- def __array__(self, __dtype: _DType) -> ndarray[Any, _DType]: ...
+ def __array__(self, dtype: _DType, /) -> ndarray[Any, _DType]: ...
@property
def base(self) -> None: ...
@property
@@ -2971,8 +2974,7 @@ class generic(_ArrayOrScalarCommon):
) -> Any: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> Any: ...
@overload
@@ -3018,7 +3020,7 @@ class generic(_ArrayOrScalarCommon):
@overload
def reshape(
- self: _ScalarType, __shape: _ShapeLike, *, order: _OrderACF = ...
+ self: _ScalarType, shape: _ShapeLike, /, *, order: _OrderACF = ...
) -> ndarray[Any, dtype[_ScalarType]]: ...
@overload
def reshape(
@@ -3028,7 +3030,7 @@ class generic(_ArrayOrScalarCommon):
def squeeze(
self: _ScalarType, axis: Union[L[0], Tuple[()]] = ...
) -> _ScalarType: ...
- def transpose(self: _ScalarType, __axes: Tuple[()] = ...) -> _ScalarType: ...
+ def transpose(self: _ScalarType, axes: Tuple[()] = ..., /) -> _ScalarType: ...
# Keep `dtype` at the bottom to avoid name conflicts with `np.dtype`
@property
def dtype(self: _ScalarType) -> dtype[_ScalarType]: ...
@@ -3063,10 +3065,9 @@ class number(generic, Generic[_NBit1]): # type: ignore
__ge__: _ComparisonOp[_NumberLike_co, _ArrayLikeNumber_co]
class bool_(generic):
- def __init__(self, __value: object = ...) -> None: ...
+ def __init__(self, value: object = ..., /) -> None: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> bool: ...
def tolist(self) -> bool: ...
@property
@@ -3112,7 +3113,7 @@ class bool_(generic):
bool8 = bool_
class object_(generic):
- def __init__(self, __value: object = ...) -> None: ...
+ def __init__(self, value: object = ..., /) -> None: ...
@property
def real(self: _ArraySelf) -> _ArraySelf: ...
@property
@@ -3141,14 +3142,16 @@ class datetime64(generic):
@overload
def __init__(
self,
- __value: Union[None, datetime64, _CharLike_co, _DatetimeScalar] = ...,
- __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]] = ...,
+ value: None | datetime64 | _CharLike_co | _DatetimeScalar = ...,
+ format: _CharLike_co | Tuple[_CharLike_co, _IntLike_co] = ...,
+ /,
) -> None: ...
@overload
def __init__(
self,
- __value: int,
- __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]]
+ value: int,
+ format: _CharLike_co | Tuple[_CharLike_co, _IntLike_co],
+ /,
) -> None: ...
def __add__(self, other: _TD64Like_co) -> datetime64: ...
def __radd__(self, other: _TD64Like_co) -> datetime64: ...
@@ -3186,8 +3189,7 @@ class integer(number[_NBit1]): # type: ignore
# NOTE: `__index__` is technically defined in the bottom-most
# sub-classes (`int64`, `uint32`, etc)
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> int: ...
def tolist(self) -> int: ...
def __index__(self) -> int: ...
@@ -3209,7 +3211,7 @@ class integer(number[_NBit1]): # type: ignore
def __rxor__(self, other: _IntLike_co) -> integer: ...
class signedinteger(integer[_NBit1]):
- def __init__(self, __value: _IntValue = ...) -> None: ...
+ def __init__(self, value: _IntValue = ..., /) -> None: ...
__add__: _SignedIntOp[_NBit1]
__radd__: _SignedIntOp[_NBit1]
__sub__: _SignedIntOp[_NBit1]
@@ -3253,8 +3255,9 @@ longlong = signedinteger[_NBitLongLong]
class timedelta64(generic):
def __init__(
self,
- __value: Union[None, int, _CharLike_co, dt.timedelta, timedelta64] = ...,
- __format: Union[_CharLike_co, Tuple[_CharLike_co, _IntLike_co]] = ...,
+ value: None | int | _CharLike_co | dt.timedelta | timedelta64 = ...,
+ format: _CharLike_co | Tuple[_CharLike_co, _IntLike_co] = ...,
+ /,
) -> None: ...
@property
def numerator(self: _ScalarType) -> _ScalarType: ...
@@ -3290,7 +3293,7 @@ class timedelta64(generic):
class unsignedinteger(integer[_NBit1]):
# NOTE: `uint64 + signedinteger -> float64`
- def __init__(self, __value: _IntValue = ...) -> None: ...
+ def __init__(self, value: _IntValue = ..., /) -> None: ...
__add__: _UnsignedIntOp[_NBit1]
__radd__: _UnsignedIntOp[_NBit1]
__sub__: _UnsignedIntOp[_NBit1]
@@ -3336,23 +3339,23 @@ _IntType = TypeVar("_IntType", bound=integer)
_FloatType = TypeVar('_FloatType', bound=floating)
class floating(inexact[_NBit1]):
- def __init__(self, __value: _FloatValue = ...) -> None: ...
+ def __init__(self, value: _FloatValue = ..., /) -> None: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ...,
+ /,
) -> float: ...
def tolist(self) -> float: ...
def is_integer(self: float64) -> bool: ...
def hex(self: float64) -> str: ...
@classmethod
- def fromhex(cls: Type[float64], __string: str) -> float64: ...
+ def fromhex(cls: Type[float64], string: str, /) -> float64: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
if sys.version_info >= (3, 9):
def __ceil__(self: float64) -> int: ...
def __floor__(self: float64) -> int: ...
def __trunc__(self: float64) -> int: ...
def __getnewargs__(self: float64) -> Tuple[float]: ...
- def __getformat__(self: float64, __typestr: L["double", "float"]) -> str: ...
+ def __getformat__(self: float64, typestr: L["double", "float"], /) -> str: ...
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@overload
@@ -3390,10 +3393,9 @@ longfloat = floating[_NBitLongDouble]
# describing the two 64 bit floats representing its real and imaginary component
class complexfloating(inexact[_NBit1], Generic[_NBit1, _NBit2]):
- def __init__(self, __value: _ComplexValue = ...) -> None: ...
+ def __init__(self, value: _ComplexValue = ..., /) -> None: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> complex: ...
def tolist(self) -> complex: ...
@property
@@ -3433,7 +3435,7 @@ class flexible(generic): ... # type: ignore
# depending on whether or not it's used as an opaque bytes sequence
# or a structure
class void(flexible):
- def __init__(self, __value: Union[_IntLike_co, bytes]) -> None: ...
+ def __init__(self, value: _IntLike_co | bytes, /) -> None: ...
@property
def real(self: _ArraySelf) -> _ArraySelf: ...
@property
@@ -3455,14 +3457,13 @@ class character(flexible): # type: ignore
class bytes_(character, bytes):
@overload
- def __init__(self, __value: object = ...) -> None: ...
+ def __init__(self, value: object = ..., /) -> None: ...
@overload
def __init__(
- self, __value: str, encoding: str = ..., errors: str = ...
+ self, value: str, /, encoding: str = ..., errors: str = ...
) -> None: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> bytes: ...
def tolist(self) -> bytes: ...
@@ -3471,14 +3472,13 @@ bytes0 = bytes_
class str_(character, str):
@overload
- def __init__(self, __value: object = ...) -> None: ...
+ def __init__(self, value: object = ..., /) -> None: ...
@overload
def __init__(
- self, __value: bytes, encoding: str = ..., errors: str = ...
+ self, value: bytes, /, encoding: str = ..., errors: str = ...
) -> None: ...
def item(
- self,
- __args: Union[L[0], Tuple[()], Tuple[L[0]]] = ...,
+ self, args: L[0] | Tuple[()] | Tuple[L[0]] = ..., /,
) -> str: ...
def tolist(self) -> str: ...
@@ -3712,9 +3712,10 @@ class errstate(Generic[_CallType], ContextDecorator):
def __enter__(self) -> None: ...
def __exit__(
self,
- __exc_type: Optional[Type[BaseException]],
- __exc_value: Optional[BaseException],
- __traceback: Optional[TracebackType],
+ exc_type: Optional[Type[BaseException]],
+ exc_value: Optional[BaseException],
+ traceback: Optional[TracebackType],
+ /,
) -> None: ...
class ndenumerate(Generic[_ScalarType]):
diff --git a/numpy/core/_ufunc_config.pyi b/numpy/core/_ufunc_config.pyi
index aa48ddba7..9c8cc8ab6 100644
--- a/numpy/core/_ufunc_config.pyi
+++ b/numpy/core/_ufunc_config.pyi
@@ -4,7 +4,7 @@ _ErrKind = Literal["ignore", "warn", "raise", "call", "print", "log"]
_ErrFunc = Callable[[str, int], Any]
class _SupportsWrite(Protocol):
- def write(self, __msg: str) -> Any: ...
+ def write(self, msg: str, /) -> Any: ...
class _ErrDict(TypedDict):
divide: _ErrKind
diff --git a/numpy/core/einsumfunc.pyi b/numpy/core/einsumfunc.pyi
index bb02590e6..52025d502 100644
--- a/numpy/core/einsumfunc.pyi
+++ b/numpy/core/einsumfunc.pyi
@@ -46,7 +46,8 @@ __all__: List[str]
# Something like `is_scalar = bool(__subscripts.partition("->")[-1])`
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeBool_co,
out: None = ...,
dtype: Optional[_DTypeLikeBool] = ...,
@@ -56,7 +57,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeUInt_co,
out: None = ...,
dtype: Optional[_DTypeLikeUInt] = ...,
@@ -66,7 +68,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeInt_co,
out: None = ...,
dtype: Optional[_DTypeLikeInt] = ...,
@@ -76,7 +79,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeFloat_co,
out: None = ...,
dtype: Optional[_DTypeLikeFloat] = ...,
@@ -86,7 +90,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeComplex_co,
out: None = ...,
dtype: Optional[_DTypeLikeComplex] = ...,
@@ -96,7 +101,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: Any,
casting: _CastingUnsafe,
dtype: Optional[_DTypeLikeComplex_co] = ...,
@@ -106,7 +112,8 @@ def einsum(
) -> Any: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeComplex_co,
out: _ArrayType,
dtype: Optional[_DTypeLikeComplex_co] = ...,
@@ -116,7 +123,8 @@ def einsum(
) -> _ArrayType: ...
@overload
def einsum(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: Any,
out: _ArrayType,
casting: _CastingUnsafe,
@@ -130,7 +138,8 @@ def einsum(
# NOTE: In practice the list consists of a `str` (first element)
# and a variable number of integer tuples.
def einsum_path(
- __subscripts: str,
+ subscripts: str,
+ /,
*operands: _ArrayLikeComplex_co,
optimize: _OptimizeKind = ...,
) -> Tuple[List[Any], str]: ...
diff --git a/numpy/core/multiarray.pyi b/numpy/core/multiarray.pyi
index b807ddff0..3e2873cb3 100644
--- a/numpy/core/multiarray.pyi
+++ b/numpy/core/multiarray.pyi
@@ -306,7 +306,8 @@ def ravel_multi_index(
@overload
def concatenate( # type: ignore[misc]
- __arrays: _ArrayLike[_SCT],
+ arrays: _ArrayLike[_SCT],
+ /,
axis: Optional[SupportsIndex] = ...,
out: None = ...,
*,
@@ -315,7 +316,8 @@ def concatenate( # type: ignore[misc]
) -> NDArray[_SCT]: ...
@overload
def concatenate( # type: ignore[misc]
- __arrays: ArrayLike,
+ arrays: ArrayLike,
+ /,
axis: Optional[SupportsIndex] = ...,
out: None = ...,
*,
@@ -324,7 +326,8 @@ def concatenate( # type: ignore[misc]
) -> NDArray[Any]: ...
@overload
def concatenate( # type: ignore[misc]
- __arrays: ArrayLike,
+ arrays: ArrayLike,
+ /,
axis: Optional[SupportsIndex] = ...,
out: None = ...,
*,
@@ -333,7 +336,8 @@ def concatenate( # type: ignore[misc]
) -> NDArray[_SCT]: ...
@overload
def concatenate( # type: ignore[misc]
- __arrays: ArrayLike,
+ arrays: ArrayLike,
+ /,
axis: Optional[SupportsIndex] = ...,
out: None = ...,
*,
@@ -342,7 +346,8 @@ def concatenate( # type: ignore[misc]
) -> NDArray[Any]: ...
@overload
def concatenate(
- __arrays: ArrayLike,
+ arrays: ArrayLike,
+ /,
axis: Optional[SupportsIndex] = ...,
out: _ArrayType = ...,
*,
@@ -351,19 +356,22 @@ def concatenate(
) -> _ArrayType: ...
def inner(
- __a: ArrayLike,
- __b: ArrayLike,
+ a: ArrayLike,
+ b: ArrayLike,
+ /,
) -> Any: ...
@overload
def where(
- __condition: ArrayLike,
+ condition: ArrayLike,
+ /,
) -> Tuple[NDArray[intp], ...]: ...
@overload
def where(
- __condition: ArrayLike,
- __x: ArrayLike,
- __y: ArrayLike,
+ condition: ArrayLike,
+ x: ArrayLike,
+ y: ArrayLike,
+ /,
) -> NDArray[Any]: ...
def lexsort(
@@ -378,7 +386,7 @@ def can_cast(
) -> bool: ...
def min_scalar_type(
- __a: ArrayLike,
+ a: ArrayLike, /,
) -> dtype[Any]: ...
def result_type(
@@ -391,24 +399,25 @@ def dot(a: ArrayLike, b: ArrayLike, out: None = ...) -> Any: ...
def dot(a: ArrayLike, b: ArrayLike, out: _ArrayType) -> _ArrayType: ...
@overload
-def vdot(__a: _ArrayLikeBool_co, __b: _ArrayLikeBool_co) -> bool_: ... # type: ignore[misc]
+def vdot(a: _ArrayLikeBool_co, b: _ArrayLikeBool_co, /) -> bool_: ... # type: ignore[misc]
@overload
-def vdot(__a: _ArrayLikeUInt_co, __b: _ArrayLikeUInt_co) -> unsignedinteger[Any]: ... # type: ignore[misc]
+def vdot(a: _ArrayLikeUInt_co, b: _ArrayLikeUInt_co, /) -> unsignedinteger[Any]: ... # type: ignore[misc]
@overload
-def vdot(__a: _ArrayLikeInt_co, __b: _ArrayLikeInt_co) -> signedinteger[Any]: ... # type: ignore[misc]
+def vdot(a: _ArrayLikeInt_co, b: _ArrayLikeInt_co, /) -> signedinteger[Any]: ... # type: ignore[misc]
@overload
-def vdot(__a: _ArrayLikeFloat_co, __b: _ArrayLikeFloat_co) -> floating[Any]: ... # type: ignore[misc]
+def vdot(a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, /) -> floating[Any]: ... # type: ignore[misc]
@overload
-def vdot(__a: _ArrayLikeComplex_co, __b: _ArrayLikeComplex_co) -> complexfloating[Any, Any]: ... # type: ignore[misc]
+def vdot(a: _ArrayLikeComplex_co, b: _ArrayLikeComplex_co, /) -> complexfloating[Any, Any]: ... # type: ignore[misc]
@overload
-def vdot(__a: _ArrayLikeTD64_co, __b: _ArrayLikeTD64_co) -> timedelta64: ...
+def vdot(a: _ArrayLikeTD64_co, b: _ArrayLikeTD64_co, /) -> timedelta64: ...
@overload
-def vdot(__a: _ArrayLikeObject_co, __b: Any) -> Any: ...
+def vdot(a: _ArrayLikeObject_co, b: Any, /) -> Any: ...
@overload
-def vdot(__a: Any, __b: _ArrayLikeObject_co) -> Any: ...
+def vdot(a: Any, b: _ArrayLikeObject_co, /) -> Any: ...
def bincount(
- __x: ArrayLike,
+ x: ArrayLike,
+ /,
weights: Optional[ArrayLike] = ...,
minlength: SupportsIndex = ...,
) -> NDArray[intp]: ...
@@ -427,27 +436,31 @@ def putmask(
) -> None: ...
def packbits(
- __a: _ArrayLikeInt_co,
+ a: _ArrayLikeInt_co,
+ /,
axis: Optional[SupportsIndex] = ...,
bitorder: L["big", "little"] = ...,
) -> NDArray[uint8]: ...
def unpackbits(
- __a: _ArrayLike[uint8],
+ a: _ArrayLike[uint8],
+ /,
axis: Optional[SupportsIndex] = ...,
count: Optional[SupportsIndex] = ...,
bitorder: L["big", "little"] = ...,
) -> NDArray[uint8]: ...
def shares_memory(
- __a: object,
- __b: object,
+ a: object,
+ b: object,
+ /,
max_work: Optional[int] = ...,
) -> bool: ...
def may_share_memory(
- __a: object,
- __b: object,
+ a: object,
+ b: object,
+ /,
max_work: Optional[int] = ...,
) -> bool: ...
@@ -586,7 +599,7 @@ def asfortranarray(
# In practice `List[Any]` is list with an int, int and a valid
# `np.seterrcall()` object
def geterrobj() -> List[Any]: ...
-def seterrobj(__errobj: List[Any]) -> None: ...
+def seterrobj(errobj: List[Any], /) -> None: ...
def promote_types(__type1: DTypeLike, __type2: DTypeLike) -> dtype[Any]: ...
@@ -620,7 +633,7 @@ def fromstring(
) -> NDArray[Any]: ...
def frompyfunc(
- __func: Callable[..., Any],
+ func: Callable[..., Any], /,
nin: SupportsIndex,
nout: SupportsIndex,
*,
@@ -705,8 +718,8 @@ def frombuffer(
@overload
def arange( # type: ignore[misc]
- __stop: _IntLike_co,
- *,
+ stop: _IntLike_co,
+ /, *,
dtype: None = ...,
like: ArrayLike = ...,
) -> NDArray[signedinteger[Any]]: ...
@@ -721,8 +734,8 @@ def arange( # type: ignore[misc]
) -> NDArray[signedinteger[Any]]: ...
@overload
def arange( # type: ignore[misc]
- __stop: _FloatLike_co,
- *,
+ stop: _FloatLike_co,
+ /, *,
dtype: None = ...,
like: ArrayLike = ...,
) -> NDArray[floating[Any]]: ...
@@ -737,8 +750,8 @@ def arange( # type: ignore[misc]
) -> NDArray[floating[Any]]: ...
@overload
def arange(
- __stop: _TD64Like_co,
- *,
+ stop: _TD64Like_co,
+ /, *,
dtype: None = ...,
like: ArrayLike = ...,
) -> NDArray[timedelta64]: ...
@@ -762,8 +775,8 @@ def arange( # both start and stop must always be specified for datetime64
) -> NDArray[datetime64]: ...
@overload
def arange(
- __stop: Any,
- *,
+ stop: Any,
+ /, *,
dtype: _DTypeLike[_SCT],
like: ArrayLike = ...,
) -> NDArray[_SCT]: ...
@@ -778,7 +791,7 @@ def arange(
) -> NDArray[_SCT]: ...
@overload
def arange(
- __stop: Any,
+ stop: Any, /,
*,
dtype: DTypeLike,
like: ArrayLike = ...,
@@ -794,7 +807,7 @@ def arange(
) -> NDArray[Any]: ...
def datetime_data(
- __dtype: str | _DTypeLike[datetime64] | _DTypeLike[timedelta64],
+ dtype: str | _DTypeLike[datetime64] | _DTypeLike[timedelta64], /,
) -> Tuple[str, int]: ...
# The datetime functions perform unsafe casts to `datetime64[D]`,
@@ -945,7 +958,7 @@ def compare_chararrays(
rstrip: bool,
) -> NDArray[bool_]: ...
-def add_docstring(__obj: Callable[..., Any], __docstring: str) -> None: ...
+def add_docstring(obj: Callable[..., Any], docstring: str, /) -> None: ...
_GetItemKeys = L[
"C", "CONTIGUOUS", "C_CONTIGUOUS",
diff --git a/numpy/core/shape_base.pyi b/numpy/core/shape_base.pyi
index a640991d3..d7914697d 100644
--- a/numpy/core/shape_base.pyi
+++ b/numpy/core/shape_base.pyi
@@ -11,23 +11,23 @@ _ArrayLike = _NestedSequence[_SupportsArray[dtype[_SCT]]]
__all__: List[str]
@overload
-def atleast_1d(__arys: _ArrayLike[_SCT]) -> NDArray[_SCT]: ...
+def atleast_1d(arys: _ArrayLike[_SCT], /) -> NDArray[_SCT]: ...
@overload
-def atleast_1d(__arys: ArrayLike) -> NDArray[Any]: ...
+def atleast_1d(arys: ArrayLike, /) -> NDArray[Any]: ...
@overload
def atleast_1d(*arys: ArrayLike) -> List[NDArray[Any]]: ...
@overload
-def atleast_2d(__arys: _ArrayLike[_SCT]) -> NDArray[_SCT]: ...
+def atleast_2d(arys: _ArrayLike[_SCT], /) -> NDArray[_SCT]: ...
@overload
-def atleast_2d(__arys: ArrayLike) -> NDArray[Any]: ...
+def atleast_2d(arys: ArrayLike, /) -> NDArray[Any]: ...
@overload
def atleast_2d(*arys: ArrayLike) -> List[NDArray[Any]]: ...
@overload
-def atleast_3d(__arys: _ArrayLike[_SCT]) -> NDArray[_SCT]: ...
+def atleast_3d(arys: _ArrayLike[_SCT], /) -> NDArray[_SCT]: ...
@overload
-def atleast_3d(__arys: ArrayLike) -> NDArray[Any]: ...
+def atleast_3d(arys: ArrayLike, /) -> NDArray[Any]: ...
@overload
def atleast_3d(*arys: ArrayLike) -> List[NDArray[Any]]: ...
diff --git a/numpy/lib/arraypad.pyi b/numpy/lib/arraypad.pyi
index d6e07a6bd..49ce8e683 100644
--- a/numpy/lib/arraypad.pyi
+++ b/numpy/lib/arraypad.pyi
@@ -24,10 +24,11 @@ _SCT = TypeVar("_SCT", bound=generic)
class _ModeFunc(Protocol):
def __call__(
self,
- __vector: NDArray[Any],
- __iaxis_pad_width: Tuple[int, int],
- __iaxis: int,
- __kwargs: Dict[str, Any],
+ vector: NDArray[Any],
+ iaxis_pad_width: Tuple[int, int],
+ iaxis: int,
+ kwargs: Dict[str, Any],
+ /,
) -> None: ...
_ModeKind = L[
diff --git a/numpy/lib/npyio.pyi b/numpy/lib/npyio.pyi
index 1321afb55..1fa689bbe 100644
--- a/numpy/lib/npyio.pyi
+++ b/numpy/lib/npyio.pyi
@@ -80,9 +80,10 @@ class NpzFile(Mapping[str, NDArray[Any]]):
def __enter__(self: _T) -> _T: ...
def __exit__(
self,
- __exc_type: None | Type[BaseException],
- __exc_value: None | BaseException,
- __traceback: None | types.TracebackType,
+ exc_type: None | Type[BaseException],
+ exc_value: None | BaseException,
+ traceback: None | types.TracebackType,
+ /,
) -> None: ...
def close(self) -> None: ...
def __del__(self) -> None: ...
diff --git a/numpy/lib/shape_base.pyi b/numpy/lib/shape_base.pyi
index 4c275cc8c..1598dc36c 100644
--- a/numpy/lib/shape_base.pyi
+++ b/numpy/lib/shape_base.pyi
@@ -38,15 +38,17 @@ _ArrayLike = _NestedSequence[_SupportsDType[dtype[_SCT]]]
class _ArrayWrap(Protocol):
def __call__(
self,
- __array: NDArray[Any],
- __context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ array: NDArray[Any],
+ context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ /,
) -> Any: ...
class _ArrayPrepare(Protocol):
def __call__(
self,
- __array: NDArray[Any],
- __context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ array: NDArray[Any],
+ context: None | Tuple[ufunc, Tuple[Any, ...], int] = ...,
+ /,
) -> Any: ...
class _SupportsArrayWrap(Protocol):
diff --git a/numpy/lib/utils.pyi b/numpy/lib/utils.pyi
index c13a219b5..f0a8797ad 100644
--- a/numpy/lib/utils.pyi
+++ b/numpy/lib/utils.pyi
@@ -26,7 +26,7 @@ _FuncType = TypeVar("_FuncType", bound=Callable[..., Any])
# A file-like object opened in `w` mode
class _SupportsWrite(Protocol[_T_contra]):
- def write(self, __s: _T_contra) -> Any: ...
+ def write(self, s: _T_contra, /) -> Any: ...
__all__: List[str]
@@ -55,7 +55,8 @@ def deprecate(
) -> _Deprecate: ...
@overload
def deprecate(
- __func: _FuncType,
+ func: _FuncType,
+ /,
old_name: Optional[str] = ...,
new_name: Optional[str] = ...,
message: Optional[str] = ...,
diff --git a/numpy/testing/_private/utils.pyi b/numpy/testing/_private/utils.pyi
index ab5ca8784..26ce52e40 100644
--- a/numpy/testing/_private/utils.pyi
+++ b/numpy/testing/_private/utils.pyi
@@ -259,8 +259,9 @@ def raises(*args: Type[BaseException]) -> Callable[[_FT], _FT]: ...
@overload
def assert_raises( # type: ignore
- __expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...],
- __callable: Callable[..., Any],
+ expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...],
+ callable: Callable[..., Any],
+ /,
*args: Any,
**kwargs: Any,
) -> None: ...
@@ -273,9 +274,10 @@ def assert_raises(
@overload
def assert_raises_regex(
- __expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...],
- __expected_regex: str | bytes | Pattern[Any],
- __callable: Callable[..., Any],
+ expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...],
+ expected_regex: str | bytes | Pattern[Any],
+ callable: Callable[..., Any],
+ /,
*args: Any,
**kwargs: Any,
) -> None: ...
@@ -339,8 +341,9 @@ def assert_warns(
) -> contextlib._GeneratorContextManager[None]: ...
@overload
def assert_warns(
- __warning_class: Type[Warning],
- __func: Callable[..., _T],
+ warning_class: Type[Warning],
+ func: Callable[..., _T],
+ /,
*args: Any,
**kwargs: Any,
) -> _T: ...
@@ -349,7 +352,8 @@ def assert_warns(
def assert_no_warnings() -> contextlib._GeneratorContextManager[None]: ...
@overload
def assert_no_warnings(
- __func: Callable[..., _T],
+ func: Callable[..., _T],
+ /,
*args: Any,
**kwargs: Any,
) -> _T: ...
@@ -386,7 +390,8 @@ def temppath(
def assert_no_gc_cycles() -> contextlib._GeneratorContextManager[None]: ...
@overload
def assert_no_gc_cycles(
- __func: Callable[..., Any],
+ func: Callable[..., Any],
+ /,
*args: Any,
**kwargs: Any,
) -> None: ...
diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py
index 63a8153af..44ad5c291 100644
--- a/numpy/typing/_callable.py
+++ b/numpy/typing/_callable.py
@@ -62,264 +62,264 @@ _GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)
class _BoolOp(Protocol[_GenericType_co]):
@overload
- def __call__(self, __other: _BoolLike_co) -> _GenericType_co: ...
+ def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
@overload # platform dependent
- def __call__(self, __other: int) -> int_: ...
+ def __call__(self, other: int, /) -> int_: ...
@overload
- def __call__(self, __other: float) -> float64: ...
+ def __call__(self, other: float, /) -> float64: ...
@overload
- def __call__(self, __other: complex) -> complex128: ...
+ def __call__(self, other: complex, /) -> complex128: ...
@overload
- def __call__(self, __other: _NumberType) -> _NumberType: ...
+ def __call__(self, other: _NumberType, /) -> _NumberType: ...
class _BoolBitOp(Protocol[_GenericType_co]):
@overload
- def __call__(self, __other: _BoolLike_co) -> _GenericType_co: ...
+ def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
@overload # platform dependent
- def __call__(self, __other: int) -> int_: ...
+ def __call__(self, other: int, /) -> int_: ...
@overload
- def __call__(self, __other: _IntType) -> _IntType: ...
+ def __call__(self, other: _IntType, /) -> _IntType: ...
class _BoolSub(Protocol):
- # Note that `__other: bool_` is absent here
+ # Note that `other: bool_` is absent here
@overload
- def __call__(self, __other: bool) -> NoReturn: ...
+ def __call__(self, other: bool, /) -> NoReturn: ...
@overload # platform dependent
- def __call__(self, __other: int) -> int_: ...
+ def __call__(self, other: int, /) -> int_: ...
@overload
- def __call__(self, __other: float) -> float64: ...
+ def __call__(self, other: float, /) -> float64: ...
@overload
- def __call__(self, __other: complex) -> complex128: ...
+ def __call__(self, other: complex, /) -> complex128: ...
@overload
- def __call__(self, __other: _NumberType) -> _NumberType: ...
+ def __call__(self, other: _NumberType, /) -> _NumberType: ...
class _BoolTrueDiv(Protocol):
@overload
- def __call__(self, __other: float | _IntLike_co) -> float64: ...
+ def __call__(self, other: float | _IntLike_co, /) -> float64: ...
@overload
- def __call__(self, __other: complex) -> complex128: ...
+ def __call__(self, other: complex, /) -> complex128: ...
@overload
- def __call__(self, __other: _NumberType) -> _NumberType: ...
+ def __call__(self, other: _NumberType, /) -> _NumberType: ...
class _BoolMod(Protocol):
@overload
- def __call__(self, __other: _BoolLike_co) -> int8: ...
+ def __call__(self, other: _BoolLike_co, /) -> int8: ...
@overload # platform dependent
- def __call__(self, __other: int) -> int_: ...
+ def __call__(self, other: int, /) -> int_: ...
@overload
- def __call__(self, __other: float) -> float64: ...
+ def __call__(self, other: float, /) -> float64: ...
@overload
- def __call__(self, __other: _IntType) -> _IntType: ...
+ def __call__(self, other: _IntType, /) -> _IntType: ...
@overload
- def __call__(self, __other: _FloatType) -> _FloatType: ...
+ def __call__(self, other: _FloatType, /) -> _FloatType: ...
class _BoolDivMod(Protocol):
@overload
- def __call__(self, __other: _BoolLike_co) -> _2Tuple[int8]: ...
+ def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ...
@overload # platform dependent
- def __call__(self, __other: int) -> _2Tuple[int_]: ...
+ def __call__(self, other: int, /) -> _2Tuple[int_]: ...
@overload
- def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
+ def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
@overload
- def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ...
+ def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ...
@overload
- def __call__(self, __other: _FloatType) -> _2Tuple[_FloatType]: ...
+ def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ...
class _TD64Div(Protocol[_NumberType_co]):
@overload
- def __call__(self, __other: timedelta64) -> _NumberType_co: ...
+ def __call__(self, other: timedelta64, /) -> _NumberType_co: ...
@overload
- def __call__(self, __other: _BoolLike_co) -> NoReturn: ...
+ def __call__(self, other: _BoolLike_co, /) -> NoReturn: ...
@overload
- def __call__(self, __other: _FloatLike_co) -> timedelta64: ...
+ def __call__(self, other: _FloatLike_co, /) -> timedelta64: ...
class _IntTrueDiv(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> floating[_NBit1]: ...
+ def __call__(self, other: bool, /) -> floating[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: complex
+ self, other: complex, /,
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
@overload
- def __call__(self, __other: integer[_NBit2]) -> floating[_NBit1 | _NBit2]: ...
+ def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ...
class _UnsignedIntOp(Protocol[_NBit1]):
# NOTE: `uint64 + signedinteger -> float64`
@overload
- def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
@overload
def __call__(
- self, __other: int | signedinteger[Any]
+ self, other: int | signedinteger[Any], /
) -> Any: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: complex
+ self, other: complex, /,
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: unsignedinteger[_NBit2]
+ self, other: unsignedinteger[_NBit2], /
) -> unsignedinteger[_NBit1 | _NBit2]: ...
class _UnsignedIntBitOp(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> signedinteger[Any]: ...
+ def __call__(self, other: int, /) -> signedinteger[Any]: ...
@overload
- def __call__(self, __other: signedinteger[Any]) -> signedinteger[Any]: ...
+ def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ...
@overload
def __call__(
- self, __other: unsignedinteger[_NBit2]
+ self, other: unsignedinteger[_NBit2], /
) -> unsignedinteger[_NBit1 | _NBit2]: ...
class _UnsignedIntMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
@overload
def __call__(
- self, __other: int | signedinteger[Any]
+ self, other: int | signedinteger[Any], /
) -> Any: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: unsignedinteger[_NBit2]
+ self, other: unsignedinteger[_NBit2], /
) -> unsignedinteger[_NBit1 | _NBit2]: ...
class _UnsignedIntDivMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ...
+ def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
@overload
def __call__(
- self, __other: int | signedinteger[Any]
+ self, other: int | signedinteger[Any], /
) -> _2Tuple[Any]: ...
@overload
- def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
+ def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
@overload
def __call__(
- self, __other: unsignedinteger[_NBit2]
+ self, other: unsignedinteger[_NBit2], /
) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ...
class _SignedIntOp(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: complex
+ self, other: complex, /,
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: signedinteger[_NBit2]
+ self, other: signedinteger[_NBit2], /,
) -> signedinteger[_NBit1 | _NBit2]: ...
class _SignedIntBitOp(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
@overload
def __call__(
- self, __other: signedinteger[_NBit2]
+ self, other: signedinteger[_NBit2], /,
) -> signedinteger[_NBit1 | _NBit2]: ...
class _SignedIntMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
+ def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: signedinteger[_NBit2]
+ self, other: signedinteger[_NBit2], /,
) -> signedinteger[_NBit1 | _NBit2]: ...
class _SignedIntDivMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ...
+ def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
@overload
- def __call__(self, __other: int) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
+ def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
@overload
- def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
+ def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
@overload
def __call__(
- self, __other: signedinteger[_NBit2]
+ self, other: signedinteger[_NBit2], /,
) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ...
class _FloatOp(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> floating[_NBit1]: ...
+ def __call__(self, other: bool, /) -> floating[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: complex
+ self, other: complex, /,
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: integer[_NBit2] | floating[_NBit2]
+ self, other: integer[_NBit2] | floating[_NBit2], /
) -> floating[_NBit1 | _NBit2]: ...
class _FloatMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> floating[_NBit1]: ...
+ def __call__(self, other: bool, /) -> floating[_NBit1]: ...
@overload
- def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
@overload
- def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
+ def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
@overload
def __call__(
- self, __other: integer[_NBit2] | floating[_NBit2]
+ self, other: integer[_NBit2] | floating[_NBit2], /
) -> floating[_NBit1 | _NBit2]: ...
class _FloatDivMod(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> _2Tuple[floating[_NBit1]]: ...
+ def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ...
@overload
- def __call__(self, __other: int) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
+ def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
@overload
- def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
+ def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
@overload
def __call__(
- self, __other: integer[_NBit2] | floating[_NBit2]
+ self, other: integer[_NBit2] | floating[_NBit2], /
) -> _2Tuple[floating[_NBit1 | _NBit2]]: ...
class _ComplexOp(Protocol[_NBit1]):
@overload
- def __call__(self, __other: bool) -> complexfloating[_NBit1, _NBit1]: ...
+ def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ...
@overload
- def __call__(self, __other: int) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
+ def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
@overload
def __call__(
- self, __other: complex
+ self, other: complex, /,
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
@overload
def __call__(
self,
- __other: Union[
+ other: Union[
integer[_NBit2],
floating[_NBit2],
complexfloating[_NBit2, _NBit2],
- ]
+ ], /,
) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ...
class _NumberOp(Protocol):
- def __call__(self, __other: _NumberLike_co) -> Any: ...
+ def __call__(self, other: _NumberLike_co, /) -> Any: ...
class _ComparisonOp(Protocol[_T1, _T2]):
@overload
- def __call__(self, __other: _T1) -> bool_: ...
+ def __call__(self, other: _T1, /) -> bool_: ...
@overload
- def __call__(self, __other: _T2) -> NDArray[bool_]: ...
+ def __call__(self, other: _T2, /) -> NDArray[bool_]: ...
diff --git a/numpy/typing/_ufunc.pyi b/numpy/typing/_ufunc.pyi
index 37e6c008f..1be3500c1 100644
--- a/numpy/typing/_ufunc.pyi
+++ b/numpy/typing/_ufunc.pyi
@@ -105,8 +105,9 @@ class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]):
def at(
self,
- __a: NDArray[Any],
- __indices: _ArrayLikeInt_co,
+ a: NDArray[Any],
+ indices: _ArrayLikeInt_co,
+ /,
) -> None: ...
class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]):
@@ -158,9 +159,10 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]):
def at(
self,
- __a: NDArray[Any],
- __indices: _ArrayLikeInt_co,
- __b: ArrayLike,
+ a: NDArray[Any],
+ indices: _ArrayLikeInt_co,
+ b: ArrayLike,
+ /,
) -> None: ...
def reduce(
@@ -195,9 +197,9 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]):
@overload
def outer(
self,
- __A: _ScalarLike_co,
- __B: _ScalarLike_co,
- *,
+ A: _ScalarLike_co,
+ B: _ScalarLike_co,
+ /, *,
out: None = ...,
where: None | _ArrayLikeBool_co = ...,
casting: _CastingKind = ...,
@@ -210,9 +212,9 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]):
@overload
def outer( # type: ignore[misc]
self,
- __A: ArrayLike,
- __B: ArrayLike,
- *,
+ A: ArrayLike,
+ B: ArrayLike,
+ /, *,
out: None | NDArray[Any] | Tuple[NDArray[Any]] = ...,
where: None | _ArrayLikeBool_co = ...,
casting: _CastingKind = ...,