diff --git a/pyproject.toml b/pyproject.toml index 2d5a17d1..2be27767 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,18 +88,18 @@ pythonVersion = "3.10" typeCheckingMode = "standard" # TODO(jorenham): set to "all" deprecateTypingAliases = true -enableReachabilityAnalysis = false enableTypeIgnoreComments = false +enableReachabilityAnalysis = false reportCallInDefaultInitializer = true reportImportCycles = true +reportImplicitOverride = false # TODO reportMissingSuperCall = false reportPrivateUsage = false reportPropertyTypeMismatch = false reportShadowedImports = true reportUninitializedInstanceVariable = true reportUnnecessaryTypeIgnoreComment = true -# TODO -reportImplicitOverride = false +reportUnusedExpression = false # basedpyright only failOnWarnings = true reportIgnoreCommentWithoutRule = true @@ -108,7 +108,7 @@ reportImplicitRelativeImport = true reportImplicitStringConcatenation = false reportInvalidCast = true reportPrivateLocalImportUsage = true -reportUnannotatedClassAttribute = true +reportUnannotatedClassAttribute = false # TODO strictGenericNarrowing = true @@ -132,6 +132,7 @@ preview = true "EM", # flake8-errmsg "FIX", # flake8-fixme "ANN401", # flake8-annotations: any-type + "PYI041", # flake8-pyi: redundant-numeric-union ] [tool.ruff.lint.per-file-ignores] diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index 86da7c2e..f2a38ada 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -27,7 +27,7 @@ from typing import ( runtime_checkable, type_check_only, ) -from typing_extensions import CapsuleType, LiteralString, Never, Protocol, Self, TypeVar, deprecated +from typing_extensions import CapsuleType, LiteralString, Never, Protocol, Self, TypeVar, Unpack, deprecated from uuid import UUID import numpy as np @@ -649,23 +649,23 @@ _FlexDType = TypeVar("_FlexDType", bound=dtype[flexible]) _ArrayT = TypeVar("_ArrayT", bound=NDArray[Any]) _ArrayT_co = TypeVar("_ArrayT_co", bound=NDArray[Any], covariant=True) -_IntegralArrayT = TypeVar("_IntegralArrayT", bound=NDArray[integer[Any] | np.bool | object_]) -_RealArrayT = TypeVar("_RealArrayT", bound=NDArray[floating[Any] | integer[Any] | timedelta64 | np.bool | object_]) -_NumericArrayT = TypeVar("_NumericArrayT", bound=NDArray[number[Any] | timedelta64 | object_]) +_IntegralArrayT = TypeVar("_IntegralArrayT", bound=NDArray[integer | np.bool | object_]) +_RealArrayT = TypeVar("_RealArrayT", bound=NDArray[floating | integer | timedelta64 | np.bool | object_]) +_NumericArrayT = TypeVar("_NumericArrayT", bound=NDArray[number | timedelta64 | object_]) _ShapeT = TypeVar("_ShapeT", bound=_Shape) _ShapeT_co = TypeVar("_ShapeT_co", bound=_Shape, covariant=True) _1DShapeT = TypeVar("_1DShapeT", bound=_1D) _2DShapeT_co = TypeVar("_2DShapeT_co", bound=_2D, covariant=True) -_1NShapeT = TypeVar("_1NShapeT", bound=tuple[L[1], *tuple[L[1], ...]]) # (1,) | (1, 1) | (1, 1, 1) | ... +_1NShapeT = TypeVar("_1NShapeT", bound=tuple[L[1], Unpack[tuple[L[1], ...]]]) # (1,) | (1, 1) | (1, 1, 1) | ... _SCT = TypeVar("_SCT", bound=generic) _SCT_co = TypeVar("_SCT_co", bound=generic, covariant=True) -_NumberT = TypeVar("_NumberT", bound=number[Any]) +_NumberT = TypeVar("_NumberT", bound=number) _RealNumberT = TypeVar("_RealNumberT", bound=floating | integer) -_FloatingT_co = TypeVar("_FloatingT_co", bound=floating[Any], default=floating[Any], covariant=True) +_FloatingT_co = TypeVar("_FloatingT_co", bound=floating, default=floating, covariant=True) _IntegerT = TypeVar("_IntegerT", bound=integer) -_IntegerT_co = TypeVar("_IntegerT_co", bound=integer[Any], default=integer[Any], covariant=True) +_IntegerT_co = TypeVar("_IntegerT_co", bound=integer, default=integer, covariant=True) _NBit = TypeVar("_NBit", bound=NBitBase, default=Any) _NBit1 = TypeVar("_NBit1", bound=NBitBase, default=Any) @@ -689,6 +689,85 @@ _TD64UnitT = TypeVar("_TD64UnitT", bound=_TD64Unit, default=_TD64Unit) # Type Aliases (for internal use only) +_SubModule: TypeAlias = L[ + "char", + "core", + "ctypeslib", + "dtypes", + "exceptions", + "f2py", + "fft", + "lib", + "linalg", + "ma", + "polynomial", + "random", + "rec", + "strings", + "test", + "testing", + "typing", +] +_ExpiredAttribute: TypeAlias = L[ + "DataSource", + "Inf", + "Infinity", + "NINF", + "NZERO", + "NaN", + "PINF", + "PZERO", + "add_docstring", + "add_newdoc", + "add_newdoc_ufunc", + "alltrue", + "asfarray", + "byte_bounds", + "cast", + "cfloat", + "clongfloat", + "compare_chararrays", + "compat", + "complex_", + "deprecate", + "deprecate_with_doc", + "disp", + "fastCopyAndTranspose", + "find_common_type", + "float_", + "format_parser", + "get_array_wrap", + "geterrobj", + "infty", + "issctype", + "issubclass_", + "issubsctype", + "longcomplex", + "longfloat", + "lookfor", + "mat", + "maximum_sctype", + "nbytes", + "obj2sctype", + "recfromcsv", + "recfromtxt", + "round_", + "safe_eval", + "sctype2char", + "sctypes", + "set_numeric_ops", + "set_string_function", + "seterrobj", + "singlecomplex", + "sometrue", + "source", + "string_", + "tracemalloc_domain", + "unicode_", + "who", +] +_FutureScalar: TypeAlias = L["bytes", "str", "object"] + _Falsy: TypeAlias = L[False, 0] | np.bool[L[False]] _Truthy: TypeAlias = L[True, 1] | np.bool[L[True]] @@ -1024,25 +1103,27 @@ class _IntegralMixin(_RealMixin): # Public API -__version__: Final[LiteralString] = ... +__version__: Final = "2.2.2" + +newaxis: Final = None +inf: Final = float("inf") # noqa: PYI015 +nan: Final = float("nan") # noqa: PYI015 +pi: Final = 3.141592653589793 # noqa: FURB152 +e: Final = 2.718281828459045 # noqa: FURB152 +euler_gamma: Final = 0.5772156649015329 -e: Final[float] = ... -euler_gamma: Final[float] = ... -pi: Final[float] = ... -inf: Final[float] = ... -nan: Final[float] = ... -little_endian: Final[builtins.bool] = ... False_: Final[np.bool[L[False]]] = ... True_: Final[np.bool[L[True]]] = ... -newaxis: Final[None] = None + +little_endian: Final[builtins.bool] = ... # not in __all__ -__NUMPY_SETUP__: Final[L[False]] = False -__numpy_submodules__: Final[set[LiteralString]] = ... -__expired_attributes__: Final[dict[LiteralString, LiteralString]] +__NUMPY_SETUP__: Final = False +__numpy_submodules__: Final[set[_SubModule]] = ... +__expired_attributes__: Final[dict[_ExpiredAttribute, LiteralString]] __former_attrs__: Final[_FormerAttrsDict] = ... -__future_scalars__: Final[set[L["bytes", "str", "object"]]] = ... -__array_api_version__: Final[L["2023.12"]] = "2023.12" +__future_scalars__: Final[set[_FutureScalar]] = ... +__array_api_version__: Final = "2023.12" test: Final[PytestTester] = ... @final @@ -1527,7 +1608,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[unsignedinteger[Any]]: ... + ) -> dtype[unsignedinteger]: ... @overload def __new__( cls, @@ -1535,7 +1616,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[signedinteger[Any]]: ... + ) -> dtype[signedinteger]: ... @overload def __new__( cls, @@ -1543,7 +1624,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[integer[Any]]: ... + ) -> dtype[integer]: ... @overload def __new__( cls, @@ -1551,7 +1632,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[floating[Any]]: ... + ) -> dtype[floating]: ... @overload def __new__( cls, @@ -1559,7 +1640,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[complexfloating[Any, Any]]: ... + ) -> dtype[complexfloating]: ... @overload def __new__( cls, @@ -1567,7 +1648,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[inexact[Any]]: ... + ) -> dtype[inexact]: ... @overload def __new__( cls, @@ -1575,7 +1656,7 @@ class dtype(Generic[_SCT_co]): align: builtins.bool = ..., copy: builtins.bool = ..., metadata: dict[str, Any] = ..., - ) -> dtype[number[Any]]: ... + ) -> dtype[number]: ... @overload def __new__( cls, @@ -1715,7 +1796,7 @@ class flatiter(Generic[_ArrayT_co]): @overload def __getitem__( self: flatiter[NDArray[_SCT]], - key: int | integer[Any] | tuple[int | integer[Any]], + key: int | integer | tuple[int | integer], /, ) -> _SCT: ... @overload @@ -2364,38 +2445,26 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def dot(self, b: _ScalarLike_co, out: None = ...) -> NDArray[Any]: ... @overload - def dot(self, b: ArrayLike, out: None = ...) -> Any: ... # type: ignore[misc] + def dot(self, b: ArrayLike, out: None = ...) -> Any: ... @overload def dot(self, b: ArrayLike, out: _ArrayT) -> _ArrayT: ... # `nonzero()` is deprecated for 0d arrays/generics def nonzero(self) -> tuple[NDArray[intp], ...]: ... - def partition( - self, - kth: _ArrayLikeInt_co, - axis: SupportsIndex = ..., - kind: _PartitionKind = ..., - order: str | Sequence[str] | None = ..., - ) -> None: ... - # `put` is technically available to `generic`, - # but is pointless as `generic`s are immutable + # def put(self, ind: _ArrayLikeInt_co, v: ArrayLike, mode: _ModeKind = ...) -> None: ... - @overload - def searchsorted( # type: ignore[misc] - self, # >= 1D array - v: _ScalarLike_co, # 0D array-like - side: _SortSide = ..., - sorter: _ArrayLikeInt_co | None = ..., - ) -> intp: ... - @overload - def searchsorted( - self, # >= 1D array - v: ArrayLike, - side: _SortSide = ..., - sorter: _ArrayLikeInt_co | None = ..., - ) -> NDArray[intp]: ... + + # def setfield(self, val: ArrayLike, dtype: DTypeLike, offset: SupportsIndex = ...) -> None: ... + + # + @overload + def searchsorted(self, v: _ScalarLike_co, side: _SortSide = ..., sorter: _ArrayLikeInt_co | None = ...) -> intp: ... + @overload + def searchsorted(self, v: ArrayLike, side: _SortSide = ..., sorter: _ArrayLikeInt_co | None = ...) -> NDArray[intp]: ... + + # def sort( self, axis: SupportsIndex = ..., @@ -2404,6 +2473,17 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): *, stable: bool | None = ..., ) -> None: ... + + # + def partition( + self, + kth: _ArrayLikeInt_co, + axis: SupportsIndex = ..., + kind: _PartitionKind = ..., + order: str | Sequence[str] | None = ..., + ) -> None: ... + + # @overload def trace( self, # >= 2D array @@ -2535,6 +2615,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): order: _OrderACF = "C", copy: builtins.bool | None = None, ) -> ndarray[_Shape, _DType_co]: ... + + # @overload def astype( self, @@ -2553,6 +2635,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): subok: builtins.bool = ..., copy: builtins.bool | _CopyMode = ..., ) -> ndarray[_ShapeT_co, dtype[Any]]: ... + + # @overload def view(self) -> Self: ... @overload @@ -2562,21 +2646,25 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def view(self, dtype: DTypeLike) -> NDArray[Any]: ... @overload - def view( - self, - dtype: DTypeLike, - type: type[_ArrayT], - ) -> _ArrayT: ... + def view(self, dtype: DTypeLike, type: type[_ArrayT]) -> _ArrayT: ... + + # @overload def getfield(self, dtype: _DTypeLike[_SCT], offset: SupportsIndex = ...) -> NDArray[_SCT]: ... @overload def getfield(self, dtype: DTypeLike, offset: SupportsIndex = ...) -> NDArray[Any]: ... - def __index__(self: NDArray[np.integer[Any]], /) -> int: ... - def __int__(self: NDArray[number[Any] | np.timedelta64 | np.bool | object_], /) -> int: ... - def __float__(self: NDArray[number[Any] | np.timedelta64 | np.bool | object_], /) -> float: ... - def __complex__(self: NDArray[number[Any] | np.bool | object_], /) -> complex: ... + + # + def __index__(self: NDArray[np.integer], /) -> int: ... + def __int__(self: NDArray[number | np.timedelta64 | np.bool | object_], /) -> int: ... + def __float__(self: NDArray[number | np.timedelta64 | np.bool | object_], /) -> float: ... + def __complex__(self: NDArray[number | np.bool | object_], /) -> complex: ... + + # def __len__(self) -> int: ... def __contains__(self, value: object, /) -> builtins.bool: ... + + # @overload # == 1-d & object_ def __iter__(self: ndarray[tuple[int], dtype[object_]], /) -> Iterator[Any]: ... @overload # == 1-d @@ -2601,7 +2689,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __lt__(self: NDArray[object_], other: Any, /) -> NDArray[np.bool]: ... @overload - def __lt__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + def __lt__(self, other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + + # @overload def __le__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co, /) -> NDArray[np.bool]: ... @overload @@ -2611,7 +2701,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __le__(self: NDArray[object_], other: Any, /) -> NDArray[np.bool]: ... @overload - def __le__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + def __le__(self, other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + + # @overload def __gt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co, /) -> NDArray[np.bool]: ... @overload @@ -2621,7 +2713,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __gt__(self: NDArray[object_], other: Any, /) -> NDArray[np.bool]: ... @overload - def __gt__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + def __gt__(self, other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + + # @overload def __ge__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co, /) -> NDArray[np.bool]: ... @overload @@ -2631,16 +2725,19 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __ge__(self: NDArray[object_], other: Any, /) -> NDArray[np.bool]: ... @overload - def __ge__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... + def __ge__(self, other: _ArrayLikeObject_co, /) -> NDArray[np.bool]: ... # Unary ops @overload def __abs__( - self: ndarray[_ShapeT, dtype[complexfloating[_AnyNBitInexact]]], / + self: ndarray[_ShapeT, dtype[complexfloating[_AnyNBitInexact]]], + /, ) -> ndarray[_ShapeT, dtype[floating[_AnyNBitInexact]]]: ... @overload def __abs__(self: _RealArrayT, /) -> _RealArrayT: ... + + # def __invert__(self: _IntegralArrayT, /) -> _IntegralArrayT: ... # noqa: PYI019 def __neg__(self: _NumericArrayT, /) -> _NumericArrayT: ... # noqa: PYI019 def __pos__(self: _NumericArrayT, /) -> _NumericArrayT: ... # noqa: PYI019 @@ -2675,7 +2772,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __matmul__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __matmul__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __matmul__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload # signature equivalent to __matmul__ def __rmatmul__(self: NDArray[_NumberT], other: _ArrayLikeBool_co, /) -> NDArray[_NumberT]: ... @overload @@ -2691,19 +2790,21 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rmatmul__(self: _ArrayComplex128_co, other: _ArrayLike[complexfloating[_64Bit]], /) -> NDArray[complex128]: ... @overload - def __rmatmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[overload-overlap] + def __rmatmul__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rmatmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... # type: ignore[overload-overlap] + def __rmatmul__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... # type: ignore[overload-overlap] @overload - def __rmatmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating[Any]]: ... # type: ignore[overload-overlap] + def __rmatmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating]: ... # type: ignore[overload-overlap] @overload - def __rmatmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating[Any, Any]]: ... + def __rmatmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ... @overload - def __rmatmul__(self: NDArray[number], other: _ArrayLikeNumber_co, /) -> NDArray[number[Any]]: ... + def __rmatmul__(self: NDArray[number], other: _ArrayLikeNumber_co, /) -> NDArray[number]: ... @overload def __rmatmul__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rmatmul__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rmatmul__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __mod__(self: NDArray[_RealNumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_RealNumberT]]: ... @overload @@ -2727,7 +2828,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __mod__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __mod__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __mod__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload # signature equivalent to __mod__ def __rmod__(self: NDArray[_RealNumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_RealNumberT]]: ... @overload @@ -2751,7 +2854,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rmod__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rmod__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rmod__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __divmod__(self: NDArray[_RealNumberT], rhs: int | np.bool, /) -> _2Tuple[ndarray[_ShapeT_co, dtype[_RealNumberT]]]: ... @overload @@ -2772,8 +2877,12 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def __divmod__(self: _ArrayFloat_co, rhs: _ArrayLikeFloat_co, /) -> _2Tuple[NDArray[floating]]: ... @overload def __divmod__( - self: NDArray[timedelta64], rhs: _ArrayLike[timedelta64], / + self: NDArray[timedelta64], + rhs: _ArrayLike[timedelta64], + /, ) -> tuple[NDArray[int64], NDArray[timedelta64]]: ... + + # @overload # signature equivalent to __divmod__ def __rdivmod__(self: NDArray[_RealNumberT], lhs: int | np.bool, /) -> _2Tuple[ndarray[_ShapeT_co, dtype[_RealNumberT]]]: ... @overload @@ -2794,8 +2903,12 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): def __rdivmod__(self: _ArrayFloat_co, lhs: _ArrayLikeFloat_co, /) -> _2Tuple[NDArray[floating]]: ... @overload def __rdivmod__( - self: NDArray[timedelta64], lhs: _ArrayLike[timedelta64], / + self: NDArray[timedelta64], + lhs: _ArrayLike[timedelta64], + /, ) -> tuple[NDArray[int64], NDArray[timedelta64]]: ... + + # @overload def __add__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2831,7 +2944,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __add__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __add__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __add__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload # signature equivalent to __add__ def __radd__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2867,7 +2982,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __radd__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __radd__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __radd__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __sub__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2903,7 +3020,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __sub__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __sub__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __sub__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __rsub__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2939,7 +3058,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rsub__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rsub__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rsub__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __mul__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2963,7 +3084,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __mul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating]: ... # type: ignore[overload-overlap] @overload - def __mul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ... # type: ignore[overload-overlap] + def __mul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ... @overload def __mul__(self: NDArray[number], other: _ArrayLikeNumber_co, /) -> NDArray[number]: ... @overload @@ -2973,7 +3094,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __mul__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __mul__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __mul__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload # signature equivalent to __mul__ def __rmul__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -2997,7 +3120,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rmul__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating]: ... # type: ignore[overload-overlap] @overload - def __rmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ... # type: ignore[overload-overlap] + def __rmul__(self: _ArrayComplex_co, other: _ArrayLikeComplex_co, /) -> NDArray[complexfloating]: ... @overload def __rmul__(self: NDArray[number], other: _ArrayLikeNumber_co, /) -> NDArray[number]: ... @overload @@ -3007,7 +3130,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rmul__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rmul__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rmul__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __truediv__(self: _ArrayInt_co, other: _ArrayLikeFloat64_co, /) -> NDArray[float64]: ... @overload @@ -3037,7 +3162,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __truediv__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __truediv__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __truediv__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __rtruediv__(self: _ArrayInt_co, other: _ArrayLikeFloat64_co, /) -> NDArray[float64]: ... @overload @@ -3065,7 +3192,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rtruediv__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rtruediv__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rtruediv__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __floordiv__(self: NDArray[_RealNumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_RealNumberT]]: ... @overload @@ -3091,9 +3220,11 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __floordiv__(self: NDArray[timedelta64], other: _ArrayLikeFloat_co, /) -> NDArray[timedelta64]: ... @overload - def __floordiv__(self: NDArray[object_], other: Any, /) -> Any: ... + def __floordiv__(self: NDArray[object_], other: object, /) -> Any: ... @overload - def __floordiv__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __floordiv__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __rfloordiv__(self: NDArray[_RealNumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_RealNumberT]]: ... @overload @@ -3111,7 +3242,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rfloordiv__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... # type: ignore[overload-overlap] @overload - def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating]: ... # type: ignore[overload-overlap] + def __rfloordiv__(self: _ArrayFloat_co, other: _ArrayLikeFloat_co, /) -> NDArray[floating]: ... @overload def __rfloordiv__(self: NDArray[timedelta64], other: _ArrayLike[timedelta64], /) -> NDArray[int64]: ... @overload @@ -3119,7 +3250,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rfloordiv__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rfloordiv__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rfloordiv__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __pow__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -3149,7 +3282,9 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __pow__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __pow__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __pow__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload def __rpow__(self: NDArray[_NumberT], other: int | np.bool, /) -> ndarray[_ShapeT_co, dtype[_NumberT]]: ... @overload @@ -3179,107 +3314,127 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __rpow__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rpow__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rpow__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __lshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... # type: ignore[misc] + def __lshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... @overload - def __lshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __lshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __lshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __lshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __lshift__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __lshift__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __lshift__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __rlshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... # type: ignore[misc] + def __rlshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... @overload - def __rlshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rlshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rlshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __rlshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __rlshift__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rlshift__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rlshift__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __rshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... # type: ignore[misc] + def __rshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... @overload - def __rshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __rshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __rshift__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rshift__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rshift__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __rrshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... # type: ignore[misc] + def __rrshift__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[int8]: ... @overload - def __rrshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rrshift__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rrshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __rrshift__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __rrshift__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rrshift__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rrshift__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __and__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __and__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __and__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __and__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __and__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __and__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __and__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __and__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __and__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __rand__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __rand__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __rand__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rand__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rand__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __rand__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __rand__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rand__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rand__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __xor__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __xor__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __xor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __xor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __xor__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __xor__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __xor__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __xor__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __xor__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __rxor__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __rxor__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __rxor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __rxor__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __rxor__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __rxor__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __rxor__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __rxor__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __rxor__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __or__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __or__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __or__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __or__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __or__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __or__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __or__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __or__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __or__(self, other: _ArrayLikeObject_co, /) -> Any: ... + + # @overload - def __ror__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... # type: ignore[misc] + def __ror__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> NDArray[np.bool]: ... @overload - def __ror__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger[Any]]: ... # type: ignore[misc] + def __ror__(self: _ArrayUInt_co, other: _ArrayLikeUInt_co, /) -> NDArray[unsignedinteger]: ... # type: ignore[overload-overlap] @overload - def __ror__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger[Any]]: ... + def __ror__(self: _ArrayInt_co, other: _ArrayLikeInt_co, /) -> NDArray[signedinteger]: ... @overload def __ror__(self: NDArray[object_], other: Any, /) -> Any: ... @overload - def __ror__(self: NDArray[Any], other: _ArrayLikeObject_co, /) -> Any: ... + def __ror__(self, other: _ArrayLikeObject_co, /) -> Any: ... # `np.generic` does not support inplace operations @@ -3292,141 +3447,125 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): @overload def __iadd__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iadd__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iadd__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iadd__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iadd__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iadd__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iadd__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iadd__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iadd__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iadd__(self: NDArray[complexfloating[Any]], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iadd__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iadd__(self: NDArray[timedelta64], other: _ArrayLikeTD64_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iadd__(self: NDArray[datetime64], other: _ArrayLikeTD64_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iadd__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload - def __isub__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __isub__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __isub__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __isub__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __isub__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __isub__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __isub__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __isub__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __isub__(self: NDArray[complexfloating[Any]], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __isub__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __isub__(self: NDArray[timedelta64], other: _ArrayLikeTD64_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __isub__(self: NDArray[datetime64], other: _ArrayLikeTD64_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __isub__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __imul__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imul__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imul__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imul__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imul__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imul__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imul__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imul__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imul__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imul__(self: NDArray[complexfloating[Any]], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imul__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imul__(self: NDArray[timedelta64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imul__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __itruediv__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __itruediv__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __itruediv__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __itruediv__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __itruediv__( - self: NDArray[complexfloating[Any]], - other: _ArrayLikeComplex_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __itruediv__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __itruediv__(self: NDArray[timedelta64], other: _ArrayLikeInt, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __itruediv__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __ifloordiv__( - self: NDArray[unsignedinteger[Any]], + self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /, ) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ifloordiv__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ifloordiv__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ifloordiv__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ifloordiv__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ifloordiv__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ifloordiv__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ifloordiv__( - self: NDArray[complexfloating[Any]], - other: _ArrayLikeComplex_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ifloordiv__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ifloordiv__(self: NDArray[timedelta64], other: _ArrayLikeInt, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ifloordiv__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload - def __ipow__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ipow__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ipow__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ipow__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ipow__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ipow__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ipow__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ipow__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ipow__(self: NDArray[complexfloating[Any]], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ipow__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ipow__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload - def __imod__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imod__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imod__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imod__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imod__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imod__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imod__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imod__( self: NDArray[timedelta64], @@ -3435,80 +3574,82 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): ) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imod__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __ilshift__( - self: NDArray[unsignedinteger[Any]], + self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /, ) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ilshift__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ilshift__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ilshift__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __irshift__( - self: NDArray[unsignedinteger[Any]], + self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /, ) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __irshift__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __irshift__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __irshift__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __iand__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iand__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iand__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __iand__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __iand__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __iand__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __ixor__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ixor__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ixor__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ixor__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ixor__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ixor__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __ior__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ior__( - self: NDArray[unsignedinteger[Any]], - other: _ArrayLikeUInt_co | _IntLike_co, - /, - ) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ior__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co | _IntLike_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __ior__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __ior__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __ior__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # @overload def __imatmul__(self: NDArray[np.bool], other: _ArrayLikeBool_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imatmul__(self: NDArray[unsignedinteger[Any]], other: _ArrayLikeUInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imatmul__(self: NDArray[unsignedinteger], other: _ArrayLikeUInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imatmul__(self: NDArray[signedinteger[Any]], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imatmul__(self: NDArray[signedinteger], other: _ArrayLikeInt_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imatmul__(self: NDArray[float64], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imatmul__(self: NDArray[floating[Any]], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imatmul__(self: NDArray[floating], other: _ArrayLikeFloat_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imatmul__(self: NDArray[complex128], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload - def __imatmul__(self: NDArray[complexfloating[Any]], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... + def __imatmul__(self: NDArray[complexfloating], other: _ArrayLikeComplex_co, /) -> ndarray[_ShapeT_co, _DType_co]: ... @overload def __imatmul__(self: NDArray[object_], other: Any, /) -> ndarray[_ShapeT_co, _DType_co]: ... + + # def __dlpack__( - self: NDArray[number[Any]], + self: NDArray[number], /, *, stream: int | Any | None = None, @@ -3531,11 +3672,17 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]): class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): @abc.abstractmethod def __init__(self, *args: Any, **kwargs: Any) -> None: ... + + # def __hash__(self) -> int: ... + + # @overload def __array__(self, dtype: None = None, /) -> ndarray[tuple[()], dtype[Self]]: ... @overload def __array__(self, dtype: _DType, /) -> ndarray[tuple[()], _DType]: ... + + # if sys.version_info >= (3, 12): def __buffer__(self, flags: int, /) -> memoryview: ... @@ -3551,12 +3698,20 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): def strides(self) -> tuple[()]: ... @property def flat(self) -> flatiter[ndarray[tuple[int], dtype[Self]]]: ... + + # @overload def item(self, /) -> _ItemT_co: ... @overload def item(self, arg0: L[0, -1] | tuple[L[0, -1]] | tuple[()] = ..., /) -> _ItemT_co: ... + + # def tolist(self, /) -> _ItemT_co: ... + + # def byteswap(self, inplace: L[False] = ...) -> Self: ... + + # @overload def astype( self, @@ -3581,23 +3736,19 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): @overload def view(self, type: type[NDArray[Any]] = ...) -> Self: ... @overload - def view( - self, - dtype: _DTypeLike[_SCT], - type: type[NDArray[Any]] = ..., - ) -> _SCT: ... + def view(self, dtype: _DTypeLike[_SCT], type: type[NDArray[Any]] = ...) -> _SCT: ... @overload - def view( - self, - dtype: DTypeLike, - type: type[NDArray[Any]] = ..., - ) -> Any: ... + def view(self, dtype: DTypeLike, type: type[NDArray[Any]] = ...) -> Any: ... + + # @overload def getfield(self, dtype: _DTypeLike[_SCT], offset: SupportsIndex = ...) -> _SCT: ... @overload def getfield(self, dtype: DTypeLike, offset: SupportsIndex = ...) -> Any: ... + + # @overload - def take( # type: ignore[misc] + def take( self, indices: _IntLike_co, axis: SupportsIndex | None = ..., @@ -3605,7 +3756,7 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): mode: _ModeKind = ..., ) -> Self: ... @overload - def take( # type: ignore[misc] + def take( self, indices: _ArrayLikeInt_co, axis: SupportsIndex | None = ..., @@ -3620,9 +3771,17 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): out: _ArrayT = ..., mode: _ModeKind = ..., ) -> _ArrayT: ... + + # def repeat(self, repeats: _ArrayLikeInt_co, axis: SupportsIndex | None = ...) -> NDArray[Self]: ... + + # def flatten(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], dtype[Self]]: ... def ravel(self, /, order: _OrderKACF = "C") -> ndarray[tuple[int], dtype[Self]]: ... + def squeeze(self, axis: L[0] | tuple[()] | None = ...) -> Self: ... + def transpose(self, axes: tuple[()] | None = ..., /) -> Self: ... + + # @overload # (() | []) def reshape( self, @@ -3705,8 +3864,8 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): order: _OrderACF = "C", copy: builtins.bool | None = None, ) -> ndarray[tuple[L[1], L[1], L[1], L[1], L[1], *tuple[L[1], ...]], dtype[Self]]: ... - def squeeze(self, axis: L[0] | tuple[()] | None = ...) -> Self: ... - def transpose(self, axes: tuple[()] | None = ..., /) -> Self: ... + + # @overload def all( self, @@ -3775,7 +3934,11 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]): class number(generic[_NumberItemT_co], Generic[_NBit, _NumberItemT_co]): @abc.abstractmethod def __init__(self, value: _NumberItemT_co, /) -> None: ... + + # def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + + # def __neg__(self) -> Self: ... def __pos__(self) -> Self: ... def __abs__(self) -> Self: ... @@ -3807,6 +3970,8 @@ class bool(generic[_BoolItemT_co], Generic[_BoolItemT_co]): def real(self) -> Self: ... @property def imag(self) -> np.bool[L[False]]: ... + + # @overload def __init__(self: np.bool[L[False]], /) -> None: ... @overload @@ -3815,16 +3980,26 @@ class bool(generic[_BoolItemT_co], Generic[_BoolItemT_co]): def __init__(self: np.bool[L[True]], value: _Truthy, /) -> None: ... @overload def __init__(self, value: object, /) -> None: ... + + # def __bool__(self, /) -> _BoolItemT_co: ... + + # @overload def __int__(self: np.bool[L[False]], /) -> L[0]: ... @overload def __int__(self: np.bool[L[True]], /) -> L[1]: ... @overload def __int__(self, /) -> L[0, 1]: ... + + # @deprecated("In future, it will be an error for 'np.bool' scalars to be interpreted as an index") def __index__(self, /) -> L[0, 1]: ... + + # def __abs__(self) -> Self: ... + + # @overload def __invert__(self: np.bool[L[False]], /) -> np.bool[L[True]]: ... @overload @@ -3923,6 +4098,8 @@ class object_(_RealMixin, generic): def __new__(cls, value: _T, /) -> _T: ... # type: ignore[misc] @overload # catch-all def __new__(cls, value: Any = ..., /) -> object | NDArray[Self]: ... # type: ignore[misc] + + # def __init__(self, value: object = ..., /) -> None: ... if sys.version_info >= (3, 12): @@ -3935,49 +4112,74 @@ class integer(_IntegralMixin, _RoundMixin, number[_NBit, int]): # NOTE: `bit_count` and `__index__` are technically defined in the concrete subtypes def bit_count(self, /) -> int: ... def __index__(self, /) -> int: ... - def __invert__(self, /) -> Self: ... + # __truediv__: _IntTrueDiv[_NBit] __rtruediv__: _IntTrueDiv[_NBit] - def __mod__(self, value: _IntLike_co, /) -> integer[Any]: ... - def __rmod__(self, value: _IntLike_co, /) -> integer[Any]: ... - # Ensure that objects annotated as `integer` support bit-wise operations - def __lshift__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __rlshift__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __rshift__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __rrshift__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __and__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __rand__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __or__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __ror__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __xor__(self, other: _IntLike_co, /) -> integer[Any]: ... - def __rxor__(self, other: _IntLike_co, /) -> integer[Any]: ... + + # + def __mod__(self, value: _IntLike_co, /) -> integer: ... + def __rmod__(self, value: _IntLike_co, /) -> integer: ... + + # + def __invert__(self, /) -> Self: ... + + # + def __lshift__(self, other: _IntLike_co, /) -> integer: ... + def __rlshift__(self, other: _IntLike_co, /) -> integer: ... + + # + def __rshift__(self, other: _IntLike_co, /) -> integer: ... + def __rrshift__(self, other: _IntLike_co, /) -> integer: ... + + # + def __and__(self, other: _IntLike_co, /) -> integer: ... + def __rand__(self, other: _IntLike_co, /) -> integer: ... + + # + def __or__(self, other: _IntLike_co, /) -> integer: ... + def __ror__(self, other: _IntLike_co, /) -> integer: ... + + # + def __xor__(self, other: _IntLike_co, /) -> integer: ... + def __rxor__(self, other: _IntLike_co, /) -> integer: ... class signedinteger(integer[_NBit1]): def __init__(self, value: _ConvertibleToInt = ..., /) -> None: ... __add__: _SignedIntOp[_NBit1] __radd__: _SignedIntOp[_NBit1] + __sub__: _SignedIntOp[_NBit1] __rsub__: _SignedIntOp[_NBit1] + __mul__: _SignedIntOp[_NBit1] __rmul__: _SignedIntOp[_NBit1] + __floordiv__: _SignedIntOp[_NBit1] __rfloordiv__: _SignedIntOp[_NBit1] + __pow__: _SignedIntOp[_NBit1] __rpow__: _SignedIntOp[_NBit1] + __lshift__: _SignedIntBitOp[_NBit1] __rlshift__: _SignedIntBitOp[_NBit1] + __rshift__: _SignedIntBitOp[_NBit1] __rrshift__: _SignedIntBitOp[_NBit1] + __and__: _SignedIntBitOp[_NBit1] __rand__: _SignedIntBitOp[_NBit1] + __xor__: _SignedIntBitOp[_NBit1] __rxor__: _SignedIntBitOp[_NBit1] + __or__: _SignedIntBitOp[_NBit1] __ror__: _SignedIntBitOp[_NBit1] + __mod__: _SignedIntMod[_NBit1] __rmod__: _SignedIntMod[_NBit1] + __divmod__: _SignedIntDivMod[_NBit1] __rdivmod__: _SignedIntDivMod[_NBit1] @@ -4079,7 +4281,11 @@ class float64(floating[_64Bit], float): # type: ignore[misc] def real(self) -> Self: ... @property def imag(self) -> Self: ... + + # def conjugate(self) -> Self: ... + + # def __getformat__(self, typestr: L["double", "float"], /) -> str: ... def __getnewargs__(self, /) -> tuple[float]: ... @@ -4087,101 +4293,127 @@ class float64(floating[_64Bit], float): # type: ignore[misc] @overload def __add__(self, other: _Float64_co, /) -> float64: ... @overload - def __add__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __add__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __add__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __add__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __radd__(self, other: _Float64_co, /) -> float64: ... @overload - def __radd__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __radd__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __radd__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __radd__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __sub__(self, other: _Float64_co, /) -> float64: ... @overload - def __sub__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __sub__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __sub__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __sub__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __rsub__(self, other: _Float64_co, /) -> float64: ... @overload - def __rsub__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __rsub__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __rsub__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __rsub__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __mul__(self, other: _Float64_co, /) -> float64: ... @overload - def __mul__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __mul__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __mul__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __mul__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __rmul__(self, other: _Float64_co, /) -> float64: ... @overload - def __rmul__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __rmul__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __rmul__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __rmul__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __truediv__(self, other: _Float64_co, /) -> float64: ... @overload - def __truediv__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __truediv__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __truediv__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __truediv__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __rtruediv__(self, other: _Float64_co, /) -> float64: ... @overload - def __rtruediv__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __rtruediv__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __rtruediv__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __rtruediv__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __floordiv__(self, other: _Float64_co, /) -> float64: ... @overload - def __floordiv__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __floordiv__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __floordiv__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __floordiv__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __rfloordiv__(self, other: _Float64_co, /) -> float64: ... @overload - def __rfloordiv__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __rfloordiv__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __rfloordiv__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __rfloordiv__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __pow__(self, other: _Float64_co, /) -> float64: ... @overload - def __pow__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __pow__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __pow__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __pow__(self, other: complex, /) -> float64 | complex128: ... + + # @overload def __rpow__(self, other: _Float64_co, /) -> float64: ... @overload - def __rpow__(self, other: complexfloating[_64Bit, _64Bit], /) -> complex128: ... + def __rpow__(self, other: complexfloating[_64Bit], /) -> complex128: ... @overload def __rpow__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... @overload def __rpow__(self, other: complex, /) -> float64 | complex128: ... + + # def __mod__(self, other: _Float64_co, /) -> float64: ... # type: ignore[override] def __rmod__(self, other: _Float64_co, /) -> float64: ... # type: ignore[override] + + # def __divmod__(self, other: _Float64_co, /) -> _2Tuple[float64]: ... # type: ignore[override] def __rdivmod__(self, other: _Float64_co, /) -> _2Tuple[float64]: ... # type: ignore[override] @@ -4195,84 +4427,108 @@ longdouble: TypeAlias = floating[_NBitLongDouble] # describing the two 64 bit floats representing its real and imaginary component class complexfloating(inexact[_NBit1, complex], Generic[_NBit1, _NBit2]): - def __init__(self, value: _ConvertibleToComplex | None = ..., /) -> None: ... @property - def real(self) -> floating[_NBit1]: ... # type: ignore[override] + def real(self) -> floating[_NBit1]: ... @property - def imag(self) -> floating[_NBit2]: ... # type: ignore[override] + def imag(self) -> floating[_NBit2]: ... + + # + def __init__(self, value: _ConvertibleToComplex | None = ..., /) -> None: ... # NOTE: `__complex__` is technically defined in the concrete subtypes def __complex__(self, /) -> complex: ... + + # def __abs__(self, /) -> floating[_NBit1 | _NBit2]: ... # type: ignore[override] + + # @deprecated( "The Python built-in `round` is deprecated for complex scalars, and will raise a `TypeError` in a future release. " "Use `np.round` or `scalar.round` instead." ) def __round__(self, /, ndigits: SupportsIndex | None = None) -> Self: ... + + # @overload def __add__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __add__(self, other: complex | float64 | complex128, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __add__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __add__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __radd__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __radd__(self, other: complex, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __radd__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __radd__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __sub__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __sub__(self, other: complex | float64 | complex128, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __sub__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __sub__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __rsub__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __rsub__(self, other: complex, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __rsub__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __rsub__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __mul__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __mul__(self, other: complex | float64 | complex128, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __mul__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __mul__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __rmul__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __rmul__(self, other: complex, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __rmul__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __rmul__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __truediv__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __truediv__(self, other: complex | float64 | complex128, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __truediv__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __truediv__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __rtruediv__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __rtruediv__(self, other: complex, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __rtruediv__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __rtruediv__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __pow__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __pow__(self, other: complex | float64 | complex128, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __pow__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... + def __pow__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... + + # @overload def __rpow__(self, other: _Complex64_co, /) -> complexfloating[_NBit1, _NBit2]: ... @overload def __rpow__(self, other: complex, /) -> complexfloating[_NBit1, _NBit2] | complex128: ... @overload - def __rpow__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit, _NBit]: ... - -complex64: TypeAlias = complexfloating[_32Bit, _32Bit] + def __rpow__(self, other: number[_NBit], /) -> complexfloating[_NBit1, _NBit2] | complexfloating[_NBit]: ... -class complex128(complexfloating[_64Bit, _64Bit], complex): # type: ignore[misc] +class complex128(complexfloating[_64Bit], complex): # type: ignore[misc] @property def itemsize(self) -> L[16]: ... @property @@ -4283,46 +4539,64 @@ class complex128(complexfloating[_64Bit, _64Bit], complex): # type: ignore[misc def real(self) -> float64: ... @property def imag(self) -> float64: ... + + # def conjugate(self) -> Self: ... + + # def __abs__(self) -> float64: ... # type: ignore[override] + # def __getnewargs__(self, /) -> tuple[float, float]: ... # complex128-specific operator overrides @overload - def __add__(self, other: _Complex128_co, /) -> complex128: ... + def __add__(self, rhs: _Complex128_co, /) -> complex128: ... @overload - def __add__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... - def __radd__(self, other: _Complex128_co, /) -> complex128: ... + def __add__(self, rhs: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... + + # @overload - def __sub__(self, other: _Complex128_co, /) -> complex128: ... + def __sub__(self, rhs: _Complex128_co, /) -> complex128: ... @overload - def __sub__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... - def __rsub__(self, other: _Complex128_co, /) -> complex128: ... + def __sub__(self, rhs: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... + + # @overload - def __mul__(self, other: _Complex128_co, /) -> complex128: ... + def __mul__(self, rhs: _Complex128_co, /) -> complex128: ... @overload - def __mul__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... - def __rmul__(self, other: _Complex128_co, /) -> complex128: ... + def __mul__(self, rhs: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... + + # @overload - def __truediv__(self, other: _Complex128_co, /) -> complex128: ... + def __truediv__(self, rhs: _Complex128_co, /) -> complex128: ... @overload - def __truediv__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... - def __rtruediv__(self, other: _Complex128_co, /) -> complex128: ... + def __truediv__(self, rhs: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... + + # @overload - def __pow__(self, other: _Complex128_co, /) -> complex128: ... + def __pow__(self, rhs: _Complex128_co, /) -> complex128: ... @overload - def __pow__(self, other: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... - def __rpow__(self, other: _Complex128_co, /) -> complex128: ... + def __pow__(self, rhs: complexfloating[_NBit1, _NBit2], /) -> complexfloating[_NBit1 | _64Bit, _NBit2 | _64Bit]: ... + + # + def __radd__(self, lhs: _Complex128_co, /) -> complex128: ... + def __rsub__(self, lhs: _Complex128_co, /) -> complex128: ... + def __rmul__(self, lhs: _Complex128_co, /) -> complex128: ... + def __rtruediv__(self, lhs: _Complex128_co, /) -> complex128: ... + def __rpow__(self, lhs: _Complex128_co, /) -> complex128: ... -csingle: TypeAlias = complexfloating[_NBitSingle, _NBitSingle] -cdouble: TypeAlias = complexfloating[_NBitDouble, _NBitDouble] -clongdouble: TypeAlias = complexfloating[_NBitLongDouble, _NBitLongDouble] +complex64: TypeAlias = complexfloating[_32Bit] +csingle: TypeAlias = complexfloating[_NBitSingle] +cdouble: TypeAlias = complexfloating[_NBitDouble] +clongdouble: TypeAlias = complexfloating[_NBitLongDouble] class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co]): @property def itemsize(self) -> L[8]: ... @property def nbytes(self) -> L[8]: ... + + # @overload def __init__(self, value: _TD64ItemT_co | timedelta64[_TD64ItemT_co], /) -> None: ... @overload @@ -4347,9 +4621,13 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] # to builtin scalar types: `Y`, `M`, `ns`, `ps`, `fs`, `as` def __int__(self: timedelta64[int], /) -> int: ... def __float__(self: timedelta64[int], /) -> float: ... + + # def __neg__(self, /) -> Self: ... def __pos__(self, /) -> Self: ... def __abs__(self, /) -> Self: ... + + # @overload def __add__(self: timedelta64[None], x: _TD64Like_co, /) -> timedelta64[None]: ... @overload @@ -4365,11 +4643,11 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] __radd__ = __add__ @overload - def __mul__(self: timedelta64[_AnyTD64Item], x: int | np.integer[Any] | np.bool, /) -> timedelta64[_AnyTD64Item]: ... + def __mul__(self: timedelta64[_AnyTD64Item], x: int | np.integer | np.bool, /) -> timedelta64[_AnyTD64Item]: ... @overload - def __mul__(self: timedelta64[_AnyTD64Item], x: float | np.floating[Any], /) -> timedelta64[_AnyTD64Item | None]: ... + def __mul__(self: timedelta64[_AnyTD64Item], x: float | np.floating, /) -> timedelta64[_AnyTD64Item | None]: ... @overload - def __mul__(self, x: float | np.floating[Any] | np.integer[Any] | np.bool, /) -> timedelta64: ... + def __mul__(self, x: float | np.floating | np.integer | np.bool, /) -> timedelta64: ... __rmul__ = __mul__ @overload @@ -4408,6 +4686,8 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] def __sub__(self: timedelta64[_AnyTD64Item], b: timedelta64[_AnyTD64Item] | _IntLike_co, /) -> timedelta64[_AnyTD64Item]: ... @overload def __sub__(self, b: timedelta64[None], /) -> timedelta64[None]: ... + + # @overload def __rsub__(self: timedelta64[None], a: _TD64Like_co, /) -> timedelta64[None]: ... @overload @@ -4420,6 +4700,8 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] def __rsub__(self, a: timedelta64[None], /) -> timedelta64[None]: ... @overload def __rsub__(self, a: datetime64[None], /) -> datetime64[None]: ... + + # @overload def __truediv__(self: timedelta64[dt.timedelta], b: dt.timedelta, /) -> float: ... @overload @@ -4428,12 +4710,16 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] def __truediv__(self: timedelta64[_AnyTD64Item], b: int | integer, /) -> timedelta64[_AnyTD64Item]: ... @overload def __truediv__(self: timedelta64[_AnyTD64Item], b: float | floating, /) -> timedelta64[_AnyTD64Item | None]: ... + + # @overload def __truediv__(self, b: float | floating | integer, /) -> timedelta64: ... @overload def __rtruediv__(self: timedelta64[dt.timedelta], a: dt.timedelta, /) -> float: ... @overload def __rtruediv__(self, a: timedelta64, /) -> float64: ... + + # @overload def __floordiv__(self: timedelta64[dt.timedelta], b: dt.timedelta, /) -> int: ... @overload @@ -4442,6 +4728,8 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co] def __floordiv__(self: timedelta64[_AnyTD64Item], b: int | integer, /) -> timedelta64[_AnyTD64Item]: ... @overload def __floordiv__(self: timedelta64[_AnyTD64Item], b: float | floating, /) -> timedelta64[_AnyTD64Item | None]: ... + + # @overload def __rfloordiv__(self: timedelta64[dt.timedelta], a: dt.timedelta, /) -> int: ... @overload @@ -4457,6 +4745,8 @@ class datetime64(_RealMixin, generic[_DT64ItemT_co], Generic[_DT64ItemT_co]): def itemsize(self) -> L[8]: ... @property def nbytes(self) -> L[8]: ... + + # @overload def __init__(self, value: datetime64[_DT64ItemT_co], /) -> None: ... @overload @@ -4471,14 +4761,19 @@ class datetime64(_RealMixin, generic[_DT64ItemT_co], Generic[_DT64ItemT_co]): def __init__(self: datetime64[int], value: int | bytes | str | dt.date, format: _TimeUnitSpec[_IntTimeUnit], /) -> None: ... @overload def __init__( - self: datetime64[dt.datetime], value: int | bytes | str | dt.date, format: _TimeUnitSpec[_NativeTimeUnit], / + self: datetime64[dt.datetime], + value: int | bytes | str | dt.date, + format: _TimeUnitSpec[_NativeTimeUnit], + /, ) -> None: ... @overload def __init__(self: datetime64[dt.date], value: int | bytes | str | dt.date, format: _TimeUnitSpec[_DateUnit], /) -> None: ... @overload def __init__(self, value: bytes | str | dt.date | None, format: _TimeUnitSpec = ..., /) -> None: ... + + # @overload - def __add__(self: datetime64[_AnyDT64Item], x: int | integer[Any] | np.bool, /) -> datetime64[_AnyDT64Item]: ... + def __add__(self: datetime64[_AnyDT64Item], x: int | integer | np.bool, /) -> datetime64[_AnyDT64Item]: ... @overload def __add__(self: datetime64[None], x: _TD64Like_co, /) -> datetime64[None]: ... @overload @@ -4496,7 +4791,7 @@ class datetime64(_RealMixin, generic[_DT64ItemT_co], Generic[_DT64ItemT_co]): __radd__ = __add__ @overload - def __sub__(self: datetime64[_AnyDT64Item], x: int | integer[Any] | np.bool, /) -> datetime64[_AnyDT64Item]: ... + def __sub__(self: datetime64[_AnyDT64Item], x: int | integer | np.bool, /) -> datetime64[_AnyDT64Item]: ... @overload def __sub__(self: datetime64[_AnyDate], x: _AnyDate, /) -> dt.timedelta: ... @overload @@ -4527,8 +4822,10 @@ class datetime64(_RealMixin, generic[_DT64ItemT_co], Generic[_DT64ItemT_co]): def __sub__(self, x: _TD64Like_co, /) -> datetime64: ... @overload def __sub__(self, x: datetime64, /) -> timedelta64: ... + + # @overload - def __rsub__(self: datetime64[_AnyDT64Item], x: int | integer[Any] | np.bool, /) -> datetime64[_AnyDT64Item]: ... + def __rsub__(self: datetime64[_AnyDT64Item], x: int | integer | np.bool, /) -> datetime64[_AnyDT64Item]: ... @overload def __rsub__(self: datetime64[_AnyDate], x: _AnyDate, /) -> dt.timedelta: ... @overload @@ -4556,11 +4853,17 @@ class void(flexible[bytes | tuple[Any, ...]]): def __init__(self, value: _IntLike_co | bytes, /, dtype: None = None) -> None: ... @overload def __init__(self, value: Any, /, dtype: _DTypeLikeVoid) -> None: ... + + # @overload def __getitem__(self, key: str | SupportsIndex, /) -> Any: ... @overload def __getitem__(self, key: list[str], /) -> void: ... + + # def __setitem__(self, key: str | list[str] | SupportsIndex, value: ArrayLike, /) -> None: ... + + # def setfield(self, val: ArrayLike, dtype: DTypeLike, offset: int = ...) -> None: ... class character(flexible[_CharacterItemT_co], Generic[_CharacterItemT_co]): @@ -4574,6 +4877,8 @@ class bytes_(character[bytes], bytes): def __init__(self, value: object = ..., /) -> None: ... @overload def __init__(self, value: str, /, encoding: str = ..., errors: str = ...) -> None: ... + + # def __bytes__(self, /) -> bytes: ... class str_(character[str], str): @@ -4591,6 +4896,8 @@ class ufunc: def __qualname__(self) -> LiteralString: ... @property def __doc__(self) -> str: ... + + # @property def nin(self) -> int: ... @property @@ -4601,144 +4908,133 @@ class ufunc: def ntypes(self) -> int: ... @property def types(self) -> list[LiteralString]: ... - # Broad return type because it has to encompass things like - # - # >>> np.logical_and.identity is True - # True - # >>> np.add.identity is 0 - # True - # >>> np.sin.identity is None - # True - # - # and any user-defined ufuncs. @property def identity(self) -> Any: ... - # This is None for ufuncs and a string for gufuncs. @property def signature(self) -> LiteralString | None: ... + + # def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - # The next four methods will always exist, but they will just - # raise a ValueError ufuncs with that don't accept two input - # arguments and return one output argument. Because of that we - # can't type them very precisely. + + # def reduce(self, /, *args: Any, **kwargs: Any) -> Any: ... def accumulate(self, /, *args: Any, **kwargs: Any) -> NDArray[Any]: ... def reduceat(self, /, *args: Any, **kwargs: Any) -> NDArray[Any]: ... def outer(self, *args: Any, **kwargs: Any) -> Any: ... - # Similarly at won't be defined for ufuncs that return multiple - # outputs, so we can't type it very precisely. + + # def at(self, /, *args: Any, **kwargs: Any) -> None: ... # Parameters: `__name__`, `ntypes` and `identity` -absolute: _UFunc_Nin1_Nout1[L["absolute"], L[20], None] -add: _UFunc_Nin2_Nout1[L["add"], L[22], L[0]] -arccos: _UFunc_Nin1_Nout1[L["arccos"], L[8], None] -arccosh: _UFunc_Nin1_Nout1[L["arccosh"], L[8], None] -arcsin: _UFunc_Nin1_Nout1[L["arcsin"], L[8], None] -arcsinh: _UFunc_Nin1_Nout1[L["arcsinh"], L[8], None] -arctan2: _UFunc_Nin2_Nout1[L["arctan2"], L[5], None] -arctan: _UFunc_Nin1_Nout1[L["arctan"], L[8], None] -arctanh: _UFunc_Nin1_Nout1[L["arctanh"], L[8], None] -bitwise_and: _UFunc_Nin2_Nout1[L["bitwise_and"], L[12], L[-1]] -bitwise_count: _UFunc_Nin1_Nout1[L["bitwise_count"], L[11], None] -bitwise_not: _UFunc_Nin1_Nout1[L["invert"], L[12], None] -bitwise_or: _UFunc_Nin2_Nout1[L["bitwise_or"], L[12], L[0]] -bitwise_xor: _UFunc_Nin2_Nout1[L["bitwise_xor"], L[12], L[0]] -cbrt: _UFunc_Nin1_Nout1[L["cbrt"], L[5], None] -ceil: _UFunc_Nin1_Nout1[L["ceil"], L[7], None] -conj: _UFunc_Nin1_Nout1[L["conjugate"], L[18], None] -conjugate: _UFunc_Nin1_Nout1[L["conjugate"], L[18], None] -copysign: _UFunc_Nin2_Nout1[L["copysign"], L[4], None] -cos: _UFunc_Nin1_Nout1[L["cos"], L[9], None] -cosh: _UFunc_Nin1_Nout1[L["cosh"], L[8], None] -deg2rad: _UFunc_Nin1_Nout1[L["deg2rad"], L[5], None] -degrees: _UFunc_Nin1_Nout1[L["degrees"], L[5], None] -divide: _UFunc_Nin2_Nout1[L["true_divide"], L[11], None] -divmod: _UFunc_Nin2_Nout2[L["divmod"], L[15], None] -equal: _UFunc_Nin2_Nout1[L["equal"], L[23], None] -exp2: _UFunc_Nin1_Nout1[L["exp2"], L[8], None] -exp: _UFunc_Nin1_Nout1[L["exp"], L[10], None] -expm1: _UFunc_Nin1_Nout1[L["expm1"], L[8], None] -fabs: _UFunc_Nin1_Nout1[L["fabs"], L[5], None] -float_power: _UFunc_Nin2_Nout1[L["float_power"], L[4], None] -floor: _UFunc_Nin1_Nout1[L["floor"], L[7], None] -floor_divide: _UFunc_Nin2_Nout1[L["floor_divide"], L[21], None] -fmax: _UFunc_Nin2_Nout1[L["fmax"], L[21], None] -fmin: _UFunc_Nin2_Nout1[L["fmin"], L[21], None] -fmod: _UFunc_Nin2_Nout1[L["fmod"], L[15], None] -frexp: _UFunc_Nin1_Nout2[L["frexp"], L[4], None] -gcd: _UFunc_Nin2_Nout1[L["gcd"], L[11], L[0]] -greater: _UFunc_Nin2_Nout1[L["greater"], L[23], None] -greater_equal: _UFunc_Nin2_Nout1[L["greater_equal"], L[23], None] -heaviside: _UFunc_Nin2_Nout1[L["heaviside"], L[4], None] -hypot: _UFunc_Nin2_Nout1[L["hypot"], L[5], L[0]] -invert: _UFunc_Nin1_Nout1[L["invert"], L[12], None] -isfinite: _UFunc_Nin1_Nout1[L["isfinite"], L[20], None] -isinf: _UFunc_Nin1_Nout1[L["isinf"], L[20], None] -isnan: _UFunc_Nin1_Nout1[L["isnan"], L[20], None] -isnat: _UFunc_Nin1_Nout1[L["isnat"], L[2], None] -lcm: _UFunc_Nin2_Nout1[L["lcm"], L[11], None] -ldexp: _UFunc_Nin2_Nout1[L["ldexp"], L[8], None] -left_shift: _UFunc_Nin2_Nout1[L["left_shift"], L[11], None] -less: _UFunc_Nin2_Nout1[L["less"], L[23], None] -less_equal: _UFunc_Nin2_Nout1[L["less_equal"], L[23], None] -log10: _UFunc_Nin1_Nout1[L["log10"], L[8], None] -log1p: _UFunc_Nin1_Nout1[L["log1p"], L[8], None] -log2: _UFunc_Nin1_Nout1[L["log2"], L[8], None] -log: _UFunc_Nin1_Nout1[L["log"], L[10], None] -logaddexp2: _UFunc_Nin2_Nout1[L["logaddexp2"], L[4], float] -logaddexp: _UFunc_Nin2_Nout1[L["logaddexp"], L[4], float] -logical_and: _UFunc_Nin2_Nout1[L["logical_and"], L[20], L[True]] -logical_not: _UFunc_Nin1_Nout1[L["logical_not"], L[20], None] -logical_or: _UFunc_Nin2_Nout1[L["logical_or"], L[20], L[False]] -logical_xor: _UFunc_Nin2_Nout1[L["logical_xor"], L[19], L[False]] -matmul: _GUFunc_Nin2_Nout1[L["matmul"], L[19], None, L["(n?,k),(k,m?)->(n?,m?)"]] -matvec: _GUFunc_Nin2_Nout1[L["matvec"], L[19], None, L["(m,n),(n)->(m)"]] -maximum: _UFunc_Nin2_Nout1[L["maximum"], L[21], None] -minimum: _UFunc_Nin2_Nout1[L["minimum"], L[21], None] -mod: _UFunc_Nin2_Nout1[L["remainder"], L[16], None] -modf: _UFunc_Nin1_Nout2[L["modf"], L[4], None] -multiply: _UFunc_Nin2_Nout1[L["multiply"], L[23], L[1]] -negative: _UFunc_Nin1_Nout1[L["negative"], L[19], None] -nextafter: _UFunc_Nin2_Nout1[L["nextafter"], L[4], None] -not_equal: _UFunc_Nin2_Nout1[L["not_equal"], L[23], None] -positive: _UFunc_Nin1_Nout1[L["positive"], L[19], None] -power: _UFunc_Nin2_Nout1[L["power"], L[18], None] -rad2deg: _UFunc_Nin1_Nout1[L["rad2deg"], L[5], None] -radians: _UFunc_Nin1_Nout1[L["radians"], L[5], None] -reciprocal: _UFunc_Nin1_Nout1[L["reciprocal"], L[18], None] -remainder: _UFunc_Nin2_Nout1[L["remainder"], L[16], None] -right_shift: _UFunc_Nin2_Nout1[L["right_shift"], L[11], None] -rint: _UFunc_Nin1_Nout1[L["rint"], L[10], None] -sign: _UFunc_Nin1_Nout1[L["sign"], L[19], None] -signbit: _UFunc_Nin1_Nout1[L["signbit"], L[4], None] -sin: _UFunc_Nin1_Nout1[L["sin"], L[9], None] -sinh: _UFunc_Nin1_Nout1[L["sinh"], L[8], None] -spacing: _UFunc_Nin1_Nout1[L["spacing"], L[4], None] -sqrt: _UFunc_Nin1_Nout1[L["sqrt"], L[10], None] -square: _UFunc_Nin1_Nout1[L["square"], L[18], None] -subtract: _UFunc_Nin2_Nout1[L["subtract"], L[21], None] -tan: _UFunc_Nin1_Nout1[L["tan"], L[8], None] -tanh: _UFunc_Nin1_Nout1[L["tanh"], L[8], None] -true_divide: _UFunc_Nin2_Nout1[L["true_divide"], L[11], None] -trunc: _UFunc_Nin1_Nout1[L["trunc"], L[7], None] -vecdot: _GUFunc_Nin2_Nout1[L["vecdot"], L[19], None, L["(n),(n)->()"]] -vecmat: _GUFunc_Nin2_Nout1[L["vecmat"], L[19], None, L["(n),(n,m)->(m)"]] - -abs = absolute -acos = arccos -acosh = arccosh -asin = arcsin -asinh = arcsinh -atan = arctan -atanh = arctanh -atan2 = arctan2 -concat = concatenate -bitwise_left_shift = left_shift -bitwise_invert = invert -bitwise_right_shift = right_shift -permute_dims = transpose -pow = power +absolute: Final[_UFunc_Nin1_Nout1[L["absolute"], L[20], None]] = ... +add: Final[_UFunc_Nin2_Nout1[L["add"], L[22], L[0]]] = ... +arccos: Final[_UFunc_Nin1_Nout1[L["arccos"], L[8], None]] = ... +arccosh: Final[_UFunc_Nin1_Nout1[L["arccosh"], L[8], None]] = ... +arcsin: Final[_UFunc_Nin1_Nout1[L["arcsin"], L[8], None]] = ... +arcsinh: Final[_UFunc_Nin1_Nout1[L["arcsinh"], L[8], None]] = ... +arctan2: Final[_UFunc_Nin2_Nout1[L["arctan2"], L[5], None]] = ... +arctan: Final[_UFunc_Nin1_Nout1[L["arctan"], L[8], None]] = ... +arctanh: Final[_UFunc_Nin1_Nout1[L["arctanh"], L[8], None]] = ... +bitwise_and: Final[_UFunc_Nin2_Nout1[L["bitwise_and"], L[12], L[-1]]] = ... +bitwise_count: Final[_UFunc_Nin1_Nout1[L["bitwise_count"], L[11], None]] = ... +bitwise_not: Final[_UFunc_Nin1_Nout1[L["invert"], L[12], None]] = ... +bitwise_or: Final[_UFunc_Nin2_Nout1[L["bitwise_or"], L[12], L[0]]] = ... +bitwise_xor: Final[_UFunc_Nin2_Nout1[L["bitwise_xor"], L[12], L[0]]] = ... +cbrt: Final[_UFunc_Nin1_Nout1[L["cbrt"], L[5], None]] = ... +ceil: Final[_UFunc_Nin1_Nout1[L["ceil"], L[7], None]] = ... +conj: Final[_UFunc_Nin1_Nout1[L["conjugate"], L[18], None]] = ... +conjugate: Final[_UFunc_Nin1_Nout1[L["conjugate"], L[18], None]] = ... +copysign: Final[_UFunc_Nin2_Nout1[L["copysign"], L[4], None]] = ... +cos: Final[_UFunc_Nin1_Nout1[L["cos"], L[9], None]] = ... +cosh: Final[_UFunc_Nin1_Nout1[L["cosh"], L[8], None]] = ... +deg2rad: Final[_UFunc_Nin1_Nout1[L["deg2rad"], L[5], None]] = ... +degrees: Final[_UFunc_Nin1_Nout1[L["degrees"], L[5], None]] = ... +divide: Final[_UFunc_Nin2_Nout1[L["true_divide"], L[11], None]] = ... +divmod: Final[_UFunc_Nin2_Nout2[L["divmod"], L[15], None]] = ... +equal: Final[_UFunc_Nin2_Nout1[L["equal"], L[23], None]] = ... +exp2: Final[_UFunc_Nin1_Nout1[L["exp2"], L[8], None]] = ... +exp: Final[_UFunc_Nin1_Nout1[L["exp"], L[10], None]] = ... +expm1: Final[_UFunc_Nin1_Nout1[L["expm1"], L[8], None]] = ... +fabs: Final[_UFunc_Nin1_Nout1[L["fabs"], L[5], None]] = ... +float_power: Final[_UFunc_Nin2_Nout1[L["float_power"], L[4], None]] = ... +floor: Final[_UFunc_Nin1_Nout1[L["floor"], L[7], None]] = ... +floor_divide: Final[_UFunc_Nin2_Nout1[L["floor_divide"], L[21], None]] = ... +fmax: Final[_UFunc_Nin2_Nout1[L["fmax"], L[21], None]] = ... +fmin: Final[_UFunc_Nin2_Nout1[L["fmin"], L[21], None]] = ... +fmod: Final[_UFunc_Nin2_Nout1[L["fmod"], L[15], None]] = ... +frexp: Final[_UFunc_Nin1_Nout2[L["frexp"], L[4], None]] = ... +gcd: Final[_UFunc_Nin2_Nout1[L["gcd"], L[11], L[0]]] = ... +greater: Final[_UFunc_Nin2_Nout1[L["greater"], L[23], None]] = ... +greater_equal: Final[_UFunc_Nin2_Nout1[L["greater_equal"], L[23], None]] = ... +heaviside: Final[_UFunc_Nin2_Nout1[L["heaviside"], L[4], None]] = ... +hypot: Final[_UFunc_Nin2_Nout1[L["hypot"], L[5], L[0]]] = ... +invert: Final[_UFunc_Nin1_Nout1[L["invert"], L[12], None]] = ... +isfinite: Final[_UFunc_Nin1_Nout1[L["isfinite"], L[20], None]] = ... +isinf: Final[_UFunc_Nin1_Nout1[L["isinf"], L[20], None]] = ... +isnan: Final[_UFunc_Nin1_Nout1[L["isnan"], L[20], None]] = ... +isnat: Final[_UFunc_Nin1_Nout1[L["isnat"], L[2], None]] = ... +lcm: Final[_UFunc_Nin2_Nout1[L["lcm"], L[11], None]] = ... +ldexp: Final[_UFunc_Nin2_Nout1[L["ldexp"], L[8], None]] = ... +left_shift: Final[_UFunc_Nin2_Nout1[L["left_shift"], L[11], None]] = ... +less: Final[_UFunc_Nin2_Nout1[L["less"], L[23], None]] = ... +less_equal: Final[_UFunc_Nin2_Nout1[L["less_equal"], L[23], None]] = ... +log10: Final[_UFunc_Nin1_Nout1[L["log10"], L[8], None]] = ... +log1p: Final[_UFunc_Nin1_Nout1[L["log1p"], L[8], None]] = ... +log2: Final[_UFunc_Nin1_Nout1[L["log2"], L[8], None]] = ... +log: Final[_UFunc_Nin1_Nout1[L["log"], L[10], None]] = ... +logaddexp2: Final[_UFunc_Nin2_Nout1[L["logaddexp2"], L[4], float]] = ... +logaddexp: Final[_UFunc_Nin2_Nout1[L["logaddexp"], L[4], float]] = ... +logical_and: Final[_UFunc_Nin2_Nout1[L["logical_and"], L[20], L[True]]] = ... +logical_not: Final[_UFunc_Nin1_Nout1[L["logical_not"], L[20], None]] = ... +logical_or: Final[_UFunc_Nin2_Nout1[L["logical_or"], L[20], L[False]]] = ... +logical_xor: Final[_UFunc_Nin2_Nout1[L["logical_xor"], L[19], L[False]]] = ... +matmul: Final[_GUFunc_Nin2_Nout1[L["matmul"], L[19], None, L["(n?,k),(k,m?)->(n?,m?)"]]] = ... +matvec: Final[_GUFunc_Nin2_Nout1[L["matvec"], L[19], None, L["(m,n),(n)->(m)"]]] = ... +maximum: Final[_UFunc_Nin2_Nout1[L["maximum"], L[21], None]] = ... +minimum: Final[_UFunc_Nin2_Nout1[L["minimum"], L[21], None]] = ... +mod: Final[_UFunc_Nin2_Nout1[L["remainder"], L[16], None]] = ... +modf: Final[_UFunc_Nin1_Nout2[L["modf"], L[4], None]] = ... +multiply: Final[_UFunc_Nin2_Nout1[L["multiply"], L[23], L[1]]] = ... +negative: Final[_UFunc_Nin1_Nout1[L["negative"], L[19], None]] = ... +nextafter: Final[_UFunc_Nin2_Nout1[L["nextafter"], L[4], None]] = ... +not_equal: Final[_UFunc_Nin2_Nout1[L["not_equal"], L[23], None]] = ... +positive: Final[_UFunc_Nin1_Nout1[L["positive"], L[19], None]] = ... +power: Final[_UFunc_Nin2_Nout1[L["power"], L[18], None]] = ... +rad2deg: Final[_UFunc_Nin1_Nout1[L["rad2deg"], L[5], None]] = ... +radians: Final[_UFunc_Nin1_Nout1[L["radians"], L[5], None]] = ... +reciprocal: Final[_UFunc_Nin1_Nout1[L["reciprocal"], L[18], None]] = ... +remainder: Final[_UFunc_Nin2_Nout1[L["remainder"], L[16], None]] = ... +right_shift: Final[_UFunc_Nin2_Nout1[L["right_shift"], L[11], None]] = ... +rint: Final[_UFunc_Nin1_Nout1[L["rint"], L[10], None]] = ... +sign: Final[_UFunc_Nin1_Nout1[L["sign"], L[19], None]] = ... +signbit: Final[_UFunc_Nin1_Nout1[L["signbit"], L[4], None]] = ... +sin: Final[_UFunc_Nin1_Nout1[L["sin"], L[9], None]] = ... +sinh: Final[_UFunc_Nin1_Nout1[L["sinh"], L[8], None]] = ... +spacing: Final[_UFunc_Nin1_Nout1[L["spacing"], L[4], None]] = ... +sqrt: Final[_UFunc_Nin1_Nout1[L["sqrt"], L[10], None]] = ... +square: Final[_UFunc_Nin1_Nout1[L["square"], L[18], None]] = ... +subtract: Final[_UFunc_Nin2_Nout1[L["subtract"], L[21], None]] = ... +tan: Final[_UFunc_Nin1_Nout1[L["tan"], L[8], None]] = ... +tanh: Final[_UFunc_Nin1_Nout1[L["tanh"], L[8], None]] = ... +true_divide: Final[_UFunc_Nin2_Nout1[L["true_divide"], L[11], None]] = ... +trunc: Final[_UFunc_Nin1_Nout1[L["trunc"], L[7], None]] = ... +vecdot: Final[_GUFunc_Nin2_Nout1[L["vecdot"], L[19], None, L["(n),(n)->()"]]] = ... +vecmat: Final[_GUFunc_Nin2_Nout1[L["vecmat"], L[19], None, L["(n),(n,m)->(m)"]]] = ... + +abs: Final = absolute +acos: Final = arccos +acosh: Final = arccosh +asin: Final = arcsin +asinh: Final = arcsinh +atan: Final = arctan +atanh: Final = arctanh +atan2: Final = arctan2 +concat: Final = concatenate +bitwise_left_shift: Final = left_shift +bitwise_invert: Final = invert +bitwise_right_shift: Final = right_shift +permute_dims: Final = transpose +pow: Final = power class _CopyMode(enum.Enum): ALWAYS: L[True] @@ -4756,24 +5052,21 @@ class errstate: under: _ErrKind | None = ..., invalid: _ErrKind | None = ..., ) -> None: ... + + # def __enter__(self) -> None: ... - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - /, - ) -> None: ... + def __exit__(self, cls: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... + + # def __call__(self, func: _CallableT) -> _CallableT: ... class ndenumerate(Generic[_SCT_co]): @property def iter(self) -> flatiter[NDArray[_SCT_co]]: ... + + # @overload - def __new__( - cls, - arr: _FiniteNestedSequence[_SupportsArray[dtype[_SCT]]], - ) -> ndenumerate[_SCT]: ... + def __new__(cls, arr: _FiniteNestedSequence[_SupportsArray[dtype[_SCT_co]]]) -> Self: ... @overload def __new__(cls, arr: str | _NestedSequence[str]) -> ndenumerate[str_]: ... @overload @@ -4791,14 +5084,13 @@ class ndenumerate(Generic[_SCT_co]): # The first overload is a (semi-)workaround for a mypy bug (tested with v1.10 and v1.11) @overload - def __next__( - self: ndenumerate[np.bool | datetime64 | timedelta64 | number[Any] | flexible], - /, - ) -> tuple[_Shape, _SCT_co]: ... + def __next__(self: ndenumerate[np.bool | datetime64 | timedelta64 | number | flexible], /) -> tuple[_Shape, _SCT_co]: ... @overload def __next__(self: ndenumerate[object_], /) -> tuple[_Shape, Any]: ... @overload def __next__(self, /) -> tuple[_Shape, _SCT_co]: ... + + # def __iter__(self) -> Self: ... class ndindex: @@ -4806,44 +5098,51 @@ class ndindex: def __init__(self, shape: tuple[SupportsIndex, ...], /) -> None: ... @overload def __init__(self, *shape: SupportsIndex) -> None: ... + + # def __iter__(self) -> Self: ... def __next__(self) -> _Shape: ... -# TODO: The type of each `__next__` and `iters` return-type depends -# on the length and dtype of `args`; we can't describe this behavior yet -# as we lack variadics (PEP 646). @final class broadcast: - def __new__(cls, *args: ArrayLike) -> broadcast: ... - @property - def index(self) -> int: ... @property def iters(self) -> tuple[flatiter[Any], ...]: ... @property + def index(self) -> int: ... + @property def nd(self) -> int: ... @property def ndim(self) -> int: ... @property def numiter(self) -> int: ... @property - def shape(self) -> _Shape: ... - @property def size(self) -> int: ... + @property + def shape(self) -> _Shape: ... + + # + def __new__(cls, *args: ArrayLike) -> Self: ... + + # def __next__(self) -> tuple[Any, ...]: ... def __iter__(self) -> Self: ... + + # def reset(self) -> None: ... @final class busdaycalendar: + @property + def weekmask(self) -> NDArray[np.bool]: ... + @property + def holidays(self) -> NDArray[datetime64]: ... + + # def __new__( cls, weekmask: ArrayLike = ..., holidays: ArrayLike | dt.date | _NestedSequence[dt.date] = ..., ) -> busdaycalendar: ... - @property - def weekmask(self) -> NDArray[np.bool]: ... - @property - def holidays(self) -> NDArray[datetime64]: ... class finfo(Generic[_FloatingT_co]): dtype: Final[dtype[_FloatingT_co]] @@ -4862,26 +5161,33 @@ class finfo(Generic[_FloatingT_co]): precision: Final[int] resolution: Final[_FloatingT_co] smallest_subnormal: Final[_FloatingT_co] + @property def smallest_normal(self) -> _FloatingT_co: ... @property def tiny(self) -> _FloatingT_co: ... + + # @overload - def __new__(cls, dtype: inexact[_NBit1] | _DTypeLike[inexact[_NBit1]]) -> finfo[floating[_NBit1]]: ... + def __new__(cls, dtype: inexact[_NBit] | _DTypeLike[inexact[_NBit]]) -> finfo[floating[_NBit]]: ... @overload - def __new__(cls, dtype: type[complex | float] | complex) -> finfo[float64]: ... + def __new__(cls, dtype: type[float | complex] | float | complex) -> finfo[float64]: ... @overload - def __new__(cls, dtype: str) -> finfo[floating[Any]]: ... + def __new__(cls, dtype: str) -> finfo[floating]: ... class iinfo(Generic[_IntegerT_co]): dtype: Final[dtype[_IntegerT_co]] kind: Final[LiteralString] bits: Final[int] key: Final[LiteralString] + + # @property def min(self) -> int: ... @property def max(self) -> int: ... + + # @overload def __new__(cls, dtype: _IntegerT_co | _DTypeLike[_IntegerT_co]) -> iinfo[_IntegerT_co]: ... @overload @@ -4891,45 +5197,15 @@ class iinfo(Generic[_IntegerT_co]): @final class nditer: - def __new__( - cls, - op: ArrayLike | Sequence[ArrayLike | None], - flags: Sequence[_NDIterFlagsKind] | None = ..., - op_flags: Sequence[Sequence[_NDIterFlagsOp]] | None = ..., - op_dtypes: DTypeLike | Sequence[DTypeLike] = ..., - order: _OrderKACF = ..., - casting: _CastingKind = ..., - op_axes: Sequence[Sequence[SupportsIndex]] | None = ..., - itershape: _ShapeLike | None = ..., - buffersize: SupportsIndex = ..., - ) -> nditer: ... - def __enter__(self) -> nditer: ... - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: ... - def __iter__(self) -> nditer: ... - def __next__(self) -> tuple[NDArray[Any], ...]: ... - def __len__(self) -> int: ... - def __copy__(self) -> nditer: ... - @overload - def __getitem__(self, index: SupportsIndex) -> NDArray[Any]: ... - @overload - def __getitem__(self, index: slice) -> tuple[NDArray[Any], ...]: ... - def __setitem__(self, index: slice | SupportsIndex, value: ArrayLike) -> None: ... - def close(self) -> None: ... - def copy(self) -> nditer: ... - def debug_print(self) -> None: ... - def enable_external_loop(self) -> None: ... - def iternext(self) -> builtins.bool: ... - def remove_axis(self, i: SupportsIndex, /) -> None: ... - def remove_multi_index(self) -> None: ... - def reset(self) -> None: ... @property def dtypes(self) -> tuple[dtype[Any], ...]: ... @property + def shape(self) -> tuple[int, ...]: ... + @property + def ndim(self) -> int: ... + + # + @property def finished(self) -> builtins.bool: ... @property def has_delayed_bufalloc(self) -> builtins.bool: ... @@ -4938,35 +5214,82 @@ class nditer: @property def has_multi_index(self) -> builtins.bool: ... @property - def index(self) -> int: ... - @property def iterationneedsapi(self) -> builtins.bool: ... + + # @property - def iterindex(self) -> int: ... + def nop(self) -> int: ... @property - def iterrange(self) -> tuple[int, ...]: ... + def index(self) -> int: ... @property - def itersize(self) -> int: ... + def multi_index(self) -> tuple[int, ...]: ... @property - def itviews(self) -> tuple[NDArray[Any], ...]: ... + def iterindex(self) -> int: ... @property - def multi_index(self) -> tuple[int, ...]: ... + def itersize(self) -> int: ... @property - def ndim(self) -> int: ... + def iterrange(self) -> tuple[int, ...]: ... @property - def nop(self) -> int: ... + def itviews(self) -> tuple[NDArray[Any], ...]: ... @property def operands(self) -> tuple[NDArray[Any], ...]: ... @property - def shape(self) -> tuple[int, ...]: ... - @property def value(self) -> tuple[NDArray[Any], ...]: ... + # + def __new__( + cls, + op: ArrayLike | Sequence[ArrayLike | None], + flags: Sequence[_NDIterFlagsKind] | None = ..., + op_flags: Sequence[Sequence[_NDIterFlagsOp]] | None = ..., + op_dtypes: DTypeLike | Sequence[DTypeLike] = ..., + order: _OrderKACF = ..., + casting: _CastingKind = ..., + op_axes: Sequence[Sequence[SupportsIndex]] | None = ..., + itershape: _ShapeLike | None = ..., + buffersize: SupportsIndex = ..., + ) -> nditer: ... + + # + def __enter__(self) -> Self: ... + def __exit__(self, cls: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, /) -> None: ... + def close(self) -> None: ... + def reset(self) -> None: ... + + # + def __len__(self) -> int: ... + def __iter__(self) -> nditer: ... + def __next__(self) -> tuple[NDArray[Any], ...]: ... + def iternext(self) -> builtins.bool: ... + + # + @overload + def __getitem__(self, index: SupportsIndex, /) -> NDArray[Any]: ... + @overload + def __getitem__(self, index: slice, /) -> tuple[NDArray[Any], ...]: ... + + # + def __setitem__(self, index: slice | SupportsIndex, value: ArrayLike, /) -> None: ... + + # + def __copy__(self) -> Self: ... + def copy(self) -> nditer: ... + + # . + def debug_print(self) -> None: ... + def enable_external_loop(self) -> None: ... + + # + def remove_axis(self, i: SupportsIndex, /) -> None: ... + def remove_multi_index(self) -> None: ... + class memmap(ndarray[_ShapeT_co, _DType_co]): - __array_priority__: ClassVar[float] + __array_priority__: ClassVar[float] # pyright: ignore[reportIncompatibleMethodOverride] + filename: str | None offset: int mode: str + @overload def __new__( cls, @@ -4997,6 +5320,8 @@ class memmap(ndarray[_ShapeT_co, _DType_co]): shape: int | tuple[int, ...] | None = ..., order: _OrderKACF = ..., ) -> memmap[Any, dtype[Any]]: ... + + # def __array_finalize__(self, obj: object) -> None: ... def __array_wrap__( self, @@ -5004,15 +5329,19 @@ class memmap(ndarray[_ShapeT_co, _DType_co]): context: tuple[ufunc, tuple[Any, ...], int] | None = ..., return_scalar: builtins.bool = ..., ) -> Any: ... + + # def flush(self) -> None: ... class vectorize: + __doc__: str | None pyfunc: Callable[..., Any] cache: builtins.bool signature: LiteralString | None otypes: LiteralString | None excluded: set[int | str] - __doc__: str | None + + # def __init__( self, pyfunc: Callable[..., Any], @@ -5022,7 +5351,9 @@ class vectorize: cache: builtins.bool = ..., signature: str | None = ..., ) -> None: ... - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + + # + def __call__(self, /, *args: Any, **kwargs: Any) -> Any: ... class poly1d: @property @@ -5035,18 +5366,26 @@ class poly1d: def roots(self) -> NDArray[Any]: ... @property def r(self) -> NDArray[Any]: ... + + # @property def coeffs(self) -> NDArray[Any]: ... @coeffs.setter def coeffs(self, value: NDArray[Any]) -> None: ... + + # @property def c(self) -> NDArray[Any]: ... @c.setter def c(self, value: NDArray[Any]) -> None: ... + + # @property def coef(self) -> NDArray[Any]: ... @coef.setter def coef(self, value: NDArray[Any]) -> None: ... + + # @property def coefficients(self) -> NDArray[Any]: ... @coefficients.setter @@ -5054,56 +5393,70 @@ class poly1d: __hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride] + # + def __init__(self, c_or_r: ArrayLike, r: builtins.bool = ..., variable: str | None = ...) -> None: ... @overload def __array__(self, /, t: None = None, copy: builtins.bool | None = None) -> ndarray[tuple[int], dtype[Any]]: ... @overload def __array__(self, /, t: _DType, copy: builtins.bool | None = None) -> ndarray[tuple[int], _DType]: ... + + # @overload def __call__(self, val: _ScalarLike_co) -> Any: ... @overload def __call__(self, val: poly1d) -> poly1d: ... @overload def __call__(self, val: ArrayLike) -> NDArray[Any]: ... - def __init__(self, c_or_r: ArrayLike, r: builtins.bool = ..., variable: str | None = ...) -> None: ... + + # def __len__(self) -> int: ... - def __neg__(self) -> poly1d: ... - def __pos__(self) -> poly1d: ... - def __mul__(self, other: ArrayLike, /) -> poly1d: ... - def __rmul__(self, other: ArrayLike, /) -> poly1d: ... + def __iter__(self) -> Iterator[Any]: ... + + # + def __getitem__(self, val: int, /) -> Any: ... + def __setitem__(self, key: int, val: Any, /) -> None: ... + + # + def __neg__(self) -> Self: ... + def __pos__(self) -> Self: ... + + # def __add__(self, other: ArrayLike, /) -> poly1d: ... def __radd__(self, other: ArrayLike, /) -> poly1d: ... - def __pow__(self, val: _FloatLike_co, /) -> poly1d: ... # Integral floats are accepted + + # + def __mul__(self, other: ArrayLike, /) -> poly1d: ... + def __rmul__(self, other: ArrayLike, /) -> poly1d: ... + + # def __sub__(self, other: ArrayLike, /) -> poly1d: ... def __rsub__(self, other: ArrayLike, /) -> poly1d: ... + + # + def __pow__(self, val: _FloatLike_co, /) -> poly1d: ... # Integral floats are accepted + + # def __div__(self, other: ArrayLike, /) -> poly1d: ... - def __truediv__(self, other: ArrayLike, /) -> poly1d: ... def __rdiv__(self, other: ArrayLike, /) -> poly1d: ... + def __truediv__(self, other: ArrayLike, /) -> poly1d: ... def __rtruediv__(self, other: ArrayLike, /) -> poly1d: ... - def __getitem__(self, val: int, /) -> Any: ... - def __setitem__(self, key: int, val: Any, /) -> None: ... - def __iter__(self) -> Iterator[Any]: ... + + # def deriv(self, m: SupportsInt | SupportsIndex = ...) -> poly1d: ... - def integ( - self, - m: SupportsInt | SupportsIndex = ..., - k: _ArrayLikeComplex_co | _ArrayLikeObject_co | None = ..., - ) -> poly1d: ... + def integ(self, m: SupportsInt | SupportsIndex = ..., k: _ArrayLikeComplex_co | _ArrayLikeObject_co | None = ...) -> Self: ... class matrix(ndarray[_2DShapeT_co, _DType_co]): - __array_priority__: ClassVar[float] - def __new__( - cls, - data: ArrayLike, - dtype: DTypeLike = ..., - copy: builtins.bool = ..., - ) -> matrix[_2D, Any]: ... + __array_priority__: ClassVar[float] = ... + + # + def __new__(cls, data: ArrayLike, dtype: DTypeLike = ..., copy: builtins.bool = ...) -> matrix[_2D, Any]: ... + + # def __array_finalize__(self, obj: object) -> None: ... + + # @overload - def __getitem__( - self, - key: (SupportsIndex | _ArrayLikeInt_co | tuple[SupportsIndex | _ArrayLikeInt_co, ...]), - /, - ) -> Any: ... + def __getitem__(self, key: (SupportsIndex | _ArrayLikeInt_co | tuple[SupportsIndex | _ArrayLikeInt_co, ...]), /) -> Any: ... @overload def __getitem__( self, @@ -5119,101 +5472,143 @@ class matrix(ndarray[_2DShapeT_co, _DType_co]): def __getitem__(self: NDArray[void], key: str, /) -> matrix[_2D, dtype[Any]]: ... @overload def __getitem__(self: NDArray[void], key: list[str], /) -> matrix[_2DShapeT_co, dtype[void]]: ... + + # def __mul__(self, other: ArrayLike, /) -> matrix[_2D, Any]: ... def __rmul__(self, other: ArrayLike, /) -> matrix[_2D, Any]: ... def __imul__(self, other: ArrayLike, /) -> Self: ... + + # def __pow__(self, other: ArrayLike, /) -> matrix[_2D, Any]: ... def __ipow__(self, other: ArrayLike, /) -> Self: ... + + # @overload def sum(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ...) -> Any: ... @overload def sum(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload def sum(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def mean(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ...) -> Any: ... @overload def mean(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload def mean(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def std(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> Any: ... @overload def std(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> matrix[_2D, Any]: ... @overload def std(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... + + # @overload def var(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> Any: ... @overload def var(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ..., ddof: float = ...) -> matrix[_2D, Any]: ... @overload def var(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ..., ddof: float = ...) -> _ArrayT: ... + + # @overload def prod(self, axis: None = ..., dtype: DTypeLike = ..., out: None = ...) -> Any: ... @overload def prod(self, axis: _ShapeLike, dtype: DTypeLike = ..., out: None = ...) -> matrix[_2D, Any]: ... @overload def prod(self, axis: _ShapeLike | None = ..., dtype: DTypeLike = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def any(self, axis: None = ..., out: None = ...) -> np.bool: ... @overload def any(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[np.bool]]: ... @overload def any(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def all(self, axis: None = ..., out: None = ...) -> np.bool: ... @overload def all(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[np.bool]]: ... @overload def all(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def max(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def max(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload def max(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def min(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def min(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload def min(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def argmax(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> intp: ... @overload def argmax(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[intp]]: ... @overload def argmax(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def argmin(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> intp: ... @overload def argmin(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, dtype[intp]]: ... @overload def argmin(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... + + # @overload def ptp(self: NDArray[_SCT], axis: None = ..., out: None = ...) -> _SCT: ... @overload def ptp(self, axis: _ShapeLike, out: None = ...) -> matrix[_2D, _DType_co]: ... @overload def ptp(self, axis: _ShapeLike | None = ..., out: _ArrayT = ...) -> _ArrayT: ... - def squeeze(self, axis: _ShapeLike | None = ...) -> matrix[_2D, _DType_co]: ... + + # def tolist(self: _SupportsItem[_T]) -> list[list[_T]]: ... + + # + def squeeze(self, axis: _ShapeLike | None = ...) -> matrix[_2D, _DType_co]: ... def ravel(self, /, order: _OrderKACF = "C") -> matrix[tuple[L[1], int], _DType_co]: ... # pyright: ignore[reportIncompatibleMethodOverride] def flatten(self, /, order: _OrderKACF = "C") -> matrix[tuple[L[1], int], _DType_co]: ... # pyright: ignore[reportIncompatibleMethodOverride] + + # @property def T(self) -> matrix[_2D, _DType_co]: ... + def getT(self) -> matrix[_2D, _DType_co]: ... + + # @property def I(self) -> matrix[_2D, Any]: ... + def getI(self) -> matrix[_2D, Any]: ... + + # @property def A(self) -> ndarray[_2DShapeT_co, _DType_co]: ... + def getA(self) -> ndarray[_2DShapeT_co, _DType_co]: ... + + # @property def A1(self) -> ndarray[_Shape, _DType_co]: ... + def getA1(self) -> ndarray[_Shape, _DType_co]: ... + + # @property def H(self) -> matrix[_2D, _DType_co]: ... - def getT(self) -> matrix[_2D, _DType_co]: ... - def getI(self) -> matrix[_2D, Any]: ... - def getA(self) -> ndarray[_2DShapeT_co, _DType_co]: ... - def getA1(self) -> ndarray[_Shape, _DType_co]: ... def getH(self) -> matrix[_2D, _DType_co]: ... def from_dlpack( @@ -5222,4 +5617,4 @@ def from_dlpack( *, device: L["cpu"] | None = None, copy: builtins.bool | None = None, -) -> NDArray[number[Any] | np.bool]: ... +) -> NDArray[number | np.bool]: ...