diff options
| -rw-r--r-- | numpy/typing/_callable.py | 178 | ||||
| -rw-r--r-- | numpy/typing/_ufunc.pyi | 24 |
2 files changed, 102 insertions, 100 deletions
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 = ..., |
