diff --git a/src/_numtype/__init__.pyi b/src/_numtype/__init__.pyi index 5c902f4f..39168dd1 100644 --- a/src/_numtype/__init__.pyi +++ b/src/_numtype/__init__.pyi @@ -9,7 +9,7 @@ import ipaddress as ip import uuid from collections.abc import Sequence from typing import Any, ClassVar, TypeAlias, final, type_check_only -from typing_extensions import Never, Protocol, TypeAliasType, TypeVar, Unpack +from typing_extensions import Protocol, TypeAliasType, TypeVar, Unpack import numpy as np from numpy._typing import _64Bit @@ -20,9 +20,10 @@ from numpy._typing import _64Bit _T = TypeVar("_T", default=Any) _T_co = TypeVar("_T_co", covariant=True) _ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], default=tuple[int, ...], covariant=True) -_ScalarT = TypeVar("_ScalarT", bound=np.generic, default=Any) +_ScalarT = TypeVar("_ScalarT", bound=np.generic) +_ScalarT0 = TypeVar("_ScalarT0", bound=np.generic, default=Any) _ScalarT_co = TypeVar("_ScalarT_co", bound=np.generic, default=Any, covariant=True) -_ToT = TypeVar("_ToT", default=Never) +_ToT = TypeVar("_ToT") ### # Type constraints (bijective type mappings) @@ -103,19 +104,19 @@ Sequence_4nd: TypeAlias = Sequence[Sequence_3nd[_T]] ### # Shape-typed array aliases -Array = TypeAliasType("Array", np.ndarray[_ShapeT, np.dtype[_ScalarT]], type_params=(_ScalarT, _ShapeT)) -Array_0d = TypeAliasType("Array_0d", np.ndarray[tuple[()], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -Array_1d = TypeAliasType("Array_1d", np.ndarray[tuple[int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -Array_2d = TypeAliasType("Array_2d", np.ndarray[tuple[int, int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -Array_3d = TypeAliasType("Array_3d", np.ndarray[tuple[int, int, int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) +Array = TypeAliasType("Array", np.ndarray[_ShapeT, np.dtype[_ScalarT0]], type_params=(_ScalarT0, _ShapeT)) +Array_0d = TypeAliasType("Array_0d", np.ndarray[tuple[()], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +Array_1d = TypeAliasType("Array_1d", np.ndarray[tuple[int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +Array_2d = TypeAliasType("Array_2d", np.ndarray[tuple[int, int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +Array_3d = TypeAliasType("Array_3d", np.ndarray[tuple[int, int, int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) -MArray = TypeAliasType("MArray", np.ma.MaskedArray[_ShapeT, np.dtype[_ScalarT]], type_params=(_ScalarT, _ShapeT)) -MArray_0d = TypeAliasType("MArray_0d", np.ma.MaskedArray[tuple[()], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -MArray_1d = TypeAliasType("MArray_1d", np.ma.MaskedArray[tuple[int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -MArray_2d = TypeAliasType("MArray_2d", np.ma.MaskedArray[tuple[int, int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) -MArray_3d = TypeAliasType("MArray_3d", np.ma.MaskedArray[tuple[int, int, int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) +MArray = TypeAliasType("MArray", np.ma.MaskedArray[_ShapeT, np.dtype[_ScalarT0]], type_params=(_ScalarT0, _ShapeT)) +MArray_0d = TypeAliasType("MArray_0d", np.ma.MaskedArray[tuple[()], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +MArray_1d = TypeAliasType("MArray_1d", np.ma.MaskedArray[tuple[int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +MArray_2d = TypeAliasType("MArray_2d", np.ma.MaskedArray[tuple[int, int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) +MArray_3d = TypeAliasType("MArray_3d", np.ma.MaskedArray[tuple[int, int, int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) -Matrix = TypeAliasType("Matrix", np.matrix[tuple[int, int], np.dtype[_ScalarT]], type_params=(_ScalarT,)) +Matrix = TypeAliasType("Matrix", np.matrix[tuple[int, int], np.dtype[_ScalarT0]], type_params=(_ScalarT0,)) ### # helper aliases @@ -137,21 +138,34 @@ _PyObject: TypeAlias = ( # anything immutable that results in an `object_` dtyp | ip.IPv6Address ) -_ToArray_nd: TypeAlias = _ScalarT | _ToT | CanArray[_ScalarT] | Sequence_nd[_ToT | _ScalarT] | Sequence_nd[CanArray[_ScalarT]] -_ToArray_0d: TypeAlias = _ScalarT | _ToT | CanArray[_ScalarT, tuple[()]] +_ToArray1_0d: TypeAlias = _ScalarT | CanArray[_ScalarT, tuple[()]] +_ToArray1_nd: TypeAlias = _ScalarT | CanArray[_ScalarT, Any] | Sequence_nd[CanArray[_ScalarT, Any]] +_ToArray2_0d: TypeAlias = _ToT | CanArray[_ScalarT, tuple[()]] +_ToArray2_nd: TypeAlias = _ToT | CanArray[_ScalarT, Any] | Sequence_nd[_ToT] | Sequence_nd[CanArray[_ScalarT, Any]] +_ToArray_0d: TypeAlias = _ToArray2_0d[_ScalarT | _ToT, _ScalarT] +_ToArray_nd: TypeAlias = _ToArray2_nd[_ScalarT | _ToT, _ScalarT] # don't require matching shape-types by default +_ToArray1_1d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray1_0d[_ScalarT]] +_ToArray1_2d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray1_1d[_ScalarT]] +_ToArray1_3d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray1_2d[_ScalarT]] _ToArray_1d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray_0d[_ScalarT, _ToT]] _ToArray_2d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray_1d[_ScalarT, _ToT]] _ToArray_3d: TypeAlias = CanArraySized[_ScalarT] | Sequence[_ToArray_2d[_ScalarT, _ToT]] # requires ndarray to be shape-types (the `s` suffix stands for "strict") +_ToArray1_1ds: TypeAlias = CanArraySized[_ScalarT, tuple[int]] | Sequence[_ToArray1_0d[_ScalarT]] +_ToArray1_2ds: TypeAlias = CanArraySized[_ScalarT, tuple[int, int]] | Sequence[_ToArray1_1ds[_ScalarT]] +_ToArray1_3ds: TypeAlias = CanArraySized[_ScalarT, tuple[int, int, int]] | Sequence[_ToArray1_2ds[_ScalarT]] _ToArray_1ds: TypeAlias = CanArraySized[_ScalarT, tuple[int]] | Sequence[_ToArray_0d[_ScalarT, _ToT]] _ToArray_2ds: TypeAlias = CanArraySized[_ScalarT, tuple[int, int]] | Sequence[_ToArray_1ds[_ScalarT, _ToT]] _ToArray_3ds: TypeAlias = CanArraySized[_ScalarT, tuple[int, int, int]] | Sequence[_ToArray_2ds[_ScalarT, _ToT]] # requires a lower bound on dimensionality, e.g. `_2nd` denotes `ndin` within `[2, n]` -_ToArray_1nd: TypeAlias = CanArraySized[_ScalarT] | Sequence_nd[_ToT | _ScalarT] | Sequence_nd[CanArray[_ScalarT]] +_ToArray1_1nd: TypeAlias = CanArraySized[_ScalarT] | Sequence_nd[CanArray[_ScalarT, Any]] +_ToArray1_2nd: TypeAlias = CanArraySized[_ScalarT, AtLeast2D] | Sequence[_ToArray1_1nd[_ScalarT]] +_ToArray1_3nd: TypeAlias = CanArraySized[_ScalarT, AtLeast3D] | Sequence[_ToArray1_2nd[_ScalarT]] +_ToArray_1nd: TypeAlias = CanArraySized[_ScalarT] | Sequence_nd[_ToT | _ScalarT] | Sequence_nd[CanArray[_ScalarT, Any]] _ToArray_2nd: TypeAlias = CanArraySized[_ScalarT, AtLeast2D] | Sequence[_ToArray_1nd[_ScalarT, _ToT]] _ToArray_3nd: TypeAlias = CanArraySized[_ScalarT, AtLeast3D] | Sequence[_ToArray_2nd[_ScalarT, _ToT]] @@ -173,162 +187,162 @@ ToBool_2nd = TypeAliasType("ToBool_2nd", _ToArray_2nd[_ToBool, bool]) ToBool_3nd = TypeAliasType("ToBool_3nd", _ToArray_3nd[_ToBool, bool]) # unsigned integers -ToUInt8_nd = TypeAliasType("ToUInt8_nd", _ToArray_nd[np.uint8]) -ToUInt8_0d = TypeAliasType("ToUInt8_0d", _ToArray_0d[np.uint8]) -ToUInt8_1d = TypeAliasType("ToUInt8_1d", _ToArray_1d[np.uint8]) -ToUInt8_2d = TypeAliasType("ToUInt8_2d", _ToArray_2d[np.uint8]) -ToUInt8_3d = TypeAliasType("ToUInt8_3d", _ToArray_3d[np.uint8]) -ToUInt8_1ds = TypeAliasType("ToUInt8_1ds", _ToArray_1ds[np.uint8]) -ToUInt8_2ds = TypeAliasType("ToUInt8_2ds", _ToArray_2ds[np.uint8]) -ToUInt8_3ds = TypeAliasType("ToUInt8_3ds", _ToArray_3ds[np.uint8]) -ToUInt8_1nd = TypeAliasType("ToUInt8_1nd", _ToArray_1nd[np.uint8]) -ToUInt8_2nd = TypeAliasType("ToUInt8_2nd", _ToArray_2nd[np.uint8]) -ToUInt8_3nd = TypeAliasType("ToUInt8_3nd", _ToArray_3nd[np.uint8]) - -ToUInt16_nd = TypeAliasType("ToUInt16_nd", _ToArray_nd[np.uint16]) -ToUInt16_0d = TypeAliasType("ToUInt16_0d", _ToArray_0d[np.uint16]) -ToUInt16_1d = TypeAliasType("ToUInt16_1d", _ToArray_1d[np.uint16]) -ToUInt16_2d = TypeAliasType("ToUInt16_2d", _ToArray_2d[np.uint16]) -ToUInt16_3d = TypeAliasType("ToUInt16_3d", _ToArray_3d[np.uint16]) -ToUInt16_1ds = TypeAliasType("ToUInt16_1ds", _ToArray_1ds[np.uint16]) -ToUInt16_2ds = TypeAliasType("ToUInt16_2ds", _ToArray_2ds[np.uint16]) -ToUInt16_3ds = TypeAliasType("ToUInt16_3ds", _ToArray_3ds[np.uint16]) -ToUInt16_1nd = TypeAliasType("ToUInt16_1nd", _ToArray_1nd[np.uint16]) -ToUInt16_2nd = TypeAliasType("ToUInt16_2nd", _ToArray_2nd[np.uint16]) -ToUInt16_3nd = TypeAliasType("ToUInt16_3nd", _ToArray_3nd[np.uint16]) - -ToUInt32_nd = TypeAliasType("ToUInt32_nd", _ToArray_nd[np.uint32]) -ToUInt32_0d = TypeAliasType("ToUInt32_0d", _ToArray_0d[np.uint32]) -ToUInt32_1d = TypeAliasType("ToUInt32_1d", _ToArray_1d[np.uint32]) -ToUInt32_2d = TypeAliasType("ToUInt32_2d", _ToArray_2d[np.uint32]) -ToUInt32_3d = TypeAliasType("ToUInt32_3d", _ToArray_3d[np.uint32]) -ToUInt32_1ds = TypeAliasType("ToUInt32_1ds", _ToArray_1ds[np.uint32]) -ToUInt32_2ds = TypeAliasType("ToUInt32_2ds", _ToArray_2ds[np.uint32]) -ToUInt32_3ds = TypeAliasType("ToUInt32_3ds", _ToArray_3ds[np.uint32]) -ToUInt32_1nd = TypeAliasType("ToUInt32_1nd", _ToArray_1nd[np.uint32]) -ToUInt32_2nd = TypeAliasType("ToUInt32_2nd", _ToArray_2nd[np.uint32]) -ToUInt32_3nd = TypeAliasType("ToUInt32_3nd", _ToArray_3nd[np.uint32]) - -ToUInt64_nd = TypeAliasType("ToUInt64_nd", _ToArray_nd[np.uint64]) -ToUInt64_0d = TypeAliasType("ToUInt64_0d", _ToArray_0d[np.uint64]) -ToUInt64_1d = TypeAliasType("ToUInt64_1d", _ToArray_1d[np.uint64]) -ToUInt64_2d = TypeAliasType("ToUInt64_2d", _ToArray_2d[np.uint64]) -ToUInt64_3d = TypeAliasType("ToUInt64_3d", _ToArray_3d[np.uint64]) -ToUInt64_1ds = TypeAliasType("ToUInt64_1ds", _ToArray_1ds[np.uint64]) -ToUInt64_2ds = TypeAliasType("ToUInt64_2ds", _ToArray_2ds[np.uint64]) -ToUInt64_3ds = TypeAliasType("ToUInt64_3ds", _ToArray_3ds[np.uint64]) -ToUInt64_1nd = TypeAliasType("ToUInt64_1nd", _ToArray_1nd[np.uint64]) -ToUInt64_2nd = TypeAliasType("ToUInt64_2nd", _ToArray_2nd[np.uint64]) -ToUInt64_3nd = TypeAliasType("ToUInt64_3nd", _ToArray_3nd[np.uint64]) - -ToULong_nd = TypeAliasType("ToULong_nd", _ToArray_nd[np.ulong]) -ToULong_0d = TypeAliasType("ToULong_0d", _ToArray_0d[np.ulong]) -ToULong_1d = TypeAliasType("ToULong_1d", _ToArray_1d[np.ulong]) -ToULong_2d = TypeAliasType("ToULong_2d", _ToArray_2d[np.ulong]) -ToULong_3d = TypeAliasType("ToULong_3d", _ToArray_3d[np.ulong]) -ToULong_1ds = TypeAliasType("ToULong_1ds", _ToArray_1ds[np.ulong]) -ToULong_2ds = TypeAliasType("ToULong_2ds", _ToArray_2ds[np.ulong]) -ToULong_3ds = TypeAliasType("ToULong_3ds", _ToArray_3ds[np.ulong]) -ToULong_1nd = TypeAliasType("ToULong_1nd", _ToArray_1nd[np.ulong]) -ToULong_2nd = TypeAliasType("ToULong_2nd", _ToArray_2nd[np.ulong]) -ToULong_3nd = TypeAliasType("ToULong_3nd", _ToArray_3nd[np.ulong]) - -ToUIntP_nd = TypeAliasType("ToUIntP_nd", _ToArray_nd[np.uintp]) -ToUIntP_0d = TypeAliasType("ToUIntP_0d", _ToArray_0d[np.uintp]) -ToUIntP_1d = TypeAliasType("ToUIntP_1d", _ToArray_1d[np.uintp]) -ToUIntP_2d = TypeAliasType("ToUIntP_2d", _ToArray_2d[np.uintp]) -ToUIntP_3d = TypeAliasType("ToUIntP_3d", _ToArray_3d[np.uintp]) -ToUIntP_1ds = TypeAliasType("ToUIntP_1ds", _ToArray_1ds[np.uintp]) -ToUIntP_2ds = TypeAliasType("ToUIntP_2ds", _ToArray_2ds[np.uintp]) -ToUIntP_3ds = TypeAliasType("ToUIntP_3ds", _ToArray_3ds[np.uintp]) -ToUIntP_1nd = TypeAliasType("ToUIntP_1nd", _ToArray_1nd[np.uintp]) -ToUIntP_2nd = TypeAliasType("ToUIntP_2nd", _ToArray_2nd[np.uintp]) -ToUIntP_3nd = TypeAliasType("ToUIntP_3nd", _ToArray_3nd[np.uintp]) - -ToULongLong_nd = TypeAliasType("ToULongLong_nd", _ToArray_nd[np.ulonglong]) -ToULongLong_0d = TypeAliasType("ToULongLong_0d", _ToArray_0d[np.ulonglong]) -ToULongLong_1d = TypeAliasType("ToULongLong_1d", _ToArray_1d[np.ulonglong]) -ToULongLong_2d = TypeAliasType("ToULongLong_2d", _ToArray_2d[np.ulonglong]) -ToULongLong_3d = TypeAliasType("ToULongLong_3d", _ToArray_3d[np.ulonglong]) -ToULongLong_1ds = TypeAliasType("ToULongLong_1ds", _ToArray_1ds[np.ulonglong]) -ToULongLong_2ds = TypeAliasType("ToULongLong_2ds", _ToArray_2ds[np.ulonglong]) -ToULongLong_3ds = TypeAliasType("ToULongLong_3ds", _ToArray_3ds[np.ulonglong]) -ToULongLong_1nd = TypeAliasType("ToULongLong_1nd", _ToArray_1nd[np.ulonglong]) -ToULongLong_2nd = TypeAliasType("ToULongLong_2nd", _ToArray_2nd[np.ulonglong]) -ToULongLong_3nd = TypeAliasType("ToULongLong_3nd", _ToArray_3nd[np.ulonglong]) - -ToUInteger_nd = TypeAliasType("ToUInteger_nd", _ToArray_nd[np.unsignedinteger]) -ToUInteger_0d = TypeAliasType("ToUInteger_0d", _ToArray_0d[np.unsignedinteger]) -ToUInteger_1d = TypeAliasType("ToUInteger_1d", _ToArray_1d[np.unsignedinteger]) -ToUInteger_2d = TypeAliasType("ToUInteger_2d", _ToArray_2d[np.unsignedinteger]) -ToUInteger_3d = TypeAliasType("ToUInteger_3d", _ToArray_3d[np.unsignedinteger]) -ToUInteger_1ds = TypeAliasType("ToUInteger_1ds", _ToArray_1ds[np.unsignedinteger]) -ToUInteger_2ds = TypeAliasType("ToUInteger_2ds", _ToArray_2ds[np.unsignedinteger]) -ToUInteger_3ds = TypeAliasType("ToUInteger_3ds", _ToArray_3ds[np.unsignedinteger]) -ToUInteger_1nd = TypeAliasType("ToUInteger_1nd", _ToArray_1nd[np.unsignedinteger]) -ToUInteger_2nd = TypeAliasType("ToUInteger_2nd", _ToArray_2nd[np.unsignedinteger]) -ToUInteger_3nd = TypeAliasType("ToUInteger_3nd", _ToArray_3nd[np.unsignedinteger]) +ToUInt8_nd = TypeAliasType("ToUInt8_nd", _ToArray1_nd[np.uint8]) +ToUInt8_0d = TypeAliasType("ToUInt8_0d", _ToArray1_0d[np.uint8]) +ToUInt8_1d = TypeAliasType("ToUInt8_1d", _ToArray1_1d[np.uint8]) +ToUInt8_2d = TypeAliasType("ToUInt8_2d", _ToArray1_2d[np.uint8]) +ToUInt8_3d = TypeAliasType("ToUInt8_3d", _ToArray1_3d[np.uint8]) +ToUInt8_1ds = TypeAliasType("ToUInt8_1ds", _ToArray1_1ds[np.uint8]) +ToUInt8_2ds = TypeAliasType("ToUInt8_2ds", _ToArray1_2ds[np.uint8]) +ToUInt8_3ds = TypeAliasType("ToUInt8_3ds", _ToArray1_3ds[np.uint8]) +ToUInt8_1nd = TypeAliasType("ToUInt8_1nd", _ToArray1_1nd[np.uint8]) +ToUInt8_2nd = TypeAliasType("ToUInt8_2nd", _ToArray1_2nd[np.uint8]) +ToUInt8_3nd = TypeAliasType("ToUInt8_3nd", _ToArray1_3nd[np.uint8]) + +ToUInt16_nd = TypeAliasType("ToUInt16_nd", _ToArray1_nd[np.uint16]) +ToUInt16_0d = TypeAliasType("ToUInt16_0d", _ToArray1_0d[np.uint16]) +ToUInt16_1d = TypeAliasType("ToUInt16_1d", _ToArray1_1d[np.uint16]) +ToUInt16_2d = TypeAliasType("ToUInt16_2d", _ToArray1_2d[np.uint16]) +ToUInt16_3d = TypeAliasType("ToUInt16_3d", _ToArray1_3d[np.uint16]) +ToUInt16_1ds = TypeAliasType("ToUInt16_1ds", _ToArray1_1ds[np.uint16]) +ToUInt16_2ds = TypeAliasType("ToUInt16_2ds", _ToArray1_2ds[np.uint16]) +ToUInt16_3ds = TypeAliasType("ToUInt16_3ds", _ToArray1_3ds[np.uint16]) +ToUInt16_1nd = TypeAliasType("ToUInt16_1nd", _ToArray1_1nd[np.uint16]) +ToUInt16_2nd = TypeAliasType("ToUInt16_2nd", _ToArray1_2nd[np.uint16]) +ToUInt16_3nd = TypeAliasType("ToUInt16_3nd", _ToArray1_3nd[np.uint16]) + +ToUInt32_nd = TypeAliasType("ToUInt32_nd", _ToArray1_nd[np.uint32]) +ToUInt32_0d = TypeAliasType("ToUInt32_0d", _ToArray1_0d[np.uint32]) +ToUInt32_1d = TypeAliasType("ToUInt32_1d", _ToArray1_1d[np.uint32]) +ToUInt32_2d = TypeAliasType("ToUInt32_2d", _ToArray1_2d[np.uint32]) +ToUInt32_3d = TypeAliasType("ToUInt32_3d", _ToArray1_3d[np.uint32]) +ToUInt32_1ds = TypeAliasType("ToUInt32_1ds", _ToArray1_1ds[np.uint32]) +ToUInt32_2ds = TypeAliasType("ToUInt32_2ds", _ToArray1_2ds[np.uint32]) +ToUInt32_3ds = TypeAliasType("ToUInt32_3ds", _ToArray1_3ds[np.uint32]) +ToUInt32_1nd = TypeAliasType("ToUInt32_1nd", _ToArray1_1nd[np.uint32]) +ToUInt32_2nd = TypeAliasType("ToUInt32_2nd", _ToArray1_2nd[np.uint32]) +ToUInt32_3nd = TypeAliasType("ToUInt32_3nd", _ToArray1_3nd[np.uint32]) + +ToUInt64_nd = TypeAliasType("ToUInt64_nd", _ToArray1_nd[np.uint64]) +ToUInt64_0d = TypeAliasType("ToUInt64_0d", _ToArray1_0d[np.uint64]) +ToUInt64_1d = TypeAliasType("ToUInt64_1d", _ToArray1_1d[np.uint64]) +ToUInt64_2d = TypeAliasType("ToUInt64_2d", _ToArray1_2d[np.uint64]) +ToUInt64_3d = TypeAliasType("ToUInt64_3d", _ToArray1_3d[np.uint64]) +ToUInt64_1ds = TypeAliasType("ToUInt64_1ds", _ToArray1_1ds[np.uint64]) +ToUInt64_2ds = TypeAliasType("ToUInt64_2ds", _ToArray1_2ds[np.uint64]) +ToUInt64_3ds = TypeAliasType("ToUInt64_3ds", _ToArray1_3ds[np.uint64]) +ToUInt64_1nd = TypeAliasType("ToUInt64_1nd", _ToArray1_1nd[np.uint64]) +ToUInt64_2nd = TypeAliasType("ToUInt64_2nd", _ToArray1_2nd[np.uint64]) +ToUInt64_3nd = TypeAliasType("ToUInt64_3nd", _ToArray1_3nd[np.uint64]) + +ToULong_0d = TypeAliasType("ToULong_0d", _ToArray1_0d[np.ulong]) +ToULong_nd = TypeAliasType("ToULong_nd", _ToArray1_nd[np.ulong]) +ToULong_1d = TypeAliasType("ToULong_1d", _ToArray1_1d[np.ulong]) +ToULong_2d = TypeAliasType("ToULong_2d", _ToArray1_2d[np.ulong]) +ToULong_3d = TypeAliasType("ToULong_3d", _ToArray1_3d[np.ulong]) +ToULong_1ds = TypeAliasType("ToULong_1ds", _ToArray1_1ds[np.ulong]) +ToULong_2ds = TypeAliasType("ToULong_2ds", _ToArray1_2ds[np.ulong]) +ToULong_3ds = TypeAliasType("ToULong_3ds", _ToArray1_3ds[np.ulong]) +ToULong_1nd = TypeAliasType("ToULong_1nd", _ToArray1_1nd[np.ulong]) +ToULong_2nd = TypeAliasType("ToULong_2nd", _ToArray1_2nd[np.ulong]) +ToULong_3nd = TypeAliasType("ToULong_3nd", _ToArray1_3nd[np.ulong]) + +ToUIntP_nd = TypeAliasType("ToUIntP_nd", _ToArray1_nd[np.uintp]) +ToUIntP_0d = TypeAliasType("ToUIntP_0d", _ToArray1_0d[np.uintp]) +ToUIntP_1d = TypeAliasType("ToUIntP_1d", _ToArray1_1d[np.uintp]) +ToUIntP_2d = TypeAliasType("ToUIntP_2d", _ToArray1_2d[np.uintp]) +ToUIntP_3d = TypeAliasType("ToUIntP_3d", _ToArray1_3d[np.uintp]) +ToUIntP_1ds = TypeAliasType("ToUIntP_1ds", _ToArray1_1ds[np.uintp]) +ToUIntP_2ds = TypeAliasType("ToUIntP_2ds", _ToArray1_2ds[np.uintp]) +ToUIntP_3ds = TypeAliasType("ToUIntP_3ds", _ToArray1_3ds[np.uintp]) +ToUIntP_1nd = TypeAliasType("ToUIntP_1nd", _ToArray1_1nd[np.uintp]) +ToUIntP_2nd = TypeAliasType("ToUIntP_2nd", _ToArray1_2nd[np.uintp]) +ToUIntP_3nd = TypeAliasType("ToUIntP_3nd", _ToArray1_3nd[np.uintp]) + +ToULongLong_nd = TypeAliasType("ToULongLong_nd", _ToArray1_nd[np.ulonglong]) +ToULongLong_0d = TypeAliasType("ToULongLong_0d", _ToArray1_0d[np.ulonglong]) +ToULongLong_1d = TypeAliasType("ToULongLong_1d", _ToArray1_1d[np.ulonglong]) +ToULongLong_2d = TypeAliasType("ToULongLong_2d", _ToArray1_2d[np.ulonglong]) +ToULongLong_3d = TypeAliasType("ToULongLong_3d", _ToArray1_3d[np.ulonglong]) +ToULongLong_1ds = TypeAliasType("ToULongLong_1ds", _ToArray1_1ds[np.ulonglong]) +ToULongLong_2ds = TypeAliasType("ToULongLong_2ds", _ToArray1_2ds[np.ulonglong]) +ToULongLong_3ds = TypeAliasType("ToULongLong_3ds", _ToArray1_3ds[np.ulonglong]) +ToULongLong_1nd = TypeAliasType("ToULongLong_1nd", _ToArray1_1nd[np.ulonglong]) +ToULongLong_2nd = TypeAliasType("ToULongLong_2nd", _ToArray1_2nd[np.ulonglong]) +ToULongLong_3nd = TypeAliasType("ToULongLong_3nd", _ToArray1_3nd[np.ulonglong]) + +ToUInteger_nd = TypeAliasType("ToUInteger_nd", _ToArray1_nd[np.unsignedinteger]) +ToUInteger_0d = TypeAliasType("ToUInteger_0d", _ToArray1_0d[np.unsignedinteger]) +ToUInteger_1d = TypeAliasType("ToUInteger_1d", _ToArray1_1d[np.unsignedinteger]) +ToUInteger_2d = TypeAliasType("ToUInteger_2d", _ToArray1_2d[np.unsignedinteger]) +ToUInteger_3d = TypeAliasType("ToUInteger_3d", _ToArray1_3d[np.unsignedinteger]) +ToUInteger_1ds = TypeAliasType("ToUInteger_1ds", _ToArray1_1ds[np.unsignedinteger]) +ToUInteger_2ds = TypeAliasType("ToUInteger_2ds", _ToArray1_2ds[np.unsignedinteger]) +ToUInteger_3ds = TypeAliasType("ToUInteger_3ds", _ToArray1_3ds[np.unsignedinteger]) +ToUInteger_1nd = TypeAliasType("ToUInteger_1nd", _ToArray1_1nd[np.unsignedinteger]) +ToUInteger_2nd = TypeAliasType("ToUInteger_2nd", _ToArray1_2nd[np.unsignedinteger]) +ToUInteger_3nd = TypeAliasType("ToUInteger_3nd", _ToArray1_3nd[np.unsignedinteger]) # signed integers -ToInt8_nd = TypeAliasType("ToInt8_nd", _ToArray_nd[np.int8]) -ToInt8_0d = TypeAliasType("ToInt8_0d", _ToArray_0d[np.int8]) -ToInt8_1d = TypeAliasType("ToInt8_1d", _ToArray_1d[np.int8]) -ToInt8_2d = TypeAliasType("ToInt8_2d", _ToArray_2d[np.int8]) -ToInt8_3d = TypeAliasType("ToInt8_3d", _ToArray_3d[np.int8]) -ToInt8_1ds = TypeAliasType("ToInt8_1ds", _ToArray_1ds[np.int8]) -ToInt8_2ds = TypeAliasType("ToInt8_2ds", _ToArray_2ds[np.int8]) -ToInt8_3ds = TypeAliasType("ToInt8_3ds", _ToArray_3ds[np.int8]) -ToInt8_1nd = TypeAliasType("ToInt8_1nd", _ToArray_1nd[np.int8]) -ToInt8_2nd = TypeAliasType("ToInt8_2nd", _ToArray_2nd[np.int8]) -ToInt8_3nd = TypeAliasType("ToInt8_3nd", _ToArray_3nd[np.int8]) - -ToInt16_nd = TypeAliasType("ToInt16_nd", _ToArray_nd[np.int16]) -ToInt16_0d = TypeAliasType("ToInt16_0d", _ToArray_0d[np.int16]) -ToInt16_1d = TypeAliasType("ToInt16_1d", _ToArray_1d[np.int16]) -ToInt16_2d = TypeAliasType("ToInt16_2d", _ToArray_2d[np.int16]) -ToInt16_3d = TypeAliasType("ToInt16_3d", _ToArray_3d[np.int16]) -ToInt16_1ds = TypeAliasType("ToInt16_1ds", _ToArray_1ds[np.int16]) -ToInt16_2ds = TypeAliasType("ToInt16_2ds", _ToArray_2ds[np.int16]) -ToInt16_3ds = TypeAliasType("ToInt16_3ds", _ToArray_3ds[np.int16]) -ToInt16_1nd = TypeAliasType("ToInt16_1nd", _ToArray_1nd[np.int16]) -ToInt16_2nd = TypeAliasType("ToInt16_2nd", _ToArray_2nd[np.int16]) -ToInt16_3nd = TypeAliasType("ToInt16_3nd", _ToArray_3nd[np.int16]) - -ToInt32_nd = TypeAliasType("ToInt32_nd", _ToArray_nd[np.int32]) -ToInt32_0d = TypeAliasType("ToInt32_0d", _ToArray_0d[np.int32]) -ToInt32_1d = TypeAliasType("ToInt32_1d", _ToArray_1d[np.int32]) -ToInt32_2d = TypeAliasType("ToInt32_2d", _ToArray_2d[np.int32]) -ToInt32_3d = TypeAliasType("ToInt32_3d", _ToArray_3d[np.int32]) -ToInt32_1ds = TypeAliasType("ToInt32_1ds", _ToArray_1ds[np.int32]) -ToInt32_2ds = TypeAliasType("ToInt32_2ds", _ToArray_2ds[np.int32]) -ToInt32_3ds = TypeAliasType("ToInt32_3ds", _ToArray_3ds[np.int32]) -ToInt32_1nd = TypeAliasType("ToInt32_1nd", _ToArray_1nd[np.int32]) -ToInt32_2nd = TypeAliasType("ToInt32_2nd", _ToArray_2nd[np.int32]) -ToInt32_3nd = TypeAliasType("ToInt32_3nd", _ToArray_3nd[np.int32]) - -ToInt64_nd = TypeAliasType("ToInt64_nd", _ToArray_nd[np.int64]) -ToInt64_0d = TypeAliasType("ToInt64_0d", _ToArray_0d[np.int64]) -ToInt64_1d = TypeAliasType("ToInt64_1d", _ToArray_1d[np.int64]) -ToInt64_2d = TypeAliasType("ToInt64_2d", _ToArray_2d[np.int64]) -ToInt64_3d = TypeAliasType("ToInt64_3d", _ToArray_3d[np.int64]) -ToInt64_1ds = TypeAliasType("ToInt64_1ds", _ToArray_1ds[np.int64]) -ToInt64_2ds = TypeAliasType("ToInt64_2ds", _ToArray_2ds[np.int64]) -ToInt64_3ds = TypeAliasType("ToInt64_3ds", _ToArray_3ds[np.int64]) -ToInt64_1nd = TypeAliasType("ToInt64_1nd", _ToArray_1nd[np.int64]) -ToInt64_2nd = TypeAliasType("ToInt64_2nd", _ToArray_2nd[np.int64]) -ToInt64_3nd = TypeAliasType("ToInt64_3nd", _ToArray_3nd[np.int64]) - -ToLong_nd = TypeAliasType("ToLong_nd", _ToArray_nd[np.long]) -ToLong_0d = TypeAliasType("ToLong_0d", _ToArray_0d[np.long]) -ToLong_1d = TypeAliasType("ToLong_1d", _ToArray_1d[np.long]) -ToLong_2d = TypeAliasType("ToLong_2d", _ToArray_2d[np.long]) -ToLong_3d = TypeAliasType("ToLong_3d", _ToArray_3d[np.long]) -ToLong_1ds = TypeAliasType("ToLong_1ds", _ToArray_1ds[np.long]) -ToLong_2ds = TypeAliasType("ToLong_2ds", _ToArray_2ds[np.long]) -ToLong_3ds = TypeAliasType("ToLong_3ds", _ToArray_3ds[np.long]) -ToLong_1nd = TypeAliasType("ToLong_1nd", _ToArray_1nd[np.long]) -ToLong_2nd = TypeAliasType("ToLong_2nd", _ToArray_2nd[np.long]) -ToLong_3nd = TypeAliasType("ToLong_3nd", _ToArray_3nd[np.long]) +ToInt8_nd = TypeAliasType("ToInt8_nd", _ToArray1_nd[np.int8]) +ToInt8_0d = TypeAliasType("ToInt8_0d", _ToArray1_0d[np.int8]) +ToInt8_1d = TypeAliasType("ToInt8_1d", _ToArray1_1d[np.int8]) +ToInt8_2d = TypeAliasType("ToInt8_2d", _ToArray1_2d[np.int8]) +ToInt8_3d = TypeAliasType("ToInt8_3d", _ToArray1_3d[np.int8]) +ToInt8_1ds = TypeAliasType("ToInt8_1ds", _ToArray1_1ds[np.int8]) +ToInt8_2ds = TypeAliasType("ToInt8_2ds", _ToArray1_2ds[np.int8]) +ToInt8_3ds = TypeAliasType("ToInt8_3ds", _ToArray1_3ds[np.int8]) +ToInt8_1nd = TypeAliasType("ToInt8_1nd", _ToArray1_1nd[np.int8]) +ToInt8_2nd = TypeAliasType("ToInt8_2nd", _ToArray1_2nd[np.int8]) +ToInt8_3nd = TypeAliasType("ToInt8_3nd", _ToArray1_3nd[np.int8]) + +ToInt16_nd = TypeAliasType("ToInt16_nd", _ToArray1_nd[np.int16]) +ToInt16_0d = TypeAliasType("ToInt16_0d", _ToArray1_0d[np.int16]) +ToInt16_1d = TypeAliasType("ToInt16_1d", _ToArray1_1d[np.int16]) +ToInt16_2d = TypeAliasType("ToInt16_2d", _ToArray1_2d[np.int16]) +ToInt16_3d = TypeAliasType("ToInt16_3d", _ToArray1_3d[np.int16]) +ToInt16_1ds = TypeAliasType("ToInt16_1ds", _ToArray1_1ds[np.int16]) +ToInt16_2ds = TypeAliasType("ToInt16_2ds", _ToArray1_2ds[np.int16]) +ToInt16_3ds = TypeAliasType("ToInt16_3ds", _ToArray1_3ds[np.int16]) +ToInt16_1nd = TypeAliasType("ToInt16_1nd", _ToArray1_1nd[np.int16]) +ToInt16_2nd = TypeAliasType("ToInt16_2nd", _ToArray1_2nd[np.int16]) +ToInt16_3nd = TypeAliasType("ToInt16_3nd", _ToArray1_3nd[np.int16]) + +ToInt32_nd = TypeAliasType("ToInt32_nd", _ToArray1_nd[np.int32]) +ToInt32_0d = TypeAliasType("ToInt32_0d", _ToArray1_0d[np.int32]) +ToInt32_1d = TypeAliasType("ToInt32_1d", _ToArray1_1d[np.int32]) +ToInt32_2d = TypeAliasType("ToInt32_2d", _ToArray1_2d[np.int32]) +ToInt32_3d = TypeAliasType("ToInt32_3d", _ToArray1_3d[np.int32]) +ToInt32_1ds = TypeAliasType("ToInt32_1ds", _ToArray1_1ds[np.int32]) +ToInt32_2ds = TypeAliasType("ToInt32_2ds", _ToArray1_2ds[np.int32]) +ToInt32_3ds = TypeAliasType("ToInt32_3ds", _ToArray1_3ds[np.int32]) +ToInt32_1nd = TypeAliasType("ToInt32_1nd", _ToArray1_1nd[np.int32]) +ToInt32_2nd = TypeAliasType("ToInt32_2nd", _ToArray1_2nd[np.int32]) +ToInt32_3nd = TypeAliasType("ToInt32_3nd", _ToArray1_3nd[np.int32]) + +ToInt64_nd = TypeAliasType("ToInt64_nd", _ToArray1_nd[np.int64]) +ToInt64_0d = TypeAliasType("ToInt64_0d", _ToArray1_0d[np.int64]) +ToInt64_1d = TypeAliasType("ToInt64_1d", _ToArray1_1d[np.int64]) +ToInt64_2d = TypeAliasType("ToInt64_2d", _ToArray1_2d[np.int64]) +ToInt64_3d = TypeAliasType("ToInt64_3d", _ToArray1_3d[np.int64]) +ToInt64_1ds = TypeAliasType("ToInt64_1ds", _ToArray1_1ds[np.int64]) +ToInt64_2ds = TypeAliasType("ToInt64_2ds", _ToArray1_2ds[np.int64]) +ToInt64_3ds = TypeAliasType("ToInt64_3ds", _ToArray1_3ds[np.int64]) +ToInt64_1nd = TypeAliasType("ToInt64_1nd", _ToArray1_1nd[np.int64]) +ToInt64_2nd = TypeAliasType("ToInt64_2nd", _ToArray1_2nd[np.int64]) +ToInt64_3nd = TypeAliasType("ToInt64_3nd", _ToArray1_3nd[np.int64]) + +ToLong_nd = TypeAliasType("ToLong_nd", _ToArray1_nd[np.long]) +ToLong_0d = TypeAliasType("ToLong_0d", _ToArray1_0d[np.long]) +ToLong_1d = TypeAliasType("ToLong_1d", _ToArray1_1d[np.long]) +ToLong_2d = TypeAliasType("ToLong_2d", _ToArray1_2d[np.long]) +ToLong_3d = TypeAliasType("ToLong_3d", _ToArray1_3d[np.long]) +ToLong_1ds = TypeAliasType("ToLong_1ds", _ToArray1_1ds[np.long]) +ToLong_2ds = TypeAliasType("ToLong_2ds", _ToArray1_2ds[np.long]) +ToLong_3ds = TypeAliasType("ToLong_3ds", _ToArray1_3ds[np.long]) +ToLong_1nd = TypeAliasType("ToLong_1nd", _ToArray1_1nd[np.long]) +ToLong_2nd = TypeAliasType("ToLong_2nd", _ToArray1_2nd[np.long]) +ToLong_3nd = TypeAliasType("ToLong_3nd", _ToArray1_3nd[np.long]) _ToIntP: TypeAlias = np.intp | Is[int] ToIntP_nd = TypeAliasType("ToIntP_nd", _ToArray_nd[np.intp, _ToIntP]) @@ -343,17 +357,17 @@ ToIntP_1nd = TypeAliasType("ToIntP_1nd", _ToArray_1nd[np.intp, _ToIntP]) ToIntP_2nd = TypeAliasType("ToIntP_2nd", _ToArray_2nd[np.intp, _ToIntP]) ToIntP_3nd = TypeAliasType("ToIntP_3nd", _ToArray_3nd[np.intp, _ToIntP]) -ToLongLong_nd = TypeAliasType("ToLongLong_nd", _ToArray_nd[np.longlong]) -ToLongLong_0d = TypeAliasType("ToLongLong_0d", _ToArray_0d[np.longlong]) -ToLongLong_1d = TypeAliasType("ToLongLong_1d", _ToArray_1d[np.longlong]) -ToLongLong_2d = TypeAliasType("ToLongLong_2d", _ToArray_2d[np.longlong]) -ToLongLong_3d = TypeAliasType("ToLongLong_3d", _ToArray_3d[np.longlong]) -ToLongLong_1ds = TypeAliasType("ToLongLong_1ds", _ToArray_1ds[np.longlong]) -ToLongLong_2ds = TypeAliasType("ToLongLong_2ds", _ToArray_2ds[np.longlong]) -ToLongLong_3ds = TypeAliasType("ToLongLong_3ds", _ToArray_3ds[np.longlong]) -ToLongLong_1nd = TypeAliasType("ToLongLong_1nd", _ToArray_1nd[np.longlong]) -ToLongLong_2nd = TypeAliasType("ToLongLong_2nd", _ToArray_2nd[np.longlong]) -ToLongLong_3nd = TypeAliasType("ToLongLong_3nd", _ToArray_3nd[np.longlong]) +ToLongLong_nd = TypeAliasType("ToLongLong_nd", _ToArray1_nd[np.longlong]) +ToLongLong_0d = TypeAliasType("ToLongLong_0d", _ToArray1_0d[np.longlong]) +ToLongLong_1d = TypeAliasType("ToLongLong_1d", _ToArray1_1d[np.longlong]) +ToLongLong_2d = TypeAliasType("ToLongLong_2d", _ToArray1_2d[np.longlong]) +ToLongLong_3d = TypeAliasType("ToLongLong_3d", _ToArray1_3d[np.longlong]) +ToLongLong_1ds = TypeAliasType("ToLongLong_1ds", _ToArray1_1ds[np.longlong]) +ToLongLong_2ds = TypeAliasType("ToLongLong_2ds", _ToArray1_2ds[np.longlong]) +ToLongLong_3ds = TypeAliasType("ToLongLong_3ds", _ToArray1_3ds[np.longlong]) +ToLongLong_1nd = TypeAliasType("ToLongLong_1nd", _ToArray1_1nd[np.longlong]) +ToLongLong_2nd = TypeAliasType("ToLongLong_2nd", _ToArray1_2nd[np.longlong]) +ToLongLong_3nd = TypeAliasType("ToLongLong_3nd", _ToArray1_3nd[np.longlong]) _ToInteger: TypeAlias = np.signedinteger | Is[int] ToSInteger_nd = TypeAliasType("ToSInteger_nd", _ToArray_nd[np.signedinteger, _ToInteger]) @@ -382,29 +396,29 @@ ToInteger_2nd = TypeAliasType("ToInteger_2nd", _ToArray_2nd[np.integer, Is[int]] ToInteger_3nd = TypeAliasType("ToInteger_3nd", _ToArray_3nd[np.integer, Is[int]]) # real floats -ToFloat16_nd = TypeAliasType("ToFloat16_nd", _ToArray_nd[np.float16]) -ToFloat16_0d = TypeAliasType("ToFloat16_0d", _ToArray_0d[np.float16]) -ToFloat16_1d = TypeAliasType("ToFloat16_1d", _ToArray_1d[np.float16]) -ToFloat16_2d = TypeAliasType("ToFloat16_2d", _ToArray_2d[np.float16]) -ToFloat16_3d = TypeAliasType("ToFloat16_3d", _ToArray_3d[np.float16]) -ToFloat16_1ds = TypeAliasType("ToFloat16_1ds", _ToArray_1ds[np.float16]) -ToFloat16_2ds = TypeAliasType("ToFloat16_2ds", _ToArray_2ds[np.float16]) -ToFloat16_3ds = TypeAliasType("ToFloat16_3ds", _ToArray_3ds[np.float16]) -ToFloat16_1nd = TypeAliasType("ToFloat16_1nd", _ToArray_1nd[np.float16]) -ToFloat16_2nd = TypeAliasType("ToFloat16_2nd", _ToArray_2nd[np.float16]) -ToFloat16_3nd = TypeAliasType("ToFloat16_3nd", _ToArray_3nd[np.float16]) - -ToFloat32_nd = TypeAliasType("ToFloat32_nd", _ToArray_nd[np.float32]) -ToFloat32_0d = TypeAliasType("ToFloat32_0d", _ToArray_0d[np.float32]) -ToFloat32_1d = TypeAliasType("ToFloat32_1d", _ToArray_1d[np.float32]) -ToFloat32_2d = TypeAliasType("ToFloat32_2d", _ToArray_2d[np.float32]) -ToFloat32_3d = TypeAliasType("ToFloat32_3d", _ToArray_3d[np.float32]) -ToFloat32_1ds = TypeAliasType("ToFloat32_1ds", _ToArray_1ds[np.float32]) -ToFloat32_2ds = TypeAliasType("ToFloat32_2ds", _ToArray_2ds[np.float32]) -ToFloat32_3ds = TypeAliasType("ToFloat32_3ds", _ToArray_3ds[np.float32]) -ToFloat32_1nd = TypeAliasType("ToFloat32_1nd", _ToArray_1nd[np.float32]) -ToFloat32_2nd = TypeAliasType("ToFloat32_2nd", _ToArray_2nd[np.float32]) -ToFloat32_3nd = TypeAliasType("ToFloat32_3nd", _ToArray_3nd[np.float32]) +ToFloat16_nd = TypeAliasType("ToFloat16_nd", _ToArray1_nd[np.float16]) +ToFloat16_0d = TypeAliasType("ToFloat16_0d", _ToArray1_0d[np.float16]) +ToFloat16_1d = TypeAliasType("ToFloat16_1d", _ToArray1_1d[np.float16]) +ToFloat16_2d = TypeAliasType("ToFloat16_2d", _ToArray1_2d[np.float16]) +ToFloat16_3d = TypeAliasType("ToFloat16_3d", _ToArray1_3d[np.float16]) +ToFloat16_1ds = TypeAliasType("ToFloat16_1ds", _ToArray1_1ds[np.float16]) +ToFloat16_2ds = TypeAliasType("ToFloat16_2ds", _ToArray1_2ds[np.float16]) +ToFloat16_3ds = TypeAliasType("ToFloat16_3ds", _ToArray1_3ds[np.float16]) +ToFloat16_1nd = TypeAliasType("ToFloat16_1nd", _ToArray1_1nd[np.float16]) +ToFloat16_2nd = TypeAliasType("ToFloat16_2nd", _ToArray1_2nd[np.float16]) +ToFloat16_3nd = TypeAliasType("ToFloat16_3nd", _ToArray1_3nd[np.float16]) + +ToFloat32_nd = TypeAliasType("ToFloat32_nd", _ToArray1_nd[np.float32]) +ToFloat32_0d = TypeAliasType("ToFloat32_0d", _ToArray1_0d[np.float32]) +ToFloat32_1d = TypeAliasType("ToFloat32_1d", _ToArray1_1d[np.float32]) +ToFloat32_2d = TypeAliasType("ToFloat32_2d", _ToArray1_2d[np.float32]) +ToFloat32_3d = TypeAliasType("ToFloat32_3d", _ToArray1_3d[np.float32]) +ToFloat32_1ds = TypeAliasType("ToFloat32_1ds", _ToArray1_1ds[np.float32]) +ToFloat32_2ds = TypeAliasType("ToFloat32_2ds", _ToArray1_2ds[np.float32]) +ToFloat32_3ds = TypeAliasType("ToFloat32_3ds", _ToArray1_3ds[np.float32]) +ToFloat32_1nd = TypeAliasType("ToFloat32_1nd", _ToArray1_1nd[np.float32]) +ToFloat32_2nd = TypeAliasType("ToFloat32_2nd", _ToArray1_2nd[np.float32]) +ToFloat32_3nd = TypeAliasType("ToFloat32_3nd", _ToArray1_3nd[np.float32]) _ToFloat64: TypeAlias = np.floating[_64Bit] ToFloat64_nd = TypeAliasType("ToFloat64_nd", _ToArray_nd[_ToFloat64, Is[float]]) @@ -419,17 +433,17 @@ ToFloat64_1nd = TypeAliasType("ToFloat64_1nd", _ToArray_1nd[_ToFloat64, Is[float ToFloat64_2nd = TypeAliasType("ToFloat64_2nd", _ToArray_2nd[_ToFloat64, Is[float]]) ToFloat64_3nd = TypeAliasType("ToFloat64_3nd", _ToArray_3nd[_ToFloat64, Is[float]]) -ToLongDouble_nd = TypeAliasType("ToLongDouble_nd", _ToArray_nd[np.longdouble]) -ToLongDouble_0d = TypeAliasType("ToLongDouble_0d", _ToArray_0d[np.longdouble]) -ToLongDouble_1d = TypeAliasType("ToLongDouble_1d", _ToArray_1d[np.longdouble]) -ToLongDouble_2d = TypeAliasType("ToLongDouble_2d", _ToArray_2d[np.longdouble]) -ToLongDouble_3d = TypeAliasType("ToLongDouble_3d", _ToArray_3d[np.longdouble]) -ToLongDouble_1ds = TypeAliasType("ToLongDouble_1ds", _ToArray_1ds[np.longdouble]) -ToLongDouble_2ds = TypeAliasType("ToLongDouble_2ds", _ToArray_2ds[np.longdouble]) -ToLongDouble_3ds = TypeAliasType("ToLongDouble_3ds", _ToArray_3ds[np.longdouble]) -ToLongDouble_1nd = TypeAliasType("ToLongDouble_1nd", _ToArray_1nd[np.longdouble]) -ToLongDouble_2nd = TypeAliasType("ToLongDouble_2nd", _ToArray_2nd[np.longdouble]) -ToLongDouble_3nd = TypeAliasType("ToLongDouble_3nd", _ToArray_3nd[np.longdouble]) +ToLongDouble_nd = TypeAliasType("ToLongDouble_nd", _ToArray1_nd[np.longdouble]) +ToLongDouble_0d = TypeAliasType("ToLongDouble_0d", _ToArray1_0d[np.longdouble]) +ToLongDouble_1d = TypeAliasType("ToLongDouble_1d", _ToArray1_1d[np.longdouble]) +ToLongDouble_2d = TypeAliasType("ToLongDouble_2d", _ToArray1_2d[np.longdouble]) +ToLongDouble_3d = TypeAliasType("ToLongDouble_3d", _ToArray1_3d[np.longdouble]) +ToLongDouble_1ds = TypeAliasType("ToLongDouble_1ds", _ToArray1_1ds[np.longdouble]) +ToLongDouble_2ds = TypeAliasType("ToLongDouble_2ds", _ToArray1_2ds[np.longdouble]) +ToLongDouble_3ds = TypeAliasType("ToLongDouble_3ds", _ToArray1_3ds[np.longdouble]) +ToLongDouble_1nd = TypeAliasType("ToLongDouble_1nd", _ToArray1_1nd[np.longdouble]) +ToLongDouble_2nd = TypeAliasType("ToLongDouble_2nd", _ToArray1_2nd[np.longdouble]) +ToLongDouble_3nd = TypeAliasType("ToLongDouble_3nd", _ToArray1_3nd[np.longdouble]) ToFloating_nd = TypeAliasType("ToFloating_nd", _ToArray_nd[np.floating, Is[float]]) ToFloating_0d = TypeAliasType("ToFloating_0d", _ToArray_0d[np.floating, Is[float]]) @@ -444,17 +458,17 @@ ToFloating_2nd = TypeAliasType("ToFloating_2nd", _ToArray_2nd[np.floating, Is[fl ToFloating_3nd = TypeAliasType("ToFloating_3nd", _ToArray_3nd[np.floating, Is[float]]) # complex floats -ToComplex64_nd = TypeAliasType("ToComplex64_nd", _ToArray_nd[np.complex64]) -ToComplex64_0d = TypeAliasType("ToComplex64_0d", _ToArray_0d[np.complex64]) -ToComplex64_1d = TypeAliasType("ToComplex64_1d", _ToArray_1d[np.complex64]) -ToComplex64_2d = TypeAliasType("ToComplex64_2d", _ToArray_2d[np.complex64]) -ToComplex64_3d = TypeAliasType("ToComplex64_3d", _ToArray_3d[np.complex64]) -ToComplex64_1ds = TypeAliasType("ToComplex64_1ds", _ToArray_1ds[np.complex64]) -ToComplex64_2ds = TypeAliasType("ToComplex64_2ds", _ToArray_2ds[np.complex64]) -ToComplex64_3ds = TypeAliasType("ToComplex64_3ds", _ToArray_3ds[np.complex64]) -ToComplex64_1nd = TypeAliasType("ToComplex64_1nd", _ToArray_1nd[np.complex64]) -ToComplex64_2nd = TypeAliasType("ToComplex64_2nd", _ToArray_2nd[np.complex64]) -ToComplex64_3nd = TypeAliasType("ToComplex64_3nd", _ToArray_3nd[np.complex64]) +ToComplex64_nd = TypeAliasType("ToComplex64_nd", _ToArray1_nd[np.complex64]) +ToComplex64_0d = TypeAliasType("ToComplex64_0d", _ToArray1_0d[np.complex64]) +ToComplex64_1d = TypeAliasType("ToComplex64_1d", _ToArray1_1d[np.complex64]) +ToComplex64_2d = TypeAliasType("ToComplex64_2d", _ToArray1_2d[np.complex64]) +ToComplex64_3d = TypeAliasType("ToComplex64_3d", _ToArray1_3d[np.complex64]) +ToComplex64_1ds = TypeAliasType("ToComplex64_1ds", _ToArray1_1ds[np.complex64]) +ToComplex64_2ds = TypeAliasType("ToComplex64_2ds", _ToArray1_2ds[np.complex64]) +ToComplex64_3ds = TypeAliasType("ToComplex64_3ds", _ToArray1_3ds[np.complex64]) +ToComplex64_1nd = TypeAliasType("ToComplex64_1nd", _ToArray1_1nd[np.complex64]) +ToComplex64_2nd = TypeAliasType("ToComplex64_2nd", _ToArray1_2nd[np.complex64]) +ToComplex64_3nd = TypeAliasType("ToComplex64_3nd", _ToArray1_3nd[np.complex64]) _ToComplex128: TypeAlias = np.complexfloating[_64Bit] ToComplex128_nd = TypeAliasType("ToComplex128_nd", _ToArray_nd[_ToComplex128, Is[complex]]) @@ -469,17 +483,17 @@ ToComplex128_1nd = TypeAliasType("ToComplex128_1nd", _ToArray_1nd[_ToComplex128, ToComplex128_2nd = TypeAliasType("ToComplex128_2nd", _ToArray_2nd[_ToComplex128, Is[complex]]) ToComplex128_3nd = TypeAliasType("ToComplex128_3nd", _ToArray_3nd[_ToComplex128, Is[complex]]) -ToCLongDouble_nd = TypeAliasType("ToCLongDouble_nd", _ToArray_nd[np.clongdouble]) -ToCLongDouble_0d = TypeAliasType("ToCLongDouble_0d", _ToArray_0d[np.clongdouble]) -ToCLongDouble_1d = TypeAliasType("ToCLongDouble_1d", _ToArray_1d[np.clongdouble]) -ToCLongDouble_2d = TypeAliasType("ToCLongDouble_2d", _ToArray_2d[np.clongdouble]) -ToCLongDouble_3d = TypeAliasType("ToCLongDouble_3d", _ToArray_3d[np.clongdouble]) -ToCLongDouble_1ds = TypeAliasType("ToCLongDouble_1ds", _ToArray_1ds[np.clongdouble]) -ToCLongDouble_2ds = TypeAliasType("ToCLongDouble_2ds", _ToArray_2ds[np.clongdouble]) -ToCLongDouble_3ds = TypeAliasType("ToCLongDouble_3ds", _ToArray_3ds[np.clongdouble]) -ToCLongDouble_1nd = TypeAliasType("ToCLongDouble_1nd", _ToArray_1nd[np.clongdouble]) -ToCLongDouble_2nd = TypeAliasType("ToCLongDouble_2nd", _ToArray_2nd[np.clongdouble]) -ToCLongDouble_3nd = TypeAliasType("ToCLongDouble_3nd", _ToArray_3nd[np.clongdouble]) +ToCLongDouble_nd = TypeAliasType("ToCLongDouble_nd", _ToArray1_nd[np.clongdouble]) +ToCLongDouble_0d = TypeAliasType("ToCLongDouble_0d", _ToArray1_0d[np.clongdouble]) +ToCLongDouble_1d = TypeAliasType("ToCLongDouble_1d", _ToArray1_1d[np.clongdouble]) +ToCLongDouble_2d = TypeAliasType("ToCLongDouble_2d", _ToArray1_2d[np.clongdouble]) +ToCLongDouble_3d = TypeAliasType("ToCLongDouble_3d", _ToArray1_3d[np.clongdouble]) +ToCLongDouble_1ds = TypeAliasType("ToCLongDouble_1ds", _ToArray1_1ds[np.clongdouble]) +ToCLongDouble_2ds = TypeAliasType("ToCLongDouble_2ds", _ToArray1_2ds[np.clongdouble]) +ToCLongDouble_3ds = TypeAliasType("ToCLongDouble_3ds", _ToArray1_3ds[np.clongdouble]) +ToCLongDouble_1nd = TypeAliasType("ToCLongDouble_1nd", _ToArray1_1nd[np.clongdouble]) +ToCLongDouble_2nd = TypeAliasType("ToCLongDouble_2nd", _ToArray1_2nd[np.clongdouble]) +ToCLongDouble_3nd = TypeAliasType("ToCLongDouble_3nd", _ToArray1_3nd[np.clongdouble]) ToComplex_nd = TypeAliasType("ToComplex_nd", _ToArray_nd[np.complexfloating, Is[complex]]) ToComplex_0d = TypeAliasType("ToComplex_0d", _ToArray_0d[np.complexfloating, Is[complex]]) @@ -507,17 +521,17 @@ ToNumber_2nd = TypeAliasType("ToNumber_2nd", _ToArray_2nd[np.number, _PyNumber]) ToNumber_3nd = TypeAliasType("ToNumber_3nd", _ToArray_3nd[np.number, _PyNumber]) # integers and real floats -ToReal_nd = TypeAliasType("ToReal_nd", _ToArray_nd[np.number[Any, float | int], _PyReal]) -ToReal_0d = TypeAliasType("ToReal_0d", _ToArray_0d[np.number[Any, float | int], _PyReal]) -ToReal_1d = TypeAliasType("ToReal_1d", _ToArray_1d[np.number[Any, float | int], _PyReal]) -ToReal_2d = TypeAliasType("ToReal_2d", _ToArray_2d[np.number[Any, float | int], _PyReal]) -ToReal_3d = TypeAliasType("ToReal_3d", _ToArray_3d[np.number[Any, float | int], _PyReal]) -ToReal_1ds = TypeAliasType("ToReal_1ds", _ToArray_1ds[np.number[Any, float | int], _PyReal]) -ToReal_2ds = TypeAliasType("ToReal_2ds", _ToArray_2ds[np.number[Any, float | int], _PyReal]) -ToReal_3ds = TypeAliasType("ToReal_3ds", _ToArray_3ds[np.number[Any, float | int], _PyReal]) -ToReal_1nd = TypeAliasType("ToReal_1nd", _ToArray_1nd[np.number[Any, float | int], _PyReal]) -ToReal_2nd = TypeAliasType("ToReal_2nd", _ToArray_2nd[np.number[Any, float | int], _PyReal]) -ToReal_3nd = TypeAliasType("ToReal_3nd", _ToArray_3nd[np.number[Any, float | int], _PyReal]) +ToReal_nd = TypeAliasType("ToReal_nd", _ToArray_nd[np.number[Any, float], _PyReal]) +ToReal_0d = TypeAliasType("ToReal_0d", _ToArray_0d[np.number[Any, float], _PyReal]) +ToReal_1d = TypeAliasType("ToReal_1d", _ToArray_1d[np.number[Any, float], _PyReal]) +ToReal_2d = TypeAliasType("ToReal_2d", _ToArray_2d[np.number[Any, float], _PyReal]) +ToReal_3d = TypeAliasType("ToReal_3d", _ToArray_3d[np.number[Any, float], _PyReal]) +ToReal_1ds = TypeAliasType("ToReal_1ds", _ToArray_1ds[np.number[Any, float], _PyReal]) +ToReal_2ds = TypeAliasType("ToReal_2ds", _ToArray_2ds[np.number[Any, float], _PyReal]) +ToReal_3ds = TypeAliasType("ToReal_3ds", _ToArray_3ds[np.number[Any, float], _PyReal]) +ToReal_1nd = TypeAliasType("ToReal_1nd", _ToArray_1nd[np.number[Any, float], _PyReal]) +ToReal_2nd = TypeAliasType("ToReal_2nd", _ToArray_2nd[np.number[Any, float], _PyReal]) +ToReal_3nd = TypeAliasType("ToReal_3nd", _ToArray_3nd[np.number[Any, float], _PyReal]) # real- and complex floats ToInexact_nd = TypeAliasType("ToInexact_nd", _ToArray_nd[np.inexact, _PyInexact]) @@ -534,30 +548,30 @@ ToInexact_3nd = TypeAliasType("ToInexact_3nd", _ToArray_3nd[np.inexact, _PyInexa # temporal _ToTimeDelta: TypeAlias = np.timedelta64[Any] -ToTimeDelta_nd = TypeAliasType("ToTimeDelta_nd", _ToArray_nd[np.timedelta64]) -ToTimeDelta_0d = TypeAliasType("ToTimeDelta_0d", _ToArray_0d[np.timedelta64]) -ToTimeDelta_1d = TypeAliasType("ToTimeDelta_1d", _ToArray_1d[np.timedelta64]) -ToTimeDelta_2d = TypeAliasType("ToTimeDelta_2d", _ToArray_2d[np.timedelta64]) -ToTimeDelta_3d = TypeAliasType("ToTimeDelta_3d", _ToArray_3d[np.timedelta64]) -ToTimeDelta_1ds = TypeAliasType("ToTimeDelta_1ds", _ToArray_1ds[np.timedelta64]) -ToTimeDelta_2ds = TypeAliasType("ToTimeDelta_2ds", _ToArray_2ds[np.timedelta64]) -ToTimeDelta_3ds = TypeAliasType("ToTimeDelta_3ds", _ToArray_3ds[np.timedelta64]) -ToTimeDelta_1nd = TypeAliasType("ToTimeDelta_1nd", _ToArray_1nd[np.timedelta64]) -ToTimeDelta_2nd = TypeAliasType("ToTimeDelta_2nd", _ToArray_2nd[np.timedelta64]) -ToTimeDelta_3nd = TypeAliasType("ToTimeDelta_3nd", _ToArray_3nd[np.timedelta64]) +ToTimeDelta_nd = TypeAliasType("ToTimeDelta_nd", _ToArray1_nd[np.timedelta64]) +ToTimeDelta_0d = TypeAliasType("ToTimeDelta_0d", _ToArray1_0d[np.timedelta64]) +ToTimeDelta_1d = TypeAliasType("ToTimeDelta_1d", _ToArray1_1d[np.timedelta64]) +ToTimeDelta_2d = TypeAliasType("ToTimeDelta_2d", _ToArray1_2d[np.timedelta64]) +ToTimeDelta_3d = TypeAliasType("ToTimeDelta_3d", _ToArray1_3d[np.timedelta64]) +ToTimeDelta_1ds = TypeAliasType("ToTimeDelta_1ds", _ToArray1_1ds[np.timedelta64]) +ToTimeDelta_2ds = TypeAliasType("ToTimeDelta_2ds", _ToArray1_2ds[np.timedelta64]) +ToTimeDelta_3ds = TypeAliasType("ToTimeDelta_3ds", _ToArray1_3ds[np.timedelta64]) +ToTimeDelta_1nd = TypeAliasType("ToTimeDelta_1nd", _ToArray1_1nd[np.timedelta64]) +ToTimeDelta_2nd = TypeAliasType("ToTimeDelta_2nd", _ToArray1_2nd[np.timedelta64]) +ToTimeDelta_3nd = TypeAliasType("ToTimeDelta_3nd", _ToArray1_3nd[np.timedelta64]) _ToDateTime: TypeAlias = np.datetime64[Any] -ToDateTime_nd = TypeAliasType("ToDateTime_nd", _ToArray_nd[np.datetime64]) -ToDateTime_0d = TypeAliasType("ToDateTime_0d", _ToArray_0d[np.datetime64]) -ToDateTime_1d = TypeAliasType("ToDateTime_1d", _ToArray_1d[np.datetime64]) -ToDateTime_2d = TypeAliasType("ToDateTime_2d", _ToArray_2d[np.datetime64]) -ToDateTime_3d = TypeAliasType("ToDateTime_3d", _ToArray_3d[np.datetime64]) -ToDateTime_1ds = TypeAliasType("ToDateTime_1ds", _ToArray_1ds[np.datetime64]) -ToDateTime_2ds = TypeAliasType("ToDateTime_2ds", _ToArray_2ds[np.datetime64]) -ToDateTime_3ds = TypeAliasType("ToDateTime_3ds", _ToArray_3ds[np.datetime64]) -ToDateTime_1nd = TypeAliasType("ToDateTime_1nd", _ToArray_1nd[np.datetime64]) -ToDateTime_2nd = TypeAliasType("ToDateTime_2nd", _ToArray_2nd[np.datetime64]) -ToDateTime_3nd = TypeAliasType("ToDateTime_3nd", _ToArray_3nd[np.datetime64]) +ToDateTime_nd = TypeAliasType("ToDateTime_nd", _ToArray1_nd[np.datetime64]) +ToDateTime_0d = TypeAliasType("ToDateTime_0d", _ToArray1_0d[np.datetime64]) +ToDateTime_1d = TypeAliasType("ToDateTime_1d", _ToArray1_1d[np.datetime64]) +ToDateTime_2d = TypeAliasType("ToDateTime_2d", _ToArray1_2d[np.datetime64]) +ToDateTime_3d = TypeAliasType("ToDateTime_3d", _ToArray1_3d[np.datetime64]) +ToDateTime_1ds = TypeAliasType("ToDateTime_1ds", _ToArray1_1ds[np.datetime64]) +ToDateTime_2ds = TypeAliasType("ToDateTime_2ds", _ToArray1_2ds[np.datetime64]) +ToDateTime_3ds = TypeAliasType("ToDateTime_3ds", _ToArray1_3ds[np.datetime64]) +ToDateTime_1nd = TypeAliasType("ToDateTime_1nd", _ToArray1_1nd[np.datetime64]) +ToDateTime_2nd = TypeAliasType("ToDateTime_2nd", _ToArray1_2nd[np.datetime64]) +ToDateTime_3nd = TypeAliasType("ToDateTime_3nd", _ToArray1_3nd[np.datetime64]) # fixed strings _ToBytes: TypeAlias = np.character[bytes] @@ -947,17 +961,17 @@ CoTimeDelta_2nd = TypeAliasType("CoTimeDelta_2nd", _ToArray_2nd[_CoTimeDelta, in CoTimeDelta_3nd = TypeAliasType("CoTimeDelta_3nd", _ToArray_3nd[_CoTimeDelta, int]) _CoDateTime: TypeAlias = _ToDateTime | _ToTimeDelta -CoDateTime_nd = TypeAliasType("CoDateTime_nd", _ToArray_nd[_CoDateTime]) -CoDateTime_0d = TypeAliasType("CoDateTime_0d", _ToArray_0d[_CoDateTime]) -CoDateTime_1d = TypeAliasType("CoDateTime_1d", _ToArray_1d[_CoDateTime]) -CoDateTime_2d = TypeAliasType("CoDateTime_2d", _ToArray_2d[_CoDateTime]) -CoDateTime_3d = TypeAliasType("CoDateTime_3d", _ToArray_3d[_CoDateTime]) -CoDateTime_1ds = TypeAliasType("CoDateTime_1ds", _ToArray_1ds[_CoDateTime]) -CoDateTime_2ds = TypeAliasType("CoDateTime_2ds", _ToArray_2ds[_CoDateTime]) -CoDateTime_3ds = TypeAliasType("CoDateTime_3ds", _ToArray_3ds[_CoDateTime]) -CoDateTime_1nd = TypeAliasType("CoDateTime_1nd", _ToArray_1nd[_CoDateTime]) -CoDateTime_2nd = TypeAliasType("CoDateTime_2nd", _ToArray_2nd[_CoDateTime]) -CoDateTime_3nd = TypeAliasType("CoDateTime_3nd", _ToArray_3nd[_CoDateTime]) +CoDateTime_nd = TypeAliasType("CoDateTime_nd", _ToArray1_nd[_CoDateTime]) +CoDateTime_0d = TypeAliasType("CoDateTime_0d", _ToArray1_0d[_CoDateTime]) +CoDateTime_1d = TypeAliasType("CoDateTime_1d", _ToArray1_1d[_CoDateTime]) +CoDateTime_2d = TypeAliasType("CoDateTime_2d", _ToArray1_2d[_CoDateTime]) +CoDateTime_3d = TypeAliasType("CoDateTime_3d", _ToArray1_3d[_CoDateTime]) +CoDateTime_1ds = TypeAliasType("CoDateTime_1ds", _ToArray1_1ds[_CoDateTime]) +CoDateTime_2ds = TypeAliasType("CoDateTime_2ds", _ToArray1_2ds[_CoDateTime]) +CoDateTime_3ds = TypeAliasType("CoDateTime_3ds", _ToArray1_3ds[_CoDateTime]) +CoDateTime_1nd = TypeAliasType("CoDateTime_1nd", _ToArray1_1nd[_CoDateTime]) +CoDateTime_2nd = TypeAliasType("CoDateTime_2nd", _ToArray1_2nd[_CoDateTime]) +CoDateTime_3nd = TypeAliasType("CoDateTime_3nd", _ToArray1_3nd[_CoDateTime]) # fixed strings _CoBytes: TypeAlias = _ToBytes diff --git a/src/numpy-stubs/_core/fromnumeric.pyi b/src/numpy-stubs/_core/fromnumeric.pyi index adb9a783..0d9d4d18 100644 --- a/src/numpy-stubs/_core/fromnumeric.pyi +++ b/src/numpy-stubs/_core/fromnumeric.pyi @@ -27,6 +27,7 @@ from _numtype import ( ToFloat64_nd, ToFloating_nd, ToGeneric_0d, + ToGeneric_1ds, ToGeneric_1nd, ToIntP_nd, ToInteger_1d, @@ -36,10 +37,9 @@ from _numtype import ( ToStr_nd, ToTimeDelta_nd, ToUInteger_nd, - _ToArray_0d, - _ToArray_1ds, - _ToArray_1nd, - _ToArray_nd, + _ToArray1_0d, + _ToArray1_1nd, + _ToArray1_nd, ) from numpy import _CastingKind, _ModeKind, _OrderACF, _OrderKACF, _PartitionKind, _SortKind, _SortSide # noqa: ICN003 from numpy._globals import _NoValueType @@ -122,9 +122,6 @@ _PyScalar: TypeAlias = complex | bytes | str _Order: TypeAlias = str | Sequence[str] -_ToGeneric_0d: TypeAlias = _ToArray_0d[np.generic, _PyScalar] -_ToGeneric_1ds: TypeAlias = _ToArray_1ds[np.generic, _PyScalar] - @type_check_only class _CanPut(Protocol[_IndT_contra, _VT_contra, _RT_co]): def put(self, ind: _IndT_contra, v: _VT_contra, /, *, mode: _ModeKind) -> _RT_co: ... @@ -147,7 +144,7 @@ class UFuncKwargs(TypedDict, total=False): @overload def take( # type: ignore[overload-overlap] - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], indices: CoInteger_0d, axis: None = None, out: None = None, @@ -155,7 +152,7 @@ def take( # type: ignore[overload-overlap] ) -> _ScalarT: ... @overload def take( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], indices: CoInteger_1nd, axis: CanIndex | None = None, out: None = None, @@ -196,14 +193,14 @@ def choose(a: CoInteger_nd, choices: ArrayLike, out: _ArrayT, mode: _ModeKind = @overload def choose(a: CoInteger_0d, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise") -> Any: ... @overload -def choose(a: CoInteger_1nd, choices: _ToArray_nd[_ScalarT], out: None = None, mode: _ModeKind = "raise") -> Array[_ScalarT]: ... +def choose(a: CoInteger_1nd, choices: _ToArray1_nd[_ScalarT], out: None = None, mode: _ModeKind = "raise") -> Array[_ScalarT]: ... @overload def choose(a: CoInteger_1nd, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise") -> Array: ... # @overload # shape: index def reshape( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], /, shape: CanIndex, order: _OrderACF = "C", @@ -212,8 +209,8 @@ def reshape( copy: bool | None = None, ) -> np.ndarray[tuple[int], np.dtype[_ScalarT]]: ... @overload # shape: _AnyShape -def reshape( # type: ignore[overload-overlap] - a: _ToArray_nd[_ScalarT], +def reshape( + a: _ToArray1_nd[_ScalarT], /, shape: _AnyShapeT, order: _OrderACF = "C", @@ -222,8 +219,8 @@ def reshape( # type: ignore[overload-overlap] copy: bool | None = None, ) -> Array[_ScalarT, _AnyShapeT]: ... @overload # shape: Sequence[index] -def reshape( # type: ignore[overload-overlap] - a: _ToArray_nd[_ScalarT], +def reshape( + a: _ToArray1_nd[_ScalarT], /, shape: Sequence[CanIndex], order: _OrderACF = "C", @@ -275,32 +272,32 @@ def reshape( # @overload -def swapaxes(a: _ToArray_nd[_ScalarT], axis1: CanIndex, axis2: CanIndex) -> Array[_ScalarT]: ... +def swapaxes(a: _ToArray1_nd[_ScalarT], axis1: CanIndex, axis2: CanIndex) -> Array[_ScalarT]: ... @overload def swapaxes(a: ArrayLike, axis1: CanIndex, axis2: CanIndex) -> Array: ... # @overload -def repeat(a: _ToArray_nd[_ScalarT], repeats: CoInteger_nd, axis: CanIndex | None = None) -> Array[_ScalarT]: ... +def repeat(a: _ToArray1_nd[_ScalarT], repeats: CoInteger_nd, axis: CanIndex | None = None) -> Array[_ScalarT]: ... @overload def repeat(a: ArrayLike, repeats: CoInteger_nd, axis: CanIndex | None = None) -> Array: ... # @overload -def transpose(a: _ToArray_nd[_ScalarT], axes: _ShapeLike | None = ...) -> Array[_ScalarT]: ... +def transpose(a: _ToArray1_nd[_ScalarT], axes: _ShapeLike | None = ...) -> Array[_ScalarT]: ... @overload def transpose(a: ArrayLike, axes: _ShapeLike | None = ...) -> Array: ... # @overload -def matrix_transpose(x: _ToArray_nd[_ScalarT]) -> Array[_ScalarT]: ... +def matrix_transpose(x: _ToArray1_nd[_ScalarT]) -> Array[_ScalarT]: ... @overload def matrix_transpose(x: ArrayLike) -> Array: ... # @overload def partition( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], kth: ToInteger_nd, axis: CanIndex | None = None, kind: _PartitionKind = "introselect", @@ -345,7 +342,7 @@ def sort( ) -> Array_1d[_ScalarT]: ... @overload # unknown shape, known dtype, axis= def sort( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: CanIndex = -1, kind: _SortKind | None = None, order: _Order | None = None, @@ -354,7 +351,7 @@ def sort( ) -> Array[_ScalarT]: ... @overload # unknown shape, known dtype, axis=None def sort( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: None, kind: _SortKind | None = None, order: _Order | None = None, @@ -392,7 +389,7 @@ def argsort( ) -> Array[np.intp, _ShapeT]: ... @overload # 0d or 1d array-like def argsort( - a: _ToGeneric_0d | _ToGeneric_1ds, + a: ToGeneric_0d | ToGeneric_1ds, axis: CanIndex | None = -1, kind: _SortKind | None = None, order: _Order | None = None, @@ -421,7 +418,7 @@ def argsort( # @overload # 0d or 1d , keepdims=False def argmax( - a: _ToGeneric_0d | _ToGeneric_1ds, + a: ToGeneric_0d | ToGeneric_1ds, axis: CanIndex, out: None = None, *, @@ -447,7 +444,7 @@ def argmax( # @overload # 0d or 1d , keepdims=False def argmin( - a: _ToGeneric_0d | _ToGeneric_1ds, + a: ToGeneric_0d | ToGeneric_1ds, axis: CanIndex, out: None = None, *, @@ -488,11 +485,11 @@ def searchsorted( # @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: CanIndex) -> Array_1d[_ScalarT]: ... +def resize(a: _ToArray1_nd[_ScalarT], new_shape: CanIndex) -> Array_1d[_ScalarT]: ... @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: _AnyShapeT) -> Array[_ScalarT, _AnyShapeT]: ... # type: ignore[overload-overlap] +def resize(a: _ToArray1_nd[_ScalarT], new_shape: _AnyShapeT) -> Array[_ScalarT, _AnyShapeT]: ... @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: Sequence[CanIndex]) -> Array[_ScalarT]: ... # type: ignore[overload-overlap] +def resize(a: _ToArray1_nd[_ScalarT], new_shape: Sequence[CanIndex]) -> Array[_ScalarT]: ... @overload def resize(a: ArrayLike, new_shape: CanIndex) -> Array_1d[Any]: ... @overload @@ -502,15 +499,15 @@ def resize(a: ArrayLike, new_shape: Sequence[CanIndex]) -> Array: ... # @overload -def squeeze(a: _ToArray_0d[_ScalarT], axis: _ShapeLike | None = None) -> Array_0d[_ScalarT]: ... +def squeeze(a: _ToArray1_0d[_ScalarT], axis: _ShapeLike | None = None) -> Array_0d[_ScalarT]: ... @overload -def squeeze(a: _ToArray_nd[_ScalarT], axis: _ShapeLike | None = None) -> Array[_ScalarT]: ... +def squeeze(a: _ToArray1_nd[_ScalarT], axis: _ShapeLike | None = None) -> Array[_ScalarT]: ... @overload def squeeze(a: ArrayLike, axis: _ShapeLike | None = None) -> Array: ... # @overload -def diagonal(a: _ToArray_nd[_ScalarT], offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1) -> Array[_ScalarT]: ... +def diagonal(a: _ToArray1_nd[_ScalarT], offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1) -> Array[_ScalarT]: ... @overload def diagonal(a: ArrayLike, offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1) -> Array: ... @@ -546,7 +543,7 @@ def trace( # @overload -def ravel(a: _ToArray_nd[_ScalarT], order: _OrderKACF = "C") -> Array_1d[_ScalarT]: ... # type: ignore[overload-overlap] +def ravel(a: _ToArray1_nd[_ScalarT], order: _OrderKACF = "C") -> Array_1d[_ScalarT]: ... # type: ignore[overload-overlap] @overload def ravel(a: ToBytes_nd, order: _OrderKACF = "C") -> Array_1d[np.bytes_]: ... @overload @@ -571,11 +568,11 @@ def shape(a: _HasShape[_ShapeT]) -> _ShapeT: ... @overload def shape(a: _PyScalar) -> tuple[()]: ... @overload -def shape(a: _PyArray[_ToGeneric_0d] | memoryview | bytearray) -> tuple[int]: ... +def shape(a: _PyArray[ToGeneric_0d] | memoryview | bytearray) -> tuple[int]: ... @overload -def shape(a: _PyArray[_PyArray[_ToGeneric_0d]]) -> tuple[int, int]: ... +def shape(a: _PyArray[_PyArray[ToGeneric_0d]]) -> tuple[int, int]: ... @overload -def shape(a: _PyArray[_PyArray[_PyArray[_ToGeneric_0d]]]) -> tuple[int, int, int]: ... +def shape(a: _PyArray[_PyArray[_PyArray[ToGeneric_0d]]]) -> tuple[int, int, int]: ... @overload def shape(a: ArrayLike) -> tuple[int, ...]: ... @@ -583,7 +580,7 @@ def shape(a: ArrayLike) -> tuple[int, ...]: ... @overload def compress( condition: ToBool_nd, - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: CanIndex | None = None, out: None = None, ) -> Array[_ScalarT]: ... @@ -609,7 +606,7 @@ def clip( ) -> _ScalarT: ... @overload def clip( - a: _ToArray_1nd[_ScalarT], + a: _ToArray1_1nd[_ScalarT], a_min: CoComplex_nd | _NoValueType | None = ..., a_max: CoComplex_nd | _NoValueType | None = ..., out: None = None, @@ -621,7 +618,7 @@ def clip( ) -> Array[_ScalarT]: ... @overload def clip( - a: _ToArray_1nd[Any, _PyScalar], + a: ToGeneric_1nd, a_min: CoComplex_nd | _NoValueType | None = ..., a_max: CoComplex_nd | _NoValueType | None = ..., out: None = None, @@ -671,7 +668,7 @@ def clip( # @overload def sum( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: None = None, dtype: None = None, out: None = None, @@ -681,7 +678,7 @@ def sum( ) -> _ScalarT: ... @overload def sum( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: None = None, dtype: None = None, out: None = None, @@ -831,7 +828,7 @@ def any( # @overload -def cumsum(a: _ToArray_nd[_ScalarT], axis: CanIndex | None = None, dtype: None = None, out: None = None) -> Array[_ScalarT]: ... +def cumsum(a: _ToArray1_nd[_ScalarT], axis: CanIndex | None = None, dtype: None = None, out: None = None) -> Array[_ScalarT]: ... @overload def cumsum(a: ArrayLike, axis: CanIndex | None = None, dtype: None = None, out: None = None) -> Array: ... @overload @@ -844,7 +841,7 @@ def cumsum(a: ArrayLike, axis: CanIndex | None = None, dtype: DTypeLike | None = # @overload def cumulative_sum( - x: _ToArray_nd[_ScalarT], + x: _ToArray1_nd[_ScalarT], /, *, axis: CanIndex | None = None, @@ -895,7 +892,7 @@ def cumulative_sum( # @overload -def ptp(a: _ToArray_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> _ScalarT: ... +def ptp(a: _ToArray1_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ...) -> _ScalarT: ... @overload def ptp(a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ...) -> Any: ... @overload @@ -904,7 +901,7 @@ def ptp(a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: # @overload def amax( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., @@ -943,7 +940,7 @@ def amax( # @overload def amin( - a: _ToArray_nd[_ScalarT], + a: _ToArray1_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., @@ -979,32 +976,28 @@ def amin( where: ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... -# TODO: `np.prod()``: For object arrays `initial` does not necessarily -# have to be a numerical scalar. -# The only requirement is that it is compatible -# with the `.__mul__()` method(s) of the passed array's elements. - -# Note that the same situation holds for all wrappers around -# `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`). +# TODO: `np.prod()``: For object arrays `initial` does not necessarily have to be a numerical scalar. +# The only requirement is that it is compatible with the `.__mul__()` method(s) of the passed array's elements. +# Note that the same situation holds for all wrappers around `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`). @overload -def prod( # type: ignore[overload-overlap] +def prod( a: ToBool_nd, axis: None = None, dtype: None = None, out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> np.int_: ... @overload -def prod( # type: ignore[overload-overlap] +def prod( a: ToUInteger_nd, axis: None = None, dtype: None = None, out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> np.uint64: ... @overload def prod( @@ -1012,9 +1005,9 @@ def prod( axis: None = None, dtype: None = None, out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> np.int64: ... @overload def prod( @@ -1022,9 +1015,9 @@ def prod( axis: None = None, dtype: None = None, out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> np.floating: ... @overload def prod( @@ -1032,9 +1025,9 @@ def prod( axis: None = None, dtype: None = None, out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> np.complexfloating: ... @overload def prod( @@ -1042,9 +1035,9 @@ def prod( axis: _ShapeLike | None = ..., dtype: None = None, out: None = None, - keepdims: bool = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | bool = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> Any: ... @overload def prod( @@ -1052,9 +1045,9 @@ def prod( axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> _ScalarT: ... @overload def prod( @@ -1063,9 +1056,9 @@ def prod( *, dtype: _DTypeLike[_ScalarT], out: None = None, - keepdims: L[False] = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | L[False] = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> _ScalarT: ... @overload def prod( @@ -1073,9 +1066,9 @@ def prod( axis: _ShapeLike | None = ..., dtype: DTypeLike | None = ..., out: None = None, - keepdims: bool = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | bool = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> Any: ... @overload def prod( @@ -1083,9 +1076,9 @@ def prod( axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, - keepdims: bool = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | bool = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> _ArrayT: ... @overload def prod( @@ -1094,21 +1087,21 @@ def prod( dtype: DTypeLike | None = ..., *, out: _ArrayT, - keepdims: bool = ..., - initial: CoComplex_0d = ..., - where: ToBool_nd = ..., + keepdims: _NoValueType | bool = ..., + initial: _NoValueType | CoComplex_0d = ..., + where: _NoValueType | ToBool_nd = ..., ) -> _ArrayT: ... # @overload -def cumprod( # type: ignore[overload-overlap] +def cumprod( a: ToBool_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None, ) -> Array[np.int_]: ... @overload -def cumprod( # type: ignore[overload-overlap] +def cumprod( a: ToUInteger_nd, axis: CanIndex | None = None, dtype: None = None, @@ -1182,7 +1175,7 @@ def cumprod( # @overload -def cumulative_prod( # type: ignore[overload-overlap] +def cumulative_prod( x: ToBool_nd, /, *, @@ -1192,7 +1185,7 @@ def cumulative_prod( # type: ignore[overload-overlap] include_initial: bool = False, ) -> Array[np.int_]: ... @overload -def cumulative_prod( # type: ignore[overload-overlap] +def cumulative_prod( x: ToUInteger_nd, /, *, @@ -1280,11 +1273,11 @@ def size(a: ArrayLike, axis: int | None = None) -> int: ... @overload def around(a: ToBool_0d, decimals: CanIndex = 0, out: None = None) -> np.float16: ... # type: ignore[overload-overlap] @overload -def around(a: ToBool_1nd, decimals: CanIndex = 0, out: None = None) -> Array[np.float16]: ... # type: ignore[overload-overlap] +def around(a: ToBool_1nd, decimals: CanIndex = 0, out: None = None) -> Array[np.float16]: ... @overload -def around(a: _ToArray_0d[_NumberT], decimals: CanIndex = 0, out: None = None) -> _NumberT: ... # type: ignore[overload-overlap] +def around(a: _ToArray1_0d[_NumberT], decimals: CanIndex = 0, out: None = None) -> _NumberT: ... # type: ignore[overload-overlap] @overload -def around(a: _ToArray_1nd[_NumberT], decimals: CanIndex = 0, out: None = None) -> Array[_NumberT]: ... +def around(a: _ToArray1_1nd[_NumberT], decimals: CanIndex = 0, out: None = None) -> Array[_NumberT]: ... @overload def around(a: Is[int], decimals: CanIndex = 0, out: None = None) -> np.intp: ... @overload @@ -1300,7 +1293,7 @@ def around(a: CoComplex_1nd, decimals: CanIndex = 0, out: Array | None = None) - # @overload -def mean( # type: ignore[overload-overlap] +def mean( a: CoFloating_nd, axis: None = None, dtype: None = None, @@ -1310,7 +1303,7 @@ def mean( # type: ignore[overload-overlap] where: ToBool_nd | _NoValueType = ..., ) -> np.floating: ... @overload -def mean( # type: ignore[overload-overlap] +def mean( a: ToComplex_nd, axis: None = None, dtype: None = None, diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index 0acc5537..da3e9c4f 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -33,6 +33,8 @@ from _numtype import ( ToFloating_1d, ToFloating_1nd, ToFloating_nd, + ToGeneric_1nd, + ToGeneric_nd, ToInteger_1d, ToObject_1d, ToObject_1nd, @@ -46,8 +48,6 @@ from _numtype import ( ToUInteger_1d, ToUInteger_1nd, ToUInteger_nd, - _ToArray_1nd, - _ToArray_nd, ) from numpy import _AnyShapeT, _OrderCF, _OrderKACF, ufunc # noqa: ICN003 from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ScalarLike_co, _ShapeLike, _SupportsArrayFunc @@ -503,23 +503,23 @@ def isfortran(a: Array | np.generic) -> bool: ... # @overload -def correlate(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array_1d[np.bool]: ... # type: ignore[overload-overlap] +def correlate(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array_1d[np.bool]: ... @overload -def correlate(a: ToUInteger_1d, v: CoUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def correlate(a: ToUInteger_1d, v: CoUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... @overload -def correlate(a: CoUInteger_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def correlate(a: CoUInteger_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... # @overload -def correlate(a: ToSInteger_1d, v: CoSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... # type: ignore[overload-overlap] +def correlate(a: ToSInteger_1d, v: CoSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... @overload -def correlate(a: CoSInteger_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... # type: ignore[overload-overlap] +def correlate(a: CoSInteger_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... @overload -def correlate(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... # type: ignore[overload-overlap] +def correlate(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... @overload -def correlate(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... # type: ignore[overload-overlap] +def correlate(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... @overload -def correlate(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... # type: ignore[overload-overlap] +def correlate(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... @overload -def correlate(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... # type: ignore[overload-overlap] +def correlate(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... @overload def correlate(a: ToTimeDelta_1d, v: CoTimeDelta_1d, mode: _Mode = "valid") -> Array_1d[np.timedelta64]: ... @overload @@ -535,23 +535,23 @@ def correlate( # @overload -def convolve(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array_1d[np.bool]: ... # type: ignore[overload-overlap] +def convolve(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array_1d[np.bool]: ... @overload -def convolve(a: ToUInteger_1d, v: CoUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def convolve(a: ToUInteger_1d, v: CoUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... @overload -def convolve(a: CoUInteger_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def convolve(a: CoUInteger_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array_1d[np.unsignedinteger]: ... @overload -def convolve(a: ToSInteger_1d, v: CoSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... # type: ignore[overload-overlap] +def convolve(a: ToSInteger_1d, v: CoSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... @overload -def convolve(a: CoSInteger_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... # type: ignore[overload-overlap] +def convolve(a: CoSInteger_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array_1d[np.signedinteger]: ... @overload -def convolve(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... # type: ignore[overload-overlap] +def convolve(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... @overload -def convolve(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... # type: ignore[overload-overlap] +def convolve(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array_1d[np.floating]: ... @overload -def convolve(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... # type: ignore[overload-overlap] +def convolve(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... @overload -def convolve(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... # type: ignore[overload-overlap] +def convolve(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array_1d[np.complexfloating]: ... @overload def convolve(a: ToTimeDelta_1d, v: CoTimeDelta_1d, mode: _Mode = "valid") -> Array_1d[np.timedelta64]: ... @overload @@ -567,23 +567,23 @@ def convolve( # @overload -def outer(a: ToBool_nd, b: ToBool_nd, out: None = None) -> Array_2d[np.bool]: ... # type: ignore[overload-overlap] +def outer(a: ToBool_nd, b: ToBool_nd, out: None = None) -> Array_2d[np.bool]: ... @overload -def outer(a: ToUInteger_nd, b: CoUInteger_nd, out: None = None) -> Array_2d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def outer(a: ToUInteger_nd, b: CoUInteger_nd, out: None = None) -> Array_2d[np.unsignedinteger]: ... @overload -def outer(a: CoUInteger_nd, b: ToUInteger_nd, out: None = None) -> Array_2d[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def outer(a: CoUInteger_nd, b: ToUInteger_nd, out: None = None) -> Array_2d[np.unsignedinteger]: ... @overload -def outer(a: ToSInteger_nd, b: CoSInteger_nd, out: None = None) -> Array_2d[np.signedinteger]: ... # type: ignore[overload-overlap] +def outer(a: ToSInteger_nd, b: CoSInteger_nd, out: None = None) -> Array_2d[np.signedinteger]: ... @overload -def outer(a: CoSInteger_nd, b: ToSInteger_nd, out: None = None) -> Array_2d[np.signedinteger]: ... # type: ignore[overload-overlap] +def outer(a: CoSInteger_nd, b: ToSInteger_nd, out: None = None) -> Array_2d[np.signedinteger]: ... @overload -def outer(a: ToFloating_nd, b: CoFloating_nd, out: None = None) -> Array_2d[np.floating]: ... # type: ignore[overload-overlap] +def outer(a: ToFloating_nd, b: CoFloating_nd, out: None = None) -> Array_2d[np.floating]: ... @overload -def outer(a: CoFloating_nd, b: ToFloating_nd, out: None = None) -> Array_2d[np.floating]: ... # type: ignore[overload-overlap] +def outer(a: CoFloating_nd, b: ToFloating_nd, out: None = None) -> Array_2d[np.floating]: ... @overload -def outer(a: ToComplex_nd, b: CoComplex_nd, out: None = None) -> Array_2d[np.complexfloating]: ... # type: ignore[overload-overlap] +def outer(a: ToComplex_nd, b: CoComplex_nd, out: None = None) -> Array_2d[np.complexfloating]: ... @overload -def outer(a: CoComplex_nd, b: ToComplex_nd, out: None = None) -> Array_2d[np.complexfloating]: ... # type: ignore[overload-overlap] +def outer(a: CoComplex_nd, b: ToComplex_nd, out: None = None) -> Array_2d[np.complexfloating]: ... @overload def outer(a: ToTimeDelta_nd, b: CoTimeDelta_nd, out: None = None) -> Array_2d[np.timedelta64]: ... @overload @@ -599,23 +599,23 @@ def outer( # @overload -def tensordot(a: ToBool_1nd, b: ToBool_1nd, axes: _Axes = 2) -> Array[np.bool]: ... # type: ignore[overload-overlap] +def tensordot(a: ToBool_1nd, b: ToBool_1nd, axes: _Axes = 2) -> Array[np.bool]: ... @overload -def tensordot(a: ToUInteger_1nd, b: CoUInteger_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def tensordot(a: ToUInteger_1nd, b: CoUInteger_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... @overload -def tensordot(a: CoUInteger_1nd, b: ToUInteger_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... # type: ignore[overload-overlap] +def tensordot(a: CoUInteger_1nd, b: ToUInteger_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... @overload -def tensordot(a: ToSInteger_1nd, b: CoSInteger_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... # type: ignore[overload-overlap] +def tensordot(a: ToSInteger_1nd, b: CoSInteger_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... @overload -def tensordot(a: CoSInteger_1nd, b: ToSInteger_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... # type: ignore[overload-overlap] +def tensordot(a: CoSInteger_1nd, b: ToSInteger_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... @overload -def tensordot(a: ToFloating_1nd, b: CoFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... # type: ignore[overload-overlap] +def tensordot(a: ToFloating_1nd, b: CoFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... @overload -def tensordot(a: CoFloating_1nd, b: ToFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... # type: ignore[overload-overlap] +def tensordot(a: CoFloating_1nd, b: ToFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... @overload -def tensordot(a: ToComplex_1nd, b: CoComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... # type: ignore[overload-overlap] +def tensordot(a: ToComplex_1nd, b: CoComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... @overload -def tensordot(a: CoComplex_1nd, b: ToComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... # type: ignore[overload-overlap] +def tensordot(a: CoComplex_1nd, b: ToComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... @overload def tensordot(a: ToTimeDelta_1nd, b: CoTimeDelta_1nd, axes: _Axes = 2) -> Array[np.timedelta64]: ... @overload @@ -650,7 +650,7 @@ def cross( axis: int | None = None, ) -> NoReturn: ... @overload -def cross( # type: ignore[overload-overlap] +def cross( x1: ToUInteger_1nd, x2: CoUInteger_1nd, axisa: int = -1, @@ -659,7 +659,7 @@ def cross( # type: ignore[overload-overlap] axis: int | None = None, ) -> Array[np.unsignedinteger]: ... @overload -def cross( # type: ignore[overload-overlap] +def cross( x1: CoUInteger_1nd, x2: ToUInteger_1nd, axisa: int = -1, @@ -788,16 +788,16 @@ def isclose( ) -> np.bool: ... @overload def isclose( - a: _ToArray_1nd[np.generic, _PyScalar], - b: _ToArray_nd[np.generic, _PyScalar], + a: ToGeneric_1nd, + b: ToGeneric_nd, rtol: ArrayLike = 1e-5, atol: ArrayLike = 1e-8, equal_nan: bool = False, ) -> Array[np.bool]: ... @overload def isclose( - a: _ToArray_nd[np.generic, _PyScalar], - b: _ToArray_1nd[np.generic, _PyScalar], + a: ToGeneric_nd, + b: ToGeneric_1nd, rtol: ArrayLike = 1e-5, atol: ArrayLike = 1e-8, equal_nan: bool = False, diff --git a/src/numpy-stubs/lib/_scimath_impl.pyi b/src/numpy-stubs/lib/_scimath_impl.pyi index 226daa24..e43a879b 100644 --- a/src/numpy-stubs/lib/_scimath_impl.pyi +++ b/src/numpy-stubs/lib/_scimath_impl.pyi @@ -54,6 +54,8 @@ from _numtype import ( ToUInteger_0d, ToUInteger_1nd, ToUInteger_nd, + _ToArray1_0d, + _ToArray1_1nd, _ToArray_0d, _ToArray_1nd, ) @@ -64,75 +66,72 @@ __all__ = ["arccos", "arcsin", "arctanh", "log", "log2", "log10", "logn", "power # NOTE: This module is publically re-exported as `numpy.emath` -# mypy: disable-error-code="overload-overlap" - -# NOTE: There are a huge amount of mypy `overload-overlap` false positives here, so we -# disable them all, and just rely on Pyright. - # NOTE: All signatures are weird: https://github.com/numpy/numpy/issues/28367 # NOTE: The signatures of sqrt, log, log2, and log10 are identical +# NOTE: all ignored mypy [overload-overlap] errors are false positives + # @overload -def sqrt(x: CoUInt8_0d) -> np.float16: ... +def sqrt(x: CoUInt8_0d) -> np.float16: ... # type: ignore[overload-overlap] +@overload +def sqrt(x: _ToArray1_0d[np.uint64 | np.uint32]) -> np.float64: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToUInt16_0d) -> np.float32: ... +def sqrt(x: ToUInt16_0d) -> np.float32: ... # type: ignore[overload-overlap] @overload -def sqrt(x: _ToArray_0d[np.uint64 | np.uint32]) -> np.float64: ... +def sqrt(x: CoUInteger_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def sqrt(x: CoUInteger_0d) -> np.floating: ... +def sqrt(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def sqrt(x: ToInt16_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def sqrt(x: ToInt8_0d) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def sqrt(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def sqrt(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # why not complex64...? +def sqrt(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def sqrt(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def sqrt(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # why not clongdouble? +def sqrt(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToComplex64_0d) -> np.complex64: ... +def sqrt(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToComplex128_0d) -> np.complex128: ... +def sqrt(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # why does this sometimes downcast? +def sqrt(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def sqrt(x: ToComplex_0d) -> np.complexfloating: ... +def sqrt(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def sqrt(x: CoComplex_0d) -> np.inexact: ... # why is this useless comment here? +def sqrt(x: _ToArray1_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... # type: ignore[overload-overlap] @overload def sqrt(x: CoUInt8_1nd) -> Array[np.float16]: ... @overload def sqrt(x: ToUInt16_1nd) -> Array[np.float32]: ... @overload -def sqrt(x: _ToArray_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... -@overload def sqrt(x: CoUInteger_1nd) -> Array[np.floating]: ... @overload -def sqrt(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... -@overload -def sqrt(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... -@overload def sqrt(x: _ToArray_1nd[np.int64 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def sqrt(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def sqrt(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... @overload -def sqrt(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def sqrt(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... @overload def sqrt(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def sqrt(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def sqrt(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def sqrt(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def sqrt(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def sqrt(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload +def sqrt(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def sqrt(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload def sqrt(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @@ -141,64 +140,64 @@ def sqrt(x: CoComplex_1nd) -> Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log(x: CoUInt8_0d) -> np.float16: ... +def log(x: CoUInt8_0d) -> np.float16: ... # type: ignore[overload-overlap] @overload -def log(x: ToUInt16_0d) -> np.float32: ... +def log(x: _ToArray1_0d[np.uint64 | np.uint32]) -> np.float64: ... # type: ignore[overload-overlap] @overload -def log(x: _ToArray_0d[np.uint64 | np.uint32]) -> np.float64: ... +def log(x: ToUInt16_0d) -> np.float32: ... # type: ignore[overload-overlap] @overload -def log(x: CoUInteger_0d) -> np.floating: ... +def log(x: CoUInteger_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def log(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log(x: ToInt16_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def log(x: ToInt8_0d) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # why not complex64...? +def log(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # why not clongdouble? +def log(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def log(x: ToComplex64_0d) -> np.complex64: ... +def log(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def log(x: ToComplex128_0d) -> np.complex128: ... +def log(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def log(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # why does this sometimes downcast? +def log(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def log(x: ToComplex_0d) -> np.complexfloating: ... +def log(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def log(x: CoComplex_0d) -> np.inexact: ... # why is this useless comment here? +def log(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] +@overload +def log(x: _ToArray1_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... # type: ignore[overload-overlap] @overload def log(x: CoUInt8_1nd) -> Array[np.float16]: ... @overload def log(x: ToUInt16_1nd) -> Array[np.float32]: ... @overload -def log(x: _ToArray_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... -@overload def log(x: CoUInteger_1nd) -> Array[np.floating]: ... @overload -def log(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... -@overload -def log(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... -@overload def log(x: _ToArray_1nd[np.int64 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def log(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... @overload -def log(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... @overload def log(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def log(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def log(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def log(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def log(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload +def log(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def log(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload def log(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @@ -207,64 +206,64 @@ def log(x: CoComplex_1nd) -> Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log10(x: CoUInt8_0d) -> np.float16: ... +def log10(x: CoUInt8_0d) -> np.float16: ... # type: ignore[overload-overlap] +@overload +def log10(x: _ToArray1_0d[np.uint64 | np.uint32]) -> np.float64: ... # type: ignore[overload-overlap] @overload -def log10(x: ToUInt16_0d) -> np.float32: ... +def log10(x: ToUInt16_0d) -> np.float32: ... # type: ignore[overload-overlap] @overload -def log10(x: _ToArray_0d[np.uint64 | np.uint32]) -> np.float64: ... +def log10(x: CoUInteger_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def log10(x: CoUInteger_0d) -> np.floating: ... +def log10(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log10(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log10(x: ToInt16_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log10(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log10(x: ToInt8_0d) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log10(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def log10(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log10(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # why not complex64...? +def log10(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log10(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log10(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log10(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log10(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def log10(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # why not clongdouble? +def log10(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def log10(x: ToComplex64_0d) -> np.complex64: ... +def log10(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def log10(x: ToComplex128_0d) -> np.complex128: ... +def log10(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def log10(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # why does this sometimes downcast? +def log10(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def log10(x: ToComplex_0d) -> np.complexfloating: ... +def log10(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def log10(x: CoComplex_0d) -> np.inexact: ... # why is this useless comment here? +def log10(x: _ToArray1_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... # type: ignore[overload-overlap] @overload def log10(x: CoUInt8_1nd) -> Array[np.float16]: ... @overload def log10(x: ToUInt16_1nd) -> Array[np.float32]: ... @overload -def log10(x: _ToArray_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... -@overload def log10(x: CoUInteger_1nd) -> Array[np.floating]: ... @overload -def log10(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... -@overload -def log10(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... -@overload def log10(x: _ToArray_1nd[np.int64 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def log10(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log10(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... @overload -def log10(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log10(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... @overload def log10(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def log10(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def log10(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log10(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def log10(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def log10(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload +def log10(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def log10(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload def log10(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @@ -273,64 +272,64 @@ def log10(x: CoComplex_1nd) -> Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log2(x: CoUInt8_0d) -> np.float16: ... +def log2(x: CoUInt8_0d) -> np.float16: ... # type: ignore[overload-overlap] +@overload +def log2(x: _ToArray1_0d[np.uint64 | np.uint32]) -> np.float64: ... # type: ignore[overload-overlap] @overload -def log2(x: ToUInt16_0d) -> np.float32: ... +def log2(x: ToUInt16_0d) -> np.float32: ... # type: ignore[overload-overlap] @overload -def log2(x: _ToArray_0d[np.uint64 | np.uint32]) -> np.float64: ... +def log2(x: CoUInteger_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def log2(x: CoUInteger_0d) -> np.floating: ... +def log2(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log2(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log2(x: ToInt16_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log2(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log2(x: ToInt8_0d) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log2(x: _ToArray_0d[np.int64 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def log2(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log2(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # why not complex64...? +def log2(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def log2(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log2(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def log2(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log2(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def log2(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # why not clongdouble? +def log2(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def log2(x: ToComplex64_0d) -> np.complex64: ... +def log2(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def log2(x: ToComplex128_0d) -> np.complex128: ... +def log2(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def log2(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # why does this sometimes downcast? +def log2(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def log2(x: ToComplex_0d) -> np.complexfloating: ... +def log2(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def log2(x: CoComplex_0d) -> np.inexact: ... # why is this useless comment here? +def log2(x: _ToArray1_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... # type: ignore[overload-overlap] @overload def log2(x: CoUInt8_1nd) -> Array[np.float16]: ... @overload def log2(x: ToUInt16_1nd) -> Array[np.float32]: ... @overload -def log2(x: _ToArray_1nd[np.uint64 | np.uint32]) -> Array[np.float64]: ... -@overload def log2(x: CoUInteger_1nd) -> Array[np.floating]: ... @overload -def log2(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... -@overload -def log2(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... -@overload def log2(x: _ToArray_1nd[np.int64 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def log2(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log2(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... @overload -def log2(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log2(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... @overload def log2(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def log2(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def log2(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log2(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def log2(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def log2(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload +def log2(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def log2(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload def log2(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @@ -341,165 +340,165 @@ def log2(x: CoComplex_1nd) -> Array[np.inexact]: ... # @overload -def arccos(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... +def arccos(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arccos(x: _ToArray_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... +def arccos(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arccos(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def arccos(x: _ToArray1_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arccos(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arccos(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arccos(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arccos(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToComplex64_0d) -> np.complex64: ... +def arccos(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToComplex128_0d) -> np.complex128: ... +def arccos(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arccos(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def arccos(x: ToComplex_0d) -> np.complexfloating: ... +def arccos(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def arccos(x: CoComplex_0d) -> np.inexact: ... +def arccos(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def arccos(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... -@overload -def arccos(x: _ToArray_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... +def arccos(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... # type: ignore[overload-overlap] @overload def arccos(x: _ToArray_1nd[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def arccos(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... -@overload -def arccos(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arccos(x: _ToArray1_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... @overload def arccos(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def arccos(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def arccos(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arccos(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def arccos(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def arccos(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload def arccos(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload +def arccos(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def arccos(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @overload def arccos(x: CoComplex_1nd) -> Array[np.inexact]: ... # signature is equivalent to `arccos` @overload -def arcsin(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... -@overload -def arcsin(x: _ToArray_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... +def arcsin(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arcsin(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def arcsin(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arcsin(x: _ToArray1_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arcsin(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arcsin(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arcsin(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToComplex64_0d) -> np.complex64: ... +def arcsin(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToComplex128_0d) -> np.complex128: ... +def arcsin(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arcsin(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def arcsin(x: ToComplex_0d) -> np.complexfloating: ... +def arcsin(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def arcsin(x: CoComplex_0d) -> np.inexact: ... +def arcsin(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def arcsin(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... +def arcsin(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def arcsin(x: _ToArray_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... +def arcsin(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... # type: ignore[overload-overlap] @overload def arcsin(x: _ToArray_1nd[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def arcsin(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... -@overload -def arcsin(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arcsin(x: _ToArray1_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... @overload def arcsin(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def arcsin(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def arcsin(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arcsin(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def arcsin(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def arcsin(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload def arcsin(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload +def arcsin(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def arcsin(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @overload def arcsin(x: CoComplex_1nd) -> Array[np.inexact]: ... # signature is equivalent to `arccos` @overload -def arctanh(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... -@overload -def arctanh(x: _ToArray_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... +def arctanh(x: _ToArray_0d[np.uint8 | np.int8 | np.bool, bool]) -> np.float16 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arctanh(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... +def arctanh(x: _ToArray_0d[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arctanh(x: _ToArray1_0d[np.uint16 | np.int16]) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arctanh(x: ToFloat64_0d) -> np.float64 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arctanh(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arctanh(x: ToFloat32_0d) -> np.float32 | np.complex64: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToComplex64_0d) -> np.complex64: ... +def arctanh(x: ToFloat16_0d) -> np.float16 | np.complex128: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToComplex128_0d) -> np.complex128: ... +def arctanh(x: ToComplex128_0d) -> np.complex128: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arctanh(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... # type: ignore[overload-overlap] @overload -def arctanh(x: ToComplex_0d) -> np.complexfloating: ... +def arctanh(x: ToComplex64_0d) -> np.complex64: ... # type: ignore[overload-overlap] @overload -def arctanh(x: CoComplex_0d) -> np.inexact: ... +def arctanh(x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def arctanh(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... +def arctanh(x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def arctanh(x: _ToArray_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... +def arctanh(x: _ToArray_1nd[np.uint8 | np.int8 | np.bool, bool]) -> Array[np.float16 | np.complex64]: ... # type: ignore[overload-overlap] @overload def arctanh(x: _ToArray_1nd[np.uint64 | np.int64 | np.uint32 | np.int32, Is[int]]) -> Array[np.float64 | np.complex128]: ... @overload -def arctanh(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... -@overload -def arctanh(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arctanh(x: _ToArray1_1nd[np.uint16 | np.int16]) -> Array[np.float32 | np.complex64]: ... @overload def arctanh(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... @overload def arctanh(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... @overload -def arctanh(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arctanh(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +@overload +def arctanh(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... @overload def arctanh(x: ToComplex128_1nd) -> Array[np.complex128]: ... @overload def arctanh(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... @overload +def arctanh(x: ToComplex64_1nd) -> Array[np.complex64]: ... +@overload def arctanh(x: ToComplex_1nd) -> Array[np.complexfloating]: ... @overload def arctanh(x: CoComplex_1nd) -> Array[np.inexact]: ... # @overload -def logn(n: CoUInt8_0d, x: CoUInt8_0d) -> np.float16: ... +def logn(n: CoUInt8_0d, x: CoUInt8_0d) -> np.float16: ... # type: ignore[overload-overlap] @overload -def logn(n: CoUInteger_0d, x: CoUInteger_0d) -> np.floating: ... +def logn(n: CoUInteger_0d, x: CoUInteger_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def logn(n: ToComplex_0d, x: CoComplex_0d) -> np.complexfloating: ... +def logn(n: ToComplex_0d, x: CoComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def logn(n: CoComplex_0d, x: ToComplex_0d) -> np.complexfloating: ... +def logn(n: CoComplex_0d, x: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def logn(n: CoComplex_0d, x: CoComplex_0d) -> np.inexact: ... +def logn(n: CoComplex_0d, x: CoComplex_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload def logn(n: CoUInt8_nd, x: CoUInt8_1nd) -> Array[np.float16]: ... @overload @@ -523,27 +522,27 @@ def logn(n: CoComplex_1nd, x: CoComplex_nd) -> Array[np.inexact]: ... # @overload -def power(x: CoInt8_0d, p: CoInt8_0d) -> np.int8: ... +def power(x: CoInt8_0d, p: CoInt8_0d) -> np.int8: ... # type: ignore[overload-overlap] @overload -def power(x: ToUInteger_0d, p: CoUInteger_0d) -> np.unsignedinteger: ... +def power(x: ToUInteger_0d, p: CoUInteger_0d) -> np.unsignedinteger: ... # type: ignore[overload-overlap] @overload -def power(x: CoUInteger_0d, p: ToUInteger_0d) -> np.unsignedinteger: ... +def power(x: CoUInteger_0d, p: ToUInteger_0d) -> np.unsignedinteger: ... # type: ignore[overload-overlap] @overload -def power(x: CoUInteger_0d, p: ToSInteger_0d) -> np.signedinteger | np.float64: ... +def power(x: CoUInteger_0d, p: ToSInteger_0d) -> np.signedinteger | np.float64: ... # type: ignore[overload-overlap] @overload -def power(x: CoUInteger_0d, p: ToFloating_0d) -> np.floating: ... +def power(x: CoUInteger_0d, p: ToFloating_0d) -> np.floating: ... # type: ignore[overload-overlap] @overload -def power(x: ToSInteger_0d, p: CoUInteger_0d) -> np.signedinteger | np.complexfloating: ... +def power(x: ToSInteger_0d, p: CoUInteger_0d) -> np.signedinteger | np.complexfloating: ... # type: ignore[overload-overlap] @overload -def power(x: ToSInteger_0d, p: CoInteger_0d) -> np.signedinteger | np.inexact: ... +def power(x: ToSInteger_0d, p: CoInteger_0d) -> np.signedinteger | np.inexact: ... # type: ignore[overload-overlap] @overload -def power(x: ToFloating_0d, p: CoFloating_0d) -> np.inexact: ... +def power(x: ToFloating_0d, p: CoFloating_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def power(x: CoFloating_0d, p: ToFloating_0d) -> np.inexact: ... +def power(x: CoFloating_0d, p: ToFloating_0d) -> np.inexact: ... # type: ignore[overload-overlap] @overload -def power(x: ToComplex_0d, p: CoComplex_0d) -> np.complexfloating: ... +def power(x: ToComplex_0d, p: CoComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload -def power(x: CoComplex_0d, p: ToComplex_0d) -> np.complexfloating: ... +def power(x: CoComplex_0d, p: ToComplex_0d) -> np.complexfloating: ... # type: ignore[overload-overlap] @overload def power(x: CoInt8_nd, p: CoInt8_1nd) -> Array[np.int8]: ... @overload diff --git a/src/numpy-stubs/linalg/_linalg.pyi b/src/numpy-stubs/linalg/_linalg.pyi index 40dba5c3..6579b5b9 100644 --- a/src/numpy-stubs/linalg/_linalg.pyi +++ b/src/numpy-stubs/linalg/_linalg.pyi @@ -88,11 +88,14 @@ from _numtype import ( ToTimeDelta_1d, ToTimeDelta_1nd, ToUInteger_1nd, - _ToArray_1d, - _ToArray_1ds, + _ToArray1_1d, + _ToArray1_1ds, + _ToArray1_1nd, + _ToArray1_2ds, + _ToArray1_2nd, + _ToArray1_3nd, _ToArray_1nd, _ToArray_2ds, - _ToArray_2nd, _ToArray_3nd, ) from numpy._core.fromnumeric import matrix_transpose @@ -194,17 +197,17 @@ _ToFloat64_1nd: TypeAlias = _ToArray_1nd[np.floating[_64Bit] | np.integer | np.b _ToFloat64_2ds: TypeAlias = _ToArray_2ds[np.floating[_64Bit] | np.integer | np.bool, float] _ToFloat64_3nd: TypeAlias = _ToArray_3nd[np.floating[_64Bit] | np.integer | np.bool, float] -_ToInexact32_1nd: TypeAlias = _ToArray_1nd[np.inexact[_32Bit]] -_ToInexact32_2ds: TypeAlias = _ToArray_2ds[np.inexact[_32Bit]] -_ToInexact32_3nd: TypeAlias = _ToArray_3nd[np.inexact[_32Bit]] +_ToInexact32_1nd: TypeAlias = _ToArray1_1nd[np.inexact[_32Bit]] +_ToInexact32_2ds: TypeAlias = _ToArray1_2ds[np.inexact[_32Bit]] +_ToInexact32_3nd: TypeAlias = _ToArray1_3nd[np.inexact[_32Bit]] _ToInexact64_1nd: TypeAlias = _ToArray_1nd[np.inexact[_64Bit] | np.integer | np.bool, complex] _ToInexact64_2ds: TypeAlias = _ToArray_2ds[np.inexact[_64Bit] | np.integer | np.bool, complex] _ToInexact64_3nd: TypeAlias = _ToArray_3nd[np.inexact[_64Bit] | np.integer | np.bool, complex] -_ToInexactLD_1nd: TypeAlias = _ToArray_1nd[np.longdouble | np.clongdouble] -_ToInexactLD_2ds: TypeAlias = _ToArray_2ds[np.longdouble | np.clongdouble] -_ToInexactLD_3nd: TypeAlias = _ToArray_3nd[np.longdouble | np.clongdouble] +_ToInexactLD_1nd: TypeAlias = _ToArray1_1nd[np.longdouble | np.clongdouble] +_ToInexactLD_2ds: TypeAlias = _ToArray1_2ds[np.longdouble | np.clongdouble] +_ToInexactLD_3nd: TypeAlias = _ToArray1_3nd[np.longdouble | np.clongdouble] _ToUnsafe64_1nd: TypeAlias = _ToArray_1nd[np.inexact[_64Bit] | np.integer | np.bool | np.character, complex | bytes | str] _ToUnsafe64_2ds: TypeAlias = _ToArray_2ds[np.inexact[_64Bit] | np.integer | np.bool | np.character, complex | bytes | str] @@ -241,17 +244,17 @@ class LinAlgError(ValueError): ... # keep in sync with `solve` @overload -def tensorsolve(a: _ToFloat64_1nd, b: CoFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def tensorsolve(a: _ToFloat64_1nd, b: CoFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... @overload -def tensorsolve(a: CoFloat64_1nd, b: _ToFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def tensorsolve(a: CoFloat64_1nd, b: _ToFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... @overload -def tensorsolve(a: ToComplex128_1nd, b: CoComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... # type: ignore[overload-overlap] +def tensorsolve(a: ToComplex128_1nd, b: CoComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... @overload -def tensorsolve(a: CoComplex128_1nd, b: ToComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... # type: ignore[overload-overlap] +def tensorsolve(a: CoComplex128_1nd, b: ToComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... @overload -def tensorsolve(a: ToFloat32_1nd, b: ToFloat32_1nd, axes: _Axes | None = None) -> Array[np.float32]: ... # type: ignore[overload-overlap] +def tensorsolve(a: ToFloat32_1nd, b: ToFloat32_1nd, axes: _Axes | None = None) -> Array[np.float32]: ... @overload -def tensorsolve(a: ToComplex64_1nd, b: ToComplex64_1nd, axes: _Axes | None = None) -> Array[np.complex64]: ... # type: ignore[overload-overlap] +def tensorsolve(a: ToComplex64_1nd, b: ToComplex64_1nd, axes: _Axes | None = None) -> Array[np.complex64]: ... @overload def tensorsolve(a: CoFloat64_1nd, b: CoFloat64_1nd, axes: _Axes | None = None) -> Array[np.floating]: ... @overload @@ -259,17 +262,17 @@ def tensorsolve(a: CoComplex128_1nd, b: CoComplex128_1nd, axes: _Axes | None = N # keep in sync with `tensorsolve` @overload -def solve(a: _ToFloat64_1nd, b: CoFloat64_1nd) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def solve(a: _ToFloat64_1nd, b: CoFloat64_1nd) -> Array[np.float64]: ... @overload -def solve(a: CoFloat64_1nd, b: _ToFloat64_1nd) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def solve(a: CoFloat64_1nd, b: _ToFloat64_1nd) -> Array[np.float64]: ... @overload -def solve(a: ToComplex128_1nd, b: CoComplex128_1nd) -> Array[np.complex128]: ... # type: ignore[overload-overlap] +def solve(a: ToComplex128_1nd, b: CoComplex128_1nd) -> Array[np.complex128]: ... @overload -def solve(a: CoComplex128_1nd, b: ToComplex128_1nd) -> Array[np.complex128]: ... # type: ignore[overload-overlap] +def solve(a: CoComplex128_1nd, b: ToComplex128_1nd) -> Array[np.complex128]: ... @overload -def solve(a: ToFloat32_1nd, b: ToFloat32_1nd) -> Array[np.float32]: ... # type: ignore[overload-overlap] +def solve(a: ToFloat32_1nd, b: ToFloat32_1nd) -> Array[np.float32]: ... @overload -def solve(a: ToComplex64_1nd, b: ToComplex64_1nd) -> Array[np.complex64]: ... # type: ignore[overload-overlap] +def solve(a: ToComplex64_1nd, b: ToComplex64_1nd) -> Array[np.complex64]: ... @overload def solve(a: CoFloat64_1nd, b: CoFloat64_1nd) -> Array[np.floating]: ... @overload @@ -277,13 +280,13 @@ def solve(a: CoComplex128_1nd, b: CoComplex128_1nd) -> Array[np.inexact]: ... # keep in sync with `inv` @overload -def tensorinv(a: _ToFloat64_1nd, ind: int = 2) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] +def tensorinv(a: _ToFloat64_1nd, ind: int = 2) -> _Array_2nd[np.float64]: ... @overload -def tensorinv(a: ToComplex128_1nd, ind: int = 2) -> _Array_2nd[np.complex128]: ... # type: ignore[overload-overlap] +def tensorinv(a: ToComplex128_1nd, ind: int = 2) -> _Array_2nd[np.complex128]: ... @overload -def tensorinv(a: ToFloat32_1nd, ind: int = 2) -> _Array_2nd[np.float32]: ... # type: ignore[overload-overlap] +def tensorinv(a: ToFloat32_1nd, ind: int = 2) -> _Array_2nd[np.float32]: ... @overload -def tensorinv(a: ToComplex64_1nd, ind: int = 2) -> _Array_2nd[np.complex64]: ... # type: ignore[overload-overlap] +def tensorinv(a: ToComplex64_1nd, ind: int = 2) -> _Array_2nd[np.complex64]: ... @overload def tensorinv(a: CoFloat64_1nd, ind: int = 2) -> _Array_2nd[np.floating]: ... @overload @@ -291,13 +294,13 @@ def tensorinv(a: CoComplex128_1nd, ind: int = 2) -> _Array_2nd[np.inexact]: ... # keep in sync with `tensorinv` @overload -def inv(a: _ToFloat64_1nd) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] +def inv(a: _ToFloat64_1nd) -> _Array_2nd[np.float64]: ... @overload -def inv(a: ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... # type: ignore[overload-overlap] +def inv(a: ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... @overload -def inv(a: ToFloat32_1nd) -> _Array_2nd[np.float32]: ... # type: ignore[overload-overlap] +def inv(a: ToFloat32_1nd) -> _Array_2nd[np.float32]: ... @overload -def inv(a: ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... # type: ignore[overload-overlap] +def inv(a: ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... @overload def inv(a: CoFloat64_1nd) -> _Array_2nd[np.floating]: ... @overload @@ -305,7 +308,7 @@ def inv(a: CoComplex128_1nd) -> _Array_2nd[np.inexact]: ... # @overload -def pinv( # type: ignore[overload-overlap] +def pinv( a: _ToFloat64_1nd, rcond: ToFloating_nd | None = None, hermitian: bool = False, @@ -313,7 +316,7 @@ def pinv( # type: ignore[overload-overlap] rtol: ToFloating_nd | None = None, ) -> _Array_2nd[np.float64]: ... @overload -def pinv( # type: ignore[overload-overlap] +def pinv( a: ToComplex128_1nd, rcond: ToFloating_nd | None = None, hermitian: bool = False, @@ -321,7 +324,7 @@ def pinv( # type: ignore[overload-overlap] rtol: ToFloating_nd | None = None, ) -> _Array_2nd[np.complex128]: ... @overload -def pinv( # type: ignore[overload-overlap] +def pinv( a: ToFloat32_1nd, rcond: ToFloating_nd | None = None, hermitian: bool = False, @@ -329,7 +332,7 @@ def pinv( # type: ignore[overload-overlap] rtol: ToFloating_nd | None = None, ) -> _Array_2nd[np.float32]: ... @overload -def pinv( # type: ignore[overload-overlap] +def pinv( a: ToComplex64_1nd, rcond: ToFloating_nd | None = None, hermitian: bool = False, @@ -360,19 +363,19 @@ _NegInt: TypeAlias = L[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, - @overload def matrix_power(a: CanArraySized[_NumberT, _Shape2T], n: _PosInt) -> Array[_NumberT, _Shape2T]: ... # type: ignore[overload-overlap] @overload -def matrix_power(a: CoBool_1nd, n: _PosInt) -> _Array_2nd[np.bool]: ... # type: ignore[overload-overlap] +def matrix_power(a: CoBool_1nd, n: _PosInt) -> _Array_2nd[np.bool]: ... @overload def matrix_power(a: ToIntP_1nd, n: _PosInt) -> _Array_2nd[np.intp]: ... # type: ignore[overload-overlap] @overload -def matrix_power(a: CoInteger_1nd, n: _NegInt) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] +def matrix_power(a: CoInteger_1nd, n: _NegInt) -> _Array_2nd[np.float64]: ... @overload def matrix_power(a: ToFloat64_1nd, n: CanIndex) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] @overload def matrix_power(a: ToComplex128_1nd, n: CanIndex) -> _Array_2nd[np.complex128]: ... # type: ignore[overload-overlap] @overload -def matrix_power(a: ToFloat32_1nd, n: CanIndex) -> _Array_2nd[np.float32]: ... # type: ignore[overload-overlap] +def matrix_power(a: ToFloat32_1nd, n: CanIndex) -> _Array_2nd[np.float32]: ... @overload -def matrix_power(a: ToComplex64_1nd, n: CanIndex) -> _Array_2nd[np.complex64]: ... # type: ignore[overload-overlap] +def matrix_power(a: ToComplex64_1nd, n: CanIndex) -> _Array_2nd[np.complex64]: ... @overload def matrix_power(a: ToObject_1nd, n: CanIndex) -> _Array_2nd[np.object_]: ... # type: ignore[overload-overlap] @overload @@ -386,13 +389,13 @@ def matrix_power(a: CoComplex_1nd | ToObject_1nd, n: CanIndex) -> _Array_2nd[Any # @overload -def cholesky(a: _ToFloat64_1nd) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] +def cholesky(a: _ToFloat64_1nd) -> _Array_2nd[np.float64]: ... @overload -def cholesky(a: ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... # type: ignore[overload-overlap] +def cholesky(a: ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... @overload -def cholesky(a: ToFloat32_1nd) -> _Array_2nd[np.float32]: ... # type: ignore[overload-overlap] +def cholesky(a: ToFloat32_1nd) -> _Array_2nd[np.float32]: ... @overload -def cholesky(a: ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... # type: ignore[overload-overlap] +def cholesky(a: ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... @overload def cholesky(a: CoFloat64_1nd) -> _Array_2nd[np.floating]: ... @overload @@ -400,29 +403,29 @@ def cholesky(a: CoComplex128_1nd) -> _Array_2nd[np.inexact]: ... # @overload -def outer(x1: _ToArray_1d[_IntegerT], x2: _ToArray_1d[_IntegerT], /) -> Array_2d[_IntegerT]: ... # type: ignore[overload-overlap] +def outer(x1: _ToArray1_1d[_IntegerT], x2: _ToArray1_1d[_IntegerT], /) -> Array_2d[_IntegerT]: ... @overload -def outer(x1: ToBool_1d, x2: ToBool_1d, /) -> Array_2d[np.bool]: ... # type: ignore[overload-overlap] +def outer(x1: ToBool_1d, x2: ToBool_1d, /) -> Array_2d[np.bool]: ... @overload -def outer(x1: ToIntP_1d, x2: CoIntP_1d, /) -> Array_2d[np.intp]: ... # type: ignore[overload-overlap] +def outer(x1: ToIntP_1d, x2: CoIntP_1d, /) -> Array_2d[np.intp]: ... @overload -def outer(x1: CoIntP_1d, x2: ToIntP_1d, /) -> Array_2d[np.intp]: ... # type: ignore[overload-overlap] +def outer(x1: CoIntP_1d, x2: ToIntP_1d, /) -> Array_2d[np.intp]: ... @overload -def outer(x1: ToFloat64_1d, x2: CoFloat64_1d, /) -> Array_2d[np.float64]: ... # type: ignore[overload-overlap] +def outer(x1: ToFloat64_1d, x2: CoFloat64_1d, /) -> Array_2d[np.float64]: ... @overload -def outer(x1: CoFloat64_1d, x2: ToFloat64_1d, /) -> Array_2d[np.float64]: ... # type: ignore[overload-overlap] +def outer(x1: CoFloat64_1d, x2: ToFloat64_1d, /) -> Array_2d[np.float64]: ... @overload -def outer(x1: ToComplex128_1d, x2: CoComplex128_1d, /) -> Array_2d[np.complex128]: ... # type: ignore[overload-overlap] +def outer(x1: ToComplex128_1d, x2: CoComplex128_1d, /) -> Array_2d[np.complex128]: ... @overload -def outer(x1: CoComplex128_1d, x2: ToComplex128_1d, /) -> Array_2d[np.complex128]: ... # type: ignore[overload-overlap] +def outer(x1: CoComplex128_1d, x2: ToComplex128_1d, /) -> Array_2d[np.complex128]: ... @overload -def outer(x1: ToTimeDelta_1d, x2: CoTimeDelta_1d, /) -> Array_2d[np.timedelta64]: ... # type: ignore[overload-overlap] +def outer(x1: ToTimeDelta_1d, x2: CoTimeDelta_1d, /) -> Array_2d[np.timedelta64]: ... @overload -def outer(x1: CoTimeDelta_1d, x2: ToTimeDelta_1d, /) -> Array_2d[np.timedelta64]: ... # type: ignore[overload-overlap] +def outer(x1: CoTimeDelta_1d, x2: ToTimeDelta_1d, /) -> Array_2d[np.timedelta64]: ... @overload -def outer(x1: ToFloat32_1d, x2: ToFloat32_1d, /) -> Array_2d[np.float32]: ... # type: ignore[overload-overlap] +def outer(x1: ToFloat32_1d, x2: ToFloat32_1d, /) -> Array_2d[np.float32]: ... @overload -def outer(x1: ToComplex64_1d, x2: ToComplex64_1d, /) -> Array_2d[np.complex64]: ... # type: ignore[overload-overlap] +def outer(x1: ToComplex64_1d, x2: ToComplex64_1d, /) -> Array_2d[np.complex64]: ... @overload def outer(x1: ToObject_1d, x2: ToObject_1d, /) -> Array_2d[np.object_]: ... @overload @@ -434,9 +437,9 @@ def outer(x1: ToNumber_1d, x2: ToNumber_1d, /) -> Array_2d[Any]: ... # @overload -def multi_dot(arrays: Iterable[_ToArray_1ds[_AnyNumberT]], *, out: None = None) -> _AnyNumberT: ... # type: ignore[overload-overlap] +def multi_dot(arrays: Iterable[_ToArray1_1ds[_AnyNumberT]], *, out: None = None) -> _AnyNumberT: ... # type: ignore[overload-overlap] @overload -def multi_dot(arrays: Iterable[_ToArray_2nd[_AnyNumberT]], *, out: None = None) -> Array[_AnyNumberT]: ... # type: ignore[overload-overlap] +def multi_dot(arrays: Iterable[_ToArray1_2nd[_AnyNumberT]], *, out: None = None) -> Array[_AnyNumberT]: ... @overload def multi_dot(arrays: Iterable[Sequence[bool]], *, out: None = None) -> np.bool: ... @overload @@ -461,8 +464,8 @@ def multi_dot(arrays: Iterable[CoComplex_1nd | ToTimeDelta_1nd | ToObject_1nd], # pyright false positive in case of typevar constraints @overload def cross( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] - x1: _ToArray_1nd[_AnyNumberT], - x2: _ToArray_1nd[_AnyNumberT], + x1: _ToArray1_1nd[_AnyNumberT], + x2: _ToArray1_1nd[_AnyNumberT], /, *, axis: int = -1, @@ -498,11 +501,11 @@ def cross(x1: CoComplex_1nd, x2: CoComplex_1nd, /, *, axis: int = -1) -> Array[A # pyright false positive in case of typevar constraints @overload -def matmul(x1: _ToArray_1ds[_AnyNumberT], x2: _ToArray_1ds[_AnyNumberT], /) -> _AnyNumberT: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _ToArray1_1ds[_AnyNumberT], x2: _ToArray1_1ds[_AnyNumberT], /) -> _AnyNumberT: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload -def matmul(x1: _ToArray_2nd[_AnyNumberT], x2: _ToArray_1nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _ToArray1_2nd[_AnyNumberT], x2: _ToArray1_1nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload -def matmul(x1: _ToArray_1nd[_AnyNumberT], x2: _ToArray_2nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _ToArray1_1nd[_AnyNumberT], x2: _ToArray1_2nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload def matmul(x1: ToBool_1ds, x2: ToBool_1ds, /) -> np.bool: ... # type: ignore[overload-overlap] @overload @@ -566,9 +569,9 @@ def matmul(x1: CoComplex_1nd, x2: CoComplex_1nd, /) -> Any: ... # @overload # float64 -def eig(a: _ToFloat64_1nd) -> EigResult[np.float64] | EigResult[np.complex128]: ... # type: ignore[overload-overlap] +def eig(a: _ToFloat64_1nd) -> EigResult[np.float64] | EigResult[np.complex128]: ... @overload # complex128 -def eig(a: ToComplex128_1nd) -> EigResult[np.complex128]: ... # type: ignore[overload-overlap] +def eig(a: ToComplex128_1nd) -> EigResult[np.complex128]: ... @overload # complex64 def eig(a: ToComplex64_1nd) -> EigResult[np.complex64]: ... @overload # float32 @@ -578,9 +581,9 @@ def eig(a: CoComplex128_1nd) -> EigResult: ... # @overload # float64 -def eigvals(a: _ToFloat64_1nd) -> Array[np.float64] | Array[np.complex128]: ... # type: ignore[overload-overlap] +def eigvals(a: _ToFloat64_1nd) -> Array[np.float64] | Array[np.complex128]: ... @overload # complex128 -def eigvals(a: ToComplex128_1nd) -> Array[np.complex128]: ... # type: ignore[overload-overlap] +def eigvals(a: ToComplex128_1nd) -> Array[np.complex128]: ... @overload # complex64 def eigvals(a: ToComplex64_1nd) -> Array[np.complex64]: ... @overload # float32 @@ -590,11 +593,11 @@ def eigvals(a: CoComplex128_1nd) -> Array[np.inexact]: ... # @overload # float64 -def eigh(a: _ToFloat64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.float64]: ... # type: ignore[overload-overlap] +def eigh(a: _ToFloat64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.float64]: ... @overload # complex128 -def eigh(a: ToComplex128_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.complex128]: ... # type: ignore[overload-overlap] +def eigh(a: ToComplex128_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.complex128]: ... @overload # float32 -def eigh(a: ToFloat32_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.float32]: ... # type: ignore[overload-overlap] +def eigh(a: ToFloat32_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.float32]: ... @overload # complex64 def eigh(a: ToComplex64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.complex64]: ... @overload # +complex128 @@ -610,23 +613,23 @@ def eigvalsh(a: CoComplex128_1nd, UPLO: _UPLO = "L") -> Array[np.floating]: ... # @overload # float64, reduced|complete -def qr(a: _ToFloat64_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float64]: ... # type: ignore[overload-overlap] +def qr(a: _ToFloat64_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float64]: ... @overload # float64, raw -def qr(a: _ToFloat64_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float64]]: ... # type: ignore[overload-overlap] +def qr(a: _ToFloat64_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float64]]: ... @overload # float64, r -def qr(a: _ToFloat64_1nd, mode: L["r"]) -> _Array_2nd[np.float64]: ... # type: ignore[overload-overlap] +def qr(a: _ToFloat64_1nd, mode: L["r"]) -> _Array_2nd[np.float64]: ... @overload # complex128, reduced|complete -def qr(a: ToComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex128]: ... # type: ignore[overload-overlap] +def qr(a: ToComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex128]: ... @overload # complex128, raw -def qr(a: ToComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex128]]: ... # type: ignore[overload-overlap] +def qr(a: ToComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex128]]: ... @overload # complex128, r -def qr(a: ToComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.complex128]: ... # type: ignore[overload-overlap] +def qr(a: ToComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.complex128]: ... @overload # float32, reduced|complete -def qr(a: ToFloat32_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float32]: ... # type: ignore[overload-overlap] +def qr(a: ToFloat32_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float32]: ... @overload # float32, raw -def qr(a: ToFloat32_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float32]]: ... # type: ignore[overload-overlap] +def qr(a: ToFloat32_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float32]]: ... @overload # float32, r -def qr(a: ToFloat32_1nd, mode: L["r"]) -> _Array_2nd[np.float32]: ... # type: ignore[overload-overlap] +def qr(a: ToFloat32_1nd, mode: L["r"]) -> _Array_2nd[np.float32]: ... @overload # complex64, reduced|complete def qr(a: ToComplex64_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex64]: ... @overload # complex64, raw @@ -657,21 +660,21 @@ def svd( hermitian: bool = False, ) -> Array[np.float64]: ... @overload # float64, compute_uv=True -def svd( # type: ignore[overload-overlap] +def svd( a: _ToFloat64_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, ) -> SVDResult[np.float64, np.float64]: ... @overload # complex128, compute_uv=True -def svd( # type: ignore[overload-overlap] +def svd( a: ToComplex128_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, ) -> SVDResult[np.float64, np.complex128]: ... @overload # float32, compute_uv=True -def svd( # type: ignore[overload-overlap] +def svd( a: ToFloat32_1nd, full_matrices: bool = True, compute_uv: _True = True, @@ -790,9 +793,9 @@ def slogdet(a: ToComplex128_2ds) -> SlogdetResult[np.float64, np.complex128]: .. @overload # 2d complex64 def slogdet(a: ToComplex64_2ds) -> SlogdetResult[np.float32, np.complex64]: ... # type: ignore[overload-overlap] @overload # >2d float64 -def slogdet(a: _ToFloat64_3nd) -> SlogdetResult[Array[np.float64], Array[np.float64]]: ... # type: ignore[overload-overlap] +def slogdet(a: _ToFloat64_3nd) -> SlogdetResult[Array[np.float64], Array[np.float64]]: ... @overload # >2d float32 -def slogdet(a: ToFloat32_3nd) -> SlogdetResult[Array[np.float32], Array[np.float32]]: ... # type: ignore[overload-overlap] +def slogdet(a: ToFloat32_3nd) -> SlogdetResult[Array[np.float32], Array[np.float32]]: ... @overload # >2d complex128 def slogdet(a: ToComplex128_3nd) -> SlogdetResult[Array[np.float64], Array[np.complex128]]: ... @overload # >2d complex64 @@ -810,9 +813,9 @@ def det(a: ToComplex128_2ds) -> np.complex128: ... # type: ignore[overload-over @overload # 2d complex64 def det(a: ToComplex64_2ds) -> np.complex64: ... # type: ignore[overload-overlap] @overload # >2d float64 -def det(a: _ToFloat64_3nd) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def det(a: _ToFloat64_3nd) -> Array[np.float64]: ... @overload # >2d float32 -def det(a: ToFloat32_3nd) -> Array[np.float32]: ... # type: ignore[overload-overlap] +def det(a: ToFloat32_3nd) -> Array[np.float32]: ... @overload # >2d complex128 def det(a: ToComplex128_3nd) -> Array[np.complex128]: ... @overload # >2d complex64 @@ -822,11 +825,11 @@ def det(a: CoComplex128_1nd) -> Any: ... # @overload # float64, +float64 -def lstsq(a: _ToFloat64_1nd, b: CoFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... # type: ignore[overload-overlap] +def lstsq(a: _ToFloat64_1nd, b: CoFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... @overload # +float64, float64 -def lstsq(a: CoFloat64_1nd, b: _ToFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... # type: ignore[overload-overlap] +def lstsq(a: CoFloat64_1nd, b: _ToFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... @overload # float32, float32 -def lstsq(a: ToFloat32_1nd, b: ToFloat32_1nd, rcond: float | None = None) -> _LstSqResult[np.float32, np.float32]: ... # type: ignore[overload-overlap] +def lstsq(a: ToFloat32_1nd, b: ToFloat32_1nd, rcond: float | None = None) -> _LstSqResult[np.float32, np.float32]: ... @overload # complex128, +complex128 def lstsq( # type: ignore[overload-overlap] a: ToComplex128_1nd, @@ -839,12 +842,18 @@ def lstsq( # type: ignore[overload-overlap] b: ToComplex128_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex128, np.float64]: ... -@overload # complex64, complex64 +@overload # complex64, +complex64 def lstsq( a: ToComplex64_1nd, b: CoComplex64_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex64, np.float32]: ... +@overload # +complex64, complex64 +def lstsq( + a: CoComplex64_1nd, + b: ToComplex64_1nd, + rcond: float | None = None, +) -> _LstSqResult[np.complex64, np.float32]: ... @overload # +complex128, +complex128 def lstsq( a: CoComplex128_1nd, @@ -884,9 +893,9 @@ def norm( x: _ToInexactLD_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.longdouble]: ... @overload # longdouble | clongdouble, axis= (positional) -def norm(x: _ToInexactLD_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.longdouble]: ... # type: ignore[overload-overlap] +def norm(x: _ToInexactLD_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.longdouble]: ... @overload # longdouble | clongdouble, axis= (keyword) -def norm(x: _ToInexactLD_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.longdouble]: ... # type: ignore[overload-overlap] +def norm(x: _ToInexactLD_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.longdouble]: ... @overload # +number, axis=None, keepdims=False def norm(x: CoComplex_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.floating: ... @overload # +number, keepdims=True @@ -970,7 +979,7 @@ def vector_norm(x: CoComplex_1nd, /, *, axis: _Ax2 | None = None, keepdims: bool @overload def diagonal(x: Sequence_2nd[ToObject_0d], /, *, offset: CanIndex = 0) -> Array[np.object_]: ... @overload -def diagonal(x: _ToArray_2ds[_ScalarT], /, *, offset: CanIndex = 0) -> Array[_ScalarT, tuple[int]]: ... +def diagonal(x: _ToArray1_2ds[_ScalarT], /, *, offset: CanIndex = 0) -> Array[_ScalarT, tuple[int]]: ... @overload def diagonal(x: _ToArray_2nd_ish[_ScalarT], /, *, offset: CanIndex = 0) -> Array[_ScalarT]: ... @overload @@ -990,9 +999,9 @@ def diagonal(x: ToGeneric_1nd, /, *, offset: CanIndex = 0) -> Array[Any]: ... # @overload -def trace(x: _ToArray_2ds[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> _ScalarT: ... # type: ignore[overload-overlap] +def trace(x: _ToArray1_2ds[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> _ScalarT: ... # type: ignore[overload-overlap] @overload -def trace(x: _ToArray_3nd[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[_ScalarT]: ... # type: ignore[overload-overlap] +def trace(x: _ToArray1_3nd[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[_ScalarT]: ... @overload def trace(x: Sequence_2d[bool], /, *, offset: CanIndex = 0, dtype: None = None) -> np.bool: ... @overload diff --git a/test/static/accept/linalg.pyi b/test/static/accept/linalg.pyi index 8e601042..729c88de 100644 --- a/test/static/accept/linalg.pyi +++ b/test/static/accept/linalg.pyi @@ -111,7 +111,7 @@ assert_type( np.linalg.slogdet([[[1.0]]]), SlogdetResult[npt.NDArray[np.float64], npt.NDArray[np.float64]], ) -assert_type( +assert_type( # type: ignore[assert-type] # mypy bug? np.linalg.slogdet([[[1j]]]), SlogdetResult[npt.NDArray[np.float64], npt.NDArray[np.complex128]], ) diff --git a/test/static/reject/linalg.pyi b/test/static/reject/linalg.pyi index fd5bdf5f..4dd6f4c3 100644 --- a/test/static/reject/linalg.pyi +++ b/test/static/reject/linalg.pyi @@ -39,4 +39,4 @@ np.linalg.slogdet(AR_O) # type: ignore[arg-type] # pyright: ignore[reportCallI np.linalg.norm(AR_f8, ord="bob") # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType] -np.linalg.multi_dot([AR_M]) # type: ignore[arg-type] # pyright: ignore[reportCallIssue,reportArgumentType] +np.linalg.multi_dot([AR_M]) # type: ignore[list-item] # pyright: ignore[reportCallIssue,reportArgumentType]