From 8f48bfd2b958f6330892d343cb1d0548e0948107 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 00:21:40 +0200 Subject: [PATCH 01/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`polynomial`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/polynomial/_polybase.pyi | 115 +-- src/numpy-stubs/polynomial/chebyshev.pyi | 49 +- src/numpy-stubs/polynomial/hermite.pyi | 16 +- src/numpy-stubs/polynomial/hermite_e.pyi | 16 +- src/numpy-stubs/polynomial/laguerre.pyi | 14 +- src/numpy-stubs/polynomial/legendre.pyi | 59 +- src/numpy-stubs/polynomial/polynomial.pyi | 806 +++++++++++----------- src/numpy-stubs/polynomial/polyutils.pyi | 94 ++- 8 files changed, 574 insertions(+), 595 deletions(-) diff --git a/src/numpy-stubs/polynomial/_polybase.pyi b/src/numpy-stubs/polynomial/_polybase.pyi index 5f65f83d..091cf7df 100644 --- a/src/numpy-stubs/polynomial/_polybase.pyi +++ b/src/numpy-stubs/polynomial/_polybase.pyi @@ -4,18 +4,9 @@ from collections.abc import Iterator, Mapping, Sequence from typing import Any, ClassVar, Final, Literal, SupportsIndex, TypeAlias, overload from typing_extensions import Self, TypeIs, TypeVar, override +import _numtype as _nt import numpy as np import numpy.typing as npt -from _numtype import ( - Array1D, - CoComplex_0d, - CoComplex_1d, - CoComplex_1nd, - CoInteger_0d, - CoInteger_1d, - ToObject_0d, - ToObject_1nd, -) from numpy._typing import _FloatLike_co from .polynomial import _ToNumeric_0d, _ToNumeric_nd @@ -24,9 +15,11 @@ __all__: Final[Sequence[str]] = ("ABCPolyBase",) ### +_T = TypeVar("_T") _PolyT = TypeVar("_PolyT", bound=ABCPolyBase) -_AnyOther: TypeAlias = ABCPolyBase | _ToNumeric_0d | CoComplex_1d +_Tuple2: TypeAlias = tuple[_T, _T] +_AnyOther: TypeAlias = ABCPolyBase | _ToNumeric_0d | _nt.CoComplex_1d _Hundred: TypeAlias = Literal[100] ### @@ -41,7 +34,7 @@ class ABCPolyBase(abc.ABC): _use_unicode: ClassVar[bool] _symbol: str - coef: Array1D[np.inexact | np.object_] + coef: _nt.Array1D[np.inexact | np.object_] @property def symbol(self, /) -> str: ... @@ -52,18 +45,18 @@ class ABCPolyBase(abc.ABC): def basis_name(self, /) -> str | None: ... @property @abc.abstractmethod - def domain(self, /) -> Array1D[np.inexact]: ... + def domain(self, /) -> _nt.Array1D[np.inexact]: ... @property @abc.abstractmethod - def window(self, /) -> Array1D[np.inexact]: ... + def window(self, /) -> _nt.Array1D[np.inexact]: ... # def __init__( self, /, - coef: CoComplex_1d, - domain: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + coef: _nt.CoComplex_1d, + domain: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> None: ... @@ -71,13 +64,13 @@ class ABCPolyBase(abc.ABC): @overload def __call__(self, /, arg: _PolyT) -> _PolyT: ... @overload - def __call__(self, /, arg: CoComplex_0d) -> np.float64 | np.complex128: ... + def __call__(self, /, arg: _nt.CoComplex_0d) -> _nt.inexact64: ... @overload - def __call__(self, /, arg: CoComplex_1nd) -> npt.NDArray[np.float64 | np.complex128]: ... + def __call__(self, /, arg: _nt.CoComplex_1nd) -> npt.NDArray[_nt.inexact64]: ... @overload - def __call__(self, /, arg: ToObject_0d) -> Any: ... + def __call__(self, /, arg: _nt.ToObject_0d) -> Any: ... @overload - def __call__(self, /, arg: ToObject_1nd) -> npt.NDArray[np.object_]: ... + def __call__(self, /, arg: _nt.ToObject_1nd) -> npt.NDArray[np.object_]: ... # @override @@ -132,78 +125,90 @@ class ABCPolyBase(abc.ABC): # @overload def convert( - self, /, domain: CoComplex_1d | None = None, kind: None = None, window: CoComplex_1d | None = None + self, + /, + domain: _nt.CoComplex_1d | None = None, + kind: None = None, + window: _nt.CoComplex_1d | None = None, ) -> Self: ... @overload def convert( - self, /, domain: CoComplex_1d | None, kind: type[_PolyT], window: CoComplex_1d | None = None + self, + /, + domain: _nt.CoComplex_1d | None, + kind: type[_PolyT], + window: _nt.CoComplex_1d | None = None, ) -> _PolyT: ... @overload def convert( self, /, - domain: CoComplex_1d | None = None, + domain: _nt.CoComplex_1d | None = None, *, kind: type[_PolyT], - window: CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, ) -> _PolyT: ... # def mapparms(self, /) -> tuple[Any, Any]: ... def integ( - self, /, m: SupportsIndex = 1, k: _ToNumeric_0d | CoComplex_1d = [], lbnd: _ToNumeric_0d | None = None + self, + /, + m: SupportsIndex = 1, + k: _ToNumeric_0d | _nt.CoComplex_1d = [], + lbnd: _ToNumeric_0d | None = None, ) -> Self: ... def deriv(self, /, m: SupportsIndex = 1) -> Self: ... - def roots(self, /) -> Array1D[np.float64] | Array1D[np.complex128]: ... + def roots(self, /) -> _nt.Array1D[_nt.inexact64]: ... def linspace( self, /, n: SupportsIndex = 100, - domain: CoComplex_1d | None = None, - ) -> tuple[Array1D[np.float64 | np.complex128], Array1D[np.float64 | np.complex128]]: ... + domain: _nt.CoComplex_1d | None = None, + ) -> _Tuple2[_nt.Array1D[_nt.inexact64]]: ... # @overload @classmethod def fit( cls, - x: CoComplex_1d, - y: CoComplex_1d, - deg: CoInteger_0d | CoInteger_1d, - domain: CoComplex_1d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + deg: _nt.CoInteger_0d | _nt.CoInteger_1d, + domain: _nt.CoComplex_1d | None = None, rcond: _FloatLike_co | None = None, full: Literal[False] = False, - w: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + w: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> Self: ... @overload @classmethod def fit( cls, - x: CoComplex_1d, - y: CoComplex_1d, - deg: CoInteger_0d | CoInteger_1d, - domain: CoComplex_1d | None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + deg: _nt.CoInteger_0d | _nt.CoInteger_1d, + domain: _nt.CoComplex_1d | None, rcond: _FloatLike_co | None, full: Literal[True], - w: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + w: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> tuple[Self, Sequence[np.inexact | np.int32]]: ... @overload @classmethod def fit( cls, - x: CoComplex_1d, - y: CoComplex_1d, - deg: CoInteger_0d | CoInteger_1d, - domain: CoComplex_1d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + deg: _nt.CoInteger_0d | _nt.CoInteger_1d, + domain: _nt.CoComplex_1d | None = None, rcond: _FloatLike_co | None = None, *, full: Literal[True], - w: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + w: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> tuple[Self, Sequence[np.inexact | np.int32]]: ... @@ -212,31 +217,31 @@ class ABCPolyBase(abc.ABC): def fromroots( cls, roots: _ToNumeric_nd, - domain: CoComplex_1d | None = [], - window: CoComplex_1d | None = None, + domain: _nt.CoComplex_1d | None = [], + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> Self: ... @classmethod def identity( cls, - domain: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + domain: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> Self: ... @classmethod def basis( cls, deg: SupportsIndex, - domain: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + domain: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, symbol: str = "x", ) -> Self: ... @classmethod def cast( cls, series: ABCPolyBase, - domain: CoComplex_1d | None = None, - window: CoComplex_1d | None = None, + domain: _nt.CoComplex_1d | None = None, + window: _nt.CoComplex_1d | None = None, ) -> Self: ... # diff --git a/src/numpy-stubs/polynomial/chebyshev.pyi b/src/numpy-stubs/polynomial/chebyshev.pyi index b371fbc3..cbd3534e 100644 --- a/src/numpy-stubs/polynomial/chebyshev.pyi +++ b/src/numpy-stubs/polynomial/chebyshev.pyi @@ -2,8 +2,8 @@ from collections.abc import Callable, Iterable from typing import Concatenate, Final, Literal as L, SupportsIndex as CanIndex, TypeAlias, overload from typing_extensions import Self, TypeVar +import _numtype as _nt import numpy as np -from _numtype import Array, Array1D, CoComplex_1d, CoInteger_0d, _ToArray_1d from ._polybase import ABCPolyBase from .legendre import ( @@ -75,51 +75,52 @@ __all__ = [ ### _T = TypeVar("_T") -_NumT = TypeVar("_NumT", bound=np.number | np.object_) +_NumericT = TypeVar("_NumericT", bound=np.number | np.object_) -_Func: TypeAlias = Callable[Concatenate[Array1D[np.float64], ...], _T] +_Args: TypeAlias = Iterable[object] +_Func: TypeAlias = Callable[Concatenate[_nt.Array1D[np.float64], ...], _T] ### -chebdomain: Final[Array1D[np.float64]] = ... -chebzero: Final[Array1D[np.intp]] = ... -chebone: Final[Array1D[np.intp]] = ... -chebx: Final[Array1D[np.intp]] = ... +chebdomain: Final[_nt.Array1D[np.float64]] = ... +chebzero: Final[_nt.Array1D[np.intp]] = ... +chebone: Final[_nt.Array1D[np.intp]] = ... +chebx: Final[_nt.Array1D[np.intp]] = ... class Chebyshev(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: L["T"] = "T" # pyright: ignore[reportIncompatibleMethodOverride] @classmethod def interpolate( cls, - func: np.ufunc | _Func[CoComplex_1d], - deg: CoInteger_0d, - domain: CoComplex_1d | None = None, - args: tuple[object, ...] = (), + func: np.ufunc | _Func[_nt.CoComplex_1d], + deg: _nt.CoInteger_0d, + domain: _nt.CoComplex_1d | None = None, + args: _Args = (), ) -> Self: ... # @overload -def chebinterpolate(func: np.ufunc, deg: CoInteger_0d, args: Iterable[object] = ()) -> Array[np.float64]: ... +def chebinterpolate(func: np.ufunc, deg: _nt.CoInteger_0d, args: _Args = ()) -> _nt.Array[np.float64]: ... @overload def chebinterpolate( - func: _Func[_ToArray_1d[_NumT]], deg: CoInteger_0d, args: tuple[object, ...] = () -) -> Array1D[_NumT]: ... + func: _Func[_nt._ToArray_1d[_NumericT]], deg: _nt.CoInteger_0d, args: _Args = () +) -> _nt.Array1D[_NumericT]: ... # -def chebpts1(npts: CanIndex) -> Array1D[np.float64]: ... -def chebpts2(npts: CanIndex) -> Array1D[np.float64]: ... +def chebpts1(npts: CanIndex) -> _nt.Array1D[np.float64]: ... +def chebpts2(npts: CanIndex) -> _nt.Array1D[np.float64]: ... # -def _cseries_to_zseries(c: Array[_NumT]) -> Array1D[_NumT]: ... -def _zseries_to_cseries(zs: Array[_NumT]) -> Array1D[_NumT]: ... +def _cseries_to_zseries(c: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... +def _zseries_to_cseries(zs: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... # -def _zseries_mul(z1: Array[_NumT], z2: Array[_NumT]) -> Array1D[_NumT]: ... -def _zseries_div(z1: Array[_NumT], z2: Array[_NumT]) -> Array1D[_NumT]: ... +def _zseries_mul(z1: _nt.Array[_NumericT], z2: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... +def _zseries_div(z1: _nt.Array[_NumericT], z2: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... # -def _zseries_der(zs: Array[_NumT]) -> Array1D[_NumT]: ... -def _zseries_int(zs: Array[_NumT]) -> Array1D[_NumT]: ... +def _zseries_der(zs: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... +def _zseries_int(zs: _nt.Array[_NumericT]) -> _nt.Array1D[_NumericT]: ... diff --git a/src/numpy-stubs/polynomial/hermite.pyi b/src/numpy-stubs/polynomial/hermite.pyi index a035061b..976d6b0f 100644 --- a/src/numpy-stubs/polynomial/hermite.pyi +++ b/src/numpy-stubs/polynomial/hermite.pyi @@ -1,8 +1,8 @@ from typing import Final, Literal as L from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import Array, Array1D from ._polybase import ABCPolyBase from .legendre import ( @@ -74,14 +74,14 @@ _ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...]) ### -hermdomain: Final[Array1D[np.float64]] = ... -hermzero: Final[Array1D[np.int_]] = ... -hermone: Final[Array1D[np.int_]] = ... -hermx: Final[Array1D[np.int_]] = ... +hermdomain: Final[_nt.Array1D[np.float64]] = ... +hermzero: Final[_nt.Array1D[np.intp]] = ... +hermone: Final[_nt.Array1D[np.intp]] = ... +hermx: Final[_nt.Array1D[np.intp]] = ... class Hermite(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: L["H"] = "H" # pyright: ignore[reportIncompatibleMethodOverride] -def _normed_hermite_n(x: Array[np.float64, _ShapeT], n: int | np.intp) -> Array[np.float64, _ShapeT]: ... +def _normed_hermite_n(x: _nt.Array[np.float64, _ShapeT], n: int | np.intp) -> _nt.Array[np.float64, _ShapeT]: ... diff --git a/src/numpy-stubs/polynomial/hermite_e.pyi b/src/numpy-stubs/polynomial/hermite_e.pyi index 5d33178a..f36107f2 100644 --- a/src/numpy-stubs/polynomial/hermite_e.pyi +++ b/src/numpy-stubs/polynomial/hermite_e.pyi @@ -1,8 +1,8 @@ from typing import Final, Literal as L from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import Array, Array1D from ._polybase import ABCPolyBase from .legendre import ( @@ -74,14 +74,14 @@ _ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...]) ### -hermedomain: Final[Array1D[np.float64]] = ... -hermezero: Final[Array1D[np.int_]] = ... -hermeone: Final[Array1D[np.int_]] = ... -hermex: Final[Array1D[np.int_]] = ... +hermedomain: Final[_nt.Array1D[np.float64]] = ... +hermezero: Final[_nt.Array1D[np.int_]] = ... +hermeone: Final[_nt.Array1D[np.int_]] = ... +hermex: Final[_nt.Array1D[np.int_]] = ... class HermiteE(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: L["He"] = "He" # pyright: ignore[reportIncompatibleMethodOverride] -def _normed_hermite_e_n(x: Array[np.float64, _ShapeT], n: int | np.intp) -> Array[np.float64, _ShapeT]: ... +def _normed_hermite_e_n(x: _nt.Array[np.float64, _ShapeT], n: int | np.intp) -> _nt.Array[np.float64, _ShapeT]: ... diff --git a/src/numpy-stubs/polynomial/laguerre.pyi b/src/numpy-stubs/polynomial/laguerre.pyi index c6a4c11d..ff33e7f6 100644 --- a/src/numpy-stubs/polynomial/laguerre.pyi +++ b/src/numpy-stubs/polynomial/laguerre.pyi @@ -1,7 +1,7 @@ from typing import Final, Literal as L +import _numtype as _nt import numpy as np -from _numtype import Array1D from ._polybase import ABCPolyBase from .legendre import ( @@ -69,12 +69,12 @@ __all__ = [ ### -lagdomain: Final[Array1D[np.float64]] = ... -lagzero: Final[Array1D[np.int_]] = ... -lagone: Final[Array1D[np.int_]] = ... -lagx: Final[Array1D[np.int_]] = ... +lagdomain: Final[_nt.Array1D[np.float64]] = ... +lagzero: Final[_nt.Array1D[np.intp]] = ... +lagone: Final[_nt.Array1D[np.intp]] = ... +lagx: Final[_nt.Array1D[np.intp]] = ... class Laguerre(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: L["L"] = "L" # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/src/numpy-stubs/polynomial/legendre.pyi b/src/numpy-stubs/polynomial/legendre.pyi index f5b1c7cb..5c48c4da 100644 --- a/src/numpy-stubs/polynomial/legendre.pyi +++ b/src/numpy-stubs/polynomial/legendre.pyi @@ -1,20 +1,7 @@ from typing import Final, Literal as L, SupportsIndex as CanIndex, overload +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - CoComplex_1d, - CoFloating_1d, - CoFloating_nd, - CoInteger_1d, - ToComplex128_1d, - ToComplex_1d, - ToComplex_nd, - ToFloat64_1d, - ToObject_1d, - ToObject_nd, -) from ._polybase import ABCPolyBase from .polynomial import ( @@ -78,53 +65,53 @@ __all__ = [ ### -legdomain: Final[Array1D[np.float64]] = ... -legzero: Final[Array1D[np.int_]] = ... -legone: Final[Array1D[np.int_]] = ... -legx: Final[Array1D[np.int_]] = ... +legdomain: Final[_nt.Array1D[np.float64]] = ... +legzero: Final[_nt.Array1D[np.int_]] = ... +legone: Final[_nt.Array1D[np.int_]] = ... +legx: Final[_nt.Array1D[np.int_]] = ... ### class Legendre(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _nt.Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: L["P"] = "P" # pyright: ignore[reportIncompatibleMethodOverride] ### @overload -def poly2leg(pol: ToFloat64_1d | CoInteger_1d) -> Array1D[np.float64]: ... +def poly2leg(pol: _nt.ToFloat64_1d | _nt.CoInteger_1d) -> _nt.Array1D[np.float64]: ... @overload -def poly2leg(pol: CoFloating_1d) -> Array1D[np.floating]: ... +def poly2leg(pol: _nt.CoFloating_1d) -> _nt.Array1D[np.floating]: ... @overload -def poly2leg(pol: ToComplex128_1d) -> Array1D[np.complex128]: ... +def poly2leg(pol: _nt.ToComplex128_1d) -> _nt.Array1D[np.complex128]: ... @overload -def poly2leg(pol: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def poly2leg(pol: _nt.ToComplex_1d) -> _nt.Array1D[np.complexfloating]: ... @overload -def poly2leg(pol: CoComplex_1d) -> Array1D[np.inexact]: ... +def poly2leg(pol: _nt.CoComplex_1d) -> _nt.Array1D[np.inexact]: ... @overload -def poly2leg(pol: ToObject_1d) -> Array1D[np.object_]: ... +def poly2leg(pol: _nt.ToObject_1d) -> _nt.Array1D[np.object_]: ... # @overload -def leg2poly(c: ToFloat64_1d | CoInteger_1d) -> Array1D[np.float64]: ... +def leg2poly(c: _nt.ToFloat64_1d | _nt.CoInteger_1d) -> _nt.Array1D[np.float64]: ... @overload -def leg2poly(c: CoFloating_1d) -> Array1D[np.floating]: ... +def leg2poly(c: _nt.CoFloating_1d) -> _nt.Array1D[np.floating]: ... @overload -def leg2poly(c: ToComplex128_1d) -> Array1D[np.complex128]: ... +def leg2poly(c: _nt.ToComplex128_1d) -> _nt.Array1D[np.complex128]: ... @overload -def leg2poly(c: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def leg2poly(c: _nt.ToComplex_1d) -> _nt.Array1D[np.complexfloating]: ... @overload -def leg2poly(c: CoComplex_1d) -> Array1D[np.inexact]: ... +def leg2poly(c: _nt.CoComplex_1d) -> _nt.Array1D[np.inexact]: ... @overload -def leg2poly(c: ToObject_1d) -> Array1D[np.object_]: ... +def leg2poly(c: _nt.ToObject_1d) -> _nt.Array1D[np.object_]: ... # @overload -def legweight(x: CoFloating_nd) -> Array[np.float64]: ... +def legweight(x: _nt.CoFloating_nd) -> _nt.Array[np.float64]: ... @overload -def legweight(x: ToComplex_nd) -> Array[np.complex128]: ... +def legweight(x: _nt.ToComplex_nd) -> _nt.Array[np.complex128]: ... @overload -def legweight(x: ToObject_nd) -> Array[np.object_]: ... +def legweight(x: _nt.ToObject_nd) -> _nt.Array[np.object_]: ... # -def leggauss(deg: CanIndex) -> tuple[Array1D[np.float64], Array1D[np.float64]]: ... +def leggauss(deg: CanIndex) -> tuple[_nt.Array1D[np.float64], _nt.Array1D[np.float64]]: ... diff --git a/src/numpy-stubs/polynomial/polynomial.pyi b/src/numpy-stubs/polynomial/polynomial.pyi index 47123a1b..4c1458ce 100644 --- a/src/numpy-stubs/polynomial/polynomial.pyi +++ b/src/numpy-stubs/polynomial/polynomial.pyi @@ -1,53 +1,9 @@ from collections.abc import Sequence -from typing import Any, Final, Literal as L, Protocol, SupportsIndex, TypeAlias, overload, type_check_only +from typing import Any, Final, Literal as L, Protocol, SupportsIndex as _Index, TypeAlias, overload, type_check_only from typing_extensions import Self, TypeVar, override +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - Array2D, - CoComplex128_0d, - CoComplex128_1d, - CoComplex_0d, - CoComplex_1d, - CoComplex_1nd, - CoComplex_nd, - CoFloat64_0d, - CoFloat64_1d, - CoFloat64_1nd, - CoFloat64_nd, - CoFloating_0d, - CoFloating_1d, - CoFloating_1nd, - CoFloating_nd, - CoInt64_0d, - CoInteger_0d, - CoInteger_1d, - CoInteger_nd, - ToComplex128_0d, - ToComplex128_1d, - ToComplex128_nd, - ToComplex_0d, - ToComplex_1d, - ToComplex_1nd, - ToComplex_nd, - ToFloat64_0d, - ToFloat64_1d, - ToFloat64_1nd, - ToFloat64_nd, - ToFloating_0d, - ToFloating_1d, - ToFloating_nd, - ToInt_0d, - ToObject_0d, - ToObject_1d, - ToObject_1nd, - ToObject_nd, - ToReal_1d, - _ToArray2_1d, - _ToArray2_nd, -) from ._polybase import ABCPolyBase from .polyutils import trimcoef as polytrim @@ -87,12 +43,27 @@ __all__ = [ _ScalarT = TypeVar("_ScalarT", bound=np.generic) -_Indices: TypeAlias = Sequence[SupportsIndex] -_ArrayAndFitResult: TypeAlias = tuple[Array[_ScalarT], Sequence[np.inexact | np.int32]] +_Indices: TypeAlias = Sequence[_Index] +_ArrayAndFitResult: TypeAlias = tuple[_nt.Array[_ScalarT], Sequence[np.inexact | np.int32]] -_ToNumeric_0d: TypeAlias = ToComplex_0d | ToObject_0d | _SupportsCoefOps -_ToNumeric_1d: TypeAlias = _ToArray2_1d[np.number | np.bool | np.object_, complex | _SupportsCoefOps] -_ToNumeric_nd: TypeAlias = _ToArray2_nd[np.number | np.bool | np.object_, complex | _SupportsCoefOps] +_ToNumeric_0d: TypeAlias = _nt.ToComplex_0d | _nt.ToObject_0d | _SupportsCoefOps +_ToNumeric_1d: TypeAlias = _nt._ToArray2_1d[np.number | np.bool | np.object_, complex | _SupportsCoefOps] +_ToNumeric_nd: TypeAlias = _nt._ToArray2_nd[np.number | np.bool | np.object_, complex | _SupportsCoefOps] + +_i64_1d: TypeAlias = _nt.Array1D[np.int64] +_f64_1d: TypeAlias = _nt.Array1D[np.float64] +_c128_1d: TypeAlias = _nt.Array1D[np.complex128] +_float_1d: TypeAlias = _nt.Array1D[np.floating] +_complex_1d: TypeAlias = _nt.Array1D[np.complexfloating] +_inexact_1d: TypeAlias = _nt.Array1D[np.inexact] +_object_1d: TypeAlias = _nt.Array1D[np.object_] + +_f64_nd: TypeAlias = _nt.Array[np.float64] +_c128_nd: TypeAlias = _nt.Array[np.complex128] +_object_nd: TypeAlias = _nt.Array[np.object_] +_floating_nd: TypeAlias = _nt.Array[np.floating] +_complex_nd: TypeAlias = _nt.Array[np.complexfloating] +_inexact_nd: TypeAlias = _nt.Array[np.inexact] # compatible with e.g. int, float, complex, Decimal, Fraction, and ABCPolyBase @type_check_only @@ -113,733 +84,756 @@ class _SupportsCoefOps(Protocol): ### -polydomain: Final[Array1D[np.float64]] = ... -polyzero: Final[Array1D[np.intp]] = ... -polyone: Final[Array1D[np.intp]] = ... -polyx: Final[Array1D[np.intp]] = ... +polydomain: Final[_f64_1d] = ... +polyzero: Final[_i64_1d] = ... +polyone: Final[_i64_1d] = ... +polyx: Final[_i64_1d] = ... ### class Polynomial(ABCPolyBase): - domain: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] - window: Array1D[np.float64] = ... # pyright: ignore[reportIncompatibleMethodOverride] + domain: _f64_1d = ... # pyright: ignore[reportIncompatibleMethodOverride] + window: _f64_1d = ... # pyright: ignore[reportIncompatibleMethodOverride] basis_name: None = None # pyright: ignore[reportIncompatibleMethodOverride] ### # @overload -def polyline(off: ToInt_0d, scl: CoInt64_0d) -> Array1D[np.intp]: ... +def polyline(off: _nt.ToInt_0d, scl: _nt.CoInt64_0d) -> _i64_1d: ... @overload -def polyline(off: CoInt64_0d, scl: ToInt_0d) -> Array1D[np.intp]: ... +def polyline(off: _nt.CoInt64_0d, scl: _nt.ToInt_0d) -> _i64_1d: ... @overload -def polyline(off: CoInteger_0d, scl: CoInteger_0d) -> Array1D[np.integer]: ... +def polyline(off: _nt.CoInteger_0d, scl: _nt.CoInteger_0d) -> _nt.Array1D[np.integer]: ... @overload -def polyline(off: ToFloat64_0d, scl: CoFloat64_0d) -> Array1D[np.float64]: ... +def polyline(off: _nt.ToFloat64_0d, scl: _nt.CoFloat64_0d) -> _f64_1d: ... @overload -def polyline(off: CoFloat64_0d, scl: ToFloat64_0d) -> Array1D[np.float64]: ... +def polyline(off: _nt.CoFloat64_0d, scl: _nt.ToFloat64_0d) -> _f64_1d: ... @overload -def polyline(off: ToFloating_0d, scl: CoFloating_0d) -> Array1D[np.floating]: ... +def polyline(off: _nt.ToFloating_0d, scl: _nt.CoFloating_0d) -> _float_1d: ... @overload -def polyline(off: CoFloating_0d, scl: ToFloating_0d) -> Array1D[np.floating]: ... +def polyline(off: _nt.CoFloating_0d, scl: _nt.ToFloating_0d) -> _float_1d: ... @overload -def polyline(off: ToComplex128_0d, scl: CoComplex128_0d) -> Array1D[np.complex128]: ... +def polyline(off: _nt.ToComplex128_0d, scl: _nt.CoComplex128_0d) -> _c128_1d: ... @overload -def polyline(off: CoComplex128_0d, scl: ToComplex128_0d) -> Array1D[np.complex128]: ... +def polyline(off: _nt.CoComplex128_0d, scl: _nt.ToComplex128_0d) -> _c128_1d: ... @overload -def polyline(off: ToComplex_0d, scl: CoComplex_0d) -> Array1D[np.complexfloating]: ... +def polyline(off: _nt.ToComplex_0d, scl: _nt.CoComplex_0d) -> _complex_1d: ... @overload -def polyline(off: CoComplex_0d, scl: ToComplex_0d) -> Array1D[np.complexfloating]: ... +def polyline(off: _nt.CoComplex_0d, scl: _nt.ToComplex_0d) -> _complex_1d: ... @overload -def polyline(off: CoComplex_0d, scl: CoComplex_0d) -> Array1D[np.number]: ... +def polyline(off: _nt.CoComplex_0d, scl: _nt.CoComplex_0d) -> _nt.Array1D[np.number]: ... @overload -def polyline(off: ToObject_0d, scl: ToObject_0d) -> Array1D[np.object_]: ... +def polyline(off: _nt.ToObject_0d, scl: _nt.ToObject_0d) -> _object_1d: ... # @overload -def polyfromroots(roots: ToFloat64_1d | CoInteger_1d) -> Array1D[np.float64]: ... +def polyfromroots(roots: _nt.ToFloat64_1d | _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polyfromroots(roots: CoFloating_1d) -> Array1D[np.floating]: ... +def polyfromroots(roots: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polyfromroots(roots: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polyfromroots(roots: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polyfromroots(roots: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polyfromroots(roots: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polyfromroots(roots: CoComplex_1d) -> Array1D[np.inexact]: ... +def polyfromroots(roots: _nt.CoComplex_1d) -> _inexact_1d: ... @overload -def polyfromroots(roots: ToObject_1d) -> Array1D[np.object_]: ... +def polyfromroots(roots: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polyadd(c1: CoInteger_1d, c2: CoInteger_1d) -> Array1D[np.float64]: ... +def polyadd(c1: _nt.CoInteger_1d, c2: _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polyadd(c1: ToFloat64_1d, c2: CoFloat64_1d) -> Array1D[np.float64]: ... +def polyadd(c1: _nt.ToFloat64_1d, c2: _nt.CoFloat64_1d) -> _f64_1d: ... @overload -def polyadd(c1: CoFloat64_1d, c2: ToFloat64_1d) -> Array1D[np.float64]: ... +def polyadd(c1: _nt.CoFloat64_1d, c2: _nt.ToFloat64_1d) -> _f64_1d: ... @overload -def polyadd(c1: ToReal_1d, c2: CoFloating_1d) -> Array1D[np.floating]: ... +def polyadd(c1: _nt.ToReal_1d, c2: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polyadd(c1: CoFloating_1d, c2: ToReal_1d) -> Array1D[np.floating]: ... +def polyadd(c1: _nt.CoFloating_1d, c2: _nt.ToReal_1d) -> _float_1d: ... @overload -def polyadd(c1: ToComplex128_1d, c2: CoComplex128_1d) -> Array1D[np.complex128]: ... +def polyadd(c1: _nt.ToComplex128_1d, c2: _nt.CoComplex128_1d) -> _c128_1d: ... @overload -def polyadd(c1: CoComplex128_1d, c2: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polyadd(c1: _nt.CoComplex128_1d, c2: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polyadd(c1: ToComplex_1d, c2: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def polyadd(c1: _nt.ToComplex_1d, c2: _nt.CoComplex_1d) -> _complex_1d: ... @overload -def polyadd(c1: CoComplex_1d, c2: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polyadd(c1: _nt.CoComplex_1d, c2: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polyadd(c1: ToObject_1d, c2: _ToNumeric_1d) -> Array1D[np.object_]: ... +def polyadd(c1: _nt.ToObject_1d, c2: _ToNumeric_1d) -> _object_1d: ... @overload -def polyadd(c1: _ToNumeric_1d, c2: ToObject_1d) -> Array1D[np.object_]: ... +def polyadd(c1: _ToNumeric_1d, c2: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polysub(c1: CoInteger_1d, c2: CoInteger_1d) -> Array1D[np.float64]: ... +def polysub(c1: _nt.CoInteger_1d, c2: _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polysub(c1: ToFloat64_1d, c2: CoFloat64_1d) -> Array1D[np.float64]: ... +def polysub(c1: _nt.ToFloat64_1d, c2: _nt.CoFloat64_1d) -> _f64_1d: ... @overload -def polysub(c1: CoFloat64_1d, c2: ToFloat64_1d) -> Array1D[np.float64]: ... +def polysub(c1: _nt.CoFloat64_1d, c2: _nt.ToFloat64_1d) -> _f64_1d: ... @overload -def polysub(c1: ToReal_1d, c2: CoFloating_1d) -> Array1D[np.floating]: ... +def polysub(c1: _nt.ToReal_1d, c2: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polysub(c1: CoFloating_1d, c2: ToReal_1d) -> Array1D[np.floating]: ... +def polysub(c1: _nt.CoFloating_1d, c2: _nt.ToReal_1d) -> _float_1d: ... @overload -def polysub(c1: ToComplex128_1d, c2: CoComplex128_1d) -> Array1D[np.complex128]: ... +def polysub(c1: _nt.ToComplex128_1d, c2: _nt.CoComplex128_1d) -> _c128_1d: ... @overload -def polysub(c1: CoComplex128_1d, c2: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polysub(c1: _nt.CoComplex128_1d, c2: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polysub(c1: ToComplex_1d, c2: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def polysub(c1: _nt.ToComplex_1d, c2: _nt.CoComplex_1d) -> _complex_1d: ... @overload -def polysub(c1: CoComplex_1d, c2: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polysub(c1: _nt.CoComplex_1d, c2: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polysub(c1: ToObject_1d, c2: _ToNumeric_1d) -> Array1D[np.object_]: ... +def polysub(c1: _nt.ToObject_1d, c2: _ToNumeric_1d) -> _object_1d: ... @overload -def polysub(c1: _ToNumeric_1d, c2: ToObject_1d) -> Array1D[np.object_]: ... +def polysub(c1: _ToNumeric_1d, c2: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polymulx(c: ToFloat64_1d | CoInteger_1d) -> Array1D[np.float64]: ... +def polymulx(c: _nt.ToFloat64_1d | _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polymulx(c: CoFloating_1d) -> Array1D[np.floating]: ... +def polymulx(c: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polymulx(c: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polymulx(c: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polymulx(c: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polymulx(c: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polymulx(c: CoComplex_1d) -> Array1D[np.inexact]: ... +def polymulx(c: _nt.CoComplex_1d) -> _inexact_1d: ... @overload -def polymulx(c: ToObject_1d) -> Array1D[np.object_]: ... +def polymulx(c: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polymul(c1: CoInteger_1d, c2: CoInteger_1d) -> Array1D[np.float64]: ... +def polymul(c1: _nt.CoInteger_1d, c2: _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polymul(c1: ToFloat64_1d, c2: CoFloat64_1d) -> Array1D[np.float64]: ... +def polymul(c1: _nt.ToFloat64_1d, c2: _nt.CoFloat64_1d) -> _f64_1d: ... @overload -def polymul(c1: CoFloat64_1d, c2: ToFloat64_1d) -> Array1D[np.float64]: ... +def polymul(c1: _nt.CoFloat64_1d, c2: _nt.ToFloat64_1d) -> _f64_1d: ... @overload -def polymul(c1: ToReal_1d, c2: CoFloating_1d) -> Array1D[np.floating]: ... +def polymul(c1: _nt.ToReal_1d, c2: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polymul(c1: CoFloating_1d, c2: ToReal_1d) -> Array1D[np.floating]: ... +def polymul(c1: _nt.CoFloating_1d, c2: _nt.ToReal_1d) -> _float_1d: ... @overload -def polymul(c1: ToComplex128_1d, c2: CoComplex128_1d) -> Array1D[np.complex128]: ... +def polymul(c1: _nt.ToComplex128_1d, c2: _nt.CoComplex128_1d) -> _c128_1d: ... @overload -def polymul(c1: CoComplex128_1d, c2: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polymul(c1: _nt.CoComplex128_1d, c2: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polymul(c1: ToComplex_1d, c2: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def polymul(c1: _nt.ToComplex_1d, c2: _nt.CoComplex_1d) -> _complex_1d: ... @overload -def polymul(c1: CoComplex_1d, c2: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polymul(c1: _nt.CoComplex_1d, c2: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polymul(c1: ToObject_1d, c2: _ToNumeric_1d) -> Array1D[np.object_]: ... +def polymul(c1: _nt.ToObject_1d, c2: _ToNumeric_1d) -> _object_1d: ... @overload -def polymul(c1: _ToNumeric_1d, c2: ToObject_1d) -> Array1D[np.object_]: ... +def polymul(c1: _ToNumeric_1d, c2: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polydiv(c1: CoInteger_1d, c2: CoInteger_1d) -> Array1D[np.float64]: ... +def polydiv(c1: _nt.CoInteger_1d, c2: _nt.CoInteger_1d) -> _f64_1d: ... @overload -def polydiv(c1: ToFloat64_1d, c2: CoFloat64_1d) -> Array1D[np.float64]: ... +def polydiv(c1: _nt.ToFloat64_1d, c2: _nt.CoFloat64_1d) -> _f64_1d: ... @overload -def polydiv(c1: CoFloat64_1d, c2: ToFloat64_1d) -> Array1D[np.float64]: ... +def polydiv(c1: _nt.CoFloat64_1d, c2: _nt.ToFloat64_1d) -> _f64_1d: ... @overload -def polydiv(c1: ToReal_1d, c2: CoFloating_1d) -> Array1D[np.floating]: ... +def polydiv(c1: _nt.ToReal_1d, c2: _nt.CoFloating_1d) -> _float_1d: ... @overload -def polydiv(c1: CoFloating_1d, c2: ToReal_1d) -> Array1D[np.floating]: ... +def polydiv(c1: _nt.CoFloating_1d, c2: _nt.ToReal_1d) -> _float_1d: ... @overload -def polydiv(c1: ToComplex128_1d, c2: CoComplex128_1d) -> Array1D[np.complex128]: ... +def polydiv(c1: _nt.ToComplex128_1d, c2: _nt.CoComplex128_1d) -> _c128_1d: ... @overload -def polydiv(c1: CoComplex128_1d, c2: ToComplex128_1d) -> Array1D[np.complex128]: ... +def polydiv(c1: _nt.CoComplex128_1d, c2: _nt.ToComplex128_1d) -> _c128_1d: ... @overload -def polydiv(c1: ToComplex_1d, c2: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def polydiv(c1: _nt.ToComplex_1d, c2: _nt.CoComplex_1d) -> _complex_1d: ... @overload -def polydiv(c1: CoComplex_1d, c2: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def polydiv(c1: _nt.CoComplex_1d, c2: _nt.ToComplex_1d) -> _complex_1d: ... @overload -def polydiv(c1: ToObject_1d, c2: _ToNumeric_1d) -> Array1D[np.object_]: ... +def polydiv(c1: _nt.ToObject_1d, c2: _ToNumeric_1d) -> _object_1d: ... @overload -def polydiv(c1: _ToNumeric_1d, c2: ToObject_1d) -> Array1D[np.object_]: ... +def polydiv(c1: _ToNumeric_1d, c2: _nt.ToObject_1d) -> _object_1d: ... # @overload -def polypow( - c: ToFloat64_1d | CoInteger_nd, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None -) -> Array1D[np.float64]: ... +def polypow(c: _nt.CoInteger_nd, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _f64_1d: ... +@overload +def polypow(c: _nt.ToFloat64_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _f64_1d: ... @overload -def polypow(c: CoFloating_1d, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None) -> Array1D[np.floating]: ... +def polypow(c: _nt.CoFloating_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _float_1d: ... @overload -def polypow(c: ToComplex128_1d, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None) -> Array1D[np.complex128]: ... +def polypow(c: _nt.ToComplex128_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _c128_1d: ... @overload -def polypow( - c: ToComplex_1d, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None -) -> Array1D[np.complexfloating]: ... +def polypow(c: _nt.ToComplex_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _complex_1d: ... @overload -def polypow(c: CoComplex_1d, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None) -> Array1D[np.inexact]: ... +def polypow(c: _nt.CoComplex_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _inexact_1d: ... @overload -def polypow(c: ToObject_1d, pow: CoInteger_0d, maxpower: CoInteger_0d | None = None) -> Array1D[np.object_]: ... +def polypow(c: _nt.ToObject_1d, pow: _nt.CoInteger_0d, maxpower: _nt.CoInteger_0d | None = None) -> _object_1d: ... # @overload -def polyder( - c: ToFloat64_nd | CoInteger_nd, - m: SupportsIndex = 1, - scl: CoFloating_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.float64]: ... +def polyder(c: _nt.CoInteger_nd, m: _Index = 1, scl: _nt.CoFloating_0d = 1, axis: _Index = 0) -> _f64_nd: ... @overload -def polyder( - c: ToFloating_nd, m: SupportsIndex = 1, scl: CoFloating_0d = 1, axis: SupportsIndex = 0 -) -> Array[np.floating]: ... +def polyder(c: _nt.ToFloat64_nd, m: _Index = 1, scl: _nt.CoFloating_0d = 1, axis: _Index = 0) -> _f64_nd: ... @overload -def polyder( - c: ToComplex128_nd, m: SupportsIndex = 1, scl: CoComplex_0d = 1, axis: SupportsIndex = 0 -) -> Array[np.complex128]: ... +def polyder(c: _nt.ToFloating_nd, m: _Index = 1, scl: _nt.CoFloating_0d = 1, axis: _Index = 0) -> _floating_nd: ... @overload -def polyder( - c: ToComplex_nd, - m: SupportsIndex = 1, - scl: CoComplex_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.complexfloating]: ... +def polyder(c: _nt.ToComplex128_nd, m: _Index = 1, scl: _nt.CoComplex_0d = 1, axis: _Index = 0) -> _c128_nd: ... @overload -def polyder( - c: CoComplex_nd, m: SupportsIndex = 1, scl: CoComplex_0d = 1, axis: SupportsIndex = 0 -) -> Array[np.inexact]: ... +def polyder(c: _nt.ToComplex_nd, m: _Index = 1, scl: _nt.CoComplex_0d = 1, axis: _Index = 0) -> _complex_nd: ... @overload -def polyder( - c: ToObject_nd, m: SupportsIndex = 1, scl: _ToNumeric_0d = 1, axis: SupportsIndex = 0 -) -> Array[np.object_]: ... +def polyder(c: _nt.CoComplex_nd, m: _Index = 1, scl: _nt.CoComplex_0d = 1, axis: _Index = 0) -> _inexact_nd: ... +@overload +def polyder(c: _nt.ToObject_nd, m: _Index = 1, scl: _ToNumeric_0d = 1, axis: _Index = 0) -> _object_nd: ... # @overload def polyint( - c: ToFloat64_nd | CoInteger_nd, - m: SupportsIndex = 1, - k: CoFloat64_0d | CoFloat64_1d = [], - lbnd: CoFloating_0d = 0, - scl: CoFloating_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.float64]: ... + c: _nt.CoInteger_nd, + m: _Index = 1, + k: _nt.CoFloat64_0d | _nt.CoFloat64_1d = [], + lbnd: _nt.CoFloating_0d = 0, + scl: _nt.CoFloating_0d = 1, + axis: _Index = 0, +) -> _f64_nd: ... +@overload +def polyint( + c: _nt.ToFloat64_nd, + m: _Index = 1, + k: _nt.CoFloat64_0d | _nt.CoFloat64_1d = [], + lbnd: _nt.CoFloating_0d = 0, + scl: _nt.CoFloating_0d = 1, + axis: _Index = 0, +) -> _f64_nd: ... @overload def polyint( - c: CoFloating_nd, - m: SupportsIndex = 1, - k: CoFloating_0d | CoFloating_1d = [], - lbnd: CoFloating_0d = 0, - scl: CoFloating_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.floating]: ... + c: _nt.CoFloating_nd, + m: _Index = 1, + k: _nt.CoFloating_0d | _nt.CoFloating_1d = [], + lbnd: _nt.CoFloating_0d = 0, + scl: _nt.CoFloating_0d = 1, + axis: _Index = 0, +) -> _floating_nd: ... @overload def polyint( - c: ToComplex_nd, - m: SupportsIndex = 1, - k: CoComplex_0d | CoComplex_1d = [], - lbnd: CoComplex_0d = 0, - scl: CoComplex_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.complexfloating]: ... + c: _nt.ToComplex_nd, + m: _Index = 1, + k: _nt.CoComplex_0d | _nt.CoComplex_1d = [], + lbnd: _nt.CoComplex_0d = 0, + scl: _nt.CoComplex_0d = 1, + axis: _Index = 0, +) -> _complex_nd: ... @overload def polyint( - c: CoComplex_nd, - m: SupportsIndex, - k: ToComplex_0d | ToComplex_1d, - lbnd: CoComplex_0d = 0, - scl: CoComplex_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.complexfloating]: ... + c: _nt.CoComplex_nd, + m: _Index, + k: _nt.ToComplex_0d | _nt.ToComplex_1d, + lbnd: _nt.CoComplex_0d = 0, + scl: _nt.CoComplex_0d = 1, + axis: _Index = 0, +) -> _complex_nd: ... @overload def polyint( - c: CoComplex_nd, - m: SupportsIndex = 1, + c: _nt.CoComplex_nd, + m: _Index = 1, *, - k: ToComplex_0d | ToComplex_1d, - lbnd: CoComplex_0d = 0, - scl: CoComplex_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.complexfloating]: ... + k: _nt.ToComplex_0d | _nt.ToComplex_1d, + lbnd: _nt.CoComplex_0d = 0, + scl: _nt.CoComplex_0d = 1, + axis: _Index = 0, +) -> _complex_nd: ... @overload def polyint( - c: ToObject_nd, - m: SupportsIndex = 1, + c: _nt.ToObject_nd, + m: _Index = 1, k: _ToNumeric_0d | _ToNumeric_1d = [], lbnd: _ToNumeric_0d = 0, scl: _ToNumeric_0d = 1, - axis: SupportsIndex = 0, -) -> Array[np.object_]: ... + axis: _Index = 0, +) -> _object_nd: ... # @overload -def polyvalfromroots(x: CoFloating_0d, r: CoFloating_0d, tensor: bool = True) -> np.floating: ... +def polyvalfromroots(x: _nt.CoFloating_0d, r: _nt.CoFloating_0d, tensor: bool = True) -> np.floating: ... @overload -def polyvalfromroots(x: CoFloating_1nd, r: CoFloating_nd, tensor: bool = True) -> Array[np.floating]: ... +def polyvalfromroots(x: _nt.CoFloating_1nd, r: _nt.CoFloating_nd, tensor: bool = True) -> _floating_nd: ... @overload -def polyvalfromroots(x: CoFloating_nd, r: CoFloating_1nd, tensor: bool = True) -> Array[np.floating]: ... +def polyvalfromroots(x: _nt.CoFloating_nd, r: _nt.CoFloating_1nd, tensor: bool = True) -> _floating_nd: ... @overload -def polyvalfromroots(x: ToComplex_0d, r: CoComplex_0d, tensor: bool = True) -> np.complexfloating: ... +def polyvalfromroots(x: _nt.ToComplex_0d, r: _nt.CoComplex_0d, tensor: bool = True) -> np.complexfloating: ... @overload -def polyvalfromroots(x: CoComplex_0d, r: ToComplex_0d, tensor: bool = True) -> np.complexfloating: ... +def polyvalfromroots(x: _nt.CoComplex_0d, r: _nt.ToComplex_0d, tensor: bool = True) -> np.complexfloating: ... @overload -def polyvalfromroots(x: ToComplex_1nd, r: CoComplex_nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyvalfromroots(x: _nt.ToComplex_1nd, r: _nt.CoComplex_nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyvalfromroots(x: ToComplex_nd, r: CoComplex_1nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyvalfromroots(x: _nt.ToComplex_nd, r: _nt.CoComplex_1nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyvalfromroots(x: CoComplex_1nd, r: ToComplex_nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyvalfromroots(x: _nt.CoComplex_1nd, r: _nt.ToComplex_nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyvalfromroots(x: CoComplex_nd, r: ToComplex_1nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyvalfromroots(x: _nt.CoComplex_nd, r: _nt.ToComplex_1nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyvalfromroots(x: ToObject_1nd, r: _ToNumeric_nd, tensor: bool = True) -> Array[np.object_]: ... +def polyvalfromroots(x: _nt.ToObject_1nd, r: _ToNumeric_nd, tensor: bool = True) -> _object_nd: ... @overload -def polyvalfromroots(x: _ToNumeric_nd, r: ToObject_1nd, tensor: bool = True) -> Array[np.object_]: ... +def polyvalfromroots(x: _ToNumeric_nd, r: _nt.ToObject_1nd, tensor: bool = True) -> _object_nd: ... # @overload -def polyval(x: CoInteger_0d, c: CoInteger_1d, tensor: bool = True) -> np.float64: ... +def polyval(x: _nt.CoInteger_0d, c: _nt.CoInteger_1d, tensor: bool = True) -> np.float64: ... @overload -def polyval(x: ToFloat64_0d, c: CoFloat64_1d, tensor: bool = True) -> np.float64: ... +def polyval(x: _nt.ToFloat64_0d, c: _nt.CoFloat64_1d, tensor: bool = True) -> np.float64: ... @overload -def polyval(x: CoFloat64_0d, c: ToFloat64_1d, tensor: bool = True) -> np.float64: ... +def polyval(x: _nt.CoFloat64_0d, c: _nt.ToFloat64_1d, tensor: bool = True) -> np.float64: ... @overload -def polyval(x: CoFloating_0d, c: CoFloating_1d, tensor: bool = True) -> np.floating: ... +def polyval(x: _nt.CoFloating_0d, c: _nt.CoFloating_1d, tensor: bool = True) -> np.floating: ... @overload -def polyval(x: ToComplex_0d, c: CoComplex_1d, tensor: bool = True) -> np.complexfloating: ... +def polyval(x: _nt.ToComplex_0d, c: _nt.CoComplex_1d, tensor: bool = True) -> np.complexfloating: ... @overload -def polyval(x: CoComplex_0d, c: ToComplex_1d, tensor: bool = True) -> np.complexfloating: ... +def polyval(x: _nt.CoComplex_0d, c: _nt.ToComplex_1d, tensor: bool = True) -> np.complexfloating: ... @overload -def polyval(x: ToFloat64_1nd, c: CoFloat64_1nd, tensor: bool = True) -> Array[np.float64]: ... +def polyval(x: _nt.ToFloat64_1nd, c: _nt.CoFloat64_1nd, tensor: bool = True) -> _f64_nd: ... @overload -def polyval(x: CoFloat64_1nd, c: ToFloat64_1nd, tensor: bool = True) -> Array[np.float64]: ... +def polyval(x: _nt.CoFloat64_1nd, c: _nt.ToFloat64_1nd, tensor: bool = True) -> _f64_nd: ... @overload -def polyval(x: CoFloating_1nd, c: CoFloating_1nd, tensor: bool = True) -> Array[np.floating]: ... +def polyval(x: _nt.CoFloating_1nd, c: _nt.CoFloating_1nd, tensor: bool = True) -> _floating_nd: ... @overload -def polyval(x: ToComplex_1nd, c: CoComplex_1nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyval(x: _nt.ToComplex_1nd, c: _nt.CoComplex_1nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyval(x: CoComplex_1nd, c: ToComplex_1nd, tensor: bool = True) -> Array[np.complexfloating]: ... +def polyval(x: _nt.CoComplex_1nd, c: _nt.ToComplex_1nd, tensor: bool = True) -> _complex_nd: ... @overload -def polyval(x: ToObject_1nd, c: _ToNumeric_nd, tensor: bool = True) -> Array[np.object_]: ... +def polyval(x: _nt.ToObject_1nd, c: _ToNumeric_nd, tensor: bool = True) -> _object_nd: ... @overload -def polyval(x: _ToNumeric_nd, c: ToObject_1nd, tensor: bool = True) -> Array[np.object_]: ... +def polyval(x: _ToNumeric_nd, c: _nt.ToObject_1nd, tensor: bool = True) -> _object_nd: ... # @overload -def polyval2d(x: CoInteger_0d, y: CoInteger_0d, c: CoInteger_1d) -> np.float64: ... +def polyval2d(x: _nt.CoInteger_0d, y: _nt.CoInteger_0d, c: _nt.CoInteger_1d) -> np.float64: ... @overload -def polyval2d(x: ToFloat64_0d, y: CoFloat64_0d, c: CoFloat64_1d) -> np.float64: ... +def polyval2d(x: _nt.ToFloat64_0d, y: _nt.CoFloat64_0d, c: _nt.CoFloat64_1d) -> np.float64: ... @overload -def polyval2d(x: CoFloat64_0d, y: ToFloat64_0d, c: CoFloat64_1d) -> np.float64: ... +def polyval2d(x: _nt.CoFloat64_0d, y: _nt.ToFloat64_0d, c: _nt.CoFloat64_1d) -> np.float64: ... @overload -def polyval2d(x: CoFloat64_0d, y: CoFloat64_0d, c: ToFloat64_1d) -> np.float64: ... +def polyval2d(x: _nt.CoFloat64_0d, y: _nt.CoFloat64_0d, c: _nt.ToFloat64_1d) -> np.float64: ... @overload -def polyval2d(x: CoFloating_0d, y: CoFloating_0d, c: CoFloating_1d) -> np.floating: ... +def polyval2d(x: _nt.CoFloating_0d, y: _nt.CoFloating_0d, c: _nt.CoFloating_1d) -> np.floating: ... @overload -def polyval2d(x: ToComplex_0d, y: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polyval2d(x: _nt.ToComplex_0d, y: _nt.CoComplex_0d, c: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def polyval2d(x: CoComplex_0d, y: ToComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polyval2d(x: _nt.CoComplex_0d, y: _nt.ToComplex_0d, c: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def polyval2d(x: CoComplex_0d, y: CoComplex_0d, c: ToComplex_1d) -> np.complexfloating: ... +def polyval2d(x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, c: _nt.ToComplex_1d) -> np.complexfloating: ... @overload -def polyval2d(x: ToFloat64_1nd, y: CoFloat64_nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.ToFloat64_1nd, y: _nt.CoFloat64_nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: CoFloat64_1nd, y: ToFloat64_nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.CoFloat64_1nd, y: _nt.ToFloat64_nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: CoFloat64_1nd, y: CoFloat64_nd, c: ToFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.CoFloat64_1nd, y: _nt.CoFloat64_nd, c: _nt.ToFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: ToFloat64_nd, y: CoFloat64_1nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.ToFloat64_nd, y: _nt.CoFloat64_1nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: CoFloat64_nd, y: ToFloat64_1nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.CoFloat64_nd, y: _nt.ToFloat64_1nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: CoFloat64_nd, y: CoFloat64_1nd, c: ToFloat64_1nd) -> Array[np.float64]: ... +def polyval2d(x: _nt.CoFloat64_nd, y: _nt.CoFloat64_1nd, c: _nt.ToFloat64_1nd) -> _f64_nd: ... @overload -def polyval2d(x: CoFloating_1nd, y: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polyval2d(x: _nt.CoFloating_1nd, y: _nt.CoFloating_nd, c: _nt.CoFloating_1nd) -> _floating_nd: ... @overload -def polyval2d(x: CoFloating_nd, y: CoFloating_1nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polyval2d(x: _nt.CoFloating_nd, y: _nt.CoFloating_1nd, c: _nt.CoFloating_1nd) -> _floating_nd: ... @overload -def polyval2d(x: ToComplex_1nd, y: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.ToComplex_1nd, y: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: CoComplex_1nd, y: ToComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.CoComplex_1nd, y: _nt.ToComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: CoComplex_1nd, y: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.CoComplex_1nd, y: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: ToComplex_nd, y: CoComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.ToComplex_nd, y: _nt.CoComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: CoComplex_nd, y: ToComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.CoComplex_nd, y: _nt.ToComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: CoComplex_nd, y: CoComplex_1nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval2d(x: _nt.CoComplex_nd, y: _nt.CoComplex_1nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polyval2d(x: ToObject_1nd, y: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polyval2d(x: _nt.ToObject_1nd, y: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polyval2d(x: _ToNumeric_nd, y: ToObject_1nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polyval2d(x: _ToNumeric_nd, y: _nt.ToObject_1nd, c: _ToNumeric_nd) -> _object_nd: ... # keep in sync with *val2d @overload -def polygrid2d(x: CoInteger_0d, y: CoInteger_0d, c: CoInteger_1d) -> np.float64: ... +def polygrid2d(x: _nt.CoInteger_0d, y: _nt.CoInteger_0d, c: _nt.CoInteger_1d) -> np.float64: ... @overload -def polygrid2d(x: ToFloat64_0d, y: CoFloat64_0d, c: CoFloat64_1d) -> np.float64: ... +def polygrid2d(x: _nt.ToFloat64_0d, y: _nt.CoFloat64_0d, c: _nt.CoFloat64_1d) -> np.float64: ... @overload -def polygrid2d(x: CoFloat64_0d, y: ToFloat64_0d, c: CoFloat64_1d) -> np.float64: ... +def polygrid2d(x: _nt.CoFloat64_0d, y: _nt.ToFloat64_0d, c: _nt.CoFloat64_1d) -> np.float64: ... @overload -def polygrid2d(x: CoFloat64_0d, y: CoFloat64_0d, c: ToFloat64_1d) -> np.float64: ... +def polygrid2d(x: _nt.CoFloat64_0d, y: _nt.CoFloat64_0d, c: _nt.ToFloat64_1d) -> np.float64: ... @overload -def polygrid2d(x: CoFloating_0d, y: CoFloating_0d, c: CoFloating_1d) -> np.floating: ... +def polygrid2d(x: _nt.CoFloating_0d, y: _nt.CoFloating_0d, c: _nt.CoFloating_1d) -> np.floating: ... @overload -def polygrid2d(x: ToComplex_0d, y: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polygrid2d(x: _nt.ToComplex_0d, y: _nt.CoComplex_0d, c: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def polygrid2d(x: CoComplex_0d, y: ToComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polygrid2d(x: _nt.CoComplex_0d, y: _nt.ToComplex_0d, c: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def polygrid2d(x: CoComplex_0d, y: CoComplex_0d, c: ToComplex_1d) -> np.complexfloating: ... +def polygrid2d(x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, c: _nt.ToComplex_1d) -> np.complexfloating: ... @overload -def polygrid2d(x: ToFloat64_1nd, y: CoFloat64_nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.ToFloat64_1nd, y: _nt.CoFloat64_nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: CoFloat64_1nd, y: ToFloat64_nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.CoFloat64_1nd, y: _nt.ToFloat64_nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: CoFloat64_1nd, y: CoFloat64_nd, c: ToFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.CoFloat64_1nd, y: _nt.CoFloat64_nd, c: _nt.ToFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: ToFloat64_nd, y: CoFloat64_1nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.ToFloat64_nd, y: _nt.CoFloat64_1nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: CoFloat64_nd, y: ToFloat64_1nd, c: CoFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.CoFloat64_nd, y: _nt.ToFloat64_1nd, c: _nt.CoFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: CoFloat64_nd, y: CoFloat64_1nd, c: ToFloat64_1nd) -> Array[np.float64]: ... +def polygrid2d(x: _nt.CoFloat64_nd, y: _nt.CoFloat64_1nd, c: _nt.ToFloat64_1nd) -> _f64_nd: ... @overload -def polygrid2d(x: CoFloating_1nd, y: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polygrid2d(x: _nt.CoFloating_1nd, y: _nt.CoFloating_nd, c: _nt.CoFloating_1nd) -> _floating_nd: ... @overload -def polygrid2d(x: CoFloating_nd, y: CoFloating_1nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polygrid2d(x: _nt.CoFloating_nd, y: _nt.CoFloating_1nd, c: _nt.CoFloating_1nd) -> _floating_nd: ... @overload -def polygrid2d(x: ToComplex_1nd, y: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.ToComplex_1nd, y: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: CoComplex_1nd, y: ToComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.CoComplex_1nd, y: _nt.ToComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: CoComplex_1nd, y: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.CoComplex_1nd, y: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: ToComplex_nd, y: CoComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.ToComplex_nd, y: _nt.CoComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: CoComplex_nd, y: ToComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.CoComplex_nd, y: _nt.ToComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: CoComplex_nd, y: CoComplex_1nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid2d(x: _nt.CoComplex_nd, y: _nt.CoComplex_1nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polygrid2d(x: ToObject_1nd, y: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polygrid2d(x: _nt.ToObject_1nd, y: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polygrid2d(x: _ToNumeric_nd, y: ToObject_1nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polygrid2d(x: _ToNumeric_nd, y: _nt.ToObject_1nd, c: _ToNumeric_nd) -> _object_nd: ... # @overload -def polyval3d(x: CoFloating_0d, y: CoFloating_0d, z: CoFloating_0d, c: CoFloating_1d) -> np.floating: ... +def polyval3d( + x: _nt.CoFloating_0d, y: _nt.CoFloating_0d, z: _nt.CoFloating_0d, c: _nt.CoFloating_1d +) -> np.floating: ... @overload -def polyval3d(x: CoFloating_1nd, y: CoFloating_nd, z: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polyval3d( + x: _nt.CoFloating_1nd, y: _nt.CoFloating_nd, z: _nt.CoFloating_nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polyval3d(x: CoFloating_nd, y: CoFloating_1nd, z: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polyval3d( + x: _nt.CoFloating_nd, y: _nt.CoFloating_1nd, z: _nt.CoFloating_nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polyval3d(x: CoFloating_nd, y: CoFloating_nd, z: CoFloating_1nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polyval3d( + x: _nt.CoFloating_nd, y: _nt.CoFloating_nd, z: _nt.CoFloating_1nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polyval3d(x: ToComplex_0d, y: CoComplex_0d, z: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polyval3d( + x: _nt.ToComplex_0d, y: _nt.CoComplex_0d, z: _nt.CoComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polyval3d(x: CoComplex_0d, y: ToComplex_0d, z: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polyval3d( + x: _nt.CoComplex_0d, y: _nt.ToComplex_0d, z: _nt.CoComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polyval3d(x: CoComplex_0d, y: CoComplex_0d, z: ToComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polyval3d( + x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, z: _nt.ToComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polyval3d(x: CoComplex_0d, y: CoComplex_0d, z: CoComplex_0d, c: ToComplex_1d) -> np.complexfloating: ... +def polyval3d( + x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, z: _nt.CoComplex_0d, c: _nt.ToComplex_1d +) -> np.complexfloating: ... @overload -def polyval3d(x: ToComplex_1nd, y: CoComplex_nd, z: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.ToComplex_1nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: CoComplex_nd, y: ToComplex_1nd, z: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.CoComplex_nd, y: _nt.ToComplex_1nd, z: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: CoComplex_nd, y: CoComplex_nd, z: ToComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_nd, z: _nt.ToComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: CoComplex_1nd, y: CoComplex_nd, z: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.CoComplex_1nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: CoComplex_nd, y: CoComplex_1nd, z: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_1nd, z: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: CoComplex_nd, y: CoComplex_nd, z: CoComplex_1nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_1nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polyval3d(x: ToObject_1nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polyval3d(x: _nt.ToObject_1nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polyval3d(x: ToObject_1nd, y: ToObject_1nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polyval3d(x: _nt.ToObject_1nd, y: _nt.ToObject_1nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polyval3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: ToObject_1nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polyval3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _nt.ToObject_1nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polyval3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: ToObject_1nd) -> Array[np.object_]: ... +def polyval3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _nt.ToObject_1nd) -> _object_nd: ... # keep in sync with *val3d @overload -def polygrid3d(x: CoFloating_0d, y: CoFloating_0d, z: CoFloating_0d, c: CoFloating_1d) -> np.floating: ... +def polygrid3d( + x: _nt.CoFloating_0d, y: _nt.CoFloating_0d, z: _nt.CoFloating_0d, c: _nt.CoFloating_1d +) -> np.floating: ... @overload -def polygrid3d(x: CoFloating_1nd, y: CoFloating_nd, z: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polygrid3d( + x: _nt.CoFloating_1nd, y: _nt.CoFloating_nd, z: _nt.CoFloating_nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polygrid3d(x: CoFloating_nd, y: CoFloating_1nd, z: CoFloating_nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polygrid3d( + x: _nt.CoFloating_nd, y: _nt.CoFloating_1nd, z: _nt.CoFloating_nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polygrid3d(x: CoFloating_nd, y: CoFloating_nd, z: CoFloating_1nd, c: CoFloating_1nd) -> Array[np.floating]: ... +def polygrid3d( + x: _nt.CoFloating_nd, y: _nt.CoFloating_nd, z: _nt.CoFloating_1nd, c: _nt.CoFloating_1nd +) -> _floating_nd: ... @overload -def polygrid3d(x: ToComplex_0d, y: CoComplex_0d, z: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polygrid3d( + x: _nt.ToComplex_0d, y: _nt.CoComplex_0d, z: _nt.CoComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polygrid3d(x: CoComplex_0d, y: ToComplex_0d, z: CoComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polygrid3d( + x: _nt.CoComplex_0d, y: _nt.ToComplex_0d, z: _nt.CoComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polygrid3d(x: CoComplex_0d, y: CoComplex_0d, z: ToComplex_0d, c: CoComplex_1d) -> np.complexfloating: ... +def polygrid3d( + x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, z: _nt.ToComplex_0d, c: _nt.CoComplex_1d +) -> np.complexfloating: ... @overload -def polygrid3d(x: CoComplex_0d, y: CoComplex_0d, z: CoComplex_0d, c: ToComplex_1d) -> np.complexfloating: ... +def polygrid3d( + x: _nt.CoComplex_0d, y: _nt.CoComplex_0d, z: _nt.CoComplex_0d, c: _nt.ToComplex_1d +) -> np.complexfloating: ... @overload -def polygrid3d(x: ToComplex_1nd, y: CoComplex_nd, z: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.ToComplex_1nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: CoComplex_nd, y: ToComplex_1nd, z: CoComplex_nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.CoComplex_nd, y: _nt.ToComplex_1nd, z: _nt.CoComplex_nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: CoComplex_nd, y: CoComplex_nd, z: ToComplex_1nd, c: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_nd, z: _nt.ToComplex_1nd, c: _nt.CoComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: CoComplex_1nd, y: CoComplex_nd, z: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.CoComplex_1nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: CoComplex_nd, y: CoComplex_1nd, z: CoComplex_nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_1nd, z: _nt.CoComplex_nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: CoComplex_nd, y: CoComplex_nd, z: CoComplex_1nd, c: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polygrid3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_1nd, c: _nt.ToComplex_1nd) -> _complex_nd: ... @overload -def polygrid3d(x: ToObject_1nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polygrid3d(x: _nt.ToObject_1nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polygrid3d(x: ToObject_1nd, y: ToObject_1nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polygrid3d(x: _nt.ToObject_1nd, y: _nt.ToObject_1nd, z: _ToNumeric_nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polygrid3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: ToObject_1nd, c: _ToNumeric_nd) -> Array[np.object_]: ... +def polygrid3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _nt.ToObject_1nd, c: _ToNumeric_nd) -> _object_nd: ... @overload -def polygrid3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: ToObject_1nd) -> Array[np.object_]: ... +def polygrid3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, c: _nt.ToObject_1nd) -> _object_nd: ... # @overload -def polyvander(x: ToFloat64_nd | CoInteger_nd, deg: SupportsIndex) -> Array[np.float64]: ... +def polyvander(x: _nt.ToFloat64_nd | _nt.CoInteger_nd, deg: _Index) -> _f64_nd: ... @overload -def polyvander(x: CoFloating_nd, deg: SupportsIndex) -> Array[np.floating]: ... +def polyvander(x: _nt.CoFloating_nd, deg: _Index) -> _floating_nd: ... @overload -def polyvander(x: ToComplex128_nd, deg: SupportsIndex) -> Array[np.complex128]: ... +def polyvander(x: _nt.ToComplex128_nd, deg: _Index) -> _c128_nd: ... @overload -def polyvander(x: ToComplex_nd, deg: SupportsIndex) -> Array[np.complexfloating]: ... +def polyvander(x: _nt.ToComplex_nd, deg: _Index) -> _complex_nd: ... @overload -def polyvander(x: CoComplex_nd, deg: SupportsIndex) -> Array[np.inexact]: ... +def polyvander(x: _nt.CoComplex_nd, deg: _Index) -> _inexact_nd: ... @overload -def polyvander(x: ToObject_nd, deg: SupportsIndex) -> Array[np.object_]: ... +def polyvander(x: _nt.ToObject_nd, deg: _Index) -> _object_nd: ... @overload -def polyvander(x: _ToNumeric_nd, deg: SupportsIndex) -> Array[Any]: ... +def polyvander(x: _ToNumeric_nd, deg: _Index) -> _nt.Array: ... # @overload -def polyvander2d(x: CoInteger_nd, y: CoInteger_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander2d(x: _nt.CoInteger_nd, y: _nt.CoInteger_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander2d(x: ToFloat64_nd, y: CoFloat64_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander2d(x: _nt.ToFloat64_nd, y: _nt.CoFloat64_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander2d(x: CoFloat64_nd, y: ToFloat64_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander2d(x: _nt.CoFloat64_nd, y: _nt.ToFloat64_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander2d(x: CoFloating_nd, y: CoFloating_nd, deg: _Indices) -> Array[np.floating]: ... +def polyvander2d(x: _nt.CoFloating_nd, y: _nt.CoFloating_nd, deg: _Indices) -> _floating_nd: ... @overload -def polyvander2d(x: ToComplex_nd, y: CoComplex_nd, deg: _Indices) -> Array[np.complexfloating]: ... +def polyvander2d(x: _nt.ToComplex_nd, y: _nt.CoComplex_nd, deg: _Indices) -> _complex_nd: ... @overload -def polyvander2d(x: CoComplex_nd, y: ToComplex_nd, deg: _Indices) -> Array[np.complexfloating]: ... +def polyvander2d(x: _nt.CoComplex_nd, y: _nt.ToComplex_nd, deg: _Indices) -> _complex_nd: ... @overload -def polyvander2d(x: ToObject_nd, y: _ToNumeric_nd, deg: _Indices) -> Array[np.object_]: ... +def polyvander2d(x: _nt.ToObject_nd, y: _ToNumeric_nd, deg: _Indices) -> _object_nd: ... @overload -def polyvander2d(x: _ToNumeric_nd, y: ToObject_nd, deg: _Indices) -> Array[np.object_]: ... +def polyvander2d(x: _ToNumeric_nd, y: _nt.ToObject_nd, deg: _Indices) -> _object_nd: ... @overload -def polyvander2d(x: _ToNumeric_nd, y: _ToNumeric_nd, deg: _Indices) -> Array[Any]: ... +def polyvander2d(x: _ToNumeric_nd, y: _ToNumeric_nd, deg: _Indices) -> _nt.Array: ... # @overload -def polyvander3d(x: CoInteger_nd, y: CoInteger_nd, z: CoInteger_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander3d(x: _nt.CoInteger_nd, y: _nt.CoInteger_nd, z: _nt.CoInteger_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander3d(x: ToFloat64_nd, y: CoFloat64_nd, z: CoFloat64_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander3d(x: _nt.ToFloat64_nd, y: _nt.CoFloat64_nd, z: _nt.CoFloat64_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander3d(x: CoFloat64_nd, y: ToFloat64_nd, z: CoFloat64_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander3d(x: _nt.CoFloat64_nd, y: _nt.ToFloat64_nd, z: _nt.CoFloat64_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander3d(x: CoFloat64_nd, y: CoFloat64_nd, z: ToFloat64_nd, deg: _Indices) -> Array[np.float64]: ... +def polyvander3d(x: _nt.CoFloat64_nd, y: _nt.CoFloat64_nd, z: _nt.ToFloat64_nd, deg: _Indices) -> _f64_nd: ... @overload -def polyvander3d(x: CoFloating_nd, y: CoFloating_nd, z: CoFloating_nd, deg: _Indices) -> Array[np.floating]: ... +def polyvander3d(x: _nt.CoFloating_nd, y: _nt.CoFloating_nd, z: _nt.CoFloating_nd, deg: _Indices) -> _floating_nd: ... @overload -def polyvander3d(x: ToComplex_nd, y: CoComplex_nd, z: CoComplex_nd, deg: _Indices) -> Array[np.complexfloating]: ... +def polyvander3d(x: _nt.ToComplex_nd, y: _nt.CoComplex_nd, z: _nt.CoComplex_nd, deg: _Indices) -> _complex_nd: ... @overload -def polyvander3d(x: CoComplex_nd, y: ToComplex_nd, z: CoComplex_nd, deg: _Indices) -> Array[np.complexfloating]: ... +def polyvander3d(x: _nt.CoComplex_nd, y: _nt.ToComplex_nd, z: _nt.CoComplex_nd, deg: _Indices) -> _complex_nd: ... @overload -def polyvander3d(x: CoComplex_nd, y: CoComplex_nd, z: ToComplex_nd, deg: _Indices) -> Array[np.complexfloating]: ... +def polyvander3d(x: _nt.CoComplex_nd, y: _nt.CoComplex_nd, z: _nt.ToComplex_nd, deg: _Indices) -> _complex_nd: ... @overload -def polyvander3d(x: ToObject_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, deg: _Indices) -> Array[np.object_]: ... +def polyvander3d(x: _nt.ToObject_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, deg: _Indices) -> _object_nd: ... @overload -def polyvander3d(x: _ToNumeric_nd, y: ToObject_nd, z: _ToNumeric_nd, deg: _Indices) -> Array[np.object_]: ... +def polyvander3d(x: _ToNumeric_nd, y: _nt.ToObject_nd, z: _ToNumeric_nd, deg: _Indices) -> _object_nd: ... @overload -def polyvander3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: ToObject_nd, deg: _Indices) -> Array[np.object_]: ... +def polyvander3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _nt.ToObject_nd, deg: _Indices) -> _object_nd: ... @overload -def polyvander3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, deg: _Indices) -> Array[Any]: ... +def polyvander3d(x: _ToNumeric_nd, y: _ToNumeric_nd, z: _ToNumeric_nd, deg: _Indices) -> _nt.Array: ... # @overload def polyfit( - x: ToFloat64_1d | CoInteger_1d, - y: ToFloat64_nd | CoInteger_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloat64_1d | _nt.CoInteger_1d, + y: _nt.ToFloat64_nd | _nt.CoInteger_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, full: L[False] = False, - w: ToFloating_1d | None = None, -) -> Array[np.float64]: ... + w: _nt.ToFloating_1d | None = None, +) -> _f64_nd: ... @overload def polyfit( - x: ToFloat64_1d | CoInteger_1d, - y: ToFloat64_nd | CoInteger_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloat64_1d | _nt.CoInteger_1d, + y: _nt.ToFloat64_nd | _nt.CoInteger_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.float64]: ... @overload def polyfit( - x: ToFloat64_1d | CoInteger_1d, - y: ToFloat64_nd | CoInteger_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloat64_1d | _nt.CoInteger_1d, + y: _nt.ToFloat64_nd | _nt.CoInteger_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.float64]: ... @overload def polyfit( - x: ToFloating_1d, - y: CoFloating_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloating_1d, + y: _nt.CoFloating_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, full: L[False] = False, - w: ToFloating_1d | None = None, -) -> Array[np.floating]: ... + w: _nt.ToFloating_1d | None = None, +) -> _floating_nd: ... @overload def polyfit( - x: ToFloating_1d, - y: CoFloating_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloating_1d, + y: _nt.CoFloating_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.floating]: ... @overload def polyfit( - x: ToFloating_1d, - y: CoFloating_nd, - deg: int | CoInteger_1d, + x: _nt.ToFloating_1d, + y: _nt.CoFloating_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.floating]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_nd, - deg: int | CoInteger_1d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, full: L[False] = False, - w: ToFloating_1d | None = None, -) -> Array[np.complexfloating]: ... + w: _nt.ToFloating_1d | None = None, +) -> _complex_nd: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_nd, - deg: int | CoInteger_1d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, full: L[False] = False, - w: ToFloating_1d | None = None, -) -> Array[np.complexfloating]: ... + w: _nt.ToFloating_1d | None = None, +) -> _complex_nd: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_nd, - deg: int | CoInteger_1d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.complexfloating]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_nd, - deg: int | CoInteger_1d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.complexfloating]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_nd, - deg: int | CoInteger_1d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.complexfloating]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_nd, - deg: int | CoInteger_1d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.complexfloating]: ... @overload def polyfit( - x: ToObject_1d, + x: _nt.ToObject_1d, y: _ToNumeric_nd, - deg: int | CoInteger_1d, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, full: L[False] = False, - w: ToFloating_1d | None = None, -) -> Array[np.object_]: ... + w: _nt.ToFloating_1d | None = None, +) -> _object_nd: ... @overload def polyfit( x: _ToNumeric_1d, - y: ToObject_nd, - deg: int | CoInteger_1d, + y: _nt.ToObject_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.object_]: ... @overload def polyfit( - x: ToObject_1d, + x: _nt.ToObject_1d, y: _ToNumeric_nd, - deg: int | CoInteger_1d, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.object_]: ... @overload def polyfit( x: _ToNumeric_1d, - y: ToObject_nd, - deg: int | CoInteger_1d, + y: _nt.ToObject_nd, + deg: int | _nt.CoInteger_1d, rcond: float | None = None, *, full: L[True], - w: ToFloating_1d | None = None, + w: _nt.ToFloating_1d | None = None, ) -> _ArrayAndFitResult[np.object_]: ... # @overload -def polycompanion(c: CoFloating_1d) -> Array2D[np.float64]: ... +def polycompanion(c: _nt.CoFloating_1d) -> _nt.Array2D[np.float64]: ... @overload -def polycompanion(c: ToComplex_1d) -> Array2D[np.complex128]: ... +def polycompanion(c: _nt.ToComplex_1d) -> _nt.Array2D[np.complex128]: ... @overload -def polycompanion(c: ToObject_1d) -> Array2D[np.object_]: ... +def polycompanion(c: _nt.ToObject_1d) -> _nt.Array2D[np.object_]: ... # @overload -def polyroots(c: CoFloating_1d) -> Array1D[np.float64]: ... +def polyroots(c: _nt.CoFloating_1d) -> _f64_1d: ... @overload -def polyroots(c: ToComplex_1d) -> Array1D[np.complex128]: ... +def polyroots(c: _nt.ToComplex_1d) -> _c128_1d: ... @overload -def polyroots(c: ToObject_1d) -> Array1D[np.object_]: ... +def polyroots(c: _nt.ToObject_1d) -> _object_1d: ... diff --git a/src/numpy-stubs/polynomial/polyutils.pyi b/src/numpy-stubs/polynomial/polyutils.pyi index 5be124c4..481d5b92 100644 --- a/src/numpy-stubs/polynomial/polyutils.pyi +++ b/src/numpy-stubs/polynomial/polyutils.pyi @@ -3,20 +3,8 @@ from collections.abc import Iterable, Sequence from typing import Any, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - CoComplex_0d, - CoComplex_1d, - CoFloating_0d, - CoFloating_1d, - ToComplex_0d, - ToComplex_1d, - ToObject_0d, - ToObject_1d, - _ToArray_1d, -) from numpy._typing import _FloatLike_co __all__ = ["as_series", "format_float", "getdomain", "mapdomain", "mapparms", "trimcoef", "trimseq"] @@ -25,11 +13,21 @@ __all__ = ["as_series", "format_float", "getdomain", "mapdomain", "mapparms", "t _T = TypeVar("_T") _T_seq = TypeVar( - "_T_seq", bound=Array[np.number | np.bool | np.object_] | SupportsLenAndGetItem[CoComplex_0d | ToObject_0d] + "_T_seq", + bound=_nt.Array[_nt.co_complex | np.object_] | SupportsLenAndGetItem[_nt.co_complex | np.object_], ) _Tuple2: TypeAlias = tuple[_T, _T] +_real: TypeAlias = np.integer | np.floating + +_CoFloating_01d: TypeAlias = _nt.CoFloating_0d | _nt.CoFloating_1d +_ToComplex_01d: TypeAlias = _nt.ToComplex_0d | _nt.ToComplex_1d +_ToObject_01d: TypeAlias = _nt.ToObject_0d | _nt.ToObject_1d + +_CoNumeric_0d: TypeAlias = _nt.CoComplex_0d | _nt.ToObject_0d +_CoNumeric_1d: TypeAlias = _nt.CoComplex_1d | _nt.ToObject_1d + ### # @@ -37,33 +35,33 @@ def trimseq(seq: _T_seq) -> _T_seq: ... # @overload -def as_series(alist: Array[np.floating | np.integer], trim: bool = True) -> list[Array1D[np.floating]]: ... +def as_series(alist: _nt.Array[_real], trim: bool = True) -> list[_nt.Array1D[np.floating]]: ... @overload -def as_series(alist: Array[np.complexfloating], trim: bool = True) -> list[Array1D[np.complexfloating]]: ... +def as_series(alist: _nt.Array[np.complexfloating], trim: bool = True) -> list[_nt.Array1D[np.complexfloating]]: ... @overload -def as_series(alist: Array[np.object_], trim: bool = True) -> list[Array1D[np.object_]]: ... +def as_series(alist: _nt.Array[np.object_], trim: bool = True) -> list[_nt.Array1D[np.object_]]: ... @overload -def as_series(alist: Iterable[CoFloating_1d | CoFloating_0d], trim: bool = True) -> list[Array1D[np.floating]]: ... +def as_series(alist: Iterable[_CoFloating_01d], trim: bool = True) -> list[_nt.Array1D[np.floating]]: ... @overload -def as_series(alist: Iterable[ToComplex_1d | ToComplex_0d], trim: bool = True) -> list[Array1D[np.complexfloating]]: ... +def as_series(alist: Iterable[_ToComplex_01d], trim: bool = True) -> list[_nt.Array1D[np.complexfloating]]: ... @overload -def as_series(alist: Iterable[ToObject_1d | ToObject_0d], trim: bool = True) -> list[Array1D[np.object_]]: ... +def as_series(alist: Iterable[_ToObject_01d], trim: bool = True) -> list[_nt.Array1D[np.object_]]: ... # @overload -def trimcoef(c: CoFloating_1d | CoFloating_0d, tol: _FloatLike_co = 0) -> Array1D[np.floating]: ... +def trimcoef(c: _CoFloating_01d, tol: _FloatLike_co = 0) -> _nt.Array1D[np.floating]: ... @overload -def trimcoef(c: ToComplex_1d | ToComplex_0d, tol: _FloatLike_co = 0) -> Array1D[np.complexfloating]: ... +def trimcoef(c: _ToComplex_01d, tol: _FloatLike_co = 0) -> _nt.Array1D[np.complexfloating]: ... @overload -def trimcoef(c: ToObject_1d | ToObject_0d, tol: _FloatLike_co = 0) -> Array1D[np.object_]: ... +def trimcoef(c: _ToObject_01d, tol: _FloatLike_co = 0) -> _nt.Array1D[np.object_]: ... # @overload -def getdomain(x: CoFloating_1d | CoFloating_0d) -> Array1D[np.float64]: ... +def getdomain(x: _CoFloating_01d) -> _nt.Array1D[np.float64]: ... @overload -def getdomain(x: ToComplex_1d | ToComplex_0d) -> Array1D[np.complex128]: ... +def getdomain(x: _ToComplex_01d) -> _nt.Array1D[np.complex128]: ... @overload -def getdomain(x: ToObject_1d | ToObject_0d) -> Array1D[np.object_]: ... +def getdomain(x: _ToObject_01d) -> _nt.Array1D[np.object_]: ... # @overload @@ -71,51 +69,45 @@ def mapparms(old: Sequence[float], new: Sequence[float]) -> _Tuple2[float]: ... @overload def mapparms(old: Sequence[complex], new: Sequence[complex]) -> _Tuple2[complex]: ... @overload -def mapparms(old: _ToArray_1d[np.floating | np.integer], new: CoFloating_1d) -> _Tuple2[np.floating]: ... +def mapparms(old: _nt._ToArray_1d[_real], new: _nt.CoFloating_1d) -> _Tuple2[np.floating]: ... @overload -def mapparms(old: CoFloating_1d, new: _ToArray_1d[np.floating | np.integer]) -> _Tuple2[np.floating]: ... +def mapparms(old: _nt.CoFloating_1d, new: _nt._ToArray_1d[_real]) -> _Tuple2[np.floating]: ... @overload -def mapparms(old: _ToArray_1d[np.complexfloating], new: CoComplex_1d) -> _Tuple2[np.complexfloating]: ... +def mapparms(old: _nt._ToArray_1d[np.complexfloating], new: _nt.CoComplex_1d) -> _Tuple2[np.complexfloating]: ... @overload -def mapparms(old: CoComplex_1d, new: _ToArray_1d[np.complexfloating]) -> _Tuple2[np.complexfloating]: ... +def mapparms(old: _nt.CoComplex_1d, new: _nt._ToArray_1d[np.complexfloating]) -> _Tuple2[np.complexfloating]: ... @overload -def mapparms(old: ToObject_1d | CoComplex_1d, new: ToObject_1d | CoComplex_1d) -> _Tuple2[Any]: ... +def mapparms(old: _CoNumeric_1d, new: _CoNumeric_1d) -> _Tuple2[Any]: ... # @overload -def mapdomain(x: CoFloating_0d, old: CoFloating_1d, new: CoFloating_1d) -> np.floating: ... +def mapdomain(x: _nt.CoFloating_0d, old: _nt.CoFloating_1d, new: _nt.CoFloating_1d) -> np.floating: ... @overload -def mapdomain(x: ToComplex_0d, old: CoComplex_1d, new: CoComplex_1d) -> np.complexfloating: ... +def mapdomain(x: _nt.ToComplex_0d, old: _nt.CoComplex_1d, new: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def mapdomain(x: CoComplex_0d, old: ToComplex_1d, new: CoComplex_1d) -> np.complexfloating: ... +def mapdomain(x: _nt.CoComplex_0d, old: _nt.ToComplex_1d, new: _nt.CoComplex_1d) -> np.complexfloating: ... @overload -def mapdomain(x: CoComplex_0d, old: CoComplex_1d, new: ToComplex_1d) -> np.complexfloating: ... +def mapdomain(x: _nt.CoComplex_0d, old: _nt.CoComplex_1d, new: _nt.ToComplex_1d) -> np.complexfloating: ... @overload -def mapdomain(x: CoFloating_1d, old: CoFloating_1d, new: CoFloating_1d) -> Array1D[np.floating]: ... +def mapdomain(x: _nt.CoFloating_1d, old: _nt.CoFloating_1d, new: _nt.CoFloating_1d) -> _nt.Array1D[np.floating]: ... @overload -def mapdomain(x: ToComplex_1d, old: CoComplex_1d, new: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def mapdomain(x: _nt.ToComplex_1d, old: _nt.CoComplex_1d, new: _nt.CoComplex_1d) -> _nt.Array1D[np.complexfloating]: ... @overload -def mapdomain(x: CoComplex_1d, old: ToComplex_1d, new: CoComplex_1d) -> Array1D[np.complexfloating]: ... +def mapdomain(x: _nt.CoComplex_1d, old: _nt.ToComplex_1d, new: _nt.CoComplex_1d) -> _nt.Array1D[np.complexfloating]: ... @overload -def mapdomain(x: CoComplex_1d, old: CoComplex_1d, new: ToComplex_1d) -> Array1D[np.complexfloating]: ... +def mapdomain(x: _nt.CoComplex_1d, old: _nt.CoComplex_1d, new: _nt.ToComplex_1d) -> _nt.Array1D[np.complexfloating]: ... @overload -def mapdomain(x: ToObject_0d, old: CoComplex_1d | ToObject_1d, new: CoComplex_1d | ToObject_1d) -> Any: ... +def mapdomain(x: _nt.ToObject_0d, old: _CoNumeric_1d, new: _CoNumeric_1d) -> Any: ... @overload -def mapdomain(x: CoComplex_0d | ToObject_0d, old: ToObject_1d, new: CoComplex_1d | ToObject_1d) -> Any: ... +def mapdomain(x: _CoNumeric_0d, old: _nt.ToObject_1d, new: _CoNumeric_1d) -> Any: ... @overload -def mapdomain(x: CoComplex_0d | ToObject_0d, old: CoComplex_1d | ToObject_1d, new: ToObject_1d) -> Any: ... +def mapdomain(x: _CoNumeric_0d, old: _CoNumeric_1d, new: _nt.ToObject_1d) -> Any: ... @overload -def mapdomain( - x: ToObject_1d, old: CoComplex_1d | ToObject_1d, new: CoComplex_1d | ToObject_1d -) -> Array1D[np.object_]: ... +def mapdomain(x: _nt.ToObject_1d, old: _CoNumeric_1d, new: _CoNumeric_1d) -> _nt.Array1D[np.object_]: ... @overload -def mapdomain( - x: CoComplex_1d | ToObject_1d, old: ToObject_1d, new: CoComplex_1d | ToObject_1d -) -> Array1D[np.object_]: ... +def mapdomain(x: _CoNumeric_1d, old: _nt.ToObject_1d, new: _CoNumeric_1d) -> _nt.Array1D[np.object_]: ... @overload -def mapdomain( - x: CoComplex_1d | ToObject_1d, old: CoComplex_1d | ToObject_1d, new: ToObject_1d -) -> Array1D[np.object_]: ... +def mapdomain(x: _CoNumeric_1d, old: _CoNumeric_1d, new: _nt.ToObject_1d) -> _nt.Array1D[np.object_]: ... # def format_float(x: _FloatLike_co, parens: bool = False) -> str: ... From 2f84514a0a0d925cd96afe22474054ec31c8538a Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 00:24:19 +0200 Subject: [PATCH 02/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`matrixlib`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/matrixlib/defmatrix.pyi | 147 ++++++++++-------------- 1 file changed, 59 insertions(+), 88 deletions(-) diff --git a/src/numpy-stubs/matrixlib/defmatrix.pyi b/src/numpy-stubs/matrixlib/defmatrix.pyi index 541b0d9c..ae9d2e04 100644 --- a/src/numpy-stubs/matrixlib/defmatrix.pyi +++ b/src/numpy-stubs/matrixlib/defmatrix.pyi @@ -4,29 +4,8 @@ from types import EllipsisType from typing import Any, ClassVar, SupportsIndex as CanIndex, TypeAlias, overload from typing_extensions import Self, TypeVar, override +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - JustBytes, - JustComplex, - JustFloat, - JustInt, - JustStr, - Matrix, - Sequence3ND, - ToBool_nd, - ToBytes_nd, - ToComplex128_nd, - ToFloat64_nd, - ToGeneric_3nd, - ToGeneric_nd, - ToInt_nd, - ToInteger_1nd, - ToObject_nd, - ToStr_nd, - _ToArray_1nd, - _ToArray_nd, -) from numpy import _CanItem, _OrderKACF # noqa: ICN003 from numpy._typing import ArrayLike, DTypeLike, _ArrayLikeInt_co, _DTypeLike @@ -35,14 +14,14 @@ __all__ = ["asmatrix", "bmat", "matrix"] ### _T = TypeVar("_T") -_ArrayT = TypeVar("_ArrayT", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) _ScalarT = TypeVar("_ScalarT", bound=np.generic) _ShapeT_co = TypeVar("_ShapeT_co", bound=_2D, default=_2D, covariant=True) _DTypeT_co = TypeVar("_DTypeT_co", bound=np.dtype, default=np.dtype, covariant=True) _2D: TypeAlias = tuple[int, int] -_ToIndex1: TypeAlias = slice | EllipsisType | ToInteger_1nd | None +_ToIndex1: TypeAlias = slice | EllipsisType | _nt.ToInteger_1nd | None _ToIndex2: TypeAlias = tuple[_ToIndex1, _ToIndex1 | CanIndex] | tuple[_ToIndex1 | CanIndex, _ToIndex1] _ToAxis: TypeAlias = CanIndex | tuple[()] | tuple[CanIndex] | tuple[CanIndex, CanIndex] @@ -53,7 +32,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): __array_priority__: ClassVar[float] = 10.0 # pyright: ignore[reportIncompatibleMethodOverride] # - def __new__(subtype, data: ArrayLike, dtype: DTypeLike | None = None, copy: bool = ...) -> Matrix: ... + def __new__(subtype, data: ArrayLike, dtype: DTypeLike | None = None, copy: bool = ...) -> _nt.Matrix: ... # @overload # type: ignore[override] @@ -61,23 +40,23 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload def __getitem__(self, key: _ToIndex1 | _ToIndex2, /) -> matrix[_2D, _DTypeT_co]: ... @overload - def __getitem__(self: Array[np.void], key: str, /) -> matrix[_ShapeT_co, np.dtype]: ... + def __getitem__(self: _nt.Array[np.void], key: str, /) -> matrix[_ShapeT_co, np.dtype]: ... @overload - def __getitem__(self: Array[np.void], key: list[str], /) -> matrix[_ShapeT_co, np.dtype[np.void]]: ... # pyright: ignore[reportIncompatibleMethodOverride] + def __getitem__(self: _nt.Array[np.void], key: list[str], /) -> matrix[_ShapeT_co, np.dtype[np.void]]: ... # pyright: ignore[reportIncompatibleMethodOverride] # @override - def __mul__(self, other: ArrayLike, /) -> Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __mul__(self, other: ArrayLike, /) -> _nt.Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] @override - def __rmul__(self, other: ArrayLike, /) -> Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __rmul__(self, other: ArrayLike, /) -> _nt.Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] @override def __imul__(self, other: Incomplete, /) -> Self: ... # type: ignore[override] # @override - def __pow__(self, other: ArrayLike, /) -> Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __pow__(self, other: ArrayLike, /) -> _nt.Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] @override - def __rpow__(self, other: ArrayLike, /) -> Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __rpow__(self, other: ArrayLike, /) -> _nt.Matrix[Incomplete]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] @override def __ipow__(self, other: Incomplete, /) -> Self: ... # type: ignore[override] @@ -85,7 +64,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload # type: ignore[override] def sum(self, /, axis: None = None, dtype: DTypeLike | None = None, out: None = None) -> Any: ... @overload - def sum(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> Matrix: ... + def sum(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> _nt.Matrix: ... @overload def sum(self, /, axis: _ToAxis | None, dtype: DTypeLike, out: _ArrayT) -> _ArrayT: ... @overload @@ -95,7 +74,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload # type: ignore[override] def mean(self, /, axis: None = None, dtype: DTypeLike | None = None, out: None = None) -> Any: ... @overload - def mean(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> Matrix: ... + def mean(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> _nt.Matrix: ... @overload def mean(self, /, axis: _ToAxis | None, dtype: DTypeLike | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -105,43 +84,35 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload # type: ignore[override] def std(self, /, axis: None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0) -> Any: ... @overload - def std(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0) -> Matrix: ... + def std( + self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0 + ) -> _nt.Matrix: ... @overload def std(self, /, axis: _ToAxis | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0) -> _ArrayT: ... @overload def std( # pyright: ignore[reportIncompatibleMethodOverride] - self, - /, - axis: _ToAxis | None = None, - dtype: DTypeLike | None = None, - *, - out: _ArrayT, - ddof: float = 0, + self, /, axis: _ToAxis | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, ddof: float = 0 ) -> _ArrayT: ... # @overload # type: ignore[override] def var(self, /, axis: None = None, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0) -> Any: ... @overload - def var(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0) -> Matrix: ... + def var( + self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None, ddof: float = 0 + ) -> _nt.Matrix: ... @overload def var(self, /, axis: _ToAxis | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0) -> _ArrayT: ... @overload def var( # pyright: ignore[reportIncompatibleMethodOverride] - self, - /, - axis: _ToAxis | None = None, - dtype: DTypeLike | None = None, - *, - out: _ArrayT, - ddof: float = 0, + self, /, axis: _ToAxis | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, ddof: float = 0 ) -> _ArrayT: ... # @overload # type: ignore[override] def prod(self, /, axis: None = None, dtype: DTypeLike | None = None, out: None = None) -> Any: ... @overload - def prod(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> Matrix: ... + def prod(self, /, axis: _ToAxis, dtype: DTypeLike | None = None, out: None = None) -> _nt.Matrix: ... @overload def prod(self, /, axis: _ToAxis | None, dtype: DTypeLike | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -151,7 +122,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload # type: ignore[override] def any(self, /, axis: None = None, out: None = None) -> np.bool: ... @overload - def any(self, /, axis: _ToAxis, out: None = None) -> Matrix[np.bool]: ... + def any(self, /, axis: _ToAxis, out: None = None) -> _nt.Matrix[np.bool]: ... @overload def any(self, /, axis: _ToAxis | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -161,7 +132,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): @overload # type: ignore[override] def all(self, /, axis: None = None, out: None = None) -> np.bool: ... @overload - def all(self, /, axis: _ToAxis, out: None = None) -> Matrix[np.bool]: ... + def all(self, /, axis: _ToAxis, out: None = None) -> _nt.Matrix[np.bool]: ... @overload def all(self, /, axis: _ToAxis | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -169,7 +140,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @overload # type: ignore[override] - def max(self: Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... + def max(self: _nt.Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... @overload def max(self, /, axis: _ToAxis, out: None = None) -> matrix[_2D, _DTypeT_co]: ... @overload @@ -179,7 +150,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @overload # type: ignore[override] - def min(self: Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... + def min(self: _nt.Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... @overload def min(self, /, axis: _ToAxis, out: None = None) -> matrix[_2D, _DTypeT_co]: ... @overload @@ -189,9 +160,9 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @overload # type: ignore[override] - def argmax(self: Array[_ScalarT], /, axis: None = None, out: None = None) -> np.intp: ... + def argmax(self: _nt.Array[_ScalarT], /, axis: None = None, out: None = None) -> np.intp: ... @overload - def argmax(self, /, axis: _ToAxis, out: None = None) -> Matrix[np.intp]: ... + def argmax(self, /, axis: _ToAxis, out: None = None) -> _nt.Matrix[np.intp]: ... @overload def argmax(self, /, axis: _ToAxis | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -199,9 +170,9 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @overload # type: ignore[override] - def argmin(self: Array[_ScalarT], /, axis: None = None, out: None = None) -> np.intp: ... + def argmin(self: _nt.Array[_ScalarT], /, axis: None = None, out: None = None) -> np.intp: ... @overload - def argmin(self, /, axis: _ToAxis, out: None = None) -> Matrix[np.intp]: ... + def argmin(self, /, axis: _ToAxis, out: None = None) -> _nt.Matrix[np.intp]: ... @overload def argmin(self, /, axis: _ToAxis | None, out: _ArrayT) -> _ArrayT: ... @overload @@ -209,7 +180,7 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @overload # type: ignore[override] - def ptp(self: Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... + def ptp(self: _nt.Array[_ScalarT], /, axis: None = None, out: None = None) -> _ScalarT: ... @overload def ptp(self, /, axis: _ToAxis, out: None = None) -> matrix[_2D, _DTypeT_co]: ... @overload @@ -242,8 +213,8 @@ class matrix(np.ndarray[_ShapeT_co, _DTypeT_co]): # @property - def I(self) -> Matrix: ... - def getI(self) -> Matrix: ... + def I(self) -> _nt.Matrix: ... + def getI(self) -> _nt.Matrix: ... # @property @@ -261,74 +232,74 @@ def bmat( obj: str, ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix: ... +) -> _nt.Matrix: ... @overload def bmat( - obj: _ToArray_1nd[_ScalarT], + obj: _nt._ToArray_1nd[_ScalarT], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[_ScalarT]: ... +) -> _nt.Matrix[_ScalarT]: ... @overload def bmat( - obj: Sequence3ND[bool], + obj: _nt.Sequence3ND[bool], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.bool]: ... +) -> _nt.Matrix[np.bool]: ... @overload def bmat( - obj: Sequence3ND[JustInt], + obj: _nt.Sequence3ND[_nt.JustInt], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.intp]: ... +) -> _nt.Matrix[np.intp]: ... @overload def bmat( - obj: Sequence3ND[JustFloat], + obj: _nt.Sequence3ND[_nt.JustFloat], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.float64]: ... +) -> _nt.Matrix[np.float64]: ... @overload def bmat( - obj: Sequence3ND[JustComplex], + obj: _nt.Sequence3ND[_nt.JustComplex], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.complex128]: ... +) -> _nt.Matrix[np.complex128]: ... @overload def bmat( - obj: Sequence3ND[JustBytes], + obj: _nt.Sequence3ND[_nt.JustBytes], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.bytes_]: ... +) -> _nt.Matrix[np.bytes_]: ... @overload def bmat( - obj: Sequence3ND[JustStr], + obj: _nt.Sequence3ND[_nt.JustStr], ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix[np.str_]: ... +) -> _nt.Matrix[np.str_]: ... @overload def bmat( - obj: ToGeneric_3nd, + obj: _nt.ToGeneric_3nd, ldict: Mapping[str, Any] | None = None, gdict: Mapping[str, Any] | None = None, -) -> Matrix: ... +) -> _nt.Matrix: ... # @overload -def asmatrix(data: _ToArray_nd[_ScalarT], dtype: None = None) -> Matrix[_ScalarT]: ... # type: ignore[overload-overlap] +def asmatrix(data: _nt._ToArray_nd[_ScalarT], dtype: None = None) -> _nt.Matrix[_ScalarT]: ... # type: ignore[overload-overlap] @overload -def asmatrix(data: ToGeneric_nd, dtype: _DTypeLike[_ScalarT]) -> Matrix[_ScalarT]: ... +def asmatrix(data: _nt.ToGeneric_nd, dtype: _DTypeLike[_ScalarT]) -> _nt.Matrix[_ScalarT]: ... @overload -def asmatrix(data: ToBool_nd, dtype: None = None) -> Matrix[np.bool]: ... +def asmatrix(data: _nt.ToBool_nd, dtype: None = None) -> _nt.Matrix[np.bool]: ... @overload -def asmatrix(data: ToInt_nd, dtype: None = None) -> Matrix[np.intp]: ... +def asmatrix(data: _nt.ToInt_nd, dtype: None = None) -> _nt.Matrix[np.intp]: ... @overload -def asmatrix(data: ToFloat64_nd, dtype: None = None) -> Matrix[np.float64]: ... +def asmatrix(data: _nt.ToFloat64_nd, dtype: None = None) -> _nt.Matrix[np.float64]: ... @overload -def asmatrix(data: ToObject_nd, dtype: None = None) -> Matrix[np.object_]: ... +def asmatrix(data: _nt.ToObject_nd, dtype: None = None) -> _nt.Matrix[np.object_]: ... @overload -def asmatrix(data: ToComplex128_nd, dtype: None = None) -> Matrix[np.complex128]: ... +def asmatrix(data: _nt.ToComplex128_nd, dtype: None = None) -> _nt.Matrix[np.complex128]: ... @overload -def asmatrix(data: ToBytes_nd, dtype: None = None) -> Matrix[np.bytes_]: ... +def asmatrix(data: _nt.ToBytes_nd, dtype: None = None) -> _nt.Matrix[np.bytes_]: ... @overload -def asmatrix(data: ToStr_nd, dtype: None = None) -> Matrix[np.str_]: ... +def asmatrix(data: _nt.ToStr_nd, dtype: None = None) -> _nt.Matrix[np.str_]: ... @overload -def asmatrix(data: ToGeneric_nd, dtype: DTypeLike | None) -> Matrix: ... +def asmatrix(data: _nt.ToGeneric_nd, dtype: DTypeLike | None) -> _nt.Matrix: ... From d782c5972fd35b6b2e849b358bcf8467c883d19c Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 00:27:08 +0200 Subject: [PATCH 03/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`linalg`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/linalg/_linalg.pyi | 824 +++++++++++------------ src/numpy-stubs/linalg/_umath_linalg.pyi | 10 +- 2 files changed, 392 insertions(+), 442 deletions(-) diff --git a/src/numpy-stubs/linalg/_linalg.pyi b/src/numpy-stubs/linalg/_linalg.pyi index 1cda646f..810b2db2 100644 --- a/src/numpy-stubs/linalg/_linalg.pyi +++ b/src/numpy-stubs/linalg/_linalg.pyi @@ -2,114 +2,8 @@ from collections.abc import Iterable, Sequence from typing import Any, Generic, Literal as L, NamedTuple, SupportsIndex as CanIndex, SupportsInt, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - Array2D, - AtLeast2D, - CanLenArray, - CanLenArrayND, - CoComplex64_1nd, - CoComplex128_0d, - CoComplex128_1d, - CoComplex128_1ds, - CoComplex128_1nd, - CoComplex128_2ds, - CoComplex128_3nd, - CoComplex128_nd, - CoComplex_1ds, - CoComplex_1nd, - CoComplex_2ds, - CoComplex_2nd, - CoComplex_3nd, - CoFloat64_1d, - CoFloat64_1ds, - CoFloat64_1nd, - CoFloating_1ds, - CoFloating_1nd, - CoInt64_1d, - CoInt64_1ds, - CoInt64_1nd, - CoInteger_1d, - CoInteger_1ds, - CoInteger_1nd, - CoTimeDelta_1d, - CoTimeDelta_1nd, - CoUInt64_1nd, - JustBytes, - JustComplex, - JustFloat, - JustInt, - JustStr, - Sequence1ND, - Sequence2D, - Sequence2ND, - Sequence3ND, - ToBool_1d, - ToBool_1ds, - ToBool_1nd, - ToBool_2nd, - ToCharacter_1nd, - ToComplex64_1d, - ToComplex64_1nd, - ToComplex64_2ds, - ToComplex64_3nd, - ToComplex128_1d, - ToComplex128_1ds, - ToComplex128_1nd, - ToComplex128_2ds, - ToComplex128_2nd, - ToComplex128_3nd, - ToComplex_1ds, - ToComplex_1nd, - ToComplex_2nd, - ToFloat16_1nd, - ToFloat16_2ds, - ToFloat16_3nd, - ToFloat32_1d, - ToFloat32_1nd, - ToFloat32_2ds, - ToFloat32_3nd, - ToFloat64_1d, - ToFloat64_1ds, - ToFloat64_1nd, - ToFloat64_2nd, - ToFloating_1ds, - ToFloating_1nd, - ToFloating_2nd, - ToFloating_nd, - ToGeneric_1nd, - ToInt_1d, - ToInt_1ds, - ToInt_1nd, - ToInt_2nd, - ToInteger_1d, - ToInteger_1ds, - ToInteger_1nd, - ToInteger_2nd, - ToNumber_1d, - ToObject_1d, - ToObject_1nd, - ToObject_2nd, - ToSInteger_1nd, - ToTimeDelta_1d, - ToTimeDelta_1nd, - ToUInteger_1nd, - _PyCharacter, - _ToArray2_1nd, - _ToArray2_2ds, - _ToArray2_3nd, - _ToArray_1d, - _ToArray_1ds, - _ToArray_1nd, - _ToArray_2ds, - _ToArray_2nd, - _ToArray_3nd, - inexact32, - inexact64, - inexact64l, -) from numpy._core.fromnumeric import matrix_transpose from numpy._core.numeric import vecdot from numpy._globals import _NoValueType @@ -156,8 +50,8 @@ _SafeFloating: TypeAlias = np.float32 | np.float64 _SafeInexact: TypeAlias = _SafeFloating | np.complex64 | np.complex128 _T = TypeVar("_T") -_ArrayT = TypeVar("_ArrayT", bound=Array[Any]) -_Shape2T = TypeVar("_Shape2T", bound=AtLeast2D) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array[Any]) +_Shape2T = TypeVar("_Shape2T", bound=_nt.AtLeast2D) _ScalarT = TypeVar("_ScalarT", bound=np.generic) _IntegerT = TypeVar("_IntegerT", bound=np.integer) @@ -170,8 +64,8 @@ _NativeScalarT = TypeVar( _FloatingT_co = TypeVar("_FloatingT_co", bound=np.floating, default=np.floating, covariant=True) _InexactT_co = TypeVar("_InexactT_co", bound=np.inexact, default=np.inexact, covariant=True) -_FloatingNDT_co = TypeVar("_FloatingNDT_co", bound=np.floating | Array[np.floating], default=Any, covariant=True) -_InexactNDT_co = TypeVar("_InexactNDT_co", bound=np.inexact | Array[np.inexact], default=Any, covariant=True) +_FloatingNDT_co = TypeVar("_FloatingNDT_co", bound=np.floating | _nt.Array[np.floating], default=Any, covariant=True) +_InexactNDT_co = TypeVar("_InexactNDT_co", bound=np.inexact | _nt.Array[np.inexact], default=Any, covariant=True) _AnyNumberT = TypeVar( "_AnyNumberT", @@ -203,50 +97,56 @@ _ToInt: TypeAlias = SupportsInt | CanIndex _Ax2: TypeAlias = _ToInt | _2Tuple[_ToInt] _Axes: TypeAlias = Iterable[int] -_ArrayOrScalar: TypeAlias = _ScalarT | Array[_ScalarT] +_ArrayOrScalar: TypeAlias = _ScalarT | _nt.Array[_ScalarT] _Ord: TypeAlias = L[1, -1, 2, -2, "fro", "nuc"] | float _UPLO: TypeAlias = L["L", "U", "l", "u"] _ToArray_2nd_ish: TypeAlias = ( - CanLenArrayND[_ScalarT] | Sequence[Sequence1ND[_ScalarT]] | Sequence1ND[CanLenArrayND[_ScalarT]] + _nt.CanLenArrayND[_ScalarT] | Sequence[_nt.Sequence1ND[_ScalarT]] | _nt.Sequence1ND[_nt.CanLenArrayND[_ScalarT]] ) _ToInteger: TypeAlias = np.integer | np.bool[Any] -_ToFloat64_1nd: TypeAlias = _ToArray2_1nd[np.float64 | _ToInteger, float] -_ToFloat64_2ds: TypeAlias = _ToArray2_2ds[np.float64 | _ToInteger, float] -_ToFloat64_3nd: TypeAlias = _ToArray2_3nd[np.float64 | _ToInteger, float] +_ToFloat64_1nd: TypeAlias = _nt._ToArray2_1nd[np.float64 | _ToInteger, float] +_ToFloat64_2ds: TypeAlias = _nt._ToArray2_2ds[np.float64 | _ToInteger, float] +_ToFloat64_3nd: TypeAlias = _nt._ToArray2_3nd[np.float64 | _ToInteger, float] -_Toinexact32_1nd: TypeAlias = _ToArray_1nd[inexact32] -_Toinexact32_2ds: TypeAlias = _ToArray_2ds[inexact32] -_Toinexact32_3nd: TypeAlias = _ToArray_3nd[inexact32] +_Toinexact32_1nd: TypeAlias = _nt._ToArray_1nd[_nt.inexact32] +_Toinexact32_2ds: TypeAlias = _nt._ToArray_2ds[_nt.inexact32] +_Toinexact32_3nd: TypeAlias = _nt._ToArray_3nd[_nt.inexact32] -_Toinexact64_1nd: TypeAlias = _ToArray2_1nd[inexact64 | _ToInteger, complex] -_Toinexact64_2ds: TypeAlias = _ToArray2_2ds[inexact64 | _ToInteger, complex] -_Toinexact64_3nd: TypeAlias = _ToArray2_3nd[inexact64 | _ToInteger, complex] +_Toinexact64_1nd: TypeAlias = _nt._ToArray2_1nd[_nt.inexact64 | _ToInteger, complex] +_Toinexact64_2ds: TypeAlias = _nt._ToArray2_2ds[_nt.inexact64 | _ToInteger, complex] +_Toinexact64_3nd: TypeAlias = _nt._ToArray2_3nd[_nt.inexact64 | _ToInteger, complex] -_Toinexact64l_1nd: TypeAlias = _ToArray_1nd[inexact64l] -_Toinexact64l_2ds: TypeAlias = _ToArray_2ds[inexact64l] -_Toinexact64l_3nd: TypeAlias = _ToArray_3nd[inexact64l] +_Toinexact64l_1nd: TypeAlias = _nt._ToArray_1nd[_nt.inexact64l] +_Toinexact64l_2ds: TypeAlias = _nt._ToArray_2ds[_nt.inexact64l] +_Toinexact64l_3nd: TypeAlias = _nt._ToArray_3nd[_nt.inexact64l] -_ToUnsafe64_1nd: TypeAlias = _ToArray2_1nd[inexact64 | _ToInteger | np.character[Any], complex | _PyCharacter] -_ToUnsafe64_2ds: TypeAlias = _ToArray2_2ds[inexact64 | _ToInteger | np.character[Any], complex | _PyCharacter] -_ToUnsafe64_3nd: TypeAlias = _ToArray2_3nd[inexact64 | _ToInteger | np.character[Any], complex | _PyCharacter] +_ToUnsafe64_1nd: TypeAlias = _nt._ToArray2_1nd[ + _nt.inexact64 | _ToInteger | np.character[Any], complex | _nt._PyCharacter +] +_ToUnsafe64_2ds: TypeAlias = _nt._ToArray2_2ds[ + _nt.inexact64 | _ToInteger | np.character[Any], complex | _nt._PyCharacter +] +_ToUnsafe64_3nd: TypeAlias = _nt._ToArray2_3nd[ + _nt.inexact64 | _ToInteger | np.character[Any], complex | _nt._PyCharacter +] -_Array_2nd: TypeAlias = Array[_ScalarT, AtLeast2D] +_Array_2nd: TypeAlias = _nt.Array[_ScalarT, _nt.AtLeast2D] -_LstSqResult: TypeAlias = tuple[Array[_ScalarT], Array[_FloatingT], np.int32, Array[_FloatingT]] +_LstSqResult: TypeAlias = tuple[_nt.Array[_ScalarT], _nt.Array[_FloatingT], np.int32, _nt.Array[_FloatingT]] ### fortran_int = np.intc class EigResult(NamedTuple, Generic[_InexactT_co]): - eigenvalues: Array[_InexactT_co] + eigenvalues: _nt.Array[_InexactT_co] eigenvectors: _Array_2nd[_InexactT_co] class EighResult(NamedTuple, Generic[_FloatingT_co, _InexactT_co]): - eigenvalues: Array[_FloatingT_co] + eigenvalues: _nt.Array[_FloatingT_co] eigenvectors: _Array_2nd[_InexactT_co] class QRResult(NamedTuple, Generic[_InexactT_co]): @@ -255,7 +155,7 @@ class QRResult(NamedTuple, Generic[_InexactT_co]): class SVDResult(NamedTuple, Generic[_FloatingT_co, _InexactT_co]): U: _Array_2nd[_InexactT_co] - S: Array[_FloatingT_co] + S: _nt.Array[_FloatingT_co] Vh: _Array_2nd[_InexactT_co] class SlogdetResult(NamedTuple, Generic[_FloatingNDT_co, _InexactNDT_co]): @@ -266,150 +166,158 @@ class LinAlgError(ValueError): ... # keep in sync with `numpy._core.numeric.tensordot` @overload -def tensordot(x1: ToBool_1nd, x2: ToBool_1nd, /, *, axes: _Ax2 = 2) -> Array[np.bool]: ... +def tensordot(x1: _nt.ToBool_1nd, x2: _nt.ToBool_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.bool]: ... @overload -def tensordot(x1: ToUInteger_1nd, x2: CoUInt64_1nd, /, *, axes: _Ax2 = 2) -> Array[np.unsignedinteger]: ... +def tensordot(x1: _nt.ToUInteger_1nd, x2: _nt.CoUInt64_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.unsignedinteger]: ... @overload -def tensordot(x1: CoUInt64_1nd, x2: ToUInteger_1nd, /, *, axes: _Ax2 = 2) -> Array[np.unsignedinteger]: ... +def tensordot(x1: _nt.CoUInt64_1nd, x2: _nt.ToUInteger_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.unsignedinteger]: ... @overload -def tensordot(x1: ToSInteger_1nd, x2: CoInt64_1nd, /, *, axes: _Ax2 = 2) -> Array[np.signedinteger]: ... +def tensordot(x1: _nt.ToSInteger_1nd, x2: _nt.CoInt64_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.signedinteger]: ... @overload -def tensordot(x1: CoInt64_1nd, x2: ToSInteger_1nd, /, *, axes: _Ax2 = 2) -> Array[np.signedinteger]: ... +def tensordot(x1: _nt.CoInt64_1nd, x2: _nt.ToSInteger_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.signedinteger]: ... @overload -def tensordot(x1: ToFloating_1nd, x2: CoFloating_1nd, /, *, axes: _Ax2 = 2) -> Array[np.floating]: ... +def tensordot(x1: _nt.ToFloating_1nd, x2: _nt.CoFloating_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.floating]: ... @overload -def tensordot(x1: CoFloating_1nd, x2: ToFloating_1nd, /, *, axes: _Ax2 = 2) -> Array[np.floating]: ... +def tensordot(x1: _nt.CoFloating_1nd, x2: _nt.ToFloating_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.floating]: ... @overload -def tensordot(x1: ToComplex_1nd, x2: CoComplex_1nd, /, *, axes: _Ax2 = 2) -> Array[np.complexfloating]: ... +def tensordot(x1: _nt.ToComplex_1nd, x2: _nt.CoComplex_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.complexfloating]: ... @overload -def tensordot(x1: CoComplex_1nd, x2: ToComplex_1nd, /, *, axes: _Ax2 = 2) -> Array[np.complexfloating]: ... +def tensordot(x1: _nt.CoComplex_1nd, x2: _nt.ToComplex_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.complexfloating]: ... @overload -def tensordot(x1: ToTimeDelta_1nd, x2: CoTimeDelta_1nd, /, *, axes: _Ax2 = 2) -> Array[np.timedelta64]: ... +def tensordot(x1: _nt.ToTimeDelta_1nd, x2: _nt.CoTimeDelta_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.timedelta64]: ... @overload -def tensordot(x1: CoTimeDelta_1nd, x2: ToTimeDelta_1nd, /, *, axes: _Ax2 = 2) -> Array[np.timedelta64]: ... +def tensordot(x1: _nt.CoTimeDelta_1nd, x2: _nt.ToTimeDelta_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.timedelta64]: ... @overload -def tensordot(x1: ToObject_1nd, x2: ToObject_1nd, /, *, axes: _Ax2 = 2) -> Array[np.object_]: ... +def tensordot(x1: _nt.ToObject_1nd, x2: _nt.ToObject_1nd, /, *, axes: _Ax2 = 2) -> _nt.Array[np.object_]: ... @overload def tensordot( - x1: CoComplex_1nd | CoTimeDelta_1nd | ToObject_1nd, - x2: CoComplex_1nd | CoTimeDelta_1nd | ToObject_1nd, + x1: _nt.CoComplex_1nd | _nt.CoTimeDelta_1nd | _nt.ToObject_1nd, + x2: _nt.CoComplex_1nd | _nt.CoTimeDelta_1nd | _nt.ToObject_1nd, /, *, axes: _Ax2 = 2, -) -> Array[Any]: ... +) -> _nt.Array[Any]: ... # keep in sync with `solve` @overload -def tensorsolve(a: _ToFloat64_1nd, b: CoFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... +def tensorsolve(a: _ToFloat64_1nd, b: _nt.CoFloat64_1nd, axes: _Axes | None = None) -> _nt.Array[np.float64]: ... @overload -def tensorsolve(a: CoFloat64_1nd, b: _ToFloat64_1nd, axes: _Axes | None = None) -> Array[np.float64]: ... +def tensorsolve(a: _nt.CoFloat64_1nd, b: _ToFloat64_1nd, axes: _Axes | None = None) -> _nt.Array[np.float64]: ... @overload -def tensorsolve(a: ToComplex128_1nd, b: CoComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... +def tensorsolve( + a: _nt.ToComplex128_1nd, b: _nt.CoComplex128_1nd, axes: _Axes | None = None +) -> _nt.Array[np.complex128]: ... @overload -def tensorsolve(a: CoComplex128_1nd, b: ToComplex128_1nd, axes: _Axes | None = None) -> Array[np.complex128]: ... +def tensorsolve( + a: _nt.CoComplex128_1nd, b: _nt.ToComplex128_1nd, axes: _Axes | None = None +) -> _nt.Array[np.complex128]: ... @overload -def tensorsolve(a: ToFloat32_1nd, b: ToFloat32_1nd, axes: _Axes | None = None) -> Array[np.float32]: ... +def tensorsolve(a: _nt.ToFloat32_1nd, b: _nt.ToFloat32_1nd, axes: _Axes | None = None) -> _nt.Array[np.float32]: ... @overload -def tensorsolve(a: ToComplex64_1nd, b: ToComplex64_1nd, axes: _Axes | None = None) -> Array[np.complex64]: ... +def tensorsolve( + a: _nt.ToComplex64_1nd, b: _nt.ToComplex64_1nd, axes: _Axes | None = None +) -> _nt.Array[np.complex64]: ... @overload -def tensorsolve(a: CoFloat64_1nd, b: CoFloat64_1nd, axes: _Axes | None = None) -> Array[np.floating]: ... +def tensorsolve(a: _nt.CoFloat64_1nd, b: _nt.CoFloat64_1nd, axes: _Axes | None = None) -> _nt.Array[np.floating]: ... @overload -def tensorsolve(a: CoComplex128_1nd, b: CoComplex128_1nd, axes: _Axes | None = None) -> Array[np.inexact]: ... +def tensorsolve( + a: _nt.CoComplex128_1nd, b: _nt.CoComplex128_1nd, axes: _Axes | None = None +) -> _nt.Array[np.inexact]: ... # keep in sync with `tensorsolve` @overload -def solve(a: _ToFloat64_1nd, b: CoFloat64_1nd) -> Array[np.float64]: ... +def solve(a: _ToFloat64_1nd, b: _nt.CoFloat64_1nd) -> _nt.Array[np.float64]: ... @overload -def solve(a: CoFloat64_1nd, b: _ToFloat64_1nd) -> Array[np.float64]: ... +def solve(a: _nt.CoFloat64_1nd, b: _ToFloat64_1nd) -> _nt.Array[np.float64]: ... @overload -def solve(a: ToComplex128_1nd, b: CoComplex128_1nd) -> Array[np.complex128]: ... +def solve(a: _nt.ToComplex128_1nd, b: _nt.CoComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def solve(a: CoComplex128_1nd, b: ToComplex128_1nd) -> Array[np.complex128]: ... +def solve(a: _nt.CoComplex128_1nd, b: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def solve(a: ToFloat32_1nd, b: ToFloat32_1nd) -> Array[np.float32]: ... +def solve(a: _nt.ToFloat32_1nd, b: _nt.ToFloat32_1nd) -> _nt.Array[np.float32]: ... @overload -def solve(a: ToComplex64_1nd, b: ToComplex64_1nd) -> Array[np.complex64]: ... +def solve(a: _nt.ToComplex64_1nd, b: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def solve(a: CoFloat64_1nd, b: CoFloat64_1nd) -> Array[np.floating]: ... +def solve(a: _nt.CoFloat64_1nd, b: _nt.CoFloat64_1nd) -> _nt.Array[np.floating]: ... @overload -def solve(a: CoComplex128_1nd, b: CoComplex128_1nd) -> Array[np.inexact]: ... +def solve(a: _nt.CoComplex128_1nd, b: _nt.CoComplex128_1nd) -> _nt.Array[np.inexact]: ... # keep in sync with `inv` @overload def tensorinv(a: _ToFloat64_1nd, ind: int = 2) -> _Array_2nd[np.float64]: ... @overload -def tensorinv(a: ToComplex128_1nd, ind: int = 2) -> _Array_2nd[np.complex128]: ... +def tensorinv(a: _nt.ToComplex128_1nd, ind: int = 2) -> _Array_2nd[np.complex128]: ... @overload -def tensorinv(a: ToFloat32_1nd, ind: int = 2) -> _Array_2nd[np.float32]: ... +def tensorinv(a: _nt.ToFloat32_1nd, ind: int = 2) -> _Array_2nd[np.float32]: ... @overload -def tensorinv(a: ToComplex64_1nd, ind: int = 2) -> _Array_2nd[np.complex64]: ... +def tensorinv(a: _nt.ToComplex64_1nd, ind: int = 2) -> _Array_2nd[np.complex64]: ... @overload -def tensorinv(a: CoFloat64_1nd, ind: int = 2) -> _Array_2nd[np.floating]: ... +def tensorinv(a: _nt.CoFloat64_1nd, ind: int = 2) -> _Array_2nd[np.floating]: ... @overload -def tensorinv(a: CoComplex128_1nd, ind: int = 2) -> _Array_2nd[np.inexact]: ... +def tensorinv(a: _nt.CoComplex128_1nd, ind: int = 2) -> _Array_2nd[np.inexact]: ... # keep in sync with `tensorinv` @overload def inv(a: _ToFloat64_1nd) -> _Array_2nd[np.float64]: ... @overload -def inv(a: ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... +def inv(a: _nt.ToComplex128_1nd) -> _Array_2nd[np.complex128]: ... @overload -def inv(a: ToFloat32_1nd) -> _Array_2nd[np.float32]: ... +def inv(a: _nt.ToFloat32_1nd) -> _Array_2nd[np.float32]: ... @overload -def inv(a: ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... +def inv(a: _nt.ToComplex64_1nd) -> _Array_2nd[np.complex64]: ... @overload -def inv(a: CoFloat64_1nd) -> _Array_2nd[np.floating]: ... +def inv(a: _nt.CoFloat64_1nd) -> _Array_2nd[np.floating]: ... @overload -def inv(a: CoComplex128_1nd) -> _Array_2nd[np.inexact]: ... +def inv(a: _nt.CoComplex128_1nd) -> _Array_2nd[np.inexact]: ... # @overload def pinv( a: _ToFloat64_1nd, - rcond: ToFloating_nd | None = None, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.float64]: ... @overload def pinv( - a: ToComplex128_1nd, - rcond: ToFloating_nd | None = None, + a: _nt.ToComplex128_1nd, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.complex128]: ... @overload def pinv( - a: ToFloat32_1nd, - rcond: ToFloating_nd | None = None, + a: _nt.ToFloat32_1nd, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.float32]: ... @overload def pinv( - a: ToComplex64_1nd, - rcond: ToFloating_nd | None = None, + a: _nt.ToComplex64_1nd, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.complex64]: ... @overload def pinv( - a: CoFloat64_1nd, - rcond: ToFloating_nd | None = None, + a: _nt.CoFloat64_1nd, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.floating]: ... @overload def pinv( - a: CoComplex128_1nd, - rcond: ToFloating_nd | None = None, + a: _nt.CoComplex128_1nd, + rcond: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | _NoValueType = ..., + rtol: _nt.ToFloating_nd | _NoValueType = ..., ) -> _Array_2nd[np.inexact]: ... _PosInt: TypeAlias = L[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] @@ -417,249 +325,253 @@ _NegInt: TypeAlias = L[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, - # @overload -def matrix_power(a: CanLenArray[_NumberT, _Shape2T], n: _PosInt) -> Array[_NumberT, _Shape2T]: ... +def matrix_power(a: _nt.CanLenArray[_NumberT, _Shape2T], n: _PosInt) -> _nt.Array[_NumberT, _Shape2T]: ... @overload -def matrix_power(a: ToBool_1nd, n: _PosInt) -> _Array_2nd[np.bool]: ... +def matrix_power(a: _nt.ToBool_1nd, n: _PosInt) -> _Array_2nd[np.bool]: ... @overload -def matrix_power(a: ToInt_1nd, n: _PosInt) -> _Array_2nd[np.intp]: ... +def matrix_power(a: _nt.ToInt_1nd, n: _PosInt) -> _Array_2nd[np.intp]: ... @overload -def matrix_power(a: CoInteger_1nd, n: _NegInt) -> _Array_2nd[np.float64]: ... +def matrix_power(a: _nt.CoInteger_1nd, n: _NegInt) -> _Array_2nd[np.float64]: ... @overload -def matrix_power(a: ToFloat64_1nd, n: CanIndex) -> _Array_2nd[np.float64]: ... +def matrix_power(a: _nt.ToFloat64_1nd, n: CanIndex) -> _Array_2nd[np.float64]: ... @overload -def matrix_power(a: ToComplex128_1nd, n: CanIndex) -> _Array_2nd[np.complex128]: ... +def matrix_power(a: _nt.ToComplex128_1nd, n: CanIndex) -> _Array_2nd[np.complex128]: ... @overload -def matrix_power(a: ToFloat32_1nd, n: CanIndex) -> _Array_2nd[np.float32]: ... +def matrix_power(a: _nt.ToFloat32_1nd, n: CanIndex) -> _Array_2nd[np.float32]: ... @overload -def matrix_power(a: ToComplex64_1nd, n: CanIndex) -> _Array_2nd[np.complex64]: ... +def matrix_power(a: _nt.ToComplex64_1nd, n: CanIndex) -> _Array_2nd[np.complex64]: ... @overload -def matrix_power(a: ToObject_1nd, n: CanIndex) -> _Array_2nd[np.object_]: ... +def matrix_power(a: _nt.ToObject_1nd, n: CanIndex) -> _Array_2nd[np.object_]: ... @overload -def matrix_power(a: ToUInteger_1nd, n: _PosInt) -> _Array_2nd[np.unsignedinteger]: ... +def matrix_power(a: _nt.ToUInteger_1nd, n: _PosInt) -> _Array_2nd[np.unsignedinteger]: ... @overload -def matrix_power(a: ToInteger_1nd, n: _PosInt) -> _Array_2nd[np.integer]: ... +def matrix_power(a: _nt.ToInteger_1nd, n: _PosInt) -> _Array_2nd[np.integer]: ... @overload -def matrix_power(a: CoComplex128_1nd, n: _NegInt) -> _Array_2nd[np.inexact]: ... +def matrix_power(a: _nt.CoComplex128_1nd, n: _NegInt) -> _Array_2nd[np.inexact]: ... @overload -def matrix_power(a: CoComplex_1nd | ToObject_1nd, n: CanIndex) -> _Array_2nd[Any]: ... +def matrix_power(a: _nt.CoComplex_1nd | _nt.ToObject_1nd, n: CanIndex) -> _Array_2nd[Any]: ... # @overload def cholesky(a: _ToFloat64_1nd, /, *, upper: bool = False) -> _Array_2nd[np.float64]: ... @overload -def cholesky(a: ToComplex128_1nd, /, *, upper: bool = False) -> _Array_2nd[np.complex128]: ... +def cholesky(a: _nt.ToComplex128_1nd, /, *, upper: bool = False) -> _Array_2nd[np.complex128]: ... @overload -def cholesky(a: ToFloat32_1nd, /, *, upper: bool = False) -> _Array_2nd[np.float32]: ... +def cholesky(a: _nt.ToFloat32_1nd, /, *, upper: bool = False) -> _Array_2nd[np.float32]: ... @overload -def cholesky(a: ToComplex64_1nd, /, *, upper: bool = False) -> _Array_2nd[np.complex64]: ... +def cholesky(a: _nt.ToComplex64_1nd, /, *, upper: bool = False) -> _Array_2nd[np.complex64]: ... @overload -def cholesky(a: CoFloat64_1nd, /, *, upper: bool = False) -> _Array_2nd[np.floating]: ... +def cholesky(a: _nt.CoFloat64_1nd, /, *, upper: bool = False) -> _Array_2nd[np.floating]: ... @overload -def cholesky(a: CoComplex128_1nd, /, *, upper: bool = False) -> _Array_2nd[np.inexact]: ... +def cholesky(a: _nt.CoComplex128_1nd, /, *, upper: bool = False) -> _Array_2nd[np.inexact]: ... # @overload -def outer(x1: ToBool_1d, x2: ToBool_1d, /) -> Array2D[np.bool]: ... +def outer(x1: _nt.ToBool_1d, x2: _nt.ToBool_1d, /) -> _nt.Array2D[np.bool]: ... @overload -def outer(x1: ToInt_1d, x2: CoInt64_1d, /) -> Array2D[np.intp]: ... +def outer(x1: _nt.ToInt_1d, x2: _nt.CoInt64_1d, /) -> _nt.Array2D[np.intp]: ... @overload -def outer(x1: CoInt64_1d, x2: ToInt_1d, /) -> Array2D[np.intp]: ... +def outer(x1: _nt.CoInt64_1d, x2: _nt.ToInt_1d, /) -> _nt.Array2D[np.intp]: ... @overload -def outer(x1: _ToArray_1d[_IntegerT], x2: _ToArray_1d[_IntegerT], /) -> Array2D[_IntegerT]: ... +def outer(x1: _nt._ToArray_1d[_IntegerT], x2: _nt._ToArray_1d[_IntegerT], /) -> _nt.Array2D[_IntegerT]: ... @overload -def outer(x1: ToFloat32_1d, x2: ToFloat32_1d, /) -> Array2D[np.float32]: ... +def outer(x1: _nt.ToFloat32_1d, x2: _nt.ToFloat32_1d, /) -> _nt.Array2D[np.float32]: ... @overload -def outer(x1: ToFloat64_1d, x2: CoFloat64_1d, /) -> Array2D[np.float64]: ... +def outer(x1: _nt.ToFloat64_1d, x2: _nt.CoFloat64_1d, /) -> _nt.Array2D[np.float64]: ... @overload -def outer(x1: CoFloat64_1d, x2: ToFloat64_1d, /) -> Array2D[np.float64]: ... +def outer(x1: _nt.CoFloat64_1d, x2: _nt.ToFloat64_1d, /) -> _nt.Array2D[np.float64]: ... @overload -def outer(x1: ToComplex64_1d, x2: ToComplex64_1d, /) -> Array2D[np.complex64]: ... +def outer(x1: _nt.ToComplex64_1d, x2: _nt.ToComplex64_1d, /) -> _nt.Array2D[np.complex64]: ... @overload -def outer(x1: ToComplex128_1d, x2: CoComplex128_1d, /) -> Array2D[np.complex128]: ... +def outer(x1: _nt.ToComplex128_1d, x2: _nt.CoComplex128_1d, /) -> _nt.Array2D[np.complex128]: ... @overload -def outer(x1: CoComplex128_1d, x2: ToComplex128_1d, /) -> Array2D[np.complex128]: ... +def outer(x1: _nt.CoComplex128_1d, x2: _nt.ToComplex128_1d, /) -> _nt.Array2D[np.complex128]: ... @overload -def outer(x1: ToTimeDelta_1d, x2: CoTimeDelta_1d, /) -> Array2D[np.timedelta64]: ... +def outer(x1: _nt.ToTimeDelta_1d, x2: _nt.CoTimeDelta_1d, /) -> _nt.Array2D[np.timedelta64]: ... @overload -def outer(x1: CoTimeDelta_1d, x2: ToTimeDelta_1d, /) -> Array2D[np.timedelta64]: ... +def outer(x1: _nt.CoTimeDelta_1d, x2: _nt.ToTimeDelta_1d, /) -> _nt.Array2D[np.timedelta64]: ... @overload -def outer(x1: ToObject_1d, x2: ToObject_1d, /) -> Array2D[np.object_]: ... +def outer(x1: _nt.ToObject_1d, x2: _nt.ToObject_1d, /) -> _nt.Array2D[np.object_]: ... @overload -def outer(x1: ToInteger_1d, x2: CoInteger_1d, /) -> Array2D[np.integer]: ... +def outer(x1: _nt.ToInteger_1d, x2: _nt.CoInteger_1d, /) -> _nt.Array2D[np.integer]: ... @overload -def outer(x1: CoInteger_1d, x2: ToInteger_1d, /) -> Array2D[np.integer]: ... +def outer(x1: _nt.CoInteger_1d, x2: _nt.ToInteger_1d, /) -> _nt.Array2D[np.integer]: ... @overload -def outer(x1: ToNumber_1d, x2: ToNumber_1d, /) -> Array2D[Any]: ... +def outer(x1: _nt.ToNumber_1d, x2: _nt.ToNumber_1d, /) -> _nt.Array2D[Any]: ... # @overload -def multi_dot(arrays: Iterable[_ToArray_1ds[_AnyNumberT]], *, out: None = None) -> _AnyNumberT: ... +def multi_dot(arrays: Iterable[_nt._ToArray_1ds[_AnyNumberT]], *, out: None = None) -> _AnyNumberT: ... @overload -def multi_dot(arrays: Iterable[_ToArray_2nd[_AnyNumberT]], *, out: None = None) -> Array[_AnyNumberT]: ... +def multi_dot(arrays: Iterable[_nt._ToArray_2nd[_AnyNumberT]], *, out: None = None) -> _nt.Array[_AnyNumberT]: ... @overload def multi_dot(arrays: Iterable[Sequence[bool]], *, out: None = None) -> np.bool: ... @overload -def multi_dot(arrays: Iterable[Sequence2ND[bool]], *, out: None = None) -> Array[np.bool]: ... +def multi_dot(arrays: Iterable[_nt.Sequence2ND[bool]], *, out: None = None) -> _nt.Array[np.bool]: ... @overload -def multi_dot(arrays: Iterable[Sequence[JustInt]], *, out: None = None) -> np.intp: ... +def multi_dot(arrays: Iterable[Sequence[_nt.JustInt]], *, out: None = None) -> np.intp: ... @overload -def multi_dot(arrays: Iterable[Sequence2ND[JustInt]], *, out: None = None) -> Array[np.intp]: ... +def multi_dot(arrays: Iterable[_nt.Sequence2ND[_nt.JustInt]], *, out: None = None) -> _nt.Array[np.intp]: ... @overload -def multi_dot(arrays: Iterable[Sequence[JustFloat]], *, out: None = None) -> np.float64: ... +def multi_dot(arrays: Iterable[Sequence[_nt.JustFloat]], *, out: None = None) -> np.float64: ... @overload -def multi_dot(arrays: Iterable[Sequence2ND[JustFloat]], *, out: None = None) -> Array[np.float64]: ... +def multi_dot(arrays: Iterable[_nt.Sequence2ND[_nt.JustFloat]], *, out: None = None) -> _nt.Array[np.float64]: ... @overload -def multi_dot(arrays: Iterable[Sequence[JustComplex]], *, out: None = None) -> np.complex128: ... +def multi_dot(arrays: Iterable[Sequence[_nt.JustComplex]], *, out: None = None) -> np.complex128: ... @overload -def multi_dot(arrays: Iterable[Sequence2ND[JustComplex]], *, out: None = None) -> Array[np.complex128]: ... +def multi_dot(arrays: Iterable[_nt.Sequence2ND[_nt.JustComplex]], *, out: None = None) -> _nt.Array[np.complex128]: ... @overload -def multi_dot(arrays: Iterable[CoComplex_1nd], *, out: _ArrayT) -> _ArrayT: ... +def multi_dot(arrays: Iterable[_nt.CoComplex_1nd], *, out: _ArrayT) -> _ArrayT: ... @overload -def multi_dot(arrays: Iterable[CoComplex_1nd | ToTimeDelta_1nd | ToObject_1nd], *, out: None = None) -> Any: ... +def multi_dot( + arrays: Iterable[_nt.CoComplex_1nd | _nt.ToTimeDelta_1nd | _nt.ToObject_1nd], *, out: None = None +) -> Any: ... # pyright false positive in case of typevar constraints @overload -def cross(x1: _ToArray_1nd[_AnyNumberT], x2: _ToArray_1nd[_AnyNumberT], /, *, axis: int = -1) -> Array[_AnyNumberT]: ... # pyright: ignore[reportOverlappingOverload] +def cross( # pyright: ignore[reportOverlappingOverload] + x1: _nt._ToArray_1nd[_AnyNumberT], x2: _nt._ToArray_1nd[_AnyNumberT], /, *, axis: int = -1 +) -> _nt.Array[_AnyNumberT]: ... @overload -def cross(x1: ToBool_1nd, x2: ToBool_1nd, /, *, axis: int = -1) -> Array[np.bool]: ... +def cross(x1: _nt.ToBool_1nd, x2: _nt.ToBool_1nd, /, *, axis: int = -1) -> _nt.Array[np.bool]: ... @overload -def cross(x1: ToInt_1nd, x2: CoInt64_1nd, /, *, axis: int = -1) -> Array[np.intp]: ... +def cross(x1: _nt.ToInt_1nd, x2: _nt.CoInt64_1nd, /, *, axis: int = -1) -> _nt.Array[np.intp]: ... @overload -def cross(x1: CoInt64_1nd, x2: ToInt_1nd, /, *, axis: int = -1) -> Array[np.intp]: ... +def cross(x1: _nt.CoInt64_1nd, x2: _nt.ToInt_1nd, /, *, axis: int = -1) -> _nt.Array[np.intp]: ... @overload -def cross(x1: ToFloat64_1nd, x2: CoFloat64_1nd, /, *, axis: int = -1) -> Array[np.float64]: ... +def cross(x1: _nt.ToFloat64_1nd, x2: _nt.CoFloat64_1nd, /, *, axis: int = -1) -> _nt.Array[np.float64]: ... @overload -def cross(x1: CoFloat64_1nd, x2: ToFloat64_1nd, /, *, axis: int = -1) -> Array[np.float64]: ... +def cross(x1: _nt.CoFloat64_1nd, x2: _nt.ToFloat64_1nd, /, *, axis: int = -1) -> _nt.Array[np.float64]: ... @overload -def cross(x1: ToComplex128_1nd, x2: CoComplex128_1nd, /, *, axis: int = -1) -> Array[np.complex128]: ... +def cross(x1: _nt.ToComplex128_1nd, x2: _nt.CoComplex128_1nd, /, *, axis: int = -1) -> _nt.Array[np.complex128]: ... @overload -def cross(x1: CoComplex128_1nd, x2: ToComplex128_1nd, /, *, axis: int = -1) -> Array[np.complex128]: ... +def cross(x1: _nt.CoComplex128_1nd, x2: _nt.ToComplex128_1nd, /, *, axis: int = -1) -> _nt.Array[np.complex128]: ... @overload -def cross(x1: ToInteger_1nd, x2: CoInteger_1nd, /, *, axis: int = -1) -> Array[np.integer]: ... +def cross(x1: _nt.ToInteger_1nd, x2: _nt.CoInteger_1nd, /, *, axis: int = -1) -> _nt.Array[np.integer]: ... @overload -def cross(x1: CoInteger_1nd, x2: ToInteger_1nd, /, *, axis: int = -1) -> Array[np.integer]: ... +def cross(x1: _nt.CoInteger_1nd, x2: _nt.ToInteger_1nd, /, *, axis: int = -1) -> _nt.Array[np.integer]: ... @overload -def cross(x1: ToFloating_1nd, x2: CoFloating_1nd, /, *, axis: int = -1) -> Array[np.floating]: ... +def cross(x1: _nt.ToFloating_1nd, x2: _nt.CoFloating_1nd, /, *, axis: int = -1) -> _nt.Array[np.floating]: ... @overload -def cross(x1: CoFloating_1nd, x2: ToFloating_1nd, /, *, axis: int = -1) -> Array[np.floating]: ... +def cross(x1: _nt.CoFloating_1nd, x2: _nt.ToFloating_1nd, /, *, axis: int = -1) -> _nt.Array[np.floating]: ... @overload -def cross(x1: ToComplex_1nd, x2: CoComplex_1nd, /, *, axis: int = -1) -> Array[np.complexfloating]: ... +def cross(x1: _nt.ToComplex_1nd, x2: _nt.CoComplex_1nd, /, *, axis: int = -1) -> _nt.Array[np.complexfloating]: ... @overload -def cross(x1: CoComplex_1nd, x2: ToComplex_1nd, /, *, axis: int = -1) -> Array[np.complexfloating]: ... +def cross(x1: _nt.CoComplex_1nd, x2: _nt.ToComplex_1nd, /, *, axis: int = -1) -> _nt.Array[np.complexfloating]: ... @overload -def cross(x1: CoComplex_1nd, x2: CoComplex_1nd, /, *, axis: int = -1) -> Array[Any]: ... +def cross(x1: _nt.CoComplex_1nd, x2: _nt.CoComplex_1nd, /, *, axis: int = -1) -> _nt.Array[Any]: ... # pyright false positive in case of typevar constraints @overload -def matmul(x1: _ToArray_1ds[_AnyNumberT], x2: _ToArray_1ds[_AnyNumberT], /) -> _AnyNumberT: ... # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _nt._ToArray_1ds[_AnyNumberT], x2: _nt._ToArray_1ds[_AnyNumberT], /) -> _AnyNumberT: ... # pyright: ignore[reportOverlappingOverload] @overload -def matmul(x1: _ToArray_2nd[_AnyNumberT], x2: _ToArray_1nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _nt._ToArray_2nd[_AnyNumberT], x2: _nt._ToArray_1nd[_AnyNumberT], /) -> _nt.Array[_AnyNumberT]: ... # pyright: ignore[reportOverlappingOverload] @overload -def matmul(x1: _ToArray_1nd[_AnyNumberT], x2: _ToArray_2nd[_AnyNumberT], /) -> Array[_AnyNumberT]: ... # pyright: ignore[reportOverlappingOverload] +def matmul(x1: _nt._ToArray_1nd[_AnyNumberT], x2: _nt._ToArray_2nd[_AnyNumberT], /) -> _nt.Array[_AnyNumberT]: ... # pyright: ignore[reportOverlappingOverload] @overload -def matmul(x1: ToBool_1ds, x2: ToBool_1ds, /) -> np.bool: ... +def matmul(x1: _nt.ToBool_1ds, x2: _nt.ToBool_1ds, /) -> np.bool: ... @overload -def matmul(x1: ToBool_2nd, x2: ToBool_1nd, /) -> Array[np.bool]: ... +def matmul(x1: _nt.ToBool_2nd, x2: _nt.ToBool_1nd, /) -> _nt.Array[np.bool]: ... @overload -def matmul(x1: ToBool_1nd, x2: ToBool_2nd, /) -> Array[np.bool]: ... +def matmul(x1: _nt.ToBool_1nd, x2: _nt.ToBool_2nd, /) -> _nt.Array[np.bool]: ... @overload -def matmul(x1: ToInt_1ds, x2: CoInt64_1ds, /) -> np.intp: ... +def matmul(x1: _nt.ToInt_1ds, x2: _nt.CoInt64_1ds, /) -> np.intp: ... @overload -def matmul(x1: CoInt64_1ds, x2: ToInt_1ds, /) -> np.intp: ... +def matmul(x1: _nt.CoInt64_1ds, x2: _nt.ToInt_1ds, /) -> np.intp: ... @overload -def matmul(x1: ToInt_2nd, x2: CoInt64_1nd, /) -> Array[np.intp]: ... +def matmul(x1: _nt.ToInt_2nd, x2: _nt.CoInt64_1nd, /) -> _nt.Array[np.intp]: ... @overload -def matmul(x1: CoInt64_1nd, x2: ToInt_2nd, /) -> Array[np.intp]: ... +def matmul(x1: _nt.CoInt64_1nd, x2: _nt.ToInt_2nd, /) -> _nt.Array[np.intp]: ... @overload -def matmul(x1: ToFloat64_1ds, x2: CoFloat64_1ds, /) -> np.float64: ... +def matmul(x1: _nt.ToFloat64_1ds, x2: _nt.CoFloat64_1ds, /) -> np.float64: ... @overload -def matmul(x1: CoFloat64_1ds, x2: ToFloat64_1ds, /) -> np.float64: ... +def matmul(x1: _nt.CoFloat64_1ds, x2: _nt.ToFloat64_1ds, /) -> np.float64: ... @overload -def matmul(x1: ToFloat64_2nd, x2: CoFloat64_1nd, /) -> Array[np.float64]: ... +def matmul(x1: _nt.ToFloat64_2nd, x2: _nt.CoFloat64_1nd, /) -> _nt.Array[np.float64]: ... @overload -def matmul(x1: CoFloat64_1nd, x2: ToFloat64_2nd, /) -> Array[np.float64]: ... +def matmul(x1: _nt.CoFloat64_1nd, x2: _nt.ToFloat64_2nd, /) -> _nt.Array[np.float64]: ... @overload -def matmul(x1: ToComplex128_1ds, x2: CoComplex128_1ds, /) -> np.complex128: ... +def matmul(x1: _nt.ToComplex128_1ds, x2: _nt.CoComplex128_1ds, /) -> np.complex128: ... @overload -def matmul(x1: CoComplex128_1ds, x2: ToComplex128_1ds, /) -> np.complex128: ... +def matmul(x1: _nt.CoComplex128_1ds, x2: _nt.ToComplex128_1ds, /) -> np.complex128: ... @overload -def matmul(x1: ToComplex128_2nd, x2: CoComplex128_1nd, /) -> Array[np.complex128]: ... +def matmul(x1: _nt.ToComplex128_2nd, x2: _nt.CoComplex128_1nd, /) -> _nt.Array[np.complex128]: ... @overload -def matmul(x1: CoComplex128_1nd, x2: ToComplex128_2nd, /) -> Array[np.complex128]: ... +def matmul(x1: _nt.CoComplex128_1nd, x2: _nt.ToComplex128_2nd, /) -> _nt.Array[np.complex128]: ... @overload -def matmul(x1: ToInteger_1ds, x2: CoInteger_1ds, /) -> np.integer: ... +def matmul(x1: _nt.ToInteger_1ds, x2: _nt.CoInteger_1ds, /) -> np.integer: ... @overload -def matmul(x1: CoInteger_1ds, x2: ToInteger_1ds, /) -> np.integer: ... +def matmul(x1: _nt.CoInteger_1ds, x2: _nt.ToInteger_1ds, /) -> np.integer: ... @overload -def matmul(x1: ToInteger_2nd, x2: CoInteger_1nd, /) -> Array[np.integer]: ... +def matmul(x1: _nt.ToInteger_2nd, x2: _nt.CoInteger_1nd, /) -> _nt.Array[np.integer]: ... @overload -def matmul(x1: CoInteger_1nd, x2: ToInteger_2nd, /) -> Array[np.integer]: ... +def matmul(x1: _nt.CoInteger_1nd, x2: _nt.ToInteger_2nd, /) -> _nt.Array[np.integer]: ... @overload -def matmul(x1: ToFloating_1ds, x2: CoFloating_1ds, /) -> np.floating: ... +def matmul(x1: _nt.ToFloating_1ds, x2: _nt.CoFloating_1ds, /) -> np.floating: ... @overload -def matmul(x1: CoFloating_1ds, x2: ToFloating_1ds, /) -> np.floating: ... +def matmul(x1: _nt.CoFloating_1ds, x2: _nt.ToFloating_1ds, /) -> np.floating: ... @overload -def matmul(x1: ToFloating_2nd, x2: CoFloating_1nd, /) -> Array[np.floating]: ... +def matmul(x1: _nt.ToFloating_2nd, x2: _nt.CoFloating_1nd, /) -> _nt.Array[np.floating]: ... @overload -def matmul(x1: CoFloating_1nd, x2: ToFloating_2nd, /) -> Array[np.floating]: ... +def matmul(x1: _nt.CoFloating_1nd, x2: _nt.ToFloating_2nd, /) -> _nt.Array[np.floating]: ... @overload -def matmul(x1: ToComplex_1ds, x2: CoComplex_1ds, /) -> np.complexfloating: ... +def matmul(x1: _nt.ToComplex_1ds, x2: _nt.CoComplex_1ds, /) -> np.complexfloating: ... @overload -def matmul(x1: CoComplex_1ds, x2: ToComplex_1ds, /) -> np.complexfloating: ... +def matmul(x1: _nt.CoComplex_1ds, x2: _nt.ToComplex_1ds, /) -> np.complexfloating: ... @overload -def matmul(x1: ToComplex_2nd, x2: CoComplex_1nd, /) -> Array[np.complexfloating]: ... +def matmul(x1: _nt.ToComplex_2nd, x2: _nt.CoComplex_1nd, /) -> _nt.Array[np.complexfloating]: ... @overload -def matmul(x1: CoComplex_1nd, x2: ToComplex_2nd, /) -> Array[np.complexfloating]: ... +def matmul(x1: _nt.CoComplex_1nd, x2: _nt.ToComplex_2nd, /) -> _nt.Array[np.complexfloating]: ... @overload -def matmul(x1: CoComplex_2nd, x2: CoComplex_1nd, /) -> Array[Any]: ... +def matmul(x1: _nt.CoComplex_2nd, x2: _nt.CoComplex_1nd, /) -> _nt.Array[Any]: ... @overload -def matmul(x1: CoComplex_1nd, x2: CoComplex_2nd, /) -> Array[Any]: ... +def matmul(x1: _nt.CoComplex_1nd, x2: _nt.CoComplex_2nd, /) -> _nt.Array[Any]: ... @overload -def matmul(x1: CoComplex_1nd, x2: CoComplex_1nd, /) -> Any: ... +def matmul(x1: _nt.CoComplex_1nd, x2: _nt.CoComplex_1nd, /) -> Any: ... # @overload # float64 def eig(a: _ToFloat64_1nd) -> EigResult[np.float64] | EigResult[np.complex128]: ... @overload # complex128 -def eig(a: ToComplex128_1nd) -> EigResult[np.complex128]: ... +def eig(a: _nt.ToComplex128_1nd) -> EigResult[np.complex128]: ... @overload # complex64 -def eig(a: ToComplex64_1nd) -> EigResult[np.complex64]: ... +def eig(a: _nt.ToComplex64_1nd) -> EigResult[np.complex64]: ... @overload # float32 -def eig(a: ToFloat32_1nd) -> EigResult[np.float32] | EigResult[np.complex64]: ... +def eig(a: _nt.ToFloat32_1nd) -> EigResult[np.float32] | EigResult[np.complex64]: ... @overload # +complex128 -def eig(a: CoComplex128_1nd) -> EigResult: ... +def eig(a: _nt.CoComplex128_1nd) -> EigResult: ... # @overload # float64 -def eigvals(a: _ToFloat64_1nd) -> Array[np.float64] | Array[np.complex128]: ... +def eigvals(a: _ToFloat64_1nd) -> _nt.Array[np.float64] | _nt.Array[np.complex128]: ... @overload # complex128 -def eigvals(a: ToComplex128_1nd) -> Array[np.complex128]: ... +def eigvals(a: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload # complex64 -def eigvals(a: ToComplex64_1nd) -> Array[np.complex64]: ... +def eigvals(a: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload # float32 -def eigvals(a: ToFloat32_1nd) -> Array[np.float32] | Array[np.complex64]: ... +def eigvals(a: _nt.ToFloat32_1nd) -> _nt.Array[np.float32] | _nt.Array[np.complex64]: ... @overload # +complex128 -def eigvals(a: CoComplex128_1nd) -> Array[np.inexact]: ... +def eigvals(a: _nt.CoComplex128_1nd) -> _nt.Array[np.inexact]: ... # @overload # float64 def eigh(a: _ToFloat64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.float64]: ... @overload # complex128 -def eigh(a: ToComplex128_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.complex128]: ... +def eigh(a: _nt.ToComplex128_1nd, UPLO: _UPLO = "L") -> EighResult[np.float64, np.complex128]: ... @overload # float32 -def eigh(a: ToFloat32_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.float32]: ... +def eigh(a: _nt.ToFloat32_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.float32]: ... @overload # complex64 -def eigh(a: ToComplex64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.complex64]: ... +def eigh(a: _nt.ToComplex64_1nd, UPLO: _UPLO = "L") -> EighResult[np.float32, np.complex64]: ... @overload # +complex128 -def eigh(a: CoComplex128_1nd, UPLO: _UPLO = "L") -> EighResult: ... +def eigh(a: _nt.CoComplex128_1nd, UPLO: _UPLO = "L") -> EighResult: ... # @overload # float64 | complex128 -def eigvalsh(a: _Toinexact64_1nd, UPLO: _UPLO = "L") -> Array[np.float64]: ... +def eigvalsh(a: _Toinexact64_1nd, UPLO: _UPLO = "L") -> _nt.Array[np.float64]: ... @overload # float32 | complex64 -def eigvalsh(a: _Toinexact32_1nd, UPLO: _UPLO = "L") -> Array[np.float32]: ... +def eigvalsh(a: _Toinexact32_1nd, UPLO: _UPLO = "L") -> _nt.Array[np.float32]: ... @overload # +complex128 -def eigvalsh(a: CoComplex128_1nd, UPLO: _UPLO = "L") -> Array[np.floating]: ... +def eigvalsh(a: _nt.CoComplex128_1nd, UPLO: _UPLO = "L") -> _nt.Array[np.floating]: ... # @overload # float64, reduced|complete @@ -669,29 +581,29 @@ def qr(a: _ToFloat64_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float64]]: .. @overload # float64, r def qr(a: _ToFloat64_1nd, mode: L["r"]) -> _Array_2nd[np.float64]: ... @overload # complex128, reduced|complete -def qr(a: ToComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex128]: ... +def qr(a: _nt.ToComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex128]: ... @overload # complex128, raw -def qr(a: ToComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex128]]: ... +def qr(a: _nt.ToComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex128]]: ... @overload # complex128, r -def qr(a: ToComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.complex128]: ... +def qr(a: _nt.ToComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.complex128]: ... @overload # float32, reduced|complete -def qr(a: ToFloat32_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float32]: ... +def qr(a: _nt.ToFloat32_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.float32]: ... @overload # float32, raw -def qr(a: ToFloat32_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float32]]: ... +def qr(a: _nt.ToFloat32_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.float32]]: ... @overload # float32, r -def qr(a: ToFloat32_1nd, mode: L["r"]) -> _Array_2nd[np.float32]: ... +def qr(a: _nt.ToFloat32_1nd, mode: L["r"]) -> _Array_2nd[np.float32]: ... @overload # complex64, reduced|complete -def qr(a: ToComplex64_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex64]: ... +def qr(a: _nt.ToComplex64_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.complex64]: ... @overload # complex64, raw -def qr(a: ToComplex64_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex64]]: ... +def qr(a: _nt.ToComplex64_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.complex64]]: ... @overload # complex64, r -def qr(a: ToComplex64_1nd, mode: L["r"]) -> _Array_2nd[np.complex64]: ... +def qr(a: _nt.ToComplex64_1nd, mode: L["r"]) -> _Array_2nd[np.complex64]: ... @overload # +complex128, reduced|complete -def qr(a: CoComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.inexact]: ... +def qr(a: _nt.CoComplex128_1nd, mode: L["reduced", "complete"] = "reduced") -> QRResult[np.inexact]: ... @overload # +complex128, raw -def qr(a: CoComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.inexact]]: ... +def qr(a: _nt.CoComplex128_1nd, mode: L["raw"]) -> _2Tuple[_Array_2nd[np.inexact]]: ... @overload # +complex128, r -def qr(a: CoComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.inexact]: ... +def qr(a: _nt.CoComplex128_1nd, mode: L["r"]) -> _Array_2nd[np.inexact]: ... # @overload # float64 | complex128, compute_uv=False (positional) @@ -700,7 +612,7 @@ def svd( full_matrices: bool, compute_uv: _False, hermitian: bool = False, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # float64 | complex128, compute_uv=False (keyword) def svd( a: _Toinexact64_1nd, @@ -708,7 +620,7 @@ def svd( *, compute_uv: _False, hermitian: bool = False, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # float64, compute_uv=True def svd( a: _ToFloat64_1nd, @@ -718,14 +630,14 @@ def svd( ) -> SVDResult[np.float64, np.float64]: ... @overload # complex128, compute_uv=True def svd( - a: ToComplex128_1nd, + a: _nt.ToComplex128_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, ) -> SVDResult[np.float64, np.complex128]: ... @overload # float32, compute_uv=True def svd( - a: ToFloat32_1nd, + a: _nt.ToFloat32_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, @@ -736,7 +648,7 @@ def svd( full_matrices: bool, compute_uv: _False, hermitian: bool = False, -) -> Array[np.float32]: ... +) -> _nt.Array[np.float32]: ... @overload # float32 | complex64, compute_uv=False (keyword) def svd( a: _Toinexact32_1nd, @@ -744,77 +656,77 @@ def svd( *, compute_uv: _False, hermitian: bool = False, -) -> Array[np.float32]: ... +) -> _nt.Array[np.float32]: ... @overload # complex64, compute_uv=True def svd( - a: ToComplex64_1nd, + a: _nt.ToComplex64_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, ) -> SVDResult[np.float32, np.complex64]: ... @overload # +complex128, compute_uv=True def svd( - a: CoComplex128_1nd, + a: _nt.CoComplex128_1nd, full_matrices: bool = True, compute_uv: _True = True, hermitian: bool = False, ) -> SVDResult: ... @overload # +complex128, compute_uv=False (positional) def svd( - a: CoComplex128_1nd, + a: _nt.CoComplex128_1nd, full_matrices: bool, compute_uv: _False, hermitian: bool = False, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload # +complex128, compute_uv=False (keyword) def svd( - a: CoComplex128_1nd, + a: _nt.CoComplex128_1nd, full_matrices: bool = True, *, compute_uv: _False, hermitian: bool = False, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... # @overload # float64 | complex128 -def svdvals(x: _Toinexact64_1nd, /) -> Array[np.float64]: ... +def svdvals(x: _Toinexact64_1nd, /) -> _nt.Array[np.float64]: ... @overload # floaat32 | complex64 -def svdvals(x: _Toinexact32_1nd, /) -> Array[np.float32]: ... +def svdvals(x: _Toinexact32_1nd, /) -> _nt.Array[np.float32]: ... @overload # +complex128 -def svdvals(x: CoComplex128_1nd, /) -> Array[np.floating]: ... +def svdvals(x: _nt.CoComplex128_1nd, /) -> _nt.Array[np.floating]: ... # @overload # <2d +complex128 def matrix_rank( - A: CoComplex128_0d | CoComplex128_1ds, - tol: ToFloating_nd | None = None, + A: _nt.CoComplex128_0d | _nt.CoComplex128_1ds, + tol: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | None = None, + rtol: _nt.ToFloating_nd | None = None, ) -> L[0, 1]: ... @overload # 2d +complex128 def matrix_rank( - A: CoComplex128_2ds, - tol: ToFloating_nd | None = None, + A: _nt.CoComplex128_2ds, + tol: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | None = None, + rtol: _nt.ToFloating_nd | None = None, ) -> np.intp: ... @overload # >2d +complex128 def matrix_rank( - A: CoComplex128_3nd, - tol: ToFloating_nd | None = None, + A: _nt.CoComplex128_3nd, + tol: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | None = None, -) -> Array[np.intp]: ... + rtol: _nt.ToFloating_nd | None = None, +) -> _nt.Array[np.intp]: ... @overload # nd +complex128 def matrix_rank( - A: CoComplex128_nd, - tol: ToFloating_nd | None = None, + A: _nt.CoComplex128_nd, + tol: _nt.ToFloating_nd | None = None, hermitian: bool = False, *, - rtol: ToFloating_nd | None = None, + rtol: _nt.ToFloating_nd | None = None, ) -> Any: ... # @@ -823,91 +735,103 @@ def cond(x: _Toinexact64_2ds, p: _Ord | None = None) -> np.float64: ... @overload # 2d float32 | complex64 def cond(x: _Toinexact32_2ds, p: _Ord | None = None) -> np.float32: ... @overload # 2d +complex128 -def cond(x: CoComplex128_2ds, p: _Ord | None = None) -> np.floating: ... +def cond(x: _nt.CoComplex128_2ds, p: _Ord | None = None) -> np.floating: ... @overload # >2d float64 | complex128 -def cond(x: _Toinexact64_3nd, p: _Ord | None = None) -> Array[np.float64]: ... +def cond(x: _Toinexact64_3nd, p: _Ord | None = None) -> _nt.Array[np.float64]: ... @overload # >2d float32 | complex64 -def cond(x: _Toinexact32_3nd, p: _Ord | None = None) -> Array[np.float32]: ... +def cond(x: _Toinexact32_3nd, p: _Ord | None = None) -> _nt.Array[np.float32]: ... @overload # >2d +complex128 -def cond(x: CoComplex128_3nd, p: _Ord | None = None) -> Array[np.floating]: ... +def cond(x: _nt.CoComplex128_3nd, p: _Ord | None = None) -> _nt.Array[np.floating]: ... @overload # +complex128 -def cond(x: CoComplex128_1nd, p: _Ord | None = None) -> Any: ... +def cond(x: _nt.CoComplex128_1nd, p: _Ord | None = None) -> Any: ... # keep in sync with `det` @overload # 2d float64 def slogdet(a: _ToFloat64_2ds) -> SlogdetResult[np.float64, np.float64]: ... @overload # 2d float32 -def slogdet(a: ToFloat32_2ds) -> SlogdetResult[np.float32, np.float32]: ... +def slogdet(a: _nt.ToFloat32_2ds) -> SlogdetResult[np.float32, np.float32]: ... @overload # 2d complex128 -def slogdet(a: ToComplex128_2ds) -> SlogdetResult[np.float64, np.complex128]: ... +def slogdet(a: _nt.ToComplex128_2ds) -> SlogdetResult[np.float64, np.complex128]: ... @overload # 2d complex64 -def slogdet(a: ToComplex64_2ds) -> SlogdetResult[np.float32, np.complex64]: ... +def slogdet(a: _nt.ToComplex64_2ds) -> SlogdetResult[np.float32, np.complex64]: ... @overload # >2d float64 -def slogdet(a: _ToFloat64_3nd) -> SlogdetResult[Array[np.float64], Array[np.float64]]: ... +def slogdet(a: _ToFloat64_3nd) -> SlogdetResult[_nt.Array[np.float64], _nt.Array[np.float64]]: ... @overload # >2d float32 -def slogdet(a: ToFloat32_3nd) -> SlogdetResult[Array[np.float32], Array[np.float32]]: ... +def slogdet(a: _nt.ToFloat32_3nd) -> SlogdetResult[_nt.Array[np.float32], _nt.Array[np.float32]]: ... @overload # >2d complex128 -def slogdet(a: ToComplex128_3nd) -> SlogdetResult[Array[np.float64], Array[np.complex128]]: ... +def slogdet(a: _nt.ToComplex128_3nd) -> SlogdetResult[_nt.Array[np.float64], _nt.Array[np.complex128]]: ... @overload # >2d complex64 -def slogdet(a: ToComplex64_3nd) -> SlogdetResult[Array[np.float32], Array[np.complex64]]: ... +def slogdet(a: _nt.ToComplex64_3nd) -> SlogdetResult[_nt.Array[np.float32], _nt.Array[np.complex64]]: ... @overload # +complex128 -def slogdet(a: CoComplex128_1nd) -> SlogdetResult[Any, Any]: ... +def slogdet(a: _nt.CoComplex128_1nd) -> SlogdetResult[Any, Any]: ... # @overload # 2d float64 def det(a: _ToFloat64_2ds) -> np.float64: ... @overload # 2d float32 -def det(a: ToFloat32_2ds) -> np.float32: ... +def det(a: _nt.ToFloat32_2ds) -> np.float32: ... @overload # 2d complex128 -def det(a: ToComplex128_2ds) -> np.complex128: ... +def det(a: _nt.ToComplex128_2ds) -> np.complex128: ... @overload # 2d complex64 -def det(a: ToComplex64_2ds) -> np.complex64: ... +def det(a: _nt.ToComplex64_2ds) -> np.complex64: ... @overload # >2d float64 -def det(a: _ToFloat64_3nd) -> Array[np.float64]: ... +def det(a: _ToFloat64_3nd) -> _nt.Array[np.float64]: ... @overload # >2d float32 -def det(a: ToFloat32_3nd) -> Array[np.float32]: ... +def det(a: _nt.ToFloat32_3nd) -> _nt.Array[np.float32]: ... @overload # >2d complex128 -def det(a: ToComplex128_3nd) -> Array[np.complex128]: ... +def det(a: _nt.ToComplex128_3nd) -> _nt.Array[np.complex128]: ... @overload # >2d complex64 -def det(a: ToComplex64_3nd) -> Array[np.complex64]: ... +def det(a: _nt.ToComplex64_3nd) -> _nt.Array[np.complex64]: ... @overload # +complex128 -def det(a: CoComplex128_1nd) -> Any: ... +def det(a: _nt.CoComplex128_1nd) -> Any: ... # @overload # float64, +float64 -def lstsq(a: _ToFloat64_1nd, b: CoFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... +def lstsq( + a: _ToFloat64_1nd, + b: _nt.CoFloat64_1nd, + rcond: float | None = None, +) -> _LstSqResult[np.float64, np.float64]: ... @overload # +float64, float64 -def lstsq(a: CoFloat64_1nd, b: _ToFloat64_1nd, rcond: float | None = None) -> _LstSqResult[np.float64, np.float64]: ... +def lstsq( + a: _nt.CoFloat64_1nd, + b: _ToFloat64_1nd, + rcond: float | None = None, +) -> _LstSqResult[np.float64, np.float64]: ... @overload # float32, float32 -def lstsq(a: ToFloat32_1nd, b: ToFloat32_1nd, rcond: float | None = None) -> _LstSqResult[np.float32, np.float32]: ... +def lstsq( + a: _nt.ToFloat32_1nd, + b: _nt.ToFloat32_1nd, + rcond: float | None = None, +) -> _LstSqResult[np.float32, np.float32]: ... @overload # complex128, +complex128 def lstsq( - a: ToComplex128_1nd, - b: CoComplex128_1nd, + a: _nt.ToComplex128_1nd, + b: _nt.CoComplex128_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex128, np.float64]: ... @overload # +complex128, complex128 def lstsq( - a: CoComplex128_1nd, - b: ToComplex128_1nd, + a: _nt.CoComplex128_1nd, + b: _nt.ToComplex128_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex128, np.float64]: ... @overload # complex64, +complex64 def lstsq( - a: ToComplex64_1nd, - b: CoComplex64_1nd, + a: _nt.ToComplex64_1nd, + b: _nt.CoComplex64_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex64, np.float32]: ... @overload # +complex64, complex64 def lstsq( - a: CoComplex64_1nd, - b: ToComplex64_1nd, + a: _nt.CoComplex64_1nd, + b: _nt.ToComplex64_1nd, rcond: float | None = None, ) -> _LstSqResult[np.complex64, np.float32]: ... @overload # +complex128, +complex128 def lstsq( - a: CoComplex128_1nd, - b: CoComplex128_1nd, + a: _nt.CoComplex128_1nd, + b: _nt.CoComplex128_1nd, rcond: float | None = None, ) -> _LstSqResult[np.inexact, np.floating]: ... @@ -919,17 +843,21 @@ def norm( x: _ToUnsafe64_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.float64]: ... @overload # float64 | complex128 | character, axis= (positional) -def norm(x: _ToUnsafe64_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def norm(x: _ToUnsafe64_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.float64]: ... # type: ignore[overload-overlap] @overload # float64 | complex128 | character, axis= (keyword) -def norm(x: _ToUnsafe64_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.float64]: ... # type: ignore[overload-overlap] +def norm( + x: _ToUnsafe64_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False +) -> _nt.Array[np.float64]: ... # type: ignore[overload-overlap] @overload # float16, axis=None, keepdims=False -def norm(x: ToFloat16_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.float16: ... +def norm(x: _nt.ToFloat16_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.float16: ... @overload # float16, keepdims=True (keyword) def norm( - x: ToFloat16_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True + x: _nt.ToFloat16_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.float16]: ... @overload # float16, axis= (keyword) -def norm(x: ToFloat16_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.float16]: ... +def norm( + x: _nt.ToFloat16_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False +) -> _nt.Array[np.float16]: ... @overload # float32 | complex64, axis=None, keepdims=False def norm(x: _Toinexact32_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.float32: ... @overload # float32 | complex64, keepdims=True (keyword) @@ -941,9 +869,11 @@ def norm( keepdims: _True, ) -> _Array_2nd[np.float32]: ... @overload # float32 | complex64, axis= (positional) -def norm(x: _Toinexact32_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.float32]: ... +def norm(x: _Toinexact32_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.float32]: ... @overload # float32 | complex64, axis= (keyword) -def norm(x: _Toinexact32_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.float32]: ... +def norm( + x: _Toinexact32_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False +) -> _nt.Array[np.float32]: ... @overload # longdouble | clongdouble, axis=None, keepdims=False def norm( x: _Toinexact64l_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False @@ -957,23 +887,25 @@ def norm( keepdims: _True, ) -> _Array_2nd[np.longdouble]: ... @overload # longdouble | clongdouble, axis= (positional) -def norm(x: _Toinexact64l_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.longdouble]: ... +def norm(x: _Toinexact64l_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.longdouble]: ... @overload # longdouble | clongdouble, axis= (keyword) def norm( x: _Toinexact64l_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False -) -> Array[np.longdouble]: ... +) -> _nt.Array[np.longdouble]: ... @overload # +number, axis=None, keepdims=False -def norm(x: CoComplex_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.floating: ... +def norm(x: _nt.CoComplex_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.floating: ... @overload # +number, keepdims=True def norm( - x: CoComplex_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True + x: _nt.CoComplex_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.floating]: ... @overload # +number, axis= (positional) -def norm(x: CoComplex_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> Array[np.floating]: ... +def norm(x: _nt.CoComplex_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.floating]: ... @overload # +number, axis= (keyword) -def norm(x: CoComplex_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False) -> Array[np.floating]: ... +def norm( + x: _nt.CoComplex_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False +) -> _nt.Array[np.floating]: ... @overload # +number -def norm(x: CoComplex_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, keepdims: bool = False) -> Any: ... +def norm(x: _nt.CoComplex_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, keepdims: bool = False) -> Any: ... # @overload # 2d float64 | complex128 | character @@ -981,33 +913,33 @@ def matrix_norm(x: _ToUnsafe64_2ds, /, *, keepdims: bool = False, ord: _Ord = "f @overload # nd float64 | complex128 | character, keepdims=True def matrix_norm(x: _ToUnsafe64_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.float64]: ... @overload # >2d float64 | complex128 | character -def matrix_norm(x: _ToUnsafe64_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Array[np.float64]: ... +def matrix_norm(x: _ToUnsafe64_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> _nt.Array[np.float64]: ... @overload # 2d float16 -def matrix_norm(x: ToFloat16_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.float16: ... # type: ignore[overload-overlap] +def matrix_norm(x: _nt.ToFloat16_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.float16: ... # type: ignore[overload-overlap] @overload # nd float16, keepdims=True -def matrix_norm(x: ToFloat16_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.float16]: ... +def matrix_norm(x: _nt.ToFloat16_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.float16]: ... @overload # >2d float16 -def matrix_norm(x: ToFloat16_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Array[np.float16]: ... +def matrix_norm(x: _nt.ToFloat16_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> _nt.Array[np.float16]: ... @overload # 2d float32 | complex64, keepdims=True def matrix_norm(x: _Toinexact32_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.float32: ... # type: ignore[overload-overlap] @overload # nd float32 | complex64, keepdims=True def matrix_norm(x: _Toinexact32_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.float32]: ... @overload # >2d float32 | complex64 -def matrix_norm(x: _Toinexact32_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Array[np.float32]: ... +def matrix_norm(x: _Toinexact32_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> _nt.Array[np.float32]: ... @overload # 2d longdouble | clongdouble def matrix_norm(x: _Toinexact64l_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.longdouble: ... # type: ignore[overload-overlap] @overload # nd longdouble | clongdouble, keepdims=True def matrix_norm(x: _Toinexact64l_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.longdouble]: ... @overload # >2d longdouble | clongdouble -def matrix_norm(x: _Toinexact64l_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Array[np.longdouble]: ... +def matrix_norm(x: _Toinexact64l_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> _nt.Array[np.longdouble]: ... @overload # 2d +number -def matrix_norm(x: CoComplex_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.floating: ... # type: ignore[overload-overlap] +def matrix_norm(x: _nt.CoComplex_2ds, /, *, keepdims: bool = False, ord: _Ord = "fro") -> np.floating: ... # type: ignore[overload-overlap] @overload # nd +number, keepdims=True -def matrix_norm(x: CoComplex_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.floating]: ... +def matrix_norm(x: _nt.CoComplex_1nd, /, *, keepdims: _True, ord: _Ord = "fro") -> _Array_2nd[np.floating]: ... @overload # >2d +number -def matrix_norm(x: CoComplex_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Array[np.floating]: ... +def matrix_norm(x: _nt.CoComplex_3nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> _nt.Array[np.floating]: ... @overload # nd +number -def matrix_norm(x: CoComplex_1nd | ToCharacter_1nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Any: ... +def matrix_norm(x: _nt.CoComplex_1nd | _nt.ToCharacter_1nd, /, *, keepdims: bool = False, ord: _Ord = "fro") -> Any: ... # @overload # float64 | complex128 | character, axis=None, keepdims=False @@ -1017,17 +949,23 @@ def vector_norm( @overload # float64 | complex128 | character, keepdims=True def vector_norm( x: _ToUnsafe64_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # float64 | complex128 | character, axis= -def vector_norm(x: _ToUnsafe64_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2) -> Array[np.float64]: ... +def vector_norm( + x: _ToUnsafe64_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2 +) -> _nt.Array[np.float64]: ... @overload # float16, axis=None, keepdims=False -def vector_norm(x: ToFloat16_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2) -> np.float16: ... +def vector_norm( + x: _nt.ToFloat16_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2 +) -> np.float16: ... @overload # float16, keepdims=True def vector_norm( - x: ToFloat16_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 -) -> Array[np.float16]: ... + x: _nt.ToFloat16_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 +) -> _nt.Array[np.float16]: ... @overload # float16, axis= -def vector_norm(x: ToFloat16_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2) -> Array[np.float16]: ... +def vector_norm( + x: _nt.ToFloat16_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2 +) -> _nt.Array[np.float16]: ... @overload # float32 | complex64, axis=None, keepdims=False def vector_norm( x: _Toinexact32_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2 @@ -1035,9 +973,11 @@ def vector_norm( @overload # float32 | complex64, keepdims=True def vector_norm( x: _Toinexact32_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 -) -> Array[np.float32]: ... +) -> _nt.Array[np.float32]: ... @overload # float32 | complex64, axis= -def vector_norm(x: _Toinexact32_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2) -> Array[np.float32]: ... +def vector_norm( + x: _Toinexact32_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2 +) -> _nt.Array[np.float32]: ... @overload # longdouble | clongdouble, axis=None, keepdims=False def vector_norm( x: _Toinexact64l_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2 @@ -1045,70 +985,80 @@ def vector_norm( @overload # longdouble | clongdouble, keepdims=True def vector_norm( x: _Toinexact64l_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 -) -> Array[np.longdouble]: ... +) -> _nt.Array[np.longdouble]: ... @overload # longdouble | clongdouble, axis= def vector_norm( x: _Toinexact64l_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2 -) -> Array[np.longdouble]: ... +) -> _nt.Array[np.longdouble]: ... @overload # +number, axis=None, keepdims=False -def vector_norm(x: CoComplex_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2) -> np.floating: ... +def vector_norm( + x: _nt.CoComplex_1nd, /, *, axis: None = None, keepdims: _False = False, ord: float = 2 +) -> np.floating: ... @overload # +number, keepdims=True def vector_norm( - x: CoComplex_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 -) -> Array[np.floating]: ... + x: _nt.CoComplex_1nd, /, *, axis: _Ax2 | None = None, keepdims: _True, ord: float = 2 +) -> _nt.Array[np.floating]: ... @overload # +number, axis= -def vector_norm(x: CoComplex_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2) -> Array[np.floating]: ... +def vector_norm( + x: _nt.CoComplex_1nd, /, *, axis: _Ax2, keepdims: bool = False, ord: float = 2 +) -> _nt.Array[np.floating]: ... @overload # +number -def vector_norm(x: CoComplex_1nd, /, *, axis: _Ax2 | None = None, keepdims: bool = False, ord: float = 2) -> Any: ... +def vector_norm( + x: _nt.CoComplex_1nd, /, *, axis: _Ax2 | None = None, keepdims: bool = False, ord: float = 2 +) -> Any: ... # @overload -def diagonal(x: ToObject_2nd, /, *, offset: CanIndex = 0) -> Array[np.object_]: ... +def diagonal(x: _nt.ToObject_2nd, /, *, offset: CanIndex = 0) -> _nt.Array[np.object_]: ... @overload -def diagonal(x: _ToArray_2ds[_NativeScalarT], /, *, offset: CanIndex = 0) -> Array1D[_NativeScalarT]: ... +def diagonal(x: _nt._ToArray_2ds[_NativeScalarT], /, *, offset: CanIndex = 0) -> _nt.Array1D[_NativeScalarT]: ... @overload -def diagonal(x: _ToArray_2nd_ish[_NativeScalarT], /, *, offset: CanIndex = 0) -> Array[_NativeScalarT]: ... +def diagonal(x: _ToArray_2nd_ish[_NativeScalarT], /, *, offset: CanIndex = 0) -> _nt.Array[_NativeScalarT]: ... @overload -def diagonal(x: Sequence2ND[bool], /, *, offset: CanIndex = 0) -> Array[np.bool]: ... +def diagonal(x: _nt.Sequence2ND[bool], /, *, offset: CanIndex = 0) -> _nt.Array[np.bool]: ... @overload -def diagonal(x: Sequence2ND[JustInt], /, *, offset: CanIndex = 0) -> Array[np.intp]: ... +def diagonal(x: _nt.Sequence2ND[_nt.JustInt], /, *, offset: CanIndex = 0) -> _nt.Array[np.intp]: ... @overload -def diagonal(x: Sequence2ND[JustFloat], /, *, offset: CanIndex = 0) -> Array[np.float64]: ... +def diagonal(x: _nt.Sequence2ND[_nt.JustFloat], /, *, offset: CanIndex = 0) -> _nt.Array[np.float64]: ... @overload -def diagonal(x: Sequence2ND[JustComplex], /, *, offset: CanIndex = 0) -> Array[np.complex128]: ... +def diagonal(x: _nt.Sequence2ND[_nt.JustComplex], /, *, offset: CanIndex = 0) -> _nt.Array[np.complex128]: ... @overload -def diagonal(x: Sequence2ND[JustBytes], /, *, offset: CanIndex = 0) -> Array[np.bytes_]: ... +def diagonal(x: _nt.Sequence2ND[_nt.JustBytes], /, *, offset: CanIndex = 0) -> _nt.Array[np.bytes_]: ... @overload -def diagonal(x: Sequence2ND[JustStr], /, *, offset: CanIndex = 0) -> Array[np.str_]: ... +def diagonal(x: _nt.Sequence2ND[_nt.JustStr], /, *, offset: CanIndex = 0) -> _nt.Array[np.str_]: ... @overload -def diagonal(x: ToGeneric_1nd, /, *, offset: CanIndex = 0) -> Array[Any]: ... +def diagonal(x: _nt.ToGeneric_1nd, /, *, offset: CanIndex = 0) -> _nt.Array[Any]: ... # @overload -def trace(x: _ToArray_2ds[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> _ScalarT: ... +def trace(x: _nt._ToArray_2ds[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> _ScalarT: ... @overload -def trace(x: _ToArray_3nd[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[_ScalarT]: ... +def trace(x: _nt._ToArray_3nd[_ScalarT], /, *, offset: CanIndex = 0, dtype: None = None) -> _nt.Array[_ScalarT]: ... @overload -def trace(x: Sequence2D[bool], /, *, offset: CanIndex = 0, dtype: None = None) -> np.bool: ... +def trace(x: _nt.Sequence2D[bool], /, *, offset: CanIndex = 0, dtype: None = None) -> np.bool: ... @overload -def trace(x: Sequence3ND[bool], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[np.bool]: ... +def trace(x: _nt.Sequence3ND[bool], /, *, offset: CanIndex = 0, dtype: None = None) -> _nt.Array[np.bool]: ... @overload -def trace(x: Sequence2D[JustInt], /, *, offset: CanIndex = 0, dtype: None = None) -> np.intp: ... +def trace(x: _nt.Sequence2D[_nt.JustInt], /, *, offset: CanIndex = 0, dtype: None = None) -> np.intp: ... @overload -def trace(x: Sequence3ND[JustInt], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[np.intp]: ... +def trace(x: _nt.Sequence3ND[_nt.JustInt], /, *, offset: CanIndex = 0, dtype: None = None) -> _nt.Array[np.intp]: ... @overload -def trace(x: Sequence2D[JustFloat], /, *, offset: CanIndex = 0, dtype: None = None) -> np.float64: ... +def trace(x: _nt.Sequence2D[_nt.JustFloat], /, *, offset: CanIndex = 0, dtype: None = None) -> np.float64: ... @overload -def trace(x: Sequence3ND[JustFloat], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[np.float64]: ... +def trace( + x: _nt.Sequence3ND[_nt.JustFloat], /, *, offset: CanIndex = 0, dtype: None = None +) -> _nt.Array[np.float64]: ... @overload -def trace(x: Sequence2D[JustComplex], /, *, offset: CanIndex = 0, dtype: None = None) -> np.complex128: ... +def trace(x: _nt.Sequence2D[_nt.JustComplex], /, *, offset: CanIndex = 0, dtype: None = None) -> np.complex128: ... @overload -def trace(x: Sequence3ND[JustComplex], /, *, offset: CanIndex = 0, dtype: None = None) -> Array[np.complex128]: ... +def trace( + x: _nt.Sequence3ND[_nt.JustComplex], /, *, offset: CanIndex = 0, dtype: None = None +) -> _nt.Array[np.complex128]: ... @overload -def trace(x: CoComplex_2ds, /, *, offset: CanIndex = 0, dtype: _ToDType[_ScalarT]) -> _ScalarT: ... +def trace(x: _nt.CoComplex_2ds, /, *, offset: CanIndex = 0, dtype: _ToDType[_ScalarT]) -> _ScalarT: ... @overload -def trace(x: CoComplex_3nd, /, *, offset: CanIndex = 0, dtype: _ToDType[_ScalarT]) -> Array[_ScalarT]: ... +def trace(x: _nt.CoComplex_3nd, /, *, offset: CanIndex = 0, dtype: _ToDType[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def trace(x: CoComplex_3nd, /, *, offset: CanIndex = 0, dtype: DTypeLike | None = None) -> Array[Any]: ... +def trace(x: _nt.CoComplex_3nd, /, *, offset: CanIndex = 0, dtype: DTypeLike | None = None) -> _nt.Array[Any]: ... @overload -def trace(x: CoComplex_1nd, /, *, offset: CanIndex = 0, dtype: DTypeLike | None = None) -> Any: ... +def trace(x: _nt.CoComplex_1nd, /, *, offset: CanIndex = 0, dtype: DTypeLike | None = None) -> Any: ... diff --git a/src/numpy-stubs/linalg/_umath_linalg.pyi b/src/numpy-stubs/linalg/_umath_linalg.pyi index 1d1a4bb4..ad122eaa 100644 --- a/src/numpy-stubs/linalg/_umath_linalg.pyi +++ b/src/numpy-stubs/linalg/_umath_linalg.pyi @@ -2,8 +2,8 @@ from collections.abc import Callable, Sequence from typing import Any, Concatenate, Final, Protocol, SupportsIndex, TypeAlias, overload, type_check_only from typing_extensions import TypeVar, Unpack +import _numtype as _nt import numpy as np -from _numtype import Array from numpy._core.umath import ( _AccumulateE, _AtE, @@ -19,9 +19,9 @@ from numpy._typing import ArrayLike, DTypeLike ### -_ArrayT = TypeVar("_ArrayT", bound=Array) -_ArrayT1 = TypeVar("_ArrayT1", bound=Array) -_ArrayT2 = TypeVar("_ArrayT2", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) +_ArrayT1 = TypeVar("_ArrayT1", bound=_nt.Array) +_ArrayT2 = TypeVar("_ArrayT2", bound=_nt.Array) _CallT11G = TypeVar("_CallT11G", bound=Callable[Concatenate[Any, ...], object], default=_Call11) _CallT12G = TypeVar("_CallT12G", bound=Callable[Concatenate[Any, ...], object], default=_Call12) @@ -55,7 +55,7 @@ class _Call11(Protocol): self, x: ArrayLike, /, - out: _Out1[Array | None] = None, + out: _Out1[_nt.Array | None] = None, *, dtype: DTypeLike | None = None, **kwds: Unpack[_Kwargs2], From 5bc8847e3772de9ab45532bcdc1cf8cb05dfe889 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 01:34:44 +0200 Subject: [PATCH 04/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`emath`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/lib/_scimath_impl.pyi | 596 ++++++++++++-------------- 1 file changed, 269 insertions(+), 327 deletions(-) diff --git a/src/numpy-stubs/lib/_scimath_impl.pyi b/src/numpy-stubs/lib/_scimath_impl.pyi index e8c28b94..caec8554 100644 --- a/src/numpy-stubs/lib/_scimath_impl.pyi +++ b/src/numpy-stubs/lib/_scimath_impl.pyi @@ -1,81 +1,23 @@ from typing import TypeAlias, overload +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - CanArray0D, - CoComplex_0d, - CoComplex_1nd, - CoComplex_nd, - CoFloating_0d, - CoFloating_1nd, - CoFloating_nd, - CoInt8_0d, - CoInt8_1nd, - CoInt8_nd, - CoInteger_0d, - CoInteger_1nd, - CoInteger_nd, - CoUInt8_0d, - CoUInt8_1nd, - CoUInt8_nd, - CoUInt64_0d, - CoUInt64_1nd, - CoUInt64_nd, - JustInt, - ToBool_0d, - ToBool_1nd, - ToCLongDouble_0d, - ToCLongDouble_1nd, - ToComplex64_0d, - ToComplex64_1nd, - ToComplex128_0d, - ToComplex128_1nd, - ToComplex_0d, - ToComplex_1nd, - ToComplex_nd, - ToFloat16_0d, - ToFloat16_1nd, - ToFloat32_0d, - ToFloat32_1nd, - ToFloat64_0d, - ToFloat64_1nd, - ToFloating_0d, - ToFloating_1nd, - ToFloating_nd, - ToInt8_0d, - ToInt8_1nd, - ToInt16_0d, - ToInt16_1nd, - ToLongDouble_0d, - ToLongDouble_1nd, - ToSInteger_0d, - ToSInteger_1nd, - ToSInteger_nd, - ToUInt8_0d, - ToUInt8_1nd, - ToUInt16_0d, - ToUInt16_1nd, - ToUInteger_0d, - ToUInteger_1nd, - ToUInteger_nd, - _ToArray2_1nd, - _ToArray_1nd, - integer8, - integer16, - integer32, - integer64, -) __all__ = ["arccos", "arcsin", "arctanh", "log", "log2", "log10", "logn", "power", "sqrt"] ### -_ToScalar_u4_u8: TypeAlias = CanArray0D[np.uint32 | np.uint64] -_ToScalar_i4_i8: TypeAlias = CanArray0D[np.int32 | np.int64] | JustInt +_ToScalar_iu1: TypeAlias = _nt.CanArray0D[_nt.integer8] +_ToScalar_iu2: TypeAlias = _nt.CanArray0D[_nt.integer16] +_ToScalar_iu4_iu8: TypeAlias = _nt.CanArray0D[_nt.integer32 | _nt.integer64] | _nt.JustInt +_ToScalar_i4_i8: TypeAlias = _nt.CanArray0D[np.int32 | np.int64] | _nt.JustInt +_ToScalar_u4_u8: TypeAlias = _nt.CanArray0D[np.uint32 | np.uint64] -_ToArray_u4_u8: TypeAlias = _ToArray_1nd[np.uint32 | np.uint64] -_ToArray_i4_i8: TypeAlias = _ToArray2_1nd[np.int32 | np.int64, JustInt] +_ToArray_iu1: TypeAlias = _nt._ToArray_1nd[_nt.integer8] +_ToArray_iu2: TypeAlias = _nt._ToArray_1nd[_nt.integer16] +_ToArray_iu4_iu8: TypeAlias = _nt._ToArray2_1nd[_nt.integer32 | _nt.integer64, _nt.JustInt] +_ToArray_i4_i8: TypeAlias = _nt._ToArray2_1nd[np.int32 | np.int64, _nt.JustInt] +_ToArray_u4_u8: TypeAlias = _nt._ToArray_1nd[np.uint32 | np.uint64] ### @@ -86,544 +28,544 @@ _ToArray_i4_i8: TypeAlias = _ToArray2_1nd[np.int32 | np.int64, JustInt] # @overload -def sqrt(x: ToBool_0d) -> np.float16: ... +def sqrt(x: _nt.ToBool_0d) -> np.float16: ... @overload def sqrt(x: _ToScalar_u4_u8) -> np.float64: ... @overload -def sqrt(x: ToUInt16_0d) -> np.float32: ... +def sqrt(x: _nt.ToUInt16_0d) -> np.float32: ... @overload -def sqrt(x: ToUInt8_0d) -> np.float16: ... +def sqrt(x: _nt.ToUInt8_0d) -> np.float16: ... @overload -def sqrt(x: CoUInt64_0d) -> np.floating: ... +def sqrt(x: _nt.CoUInt64_0d) -> np.floating: ... @overload -def sqrt(x: _ToScalar_i4_i8) -> np.float64 | np.complex128: ... +def sqrt(x: _ToScalar_i4_i8) -> _nt.inexact64: ... @overload -def sqrt(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def sqrt(x: _nt.ToInt16_0d) -> _nt.inexact32: ... @overload -def sqrt(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def sqrt(x: _nt.ToInt8_0d) -> np.float16 | np.complex64: ... @overload -def sqrt(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def sqrt(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def sqrt(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def sqrt(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def sqrt(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def sqrt(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def sqrt(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def sqrt(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def sqrt(x: ToComplex128_0d) -> np.complex128: ... +def sqrt(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def sqrt(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def sqrt(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def sqrt(x: ToComplex64_0d) -> np.complex64: ... +def sqrt(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def sqrt(x: ToComplex_0d) -> np.complexfloating: ... +def sqrt(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def sqrt(x: CoComplex_0d) -> np.inexact: ... +def sqrt(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def sqrt(x: ToBool_1nd) -> Array[np.float16]: ... +def sqrt(x: _nt.ToBool_1nd) -> _nt.Array[np.float16]: ... @overload -def sqrt(x: _ToArray_u4_u8) -> Array[np.float64]: ... +def sqrt(x: _ToArray_u4_u8) -> _nt.Array[np.float64]: ... @overload -def sqrt(x: ToUInt16_1nd) -> Array[np.float32]: ... +def sqrt(x: _nt.ToUInt16_1nd) -> _nt.Array[np.float32]: ... @overload -def sqrt(x: ToUInt8_1nd) -> Array[np.float16]: ... +def sqrt(x: _nt.ToUInt8_1nd) -> _nt.Array[np.float16]: ... @overload -def sqrt(x: CoUInt64_1nd) -> Array[np.floating]: ... +def sqrt(x: _nt.CoUInt64_1nd) -> _nt.Array[np.floating]: ... @overload -def sqrt(x: _ToArray_i4_i8) -> Array[np.float64 | np.complex128]: ... +def sqrt(x: _ToArray_i4_i8) -> _nt.Array[_nt.inexact64]: ... @overload -def sqrt(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... +def sqrt(x: _nt.ToInt16_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def sqrt(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... +def sqrt(x: _nt.ToInt8_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def sqrt(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def sqrt(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def sqrt(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def sqrt(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def sqrt(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def sqrt(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def sqrt(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def sqrt(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def sqrt(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def sqrt(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def sqrt(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def sqrt(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def sqrt(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def sqrt(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def sqrt(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def sqrt(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def sqrt(x: CoComplex_1nd) -> Array[np.inexact]: ... +def sqrt(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log(x: ToBool_0d) -> np.float16: ... +def log(x: _nt.ToBool_0d) -> np.float16: ... @overload def log(x: _ToScalar_u4_u8) -> np.float64: ... @overload -def log(x: ToUInt16_0d) -> np.float32: ... +def log(x: _nt.ToUInt16_0d) -> np.float32: ... @overload -def log(x: ToUInt8_0d) -> np.float16: ... +def log(x: _nt.ToUInt8_0d) -> np.float16: ... @overload -def log(x: CoUInt64_0d) -> np.floating: ... +def log(x: _nt.CoUInt64_0d) -> np.floating: ... @overload -def log(x: _ToScalar_i4_i8) -> np.float64 | np.complex128: ... +def log(x: _ToScalar_i4_i8) -> _nt.inexact64: ... @overload -def log(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log(x: _nt.ToInt16_0d) -> _nt.inexact32: ... @overload -def log(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log(x: _nt.ToInt8_0d) -> np.float16 | np.complex64: ... @overload -def log(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def log(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def log(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def log(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def log(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def log(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def log(x: ToComplex128_0d) -> np.complex128: ... +def log(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def log(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def log(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def log(x: ToComplex64_0d) -> np.complex64: ... +def log(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def log(x: ToComplex_0d) -> np.complexfloating: ... +def log(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def log(x: CoComplex_0d) -> np.inexact: ... +def log(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def log(x: ToBool_1nd) -> Array[np.float16]: ... +def log(x: _nt.ToBool_1nd) -> _nt.Array[np.float16]: ... @overload -def log(x: _ToArray_u4_u8) -> Array[np.float64]: ... +def log(x: _ToArray_u4_u8) -> _nt.Array[np.float64]: ... @overload -def log(x: ToUInt16_1nd) -> Array[np.float32]: ... +def log(x: _nt.ToUInt16_1nd) -> _nt.Array[np.float32]: ... @overload -def log(x: ToUInt8_1nd) -> Array[np.float16]: ... +def log(x: _nt.ToUInt8_1nd) -> _nt.Array[np.float16]: ... @overload -def log(x: CoUInt64_1nd) -> Array[np.floating]: ... +def log(x: _nt.CoUInt64_1nd) -> _nt.Array[np.floating]: ... @overload -def log(x: _ToArray_i4_i8) -> Array[np.float64 | np.complex128]: ... +def log(x: _ToArray_i4_i8) -> _nt.Array[_nt.inexact64]: ... @overload -def log(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... +def log(x: _nt.ToInt16_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... +def log(x: _nt.ToInt8_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def log(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def log(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def log(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def log(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def log(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def log(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def log(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def log(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def log(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def log(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def log(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def log(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def log(x: CoComplex_1nd) -> Array[np.inexact]: ... +def log(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log10(x: ToBool_0d) -> np.float16: ... +def log10(x: _nt.ToBool_0d) -> np.float16: ... @overload def log10(x: _ToScalar_u4_u8) -> np.float64: ... @overload -def log10(x: ToUInt16_0d) -> np.float32: ... +def log10(x: _nt.ToUInt16_0d) -> np.float32: ... @overload -def log10(x: ToUInt8_0d) -> np.float16: ... +def log10(x: _nt.ToUInt8_0d) -> np.float16: ... @overload -def log10(x: CoUInt64_0d) -> np.floating: ... +def log10(x: _nt.CoUInt64_0d) -> np.floating: ... @overload -def log10(x: _ToScalar_i4_i8) -> np.float64 | np.complex128: ... +def log10(x: _ToScalar_i4_i8) -> _nt.inexact64: ... @overload -def log10(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log10(x: _nt.ToInt16_0d) -> _nt.inexact32: ... @overload -def log10(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log10(x: _nt.ToInt8_0d) -> np.float16 | np.complex64: ... @overload -def log10(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log10(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def log10(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def log10(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def log10(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log10(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def log10(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def log10(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def log10(x: ToComplex128_0d) -> np.complex128: ... +def log10(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def log10(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def log10(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def log10(x: ToComplex64_0d) -> np.complex64: ... +def log10(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def log10(x: ToComplex_0d) -> np.complexfloating: ... +def log10(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def log10(x: CoComplex_0d) -> np.inexact: ... +def log10(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def log10(x: ToBool_1nd) -> Array[np.float16]: ... +def log10(x: _nt.ToBool_1nd) -> _nt.Array[np.float16]: ... @overload -def log10(x: _ToArray_u4_u8) -> Array[np.float64]: ... +def log10(x: _ToArray_u4_u8) -> _nt.Array[np.float64]: ... @overload -def log10(x: ToUInt16_1nd) -> Array[np.float32]: ... +def log10(x: _nt.ToUInt16_1nd) -> _nt.Array[np.float32]: ... @overload -def log10(x: ToUInt8_1nd) -> Array[np.float16]: ... +def log10(x: _nt.ToUInt8_1nd) -> _nt.Array[np.float16]: ... @overload -def log10(x: CoUInt64_1nd) -> Array[np.floating]: ... +def log10(x: _nt.CoUInt64_1nd) -> _nt.Array[np.floating]: ... @overload -def log10(x: _ToArray_i4_i8) -> Array[np.float64 | np.complex128]: ... +def log10(x: _ToArray_i4_i8) -> _nt.Array[_nt.inexact64]: ... @overload -def log10(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... +def log10(x: _nt.ToInt16_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log10(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... +def log10(x: _nt.ToInt8_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def log10(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def log10(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def log10(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def log10(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def log10(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log10(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log10(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log10(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def log10(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def log10(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def log10(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def log10(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def log10(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log10(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def log10(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def log10(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def log10(x: CoComplex_1nd) -> Array[np.inexact]: ... +def log10(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # signature is equivalent to `sqrt` @overload -def log2(x: ToBool_0d) -> np.float16: ... +def log2(x: _nt.ToBool_0d) -> np.float16: ... @overload def log2(x: _ToScalar_u4_u8) -> np.float64: ... @overload -def log2(x: ToUInt16_0d) -> np.float32: ... +def log2(x: _nt.ToUInt16_0d) -> np.float32: ... @overload -def log2(x: ToUInt8_0d) -> np.float16: ... +def log2(x: _nt.ToUInt8_0d) -> np.float16: ... @overload -def log2(x: CoUInt64_0d) -> np.floating: ... +def log2(x: _nt.CoUInt64_0d) -> np.floating: ... @overload -def log2(x: _ToScalar_i4_i8) -> np.float64 | np.complex128: ... +def log2(x: _ToScalar_i4_i8) -> _nt.inexact64: ... @overload -def log2(x: ToInt16_0d) -> np.float32 | np.complex64: ... +def log2(x: _nt.ToInt16_0d) -> _nt.inexact32: ... @overload -def log2(x: ToInt8_0d) -> np.float16 | np.complex64: ... +def log2(x: _nt.ToInt8_0d) -> np.float16 | np.complex64: ... @overload -def log2(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def log2(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def log2(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def log2(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def log2(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def log2(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def log2(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def log2(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def log2(x: ToComplex128_0d) -> np.complex128: ... +def log2(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def log2(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def log2(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def log2(x: ToComplex64_0d) -> np.complex64: ... +def log2(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def log2(x: ToComplex_0d) -> np.complexfloating: ... +def log2(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def log2(x: CoComplex_0d) -> np.inexact: ... +def log2(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def log2(x: ToBool_1nd) -> Array[np.float16]: ... +def log2(x: _nt.ToBool_1nd) -> _nt.Array[np.float16]: ... @overload -def log2(x: _ToArray_u4_u8) -> Array[np.float64]: ... +def log2(x: _ToArray_u4_u8) -> _nt.Array[np.float64]: ... @overload -def log2(x: ToUInt16_1nd) -> Array[np.float32]: ... +def log2(x: _nt.ToUInt16_1nd) -> _nt.Array[np.float32]: ... @overload -def log2(x: ToUInt8_1nd) -> Array[np.float16]: ... +def log2(x: _nt.ToUInt8_1nd) -> _nt.Array[np.float16]: ... @overload -def log2(x: CoUInt64_1nd) -> Array[np.floating]: ... +def log2(x: _nt.CoUInt64_1nd) -> _nt.Array[np.floating]: ... @overload -def log2(x: _ToArray_i4_i8) -> Array[np.float64 | np.complex128]: ... +def log2(x: _ToArray_i4_i8) -> _nt.Array[_nt.inexact64]: ... @overload -def log2(x: ToInt16_1nd) -> Array[np.float32 | np.complex64]: ... +def log2(x: _nt.ToInt16_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log2(x: ToInt8_1nd) -> Array[np.float16 | np.complex64]: ... +def log2(x: _nt.ToInt8_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def log2(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def log2(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def log2(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def log2(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def log2(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def log2(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def log2(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def log2(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def log2(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def log2(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def log2(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def log2(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def log2(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def log2(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def log2(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def log2(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def log2(x: CoComplex_1nd) -> Array[np.inexact]: ... +def log2(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # NOTE: The signatures of arccos, arcsin, and arctanh are identical # @overload -def arccos(x: ToBool_0d) -> np.float16 | np.complex64: ... +def arccos(x: _nt.ToBool_0d) -> np.float16 | np.complex64: ... @overload -def arccos(x: CanArray0D[integer64 | integer32] | JustInt) -> np.float64 | np.complex128: ... +def arccos(x: _ToScalar_iu4_iu8) -> _nt.inexact64: ... @overload -def arccos(x: CanArray0D[integer16]) -> np.float32 | np.complex64: ... +def arccos(x: _ToScalar_iu2) -> _nt.inexact32: ... @overload -def arccos(x: CanArray0D[integer8]) -> np.float16 | np.complex64: ... +def arccos(x: _ToScalar_iu1) -> np.float16 | np.complex64: ... @overload -def arccos(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arccos(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def arccos(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arccos(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def arccos(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arccos(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def arccos(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arccos(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def arccos(x: ToComplex128_0d) -> np.complex128: ... +def arccos(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def arccos(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arccos(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def arccos(x: ToComplex64_0d) -> np.complex64: ... +def arccos(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def arccos(x: ToComplex_0d) -> np.complexfloating: ... +def arccos(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def arccos(x: CoComplex_0d) -> np.inexact: ... +def arccos(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def arccos(x: ToBool_1nd) -> Array[np.float16 | np.complex64]: ... +def arccos(x: _nt.ToBool_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arccos(x: _ToArray2_1nd[integer64 | integer32, JustInt]) -> Array[np.float64 | np.complex128]: ... +def arccos(x: _ToArray_iu4_iu8) -> _nt.Array[_nt.inexact64]: ... @overload -def arccos(x: _ToArray_1nd[integer16]) -> Array[np.float32 | np.complex64]: ... +def arccos(x: _ToArray_iu2) -> _nt.Array[_nt.inexact32]: ... @overload -def arccos(x: _ToArray_1nd[integer8]) -> Array[np.float16 | np.complex64]: ... +def arccos(x: _ToArray_iu1) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arccos(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def arccos(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def arccos(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def arccos(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def arccos(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arccos(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def arccos(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def arccos(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def arccos(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def arccos(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def arccos(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def arccos(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def arccos(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arccos(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def arccos(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def arccos(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def arccos(x: CoComplex_1nd) -> Array[np.inexact]: ... +def arccos(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # signature is equivalent to `arccos` @overload -def arcsin(x: ToBool_0d) -> np.float16 | np.complex64: ... +def arcsin(x: _nt.ToBool_0d) -> np.float16 | np.complex64: ... @overload -def arcsin(x: CanArray0D[integer64 | integer32] | JustInt) -> np.float64 | np.complex128: ... +def arcsin(x: _ToScalar_iu4_iu8) -> _nt.inexact64: ... @overload -def arcsin(x: CanArray0D[integer16]) -> np.float32 | np.complex64: ... +def arcsin(x: _ToScalar_iu2) -> _nt.inexact32: ... @overload -def arcsin(x: CanArray0D[integer8]) -> np.float16 | np.complex64: ... +def arcsin(x: _ToScalar_iu1) -> np.float16 | np.complex64: ... @overload -def arcsin(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arcsin(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def arcsin(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arcsin(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def arcsin(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arcsin(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def arcsin(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arcsin(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def arcsin(x: ToComplex128_0d) -> np.complex128: ... +def arcsin(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def arcsin(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arcsin(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def arcsin(x: ToComplex64_0d) -> np.complex64: ... +def arcsin(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def arcsin(x: ToComplex_0d) -> np.complexfloating: ... +def arcsin(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def arcsin(x: CoComplex_0d) -> np.inexact: ... +def arcsin(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def arcsin(x: ToBool_1nd) -> Array[np.float16 | np.complex64]: ... +def arcsin(x: _nt.ToBool_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arcsin(x: _ToArray2_1nd[integer64 | integer32, JustInt]) -> Array[np.float64 | np.complex128]: ... +def arcsin(x: _ToArray_iu4_iu8) -> _nt.Array[_nt.inexact64]: ... @overload -def arcsin(x: _ToArray_1nd[integer16]) -> Array[np.float32 | np.complex64]: ... +def arcsin(x: _ToArray_iu2) -> _nt.Array[_nt.inexact32]: ... @overload -def arcsin(x: _ToArray_1nd[integer8]) -> Array[np.float16 | np.complex64]: ... +def arcsin(x: _ToArray_iu1) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arcsin(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def arcsin(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def arcsin(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def arcsin(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def arcsin(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arcsin(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def arcsin(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def arcsin(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def arcsin(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def arcsin(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def arcsin(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def arcsin(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def arcsin(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arcsin(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def arcsin(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def arcsin(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def arcsin(x: CoComplex_1nd) -> Array[np.inexact]: ... +def arcsin(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # signature is equivalent to `arccos` @overload -def arctanh(x: ToBool_0d) -> np.float16 | np.complex64: ... +def arctanh(x: _nt.ToBool_0d) -> np.float16 | np.complex64: ... @overload -def arctanh(x: CanArray0D[integer64 | integer32] | JustInt) -> np.float64 | np.complex128: ... +def arctanh(x: _ToScalar_iu4_iu8) -> _nt.inexact64: ... @overload -def arctanh(x: CanArray0D[integer16]) -> np.float32 | np.complex64: ... +def arctanh(x: _ToScalar_iu2) -> _nt.inexact32: ... @overload -def arctanh(x: CanArray0D[integer8]) -> np.float16 | np.complex64: ... +def arctanh(x: _ToScalar_iu1) -> np.float16 | np.complex64: ... @overload -def arctanh(x: ToFloat64_0d) -> np.float64 | np.complex128: ... +def arctanh(x: _nt.ToFloat64_0d) -> _nt.inexact64: ... @overload -def arctanh(x: ToLongDouble_0d) -> np.longdouble | np.complex128: ... +def arctanh(x: _nt.ToLongDouble_0d) -> np.longdouble | np.complex128: ... @overload -def arctanh(x: ToFloat32_0d) -> np.float32 | np.complex64: ... +def arctanh(x: _nt.ToFloat32_0d) -> _nt.inexact32: ... @overload -def arctanh(x: ToFloat16_0d) -> np.float16 | np.complex128: ... +def arctanh(x: _nt.ToFloat16_0d) -> np.float16 | np.complex128: ... @overload -def arctanh(x: ToComplex128_0d) -> np.complex128: ... +def arctanh(x: _nt.ToComplex128_0d) -> np.complex128: ... @overload -def arctanh(x: ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... +def arctanh(x: _nt.ToCLongDouble_0d) -> np.complex128 | np.clongdouble: ... @overload -def arctanh(x: ToComplex64_0d) -> np.complex64: ... +def arctanh(x: _nt.ToComplex64_0d) -> np.complex64: ... @overload -def arctanh(x: ToComplex_0d) -> np.complexfloating: ... +def arctanh(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def arctanh(x: CoComplex_0d) -> np.inexact: ... +def arctanh(x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def arctanh(x: ToBool_1nd) -> Array[np.float16 | np.complex64]: ... +def arctanh(x: _nt.ToBool_1nd) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arctanh(x: _ToArray2_1nd[integer64 | integer32, JustInt]) -> Array[np.float64 | np.complex128]: ... +def arctanh(x: _ToArray_iu4_iu8) -> _nt.Array[_nt.inexact64]: ... @overload -def arctanh(x: _ToArray_1nd[integer16]) -> Array[np.float32 | np.complex64]: ... +def arctanh(x: _ToArray_iu2) -> _nt.Array[_nt.inexact32]: ... @overload -def arctanh(x: _ToArray_1nd[integer8]) -> Array[np.float16 | np.complex64]: ... +def arctanh(x: _ToArray_iu1) -> _nt.Array[np.float16 | np.complex64]: ... @overload -def arctanh(x: ToFloat64_1nd) -> Array[np.float64 | np.complex128]: ... +def arctanh(x: _nt.ToFloat64_1nd) -> _nt.Array[_nt.inexact64]: ... @overload -def arctanh(x: ToLongDouble_1nd) -> Array[np.longdouble | np.complex128]: ... +def arctanh(x: _nt.ToLongDouble_1nd) -> _nt.Array[np.longdouble | np.complex128]: ... @overload -def arctanh(x: ToFloat32_1nd) -> Array[np.float32 | np.complex64]: ... +def arctanh(x: _nt.ToFloat32_1nd) -> _nt.Array[_nt.inexact32]: ... @overload -def arctanh(x: ToFloat16_1nd) -> Array[np.float16 | np.complex128]: ... +def arctanh(x: _nt.ToFloat16_1nd) -> _nt.Array[np.float16 | np.complex128]: ... @overload -def arctanh(x: ToComplex128_1nd) -> Array[np.complex128]: ... +def arctanh(x: _nt.ToComplex128_1nd) -> _nt.Array[np.complex128]: ... @overload -def arctanh(x: ToCLongDouble_1nd) -> Array[np.complex128 | np.clongdouble]: ... +def arctanh(x: _nt.ToCLongDouble_1nd) -> _nt.Array[np.complex128 | np.clongdouble]: ... @overload -def arctanh(x: ToComplex64_1nd) -> Array[np.complex64]: ... +def arctanh(x: _nt.ToComplex64_1nd) -> _nt.Array[np.complex64]: ... @overload -def arctanh(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def arctanh(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def arctanh(x: CoComplex_1nd) -> Array[np.inexact]: ... +def arctanh(x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... # @overload -def logn(n: CoUInt8_0d, x: CoUInt8_0d) -> np.float16: ... +def logn(n: _nt.CoUInt8_0d, x: _nt.CoUInt8_0d) -> np.float16: ... @overload -def logn(n: CoUInt64_0d, x: CoUInt64_0d) -> np.floating: ... +def logn(n: _nt.CoUInt64_0d, x: _nt.CoUInt64_0d) -> np.floating: ... @overload -def logn(n: ToComplex_0d, x: CoComplex_0d) -> np.complexfloating: ... +def logn(n: _nt.ToComplex_0d, x: _nt.CoComplex_0d) -> np.complexfloating: ... @overload -def logn(n: CoComplex_0d, x: ToComplex_0d) -> np.complexfloating: ... +def logn(n: _nt.CoComplex_0d, x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def logn(n: CoComplex_0d, x: CoComplex_0d) -> np.inexact: ... +def logn(n: _nt.CoComplex_0d, x: _nt.CoComplex_0d) -> np.inexact: ... @overload -def logn(n: CoUInt8_nd, x: CoUInt8_1nd) -> Array[np.float16]: ... +def logn(n: _nt.CoUInt8_nd, x: _nt.CoUInt8_1nd) -> _nt.Array[np.float16]: ... @overload -def logn(n: CoUInt8_1nd, x: CoUInt8_nd) -> Array[np.float16]: ... +def logn(n: _nt.CoUInt8_1nd, x: _nt.CoUInt8_nd) -> _nt.Array[np.float16]: ... @overload -def logn(n: CoUInt64_nd, x: CoUInt64_1nd) -> Array[np.floating]: ... +def logn(n: _nt.CoUInt64_nd, x: _nt.CoUInt64_1nd) -> _nt.Array[np.floating]: ... @overload -def logn(n: CoUInt64_1nd, x: CoUInt64_nd) -> Array[np.floating]: ... +def logn(n: _nt.CoUInt64_1nd, x: _nt.CoUInt64_nd) -> _nt.Array[np.floating]: ... @overload -def logn(n: ToComplex_nd, x: CoComplex_1nd) -> Array[np.complexfloating]: ... +def logn(n: _nt.ToComplex_nd, x: _nt.CoComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def logn(n: ToComplex_1nd, x: CoComplex_nd) -> Array[np.complexfloating]: ... +def logn(n: _nt.ToComplex_1nd, x: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def logn(n: CoComplex_nd, x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def logn(n: _nt.CoComplex_nd, x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def logn(n: CoComplex_1nd, x: ToComplex_nd) -> Array[np.complexfloating]: ... +def logn(n: _nt.CoComplex_1nd, x: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def logn(n: CoComplex_nd, x: CoComplex_1nd) -> Array[np.inexact]: ... +def logn(n: _nt.CoComplex_nd, x: _nt.CoComplex_1nd) -> _nt.Array[np.inexact]: ... @overload -def logn(n: CoComplex_1nd, x: CoComplex_nd) -> Array[np.inexact]: ... +def logn(n: _nt.CoComplex_1nd, x: _nt.CoComplex_nd) -> _nt.Array[np.inexact]: ... # @overload -def power(x: CoInt8_0d, p: CoInt8_0d) -> np.int8: ... +def power(x: _nt.CoInt8_0d, p: _nt.CoInt8_0d) -> np.int8: ... @overload -def power(x: ToUInteger_0d, p: CoUInt64_0d) -> np.unsignedinteger: ... +def power(x: _nt.ToUInteger_0d, p: _nt.CoUInt64_0d) -> np.unsignedinteger: ... @overload -def power(x: CoUInt64_0d, p: ToUInteger_0d) -> np.unsignedinteger: ... +def power(x: _nt.CoUInt64_0d, p: _nt.ToUInteger_0d) -> np.unsignedinteger: ... @overload -def power(x: CoUInt64_0d, p: ToSInteger_0d) -> np.signedinteger | np.float64: ... +def power(x: _nt.CoUInt64_0d, p: _nt.ToSInteger_0d) -> np.signedinteger | np.float64: ... @overload -def power(x: CoUInt64_0d, p: ToFloating_0d) -> np.floating: ... +def power(x: _nt.CoUInt64_0d, p: _nt.ToFloating_0d) -> np.floating: ... @overload -def power(x: ToSInteger_0d, p: CoUInt64_0d) -> np.signedinteger | np.complexfloating: ... +def power(x: _nt.ToSInteger_0d, p: _nt.CoUInt64_0d) -> np.signedinteger | np.complexfloating: ... @overload -def power(x: ToSInteger_0d, p: CoInteger_0d) -> np.signedinteger | np.inexact: ... +def power(x: _nt.ToSInteger_0d, p: _nt.CoInteger_0d) -> np.signedinteger | np.inexact: ... @overload -def power(x: ToFloating_0d, p: CoFloating_0d) -> np.inexact: ... +def power(x: _nt.ToFloating_0d, p: _nt.CoFloating_0d) -> np.inexact: ... @overload -def power(x: CoFloating_0d, p: ToFloating_0d) -> np.inexact: ... +def power(x: _nt.CoFloating_0d, p: _nt.ToFloating_0d) -> np.inexact: ... @overload -def power(x: ToComplex_0d, p: CoComplex_0d) -> np.complexfloating: ... +def power(x: _nt.ToComplex_0d, p: _nt.CoComplex_0d) -> np.complexfloating: ... @overload -def power(x: CoComplex_0d, p: ToComplex_0d) -> np.complexfloating: ... +def power(x: _nt.CoComplex_0d, p: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def power(x: CoInt8_nd, p: CoInt8_1nd) -> Array[np.int8]: ... +def power(x: _nt.CoInt8_nd, p: _nt.CoInt8_1nd) -> _nt.Array[np.int8]: ... @overload -def power(x: CoInt8_1nd, p: CoInt8_nd) -> Array[np.int8]: ... +def power(x: _nt.CoInt8_1nd, p: _nt.CoInt8_nd) -> _nt.Array[np.int8]: ... @overload -def power(x: ToUInteger_1nd, p: CoUInt64_nd) -> Array[np.unsignedinteger]: ... +def power(x: _nt.ToUInteger_1nd, p: _nt.CoUInt64_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def power(x: CoUInt64_1nd, p: ToUInteger_nd) -> Array[np.unsignedinteger]: ... +def power(x: _nt.CoUInt64_1nd, p: _nt.ToUInteger_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def power(x: CoUInt64_1nd, p: ToSInteger_nd) -> Array[np.signedinteger | np.float64]: ... +def power(x: _nt.CoUInt64_1nd, p: _nt.ToSInteger_nd) -> _nt.Array[np.signedinteger | np.float64]: ... @overload -def power(x: CoUInt64_nd, p: ToSInteger_1nd) -> Array[np.signedinteger | np.float64]: ... +def power(x: _nt.CoUInt64_nd, p: _nt.ToSInteger_1nd) -> _nt.Array[np.signedinteger | np.float64]: ... @overload -def power(x: CoUInt64_1nd, p: ToFloating_nd) -> Array[np.floating]: ... +def power(x: _nt.CoUInt64_1nd, p: _nt.ToFloating_nd) -> _nt.Array[np.floating]: ... @overload -def power(x: CoUInt64_nd, p: ToFloating_1nd) -> Array[np.floating]: ... +def power(x: _nt.CoUInt64_nd, p: _nt.ToFloating_1nd) -> _nt.Array[np.floating]: ... @overload -def power(x: ToUInteger_nd, p: CoUInt64_1nd) -> Array[np.unsignedinteger]: ... +def power(x: _nt.ToUInteger_nd, p: _nt.CoUInt64_1nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def power(x: CoUInt64_nd, p: ToUInteger_1nd) -> Array[np.unsignedinteger]: ... +def power(x: _nt.CoUInt64_nd, p: _nt.ToUInteger_1nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def power(x: ToSInteger_1nd, p: CoUInt64_nd) -> Array[np.signedinteger | np.complexfloating]: ... +def power(x: _nt.ToSInteger_1nd, p: _nt.CoUInt64_nd) -> _nt.Array[np.signedinteger | np.complexfloating]: ... @overload -def power(x: ToSInteger_nd, p: CoUInt64_1nd) -> Array[np.signedinteger | np.complexfloating]: ... +def power(x: _nt.ToSInteger_nd, p: _nt.CoUInt64_1nd) -> _nt.Array[np.signedinteger | np.complexfloating]: ... @overload -def power(x: ToSInteger_1nd, p: CoInteger_nd) -> Array[np.signedinteger | np.inexact]: ... +def power(x: _nt.ToSInteger_1nd, p: _nt.CoInteger_nd) -> _nt.Array[np.signedinteger | np.inexact]: ... @overload -def power(x: ToSInteger_nd, p: CoInteger_1nd) -> Array[np.signedinteger | np.inexact]: ... +def power(x: _nt.ToSInteger_nd, p: _nt.CoInteger_1nd) -> _nt.Array[np.signedinteger | np.inexact]: ... @overload -def power(x: ToFloating_1nd, p: CoFloating_nd) -> Array[np.inexact]: ... +def power(x: _nt.ToFloating_1nd, p: _nt.CoFloating_nd) -> _nt.Array[np.inexact]: ... @overload -def power(x: ToFloating_nd, p: CoFloating_1nd) -> Array[np.inexact]: ... +def power(x: _nt.ToFloating_nd, p: _nt.CoFloating_1nd) -> _nt.Array[np.inexact]: ... @overload -def power(x: CoFloating_1nd, p: ToFloating_nd) -> Array[np.inexact]: ... +def power(x: _nt.CoFloating_1nd, p: _nt.ToFloating_nd) -> _nt.Array[np.inexact]: ... @overload -def power(x: CoFloating_nd, p: ToFloating_1nd) -> Array[np.inexact]: ... +def power(x: _nt.CoFloating_nd, p: _nt.ToFloating_1nd) -> _nt.Array[np.inexact]: ... @overload -def power(x: CoComplex_nd, p: ToComplex_1nd) -> Array[np.complexfloating]: ... +def power(x: _nt.CoComplex_nd, p: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def power(x: CoComplex_1nd, p: ToComplex_nd) -> Array[np.complexfloating]: ... +def power(x: _nt.CoComplex_1nd, p: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def power(x: ToComplex_nd, p: CoComplex_1nd) -> Array[np.complexfloating]: ... +def power(x: _nt.ToComplex_nd, p: _nt.CoComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def power(x: ToComplex_1nd, p: CoComplex_nd) -> Array[np.complexfloating]: ... +def power(x: _nt.ToComplex_1nd, p: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... From ed05804246c7e3dfef2dd1a57f7a96a2a46b3766 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:10:07 +0200 Subject: [PATCH 05/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`lib`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/lib/_arraysetops_impl.pyi | 327 ++++---- src/numpy-stubs/lib/_function_base_impl.pyi | 885 ++++++++++---------- src/numpy-stubs/lib/_index_tricks_impl.pyi | 86 +- src/numpy-stubs/lib/_nanfunctions_impl.pyi | 123 ++- src/numpy-stubs/lib/_polynomial_impl.pyi | 461 +++++----- src/numpy-stubs/lib/_shape_base_impl.pyi | 113 ++- src/numpy-stubs/lib/_twodim_base_impl.pyi | 343 ++++---- src/numpy-stubs/lib/_type_check_impl.pyi | 113 ++- src/numpy-stubs/lib/_ufunclike_impl.pyi | 85 +- 9 files changed, 1161 insertions(+), 1375 deletions(-) diff --git a/src/numpy-stubs/lib/_arraysetops_impl.pyi b/src/numpy-stubs/lib/_arraysetops_impl.pyi index d54f7806..6b1c3d43 100644 --- a/src/numpy-stubs/lib/_arraysetops_impl.pyi +++ b/src/numpy-stubs/lib/_arraysetops_impl.pyi @@ -1,25 +1,8 @@ from typing import Any, Generic, Literal as L, NamedTuple, SupportsIndex as CanIndex, TypeAlias, overload from typing_extensions import TypeVar, deprecated +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - CoComplex128_nd, - CoComplex_nd, - CoDateTime_nd, - CoFloat64_nd, - CoFloating_nd, - CoInt64_nd, - CoInteger_nd, - CoTimeDelta_nd, - ToBool_nd, - ToComplex128_nd, - ToFloat64_nd, - ToInt_nd, - ToObject_nd, - _ToArray_nd, -) from numpy._typing import ArrayLike, _ArrayLike __all__ = [ @@ -37,6 +20,8 @@ __all__ = [ "unique_values", ] +### + _ScalarT = TypeVar("_ScalarT", bound=np.generic, default=Any) _CoNumberT = TypeVar("_CoNumberT", bound=np.number | np.timedelta64 | np.object_) @@ -58,81 +43,81 @@ _AnyScalarT = TypeVar( np.complex64, np.complex128, np.clongdouble, - np.timedelta64, - np.datetime64, np.object_, np.bytes_, np.str_, np.void, + np.datetime64, + np.timedelta64, ) -_IntersectResult: TypeAlias = tuple[Array1D[_ScalarT], Array1D[np.intp], Array1D[np.intp]] +_IntersectResult: TypeAlias = tuple[_nt.Array1D[_ScalarT], _nt.Array1D[np.intp], _nt.Array1D[np.intp]] ### class UniqueAllResult(NamedTuple, Generic[_ScalarT]): - values: Array1D[_ScalarT] - indices: Array1D[np.intp] - inverse_indices: Array[np.intp] - counts: Array1D[np.intp] + values: _nt.Array1D[_ScalarT] + indices: _nt.Array1D[np.intp] + inverse_indices: _nt.Array[np.intp] + counts: _nt.Array1D[np.intp] class UniqueCountsResult(NamedTuple, Generic[_ScalarT]): - values: Array1D[_ScalarT] - counts: Array1D[np.intp] + values: _nt.Array1D[_ScalarT] + counts: _nt.Array1D[np.intp] class UniqueInverseResult(NamedTuple, Generic[_ScalarT]): - values: Array1D[_ScalarT] - inverse_indices: Array[np.intp] + values: _nt.Array1D[_ScalarT] + inverse_indices: _nt.Array[np.intp] # @overload def ediff1d( - ary: ToBool_nd, + ary: _nt.ToBool_nd, to_end: ArrayLike | None = None, to_begin: ArrayLike | None = None, -) -> Array1D[np.int8]: ... +) -> _nt.Array1D[np.int8]: ... @overload def ediff1d( - ary: ToInt_nd, - to_end: CoInteger_nd | None = None, - to_begin: CoInteger_nd | None = None, -) -> Array1D[np.intp]: ... + ary: _nt.ToInt_nd, + to_end: _nt.CoInteger_nd | None = None, + to_begin: _nt.CoInteger_nd | None = None, +) -> _nt.Array1D[np.intp]: ... @overload def ediff1d( - ary: ToFloat64_nd, - to_end: CoFloating_nd | None = None, - to_begin: CoFloating_nd | None = None, -) -> Array1D[np.float64]: ... + ary: _nt.ToFloat64_nd, + to_end: _nt.CoFloating_nd | None = None, + to_begin: _nt.CoFloating_nd | None = None, +) -> _nt.Array1D[np.float64]: ... @overload def ediff1d( - ary: ToComplex128_nd, - to_end: CoComplex_nd | None = None, - to_begin: CoComplex_nd | None = None, -) -> Array1D[np.complex128]: ... + ary: _nt.ToComplex128_nd, + to_end: _nt.CoComplex_nd | None = None, + to_begin: _nt.CoComplex_nd | None = None, +) -> _nt.Array1D[np.complex128]: ... @overload def ediff1d( - ary: CoDateTime_nd, - to_end: CoTimeDelta_nd | None = None, - to_begin: CoTimeDelta_nd | None = None, -) -> Array1D[np.timedelta64]: ... + ary: _nt.CoDateTime_nd, + to_end: _nt.CoTimeDelta_nd | None = None, + to_begin: _nt.CoTimeDelta_nd | None = None, +) -> _nt.Array1D[np.timedelta64]: ... @overload def ediff1d( - ary: ToObject_nd, + ary: _nt.ToObject_nd, to_end: ArrayLike | None = None, to_begin: ArrayLike | None = None, -) -> Array1D[np.object_]: ... +) -> _nt.Array1D[np.object_]: ... @overload def ediff1d( - ary: _ToArray_nd[_CoNumberT], + ary: _nt._ToArray_nd[_CoNumberT], to_end: ArrayLike | None = None, to_begin: ArrayLike | None = None, -) -> Array1D[_CoNumberT]: ... +) -> _nt.Array1D[_CoNumberT]: ... @overload def ediff1d( - ary: CoComplex_nd | CoTimeDelta_nd, - to_end: CoComplex_nd | CoTimeDelta_nd | None = None, - to_begin: CoComplex_nd | CoTimeDelta_nd | None = None, -) -> Array1D[Any]: ... + ary: _nt.CoComplex_nd | _nt.CoTimeDelta_nd, + to_end: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | None = None, + to_begin: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | None = None, +) -> _nt.Array1D[Any]: ... # @overload @@ -144,7 +129,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def unique( ar: ArrayLike, @@ -154,7 +139,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> Array[Any]: ... +) -> _nt.Array[Any]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -164,7 +149,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -174,7 +159,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -184,7 +169,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -194,7 +179,7 @@ def unique( return_counts: L[False] = False, axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -204,7 +189,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -214,7 +199,7 @@ def unique( return_counts: L[False] = False, axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -224,7 +209,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -234,7 +219,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -244,7 +229,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -254,7 +239,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -264,7 +249,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -274,7 +259,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -284,7 +269,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -294,7 +279,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -304,7 +289,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -314,7 +299,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -324,7 +309,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -334,7 +319,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -344,7 +329,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -354,7 +339,7 @@ def unique( return_counts: L[True], axis: CanIndex | None = None, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: _ArrayLike[_ScalarT], @@ -364,7 +349,7 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[_ScalarT], Array[np.intp], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[_ScalarT], _nt.Array[np.intp], _nt.Array[np.intp], _nt.Array[np.intp]]: ... @overload def unique( ar: ArrayLike, @@ -374,17 +359,17 @@ def unique( axis: CanIndex | None = None, *, equal_nan: bool = True, -) -> tuple[Array[Any], Array[np.intp], Array[np.intp], Array[np.intp]]: ... +) -> tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp], _nt.Array[np.intp]]: ... # @overload -def unique_all(x: ToBool_nd) -> UniqueAllResult[np.bool]: ... +def unique_all(x: _nt.ToBool_nd) -> UniqueAllResult[np.bool]: ... @overload -def unique_all(x: ToInt_nd) -> UniqueAllResult[np.intp]: ... +def unique_all(x: _nt.ToInt_nd) -> UniqueAllResult[np.intp]: ... @overload -def unique_all(x: ToFloat64_nd) -> UniqueAllResult[np.float64]: ... +def unique_all(x: _nt.ToFloat64_nd) -> UniqueAllResult[np.float64]: ... @overload -def unique_all(x: ToComplex128_nd) -> UniqueAllResult[np.complex128]: ... +def unique_all(x: _nt.ToComplex128_nd) -> UniqueAllResult[np.complex128]: ... @overload def unique_all(x: _ArrayLike[_ScalarT]) -> UniqueAllResult[_ScalarT]: ... @overload @@ -392,13 +377,13 @@ def unique_all(x: ArrayLike) -> UniqueAllResult: ... # @overload -def unique_counts(x: ToBool_nd) -> UniqueCountsResult[np.bool]: ... +def unique_counts(x: _nt.ToBool_nd) -> UniqueCountsResult[np.bool]: ... @overload -def unique_counts(x: ToInt_nd) -> UniqueCountsResult[np.intp]: ... +def unique_counts(x: _nt.ToInt_nd) -> UniqueCountsResult[np.intp]: ... @overload -def unique_counts(x: ToFloat64_nd) -> UniqueCountsResult[np.float64]: ... +def unique_counts(x: _nt.ToFloat64_nd) -> UniqueCountsResult[np.float64]: ... @overload -def unique_counts(x: ToComplex128_nd) -> UniqueCountsResult[np.complex128]: ... +def unique_counts(x: _nt.ToComplex128_nd) -> UniqueCountsResult[np.complex128]: ... @overload def unique_counts(x: _ArrayLike[_ScalarT]) -> UniqueCountsResult[_ScalarT]: ... @overload @@ -406,13 +391,13 @@ def unique_counts(x: ArrayLike) -> UniqueCountsResult: ... # @overload -def unique_inverse(x: ToBool_nd) -> UniqueInverseResult[np.bool]: ... +def unique_inverse(x: _nt.ToBool_nd) -> UniqueInverseResult[np.bool]: ... @overload -def unique_inverse(x: ToInt_nd) -> UniqueInverseResult[np.intp]: ... +def unique_inverse(x: _nt.ToInt_nd) -> UniqueInverseResult[np.intp]: ... @overload -def unique_inverse(x: ToFloat64_nd) -> UniqueInverseResult[np.float64]: ... +def unique_inverse(x: _nt.ToFloat64_nd) -> UniqueInverseResult[np.float64]: ... @overload -def unique_inverse(x: ToComplex128_nd) -> UniqueInverseResult[np.complex128]: ... +def unique_inverse(x: _nt.ToComplex128_nd) -> UniqueInverseResult[np.complex128]: ... @overload def unique_inverse(x: _ArrayLike[_ScalarT]) -> UniqueInverseResult[_ScalarT]: ... @overload @@ -420,120 +405,120 @@ def unique_inverse(x: ArrayLike) -> UniqueInverseResult: ... # @overload -def unique_values(x: ToBool_nd) -> Array1D[np.bool]: ... +def unique_values(x: _nt.ToBool_nd) -> _nt.Array1D[np.bool]: ... @overload -def unique_values(x: ToInt_nd) -> Array1D[np.intp]: ... +def unique_values(x: _nt.ToInt_nd) -> _nt.Array1D[np.intp]: ... @overload -def unique_values(x: ToFloat64_nd) -> Array1D[np.float64]: ... +def unique_values(x: _nt.ToFloat64_nd) -> _nt.Array1D[np.float64]: ... @overload -def unique_values(x: ToComplex128_nd) -> Array1D[np.complex128]: ... +def unique_values(x: _nt.ToComplex128_nd) -> _nt.Array1D[np.complex128]: ... @overload -def unique_values(x: _ArrayLike[_ScalarT]) -> Array1D[_ScalarT]: ... +def unique_values(x: _ArrayLike[_ScalarT]) -> _nt.Array1D[_ScalarT]: ... @overload -def unique_values(x: ArrayLike) -> Array1D[Any]: ... +def unique_values(x: ArrayLike) -> _nt.Array1D[Any]: ... # @overload def intersect1d( - ar1: ToFloat64_nd, - ar2: CoFloat64_nd, + ar1: _nt.ToFloat64_nd, + ar2: _nt.CoFloat64_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload def intersect1d( - ar1: ToFloat64_nd, - ar2: CoFloat64_nd, + ar1: _nt.ToFloat64_nd, + ar2: _nt.CoFloat64_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.float64]: ... @overload def intersect1d( - ar1: CoFloat64_nd, - ar2: ToFloat64_nd, + ar1: _nt.CoFloat64_nd, + ar2: _nt.ToFloat64_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload def intersect1d( - ar1: CoFloat64_nd, - ar2: ToFloat64_nd, + ar1: _nt.CoFloat64_nd, + ar2: _nt.ToFloat64_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.float64]: ... @overload def intersect1d( - ar1: ToBool_nd, - ar2: ToBool_nd, + ar1: _nt.ToBool_nd, + ar2: _nt.ToBool_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.bool]: ... +) -> _nt.Array1D[np.bool]: ... @overload def intersect1d( - ar1: ToBool_nd, - ar2: ToBool_nd, + ar1: _nt.ToBool_nd, + ar2: _nt.ToBool_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.bool]: ... @overload def intersect1d( - ar1: ToInt_nd, - ar2: CoInt64_nd, + ar1: _nt.ToInt_nd, + ar2: _nt.CoInt64_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload def intersect1d( - ar1: ToInt_nd, - ar2: CoInt64_nd, + ar1: _nt.ToInt_nd, + ar2: _nt.CoInt64_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.intp]: ... @overload def intersect1d( - ar1: CoInt64_nd, - ar2: ToInt_nd, + ar1: _nt.CoInt64_nd, + ar2: _nt.ToInt_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload def intersect1d( - ar1: CoInt64_nd, - ar2: ToInt_nd, + ar1: _nt.CoInt64_nd, + ar2: _nt.ToInt_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.intp]: ... @overload def intersect1d( - ar1: ToComplex128_nd, - ar2: CoComplex128_nd, + ar1: _nt.ToComplex128_nd, + ar2: _nt.CoComplex128_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload def intersect1d( - ar1: ToComplex128_nd, - ar2: CoComplex128_nd, + ar1: _nt.ToComplex128_nd, + ar2: _nt.CoComplex128_nd, assume_unique: bool = False, *, return_indices: L[True], ) -> _IntersectResult[np.complex128]: ... @overload def intersect1d( - ar1: CoComplex128_nd, - ar2: ToComplex128_nd, + ar1: _nt.CoComplex128_nd, + ar2: _nt.ToComplex128_nd, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload def intersect1d( - ar1: CoComplex128_nd, - ar2: ToComplex128_nd, + ar1: _nt.CoComplex128_nd, + ar2: _nt.ToComplex128_nd, assume_unique: bool = False, *, return_indices: L[True], @@ -544,7 +529,7 @@ def intersect1d( ar2: _ArrayLike[_AnyScalarT], assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[_AnyScalarT]: ... +) -> _nt.Array1D[_AnyScalarT]: ... @overload def intersect1d( ar1: _ArrayLike[_AnyScalarT], @@ -559,7 +544,7 @@ def intersect1d( ar2: ArrayLike, assume_unique: bool = False, return_indices: L[False] = False, -) -> Array1D[Any]: ... +) -> _nt.Array1D[Any]: ... @overload def intersect1d( ar1: ArrayLike, @@ -571,71 +556,87 @@ def intersect1d( # @overload -def union1d(ar1: ToFloat64_nd, ar2: CoFloat64_nd) -> Array1D[np.float64]: ... +def union1d(ar1: _nt.ToFloat64_nd, ar2: _nt.CoFloat64_nd) -> _nt.Array1D[np.float64]: ... @overload -def union1d(ar1: CoFloat64_nd, ar2: ToFloat64_nd) -> Array1D[np.float64]: ... +def union1d(ar1: _nt.CoFloat64_nd, ar2: _nt.ToFloat64_nd) -> _nt.Array1D[np.float64]: ... @overload -def union1d(ar1: ToBool_nd, ar2: ToBool_nd) -> Array1D[np.bool]: ... +def union1d(ar1: _nt.ToBool_nd, ar2: _nt.ToBool_nd) -> _nt.Array1D[np.bool]: ... @overload -def union1d(ar1: ToInt_nd, ar2: CoInt64_nd) -> Array1D[np.intp]: ... +def union1d(ar1: _nt.ToInt_nd, ar2: _nt.CoInt64_nd) -> _nt.Array1D[np.intp]: ... @overload -def union1d(ar1: CoInt64_nd, ar2: ToInt_nd) -> Array1D[np.intp]: ... +def union1d(ar1: _nt.CoInt64_nd, ar2: _nt.ToInt_nd) -> _nt.Array1D[np.intp]: ... @overload -def union1d(ar1: ToComplex128_nd, ar2: CoComplex128_nd) -> Array1D[np.complex128]: ... +def union1d(ar1: _nt.ToComplex128_nd, ar2: _nt.CoComplex128_nd) -> _nt.Array1D[np.complex128]: ... @overload -def union1d(ar1: CoComplex128_nd, ar2: ToComplex128_nd) -> Array1D[np.complex128]: ... +def union1d(ar1: _nt.CoComplex128_nd, ar2: _nt.ToComplex128_nd) -> _nt.Array1D[np.complex128]: ... @overload -def union1d(ar1: _ArrayLike[_AnyScalarT], ar2: _ArrayLike[_AnyScalarT]) -> Array1D[_AnyScalarT]: ... +def union1d(ar1: _ArrayLike[_AnyScalarT], ar2: _ArrayLike[_AnyScalarT]) -> _nt.Array1D[_AnyScalarT]: ... @overload -def union1d(ar1: ArrayLike, ar2: ArrayLike) -> Array1D[Any]: ... +def union1d(ar1: ArrayLike, ar2: ArrayLike) -> _nt.Array1D[Any]: ... # @overload -def setxor1d(ar1: ToFloat64_nd, ar2: CoFloat64_nd, assume_unique: bool = False) -> Array1D[np.float64]: ... +def setxor1d(ar1: _nt.ToFloat64_nd, ar2: _nt.CoFloat64_nd, assume_unique: bool = False) -> _nt.Array1D[np.float64]: ... @overload -def setxor1d(ar1: CoFloat64_nd, ar2: ToFloat64_nd, assume_unique: bool = False) -> Array1D[np.float64]: ... +def setxor1d(ar1: _nt.CoFloat64_nd, ar2: _nt.ToFloat64_nd, assume_unique: bool = False) -> _nt.Array1D[np.float64]: ... @overload -def setxor1d(ar1: ToBool_nd, ar2: ToBool_nd, assume_unique: bool = False) -> Array1D[np.bool]: ... +def setxor1d(ar1: _nt.ToBool_nd, ar2: _nt.ToBool_nd, assume_unique: bool = False) -> _nt.Array1D[np.bool]: ... @overload -def setxor1d(ar1: ToInt_nd, ar2: CoInt64_nd, assume_unique: bool = False) -> Array1D[np.intp]: ... +def setxor1d(ar1: _nt.ToInt_nd, ar2: _nt.CoInt64_nd, assume_unique: bool = False) -> _nt.Array1D[np.intp]: ... @overload -def setxor1d(ar1: CoInt64_nd, ar2: ToInt_nd, assume_unique: bool = False) -> Array1D[np.intp]: ... +def setxor1d(ar1: _nt.CoInt64_nd, ar2: _nt.ToInt_nd, assume_unique: bool = False) -> _nt.Array1D[np.intp]: ... @overload -def setxor1d(ar1: ToComplex128_nd, ar2: CoComplex128_nd, assume_unique: bool = False) -> Array1D[np.complex128]: ... +def setxor1d( + ar1: _nt.ToComplex128_nd, + ar2: _nt.CoComplex128_nd, + assume_unique: bool = False, +) -> _nt.Array1D[np.complex128]: ... @overload -def setxor1d(ar1: CoComplex128_nd, ar2: ToComplex128_nd, assume_unique: bool = False) -> Array1D[np.complex128]: ... +def setxor1d( + ar1: _nt.CoComplex128_nd, + ar2: _nt.ToComplex128_nd, + assume_unique: bool = False, +) -> _nt.Array1D[np.complex128]: ... @overload def setxor1d( ar1: _ArrayLike[_AnyScalarT], ar2: _ArrayLike[_AnyScalarT], assume_unique: bool = False, -) -> Array1D[_AnyScalarT]: ... +) -> _nt.Array1D[_AnyScalarT]: ... @overload -def setxor1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False) -> Array1D[Any]: ... +def setxor1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False) -> _nt.Array1D[Any]: ... # @overload -def setdiff1d(ar1: ToFloat64_nd, ar2: CoFloat64_nd, assume_unique: bool = False) -> Array1D[np.float64]: ... +def setdiff1d(ar1: _nt.ToFloat64_nd, ar2: _nt.CoFloat64_nd, assume_unique: bool = False) -> _nt.Array1D[np.float64]: ... @overload -def setdiff1d(ar1: CoFloat64_nd, ar2: ToFloat64_nd, assume_unique: bool = False) -> Array1D[np.float64]: ... +def setdiff1d(ar1: _nt.CoFloat64_nd, ar2: _nt.ToFloat64_nd, assume_unique: bool = False) -> _nt.Array1D[np.float64]: ... @overload -def setdiff1d(ar1: ToBool_nd, ar2: ToBool_nd, assume_unique: bool = False) -> Array1D[np.bool]: ... +def setdiff1d(ar1: _nt.ToBool_nd, ar2: _nt.ToBool_nd, assume_unique: bool = False) -> _nt.Array1D[np.bool]: ... @overload -def setdiff1d(ar1: ToInt_nd, ar2: CoInt64_nd, assume_unique: bool = False) -> Array1D[np.intp]: ... +def setdiff1d(ar1: _nt.ToInt_nd, ar2: _nt.CoInt64_nd, assume_unique: bool = False) -> _nt.Array1D[np.intp]: ... @overload -def setdiff1d(ar1: CoInt64_nd, ar2: ToInt_nd, assume_unique: bool = False) -> Array1D[np.intp]: ... +def setdiff1d(ar1: _nt.CoInt64_nd, ar2: _nt.ToInt_nd, assume_unique: bool = False) -> _nt.Array1D[np.intp]: ... @overload -def setdiff1d(ar1: ToComplex128_nd, ar2: CoComplex128_nd, assume_unique: bool = False) -> Array1D[np.complex128]: ... +def setdiff1d( + ar1: _nt.ToComplex128_nd, + ar2: _nt.CoComplex128_nd, + assume_unique: bool = False, +) -> _nt.Array1D[np.complex128]: ... @overload -def setdiff1d(ar1: CoComplex128_nd, ar2: ToComplex128_nd, assume_unique: bool = False) -> Array1D[np.complex128]: ... +def setdiff1d( + ar1: _nt.CoComplex128_nd, + ar2: _nt.ToComplex128_nd, + assume_unique: bool = False, +) -> _nt.Array1D[np.complex128]: ... @overload def setdiff1d( ar1: _ArrayLike[_AnyScalarT], ar2: _ArrayLike[_AnyScalarT], assume_unique: bool = False, -) -> Array1D[_AnyScalarT]: ... +) -> _nt.Array1D[_AnyScalarT]: ... @overload -def setdiff1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False) -> Array1D[Any]: ... +def setdiff1d(ar1: ArrayLike, ar2: ArrayLike, assume_unique: bool = False) -> _nt.Array1D[Any]: ... # def isin( @@ -645,7 +646,7 @@ def isin( invert: bool = False, *, kind: L["sort", "table"] | None = None, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... # @deprecated("Use 'isin' instead") @@ -656,4 +657,4 @@ def in1d( invert: bool = False, *, kind: L["sort", "table"] | None = None, -) -> Array1D[np.bool]: ... +) -> _nt.Array1D[np.bool]: ... diff --git a/src/numpy-stubs/lib/_function_base_impl.pyi b/src/numpy-stubs/lib/_function_base_impl.pyi index c50b4ea9..60f4f5c9 100644 --- a/src/numpy-stubs/lib/_function_base_impl.pyi +++ b/src/numpy-stubs/lib/_function_base_impl.pyi @@ -1,12 +1,12 @@ import datetime as dt +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Sequence from typing import ( - Any, Concatenate, Final, Literal as L, Protocol, - SupportsIndex, + SupportsIndex as CanIndex, SupportsInt, TypeAlias, overload, @@ -14,78 +14,12 @@ from typing import ( ) from typing_extensions import LiteralString, ParamSpec, TypeIs, TypeVar, deprecated +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - Array2D, - Array3D, - Array4D, - CanLenArray, - CoComplex_0d, - CoComplex_1ds, - CoComplex_1nd, - CoComplex_2nd, - CoComplex_nd, - CoDateTime_nd, - CoFloat64_0d, - CoFloat64_nd, - CoFloating_0d, - CoFloating_1d, - CoFloating_1ds, - CoFloating_1nd, - CoFloating_2nd, - CoFloating_nd, - CoInteger_nd, - CoTimeDelta_1ds, - CoTimeDelta_1nd, - CoTimeDelta_2nd, - CoTimeDelta_nd, - ToBool_nd, - ToBytes_nd, - ToComplex128_nd, - ToComplex_0d, - ToComplex_1ds, - ToComplex_1nd, - ToComplex_2nd, - ToComplex_nd, - ToDateTime_nd, - ToFloat64_0d, - ToFloat64_nd, - ToFloating_0d, - ToGeneric_0d, - ToGeneric_1nd, - ToInt_nd, - ToObject_1nd, - ToObject_nd, - ToStr_nd, - ToTimeDelta_1ds, - ToTimeDelta_1nd, - ToTimeDelta_2nd, - ToTimeDelta_nd, - _ToArray2_1ds, - _ToArray2_1nd, - _ToArray2_2nd, - _ToArray_1nd, -) -from numpy import _OrderKACF # noqa: ICN003 +from numpy import _OrderKACF as _Order # noqa: ICN003 from numpy._core.multiarray import bincount from numpy._globals import _NoValueType -from numpy._typing import ( - ArrayLike, - DTypeLike, - _ArrayLike, - _ArrayLikeFloat_co, - _ArrayLikeInt_co, - _ArrayLikeNumber_co, - _ArrayLikeObject_co, - _DTypeLike, - _FloatLike_co, - _NestedSequence, - _NumberLike_co, - _ScalarLike_co, - _ShapeLike, -) +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ShapeLike __all__ = [ "angle", @@ -134,7 +68,7 @@ _Tss = ParamSpec("_Tss") _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) -_ArrayT = TypeVar("_ArrayT", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) _ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...]) _ScalarT = TypeVar("_ScalarT", bound=np.generic) _ScalarT1 = TypeVar("_ScalarT1", bound=np.generic) @@ -142,7 +76,7 @@ _ScalarT2 = TypeVar("_ScalarT2", bound=np.generic) _NumberT = TypeVar("_NumberT", bound=np.number) _2Tuple: TypeAlias = tuple[_T, _T] -_ToInt: TypeAlias = SupportsIndex | SupportsInt +_ToInt: TypeAlias = CanIndex | SupportsInt _PercentileMethod: TypeAlias = L[ "inverted_cdf", "averaged_inverted_cdf", @@ -173,7 +107,7 @@ class _CanLenAndGetSlice(Protocol[_T_co]): class vectorize: __doc__: str | None - pyfunc: Callable[..., Any] + pyfunc: Callable[..., Incomplete] cache: Final[bool] signature: Final[LiteralString | None] otypes: Final[LiteralString | None] @@ -183,7 +117,7 @@ class vectorize: def __init__( self, /, - pyfunc: Callable[..., Any] | _NoValueType = ..., + pyfunc: Callable[..., Incomplete] | _NoValueType = ..., otypes: str | Iterable[DTypeLike] | None = None, doc: str | None = None, excluded: Iterable[int | str] | None = None, @@ -192,218 +126,220 @@ class vectorize: ) -> None: ... # - def __call__(self, /, *args: Any, **kwargs: Any) -> Any: ... + def __call__(self, /, *args: Incomplete, **kwargs: Incomplete) -> Incomplete: ... ### # @overload -def rot90(m: _ArrayLike[_ScalarT], k: int = 1, axes: tuple[int, int] = (0, 1)) -> Array[_ScalarT]: ... +def rot90(m: _ArrayLike[_ScalarT], k: int = 1, axes: tuple[int, int] = (0, 1)) -> _nt.Array[_ScalarT]: ... @overload -def rot90(m: ArrayLike, k: int = 1, axes: tuple[int, int] = (0, 1)) -> Array: ... +def rot90(m: ArrayLike, k: int = 1, axes: tuple[int, int] = (0, 1)) -> _nt.Array[Incomplete]: ... # @overload def flip(m: _ScalarT, axis: None = None) -> _ScalarT: ... @overload -def flip(m: _ScalarLike_co, axis: None = None) -> Any: ... +def flip(m: _nt.ToGeneric_0d, axis: None = None) -> Incomplete: ... @overload -def flip(m: _ToArray_1nd[_ScalarT], axis: _ShapeLike | None = None) -> Array[_ScalarT]: ... +def flip(m: _nt._ToArray_1nd[_ScalarT], axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def flip(m: ToGeneric_1nd, axis: _ShapeLike | None = None) -> Array: ... +def flip(m: _nt.ToGeneric_1nd, axis: _ShapeLike | None = None) -> _nt.Array[Incomplete]: ... # -def iterable(y: object) -> TypeIs[Iterable[Any]]: ... +def iterable(y: object) -> TypeIs[Iterable[Incomplete]]: ... # @overload def average( - a: ToFloat64_nd | CoInteger_nd, + a: _nt.ToFloat64_nd | _nt.CoInteger_nd, axis: None = None, - weights: CoFloat64_nd | None = None, + weights: _nt.CoFloat64_nd | None = None, returned: L[False] = False, *, keepdims: _NoValueType | L[False] = ..., ) -> np.float64: ... @overload def average( - a: ToFloat64_nd | CoInteger_nd, + a: _nt.ToFloat64_nd | _nt.CoInteger_nd, axis: None, - weights: CoFloat64_nd | None, + weights: _nt.CoFloat64_nd | None, returned: L[True], *, keepdims: _NoValueType = ..., ) -> _2Tuple[np.float64]: ... @overload def average( - a: ToFloat64_nd | CoInteger_nd, + a: _nt.ToFloat64_nd | _nt.CoInteger_nd, axis: None = None, - weights: CoFloat64_nd | None = None, + weights: _nt.CoFloat64_nd | None = None, *, returned: L[True], keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.float64]: ... @overload def average( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None = None, - weights: CoFloating_nd | None = None, + weights: _nt.CoFloating_nd | None = None, returned: L[False] = False, *, keepdims: _NoValueType | L[False] = ..., ) -> np.floating: ... @overload def average( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None, - weights: CoFloating_nd | None, + weights: _nt.CoFloating_nd | None, returned: L[True], *, keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.floating]: ... @overload def average( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None = None, - weights: CoFloating_nd | None = None, + weights: _nt.CoFloating_nd | None = None, *, returned: L[True], keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.floating]: ... @overload def average( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, - weights: CoComplex_nd | None = None, + weights: _nt.CoComplex_nd | None = None, returned: L[False] = False, *, keepdims: _NoValueType | L[False] = ..., ) -> np.complexfloating: ... @overload def average( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None, - weights: ToComplex_nd, + weights: _nt.ToComplex_nd, returned: L[False] = False, *, keepdims: _NoValueType | L[False] = ..., ) -> np.complexfloating: ... @overload def average( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None = None, *, - weights: ToComplex_nd, + weights: _nt.ToComplex_nd, returned: L[False] = False, keepdims: _NoValueType | L[False] = ..., ) -> np.complexfloating: ... @overload def average( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None, - weights: CoComplex_nd | None, + weights: _nt.CoComplex_nd | None, returned: L[True], *, keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.complexfloating]: ... @overload def average( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None, - weights: ToComplex_nd, + weights: _nt.ToComplex_nd, returned: L[True], *, keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.complexfloating]: ... @overload def average( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, - weights: CoComplex_nd | None = None, + weights: _nt.CoComplex_nd | None = None, *, returned: L[True], keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.complexfloating]: ... @overload def average( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None = None, *, - weights: ToComplex_nd, + weights: _nt.ToComplex_nd, returned: L[True], keepdims: _NoValueType | L[False] = ..., ) -> _2Tuple[np.complexfloating]: ... @overload def average( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, - weights: CoComplex_nd | ToObject_nd | None = None, + weights: _nt.CoComplex_nd | _nt.ToObject_nd | None = None, returned: L[False] = False, *, keepdims: _NoValueType | bool = ..., -) -> Any: ... +) -> Incomplete: ... @overload def average( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None, - weights: CoComplex_nd | ToObject_nd | None, + weights: _nt.CoComplex_nd | _nt.ToObject_nd | None, returned: L[True], *, keepdims: _NoValueType | bool = ..., -) -> _2Tuple[Any]: ... +) -> _2Tuple[Incomplete]: ... @overload def average( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, - weights: CoComplex_nd | ToObject_nd | None = None, + weights: _nt.CoComplex_nd | _nt.ToObject_nd | None = None, *, returned: L[True], keepdims: _NoValueType | bool = ..., -) -> _2Tuple[Any]: ... +) -> _2Tuple[Incomplete]: ... # @overload -def asarray_chkfinite(a: ToBool_nd, dtype: None = None, order: _OrderKACF | None = None) -> Array[np.bool]: ... +def asarray_chkfinite(a: _nt.ToBool_nd, dtype: None = None, order: _Order | None = None) -> _nt.Array[np.bool]: ... @overload -def asarray_chkfinite(a: ToInt_nd, dtype: None = None, order: _OrderKACF | None = None) -> Array[np.intp]: ... +def asarray_chkfinite(a: _nt.ToInt_nd, dtype: None = None, order: _Order | None = None) -> _nt.Array[np.intp]: ... @overload -def asarray_chkfinite(a: ToFloat64_0d, dtype: None = None, order: _OrderKACF | None = None) -> Array[np.float64]: ... +def asarray_chkfinite( + a: _nt.ToFloat64_0d, dtype: None = None, order: _Order | None = None +) -> _nt.Array[np.float64]: ... @overload def asarray_chkfinite( - a: ToComplex128_nd, dtype: None = None, order: _OrderKACF | None = None -) -> Array[np.complex128]: ... + a: _nt.ToComplex128_nd, dtype: None = None, order: _Order | None = None +) -> _nt.Array[np.complex128]: ... @overload -def asarray_chkfinite(a: ToBytes_nd, dtype: None = None, order: _OrderKACF | None = None) -> Array[np.bytes_]: ... +def asarray_chkfinite(a: _nt.ToBytes_nd, dtype: None = None, order: _Order | None = None) -> _nt.Array[np.bytes_]: ... @overload -def asarray_chkfinite(a: ToStr_nd, dtype: None = None, order: _OrderKACF | None = None) -> Array[np.str_]: ... +def asarray_chkfinite(a: _nt.ToStr_nd, dtype: None = None, order: _Order | None = None) -> _nt.Array[np.str_]: ... @overload def asarray_chkfinite( - a: _ArrayLike[_ScalarT], dtype: None = None, order: _OrderKACF | None = None -) -> Array[_ScalarT]: ... + a: _ArrayLike[_ScalarT], dtype: None = None, order: _Order | None = None +) -> _nt.Array[_ScalarT]: ... @overload -def asarray_chkfinite(a: object, dtype: _DTypeLike[_ScalarT], order: _OrderKACF | None = None) -> Array[_ScalarT]: ... +def asarray_chkfinite(a: object, dtype: _DTypeLike[_ScalarT], order: _Order | None = None) -> _nt.Array[_ScalarT]: ... @overload -def asarray_chkfinite(a: object, dtype: None = None, order: _OrderKACF | None = None) -> Array: ... +def asarray_chkfinite(a: object, dtype: None = None, order: _Order | None = None) -> _nt.Array[Incomplete]: ... @overload -def asarray_chkfinite(a: object, dtype: DTypeLike, order: _OrderKACF | None = None) -> Array: ... +def asarray_chkfinite(a: object, dtype: DTypeLike, order: _Order | None = None) -> _nt.Array[Incomplete]: ... # @overload def piecewise( x: _ArrayLike[_ScalarT], - condlist: ToBool_nd, - funclist: Sequence[Callable[Concatenate[Array1D[_ScalarT], _Tss], Array] | _ScalarT | object], + condlist: _nt.ToBool_nd, + funclist: Sequence[Callable[Concatenate[_nt.Array1D[_ScalarT], _Tss], _nt.Array] | _ScalarT | object], *args: _Tss.args, **kw: _Tss.kwargs, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def piecewise( x: ArrayLike, - condlist: ToBool_nd, - funclist: Sequence[Callable[Concatenate[Array1D, _Tss], Array] | object], + condlist: _nt.ToBool_nd, + funclist: Sequence[Callable[Concatenate[_nt.Array1D, _Tss], _nt.Array] | object], *args: _Tss.args, **kw: _Tss.kwargs, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload @@ -411,184 +347,206 @@ def select( condlist: Sequence[ArrayLike], choicelist: Sequence[_ArrayLike[_ScalarT]], default: ArrayLike = 0, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload -def select(condlist: Sequence[ArrayLike], choicelist: Sequence[ArrayLike], default: ArrayLike = 0) -> Array: ... +def select( + condlist: Sequence[ArrayLike], + choicelist: Sequence[ArrayLike], + default: ArrayLike = 0, +) -> _nt.Array[Incomplete]: ... # @overload -def copy(a: _ArrayT, order: _OrderKACF, subok: L[True]) -> _ArrayT: ... +def copy(a: _ArrayT, order: _Order, subok: L[True]) -> _ArrayT: ... @overload -def copy(a: _ArrayT, order: _OrderKACF = "K", *, subok: L[True]) -> _ArrayT: ... +def copy(a: _ArrayT, order: _Order = "K", *, subok: L[True]) -> _ArrayT: ... @overload def copy( - a: CanLenArray[_ScalarT, _ShapeT], order: _OrderKACF = "K", subok: L[False] = False -) -> Array[_ScalarT, _ShapeT]: ... + a: _nt.CanLenArray[_ScalarT, _ShapeT], order: _Order = "K", subok: L[False] = False +) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def copy(a: _ArrayLike[_ScalarT], order: _OrderKACF = "K", subok: L[False] = False) -> Array[_ScalarT]: ... +def copy(a: _ArrayLike[_ScalarT], order: _Order = "K", subok: L[False] = False) -> _nt.Array[_ScalarT]: ... @overload -def copy(a: ArrayLike, order: _OrderKACF = "K", subok: L[False] = False) -> Array: ... +def copy(a: ArrayLike, order: _Order = "K", subok: L[False] = False) -> _nt.Array[Incomplete]: ... # @overload def gradient( - f: ToGeneric_0d, *varargs: ArrayLike, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1 + f: _nt.ToGeneric_0d, + *varargs: ArrayLike, + axis: _ShapeLike | None = None, + edge_order: L[1, 2] = 1, ) -> tuple[()]: ... @overload -def gradient(f: ArrayLike, *varargs: ArrayLike, axis: _ShapeLike | None = None, edge_order: L[1, 2] = 1) -> Any: ... +def gradient( + f: ArrayLike, + *varargs: ArrayLike, + axis: _ShapeLike | None = None, + edge_order: L[1, 2] = 1, +) -> Incomplete: ... # @overload def diff( # type: ignore[overload-overlap] a: _T, n: L[0], - axis: SupportsIndex = -1, + axis: CanIndex = -1, prepend: ArrayLike | _NoValueType = ..., append: ArrayLike | _NoValueType = ..., ) -> _T: ... @overload def diff( - a: _ToArray_1nd[_NumberT], + a: _nt._ToArray_1nd[_NumberT], n: int = 1, - axis: SupportsIndex = -1, + axis: CanIndex = -1, prepend: _ArrayLike[_NumberT] | _NoValueType = ..., append: _ArrayLike[_NumberT] | _NoValueType = ..., -) -> Array[_NumberT]: ... +) -> _nt.Array[_NumberT]: ... @overload def diff( - a: ToGeneric_1nd, + a: _nt.ToGeneric_1nd, n: int = 1, - axis: SupportsIndex = -1, + axis: CanIndex = -1, prepend: ArrayLike | _NoValueType = ..., append: ArrayLike | _NoValueType = ..., -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload # float scalar def interp( - x: _FloatLike_co, - xp: _ArrayLikeFloat_co, - fp: _ArrayLikeFloat_co, - left: _FloatLike_co | None = None, - right: _FloatLike_co | None = None, - period: _FloatLike_co | None = None, + x: _nt.CoFloating_0d, + xp: _nt.CoFloating_nd, + fp: _nt.CoFloating_nd, + left: _nt.CoFloating_0d | None = None, + right: _nt.CoFloating_0d | None = None, + period: _nt.CoFloating_0d | None = None, ) -> np.float64: ... @overload # float array def interp( - x: Array[np.floating | np.integer | np.bool] | _NestedSequence[_FloatLike_co], - xp: _ArrayLikeFloat_co, - fp: _ArrayLikeFloat_co, - left: _FloatLike_co | None = None, - right: _FloatLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.float64]: ... + x: _nt.CoFloating_1nd, + xp: _nt.CoFloating_nd, + fp: _nt.CoFloating_nd, + left: _nt.CoFloating_0d | None = None, + right: _nt.CoFloating_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[np.float64]: ... @overload # float scalar or array def interp( - x: _ArrayLikeFloat_co, - xp: _ArrayLikeFloat_co, - fp: _ArrayLikeFloat_co, - left: _FloatLike_co | None = None, - right: _FloatLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.float64] | np.float64: ... + x: _nt.CoFloating_nd, + xp: _nt.CoFloating_nd, + fp: _nt.CoFloating_nd, + left: _nt.CoFloating_0d | None = None, + right: _nt.CoFloating_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[np.float64] | np.float64: ... @overload # complex scalar def interp( - x: _FloatLike_co, - xp: _ArrayLikeFloat_co, + x: _nt.CoFloating_0d, + xp: _nt.CoFloating_nd, fp: _ArrayLike[np.complexfloating], - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, ) -> np.complex128: ... @overload # complex or float scalar def interp( - x: _FloatLike_co, - xp: _ArrayLikeFloat_co, + x: _nt.CoFloating_0d, + xp: _nt.CoFloating_nd, fp: Sequence[complex | np.complexfloating], - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, -) -> np.complex128 | np.float64: ... + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.inexact64: ... @overload # complex array def interp( - x: Array[np.floating | np.integer | np.bool] | _NestedSequence[_FloatLike_co], - xp: _ArrayLikeFloat_co, + x: _nt.CoFloating_1nd, + xp: _nt.CoFloating_nd, fp: _ArrayLike[np.complexfloating], - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.complex128]: ... + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[np.complex128]: ... @overload # complex or float array def interp( - x: Array[np.floating | np.integer | np.bool] | _NestedSequence[_FloatLike_co], - xp: _ArrayLikeFloat_co, + x: _nt.CoFloating_1nd, + xp: _nt.CoFloating_nd, fp: Sequence[complex | np.complexfloating], - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.complex128 | np.float64]: ... + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[_nt.inexact64]: ... @overload # complex scalar or array def interp( - x: _ArrayLikeFloat_co, - xp: _ArrayLikeFloat_co, + x: _nt.CoFloating_nd, + xp: _nt.CoFloating_nd, fp: _ArrayLike[np.complexfloating], - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.complex128] | np.complex128: ... + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[np.complex128] | np.complex128: ... @overload # complex or float scalar or array def interp( - x: _ArrayLikeFloat_co, - xp: _ArrayLikeFloat_co, - fp: _ArrayLikeNumber_co, - left: _NumberLike_co | None = None, - right: _NumberLike_co | None = None, - period: _FloatLike_co | None = None, -) -> Array[np.complex128 | np.float64] | np.complex128 | np.float64: ... + x: _nt.CoFloating_nd, + xp: _nt.CoFloating_nd, + fp: _nt.CoComplex_nd, + left: _nt.CoComplex_0d | None = None, + right: _nt.CoComplex_0d | None = None, + period: _nt.CoFloating_0d | None = None, +) -> _nt.Array[_nt.inexact64] | _nt.inexact64: ... # @overload -def angle(z: CoComplex_0d, deg: bool = False) -> np.floating: ... +def angle(z: _nt.CoComplex_0d, deg: bool = False) -> np.floating: ... @overload -def angle(z: CoComplex_1nd, deg: bool = False) -> Array[np.floating]: ... +def angle(z: _nt.CoComplex_1nd, deg: bool = False) -> _nt.Array[np.floating]: ... @overload -def angle(z: np.object_, deg: bool = False) -> Any: ... +def angle(z: np.object_, deg: bool = False) -> Incomplete: ... @overload -def angle(z: ToObject_1nd, deg: bool = False) -> Array[np.object_]: ... +def angle(z: _nt.ToObject_1nd, deg: bool = False) -> _nt.Array[np.object_]: ... # @overload def unwrap( - p: _ArrayLikeFloat_co, discont: float | None = None, axis: int = -1, *, period: float = ... -) -> Array[np.floating]: ... + p: _nt.CoFloating_nd, + discont: float | None = None, + axis: int = -1, + *, + period: float = ..., +) -> _nt.Array[np.floating]: ... @overload def unwrap( - p: _ArrayLikeObject_co, discont: float | None = None, axis: int = -1, *, period: float = ... -) -> Array[np.object_]: ... + p: _nt.ToObject_nd, + discont: float | None = None, + axis: int = -1, + *, + period: float = ..., +) -> _nt.Array[np.object_]: ... # -def sort_complex(a: ArrayLike) -> Array[np.complexfloating]: ... +def sort_complex(a: ArrayLike) -> _nt.Array[np.complexfloating]: ... # @overload def trim_zeros(filt: _CanLenAndGetSlice[_T], trim: L["f", "b", "fb", "bf"] = "fb", axis: None = None) -> _T: ... @overload -def trim_zeros(filt: ToGeneric_1nd, trim: L["f", "b", "fb", "bf"] = "fb", axis: _ShapeLike | None = None) -> Array: ... +def trim_zeros( + filt: _nt.ToGeneric_1nd, trim: L["f", "b", "fb", "bf"] = "fb", axis: _ShapeLike | None = None +) -> _nt.Array[Incomplete]: ... # @overload -def extract(condition: ArrayLike, arr: _ArrayLike[_ScalarT]) -> Array[_ScalarT]: ... +def extract(condition: ArrayLike, arr: _ArrayLike[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def extract(condition: ArrayLike, arr: ArrayLike) -> Array: ... +def extract(condition: ArrayLike, arr: ArrayLike) -> _nt.Array[Incomplete]: ... # -def place(arr: Array, mask: ArrayLike, vals: Any) -> None: ... +def place(arr: _nt.Array[Incomplete], mask: ArrayLike, vals: Incomplete) -> None: ... # @overload def cov( - m: CoFloating_1nd, - y: CoFloating_1nd | None = None, + m: _nt.CoFloating_1nd, + y: _nt.CoFloating_1nd | None = None, rowvar: bool = True, bias: bool = False, ddof: _ToInt | None = None, @@ -596,11 +554,11 @@ def cov( aweights: ArrayLike | None = None, *, dtype: None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def cov( - m: ToComplex_1nd, - y: CoComplex_1nd | None = None, + m: _nt.ToComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: bool = False, ddof: _ToInt | None = None, @@ -608,11 +566,11 @@ def cov( aweights: ArrayLike | None = None, *, dtype: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def cov( - m: CoComplex_1nd, - y: ToComplex_1nd, + m: _nt.CoComplex_1nd, + y: _nt.ToComplex_1nd, rowvar: bool = True, bias: bool = False, ddof: _ToInt | None = None, @@ -620,11 +578,11 @@ def cov( aweights: ArrayLike | None = None, *, dtype: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def cov( - m: CoComplex_1nd, - y: CoComplex_1nd | None = None, + m: _nt.CoComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: bool = False, ddof: _ToInt | None = None, @@ -632,11 +590,11 @@ def cov( aweights: ArrayLike | None = None, *, dtype: _DTypeLike[_ScalarT], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cov( - m: CoComplex_1nd, - y: CoComplex_1nd | None = None, + m: _nt.CoComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: bool = False, ddof: _ToInt | None = None, @@ -644,82 +602,82 @@ def cov( aweights: ArrayLike | None = None, *, dtype: DTypeLike, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # NOTE `bias` and `ddof` are deprecated and ignored @overload def corrcoef( - x: CoFloating_1nd, - y: CoFloating_1nd | None = None, + x: _nt.CoFloating_1nd, + y: _nt.CoFloating_1nd | None = None, rowvar: bool = True, bias: _NoValueType = ..., ddof: _NoValueType = ..., *, dtype: None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def corrcoef( - x: ToComplex_1nd, - y: CoComplex_1nd | None = None, + x: _nt.ToComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: _NoValueType = ..., ddof: _NoValueType = ..., *, dtype: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def corrcoef( - x: CoComplex_1nd, - y: ToComplex_1nd, + x: _nt.CoComplex_1nd, + y: _nt.ToComplex_1nd, rowvar: bool = True, bias: _NoValueType = ..., ddof: _NoValueType = ..., *, dtype: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def corrcoef( - x: CoComplex_1nd, - y: CoComplex_1nd | None = None, + x: _nt.CoComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: _NoValueType = ..., ddof: _NoValueType = ..., *, dtype: _DTypeLike[_ScalarT], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def corrcoef( - x: CoComplex_1nd, - y: CoComplex_1nd | None = None, + x: _nt.CoComplex_1nd, + y: _nt.CoComplex_1nd | None = None, rowvar: bool = True, bias: _NoValueType = ..., ddof: _NoValueType = ..., *, dtype: DTypeLike | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # -def blackman(M: CoFloating_0d) -> Array1D[np.floating]: ... -def bartlett(M: CoFloating_0d) -> Array1D[np.floating]: ... -def hanning(M: CoFloating_0d) -> Array1D[np.floating]: ... -def hamming(M: CoFloating_0d) -> Array1D[np.floating]: ... -def kaiser(M: CoFloating_0d, beta: ToFloating_0d) -> Array1D[np.floating]: ... -def i0(x: CoFloating_nd) -> Array[np.floating]: ... +def blackman(M: _nt.CoFloating_0d) -> _nt.Array1D[np.floating]: ... +def bartlett(M: _nt.CoFloating_0d) -> _nt.Array1D[np.floating]: ... +def hanning(M: _nt.CoFloating_0d) -> _nt.Array1D[np.floating]: ... +def hamming(M: _nt.CoFloating_0d) -> _nt.Array1D[np.floating]: ... +def kaiser(M: _nt.CoFloating_0d, beta: _nt.ToFloating_0d) -> _nt.Array1D[np.floating]: ... +def i0(x: _nt.CoFloating_nd) -> _nt.Array[np.floating]: ... # @overload -def sinc(x: CoFloating_0d) -> np.floating: ... +def sinc(x: _nt.CoFloating_0d) -> np.floating: ... @overload -def sinc(x: ToComplex_0d) -> np.complexfloating: ... +def sinc(x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def sinc(x: CoFloating_1nd) -> Array[np.floating]: ... +def sinc(x: _nt.CoFloating_1nd) -> _nt.Array[np.floating]: ... @overload -def sinc(x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def sinc(x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... # keep in sync with `lib._nanfunctions_impl.nanmedian` @overload def median( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -727,7 +685,7 @@ def median( ) -> np.floating: ... @overload def median( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -735,7 +693,7 @@ def median( ) -> np.complexfloating: ... @overload def median( - a: ToTimeDelta_nd, + a: _nt.ToTimeDelta_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -743,23 +701,23 @@ def median( ) -> np.timedelta64: ... @overload def median( - a: ToObject_nd, + a: _nt.ToObject_nd, axis: None = None, out: None = None, overwrite_input: bool = False, keepdims: L[False] = False, -) -> Any: ... +) -> Incomplete: ... @overload def median( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, out: None = None, overwrite_input: bool = False, keepdims: bool = False, -) -> Any: ... +) -> Incomplete: ... @overload def median( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, @@ -767,7 +725,7 @@ def median( ) -> _ArrayT: ... @overload def median( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, *, out: _ArrayT, @@ -780,171 +738,171 @@ def median( # TODO(jorenham): deprecate only allow weights if method="inverted_cdf" @overload def percentile( - a: CoFloating_nd, - q: CoFloating_0d, + a: _nt.CoFloating_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.floating: ... @overload def percentile( - a: CoFloating_nd, - q: CoFloating_1nd, + a: _nt.CoFloating_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def percentile( - a: ToComplex_nd, - q: CoFloating_0d, + a: _nt.ToComplex_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.complexfloating: ... @overload def percentile( - a: ToComplex_nd, - q: CoFloating_1nd, + a: _nt.ToComplex_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def percentile( - a: ToTimeDelta_nd, - q: CoFloating_0d, + a: _nt.ToTimeDelta_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.timedelta64: ... @overload def percentile( - a: ToTimeDelta_nd, - q: CoFloating_1nd, + a: _nt.ToTimeDelta_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.timedelta64]: ... +) -> _nt.Array[np.timedelta64]: ... @overload def percentile( - a: ToDateTime_nd, - q: CoFloating_0d, + a: _nt.ToDateTime_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.datetime64: ... @overload def percentile( - a: ToDateTime_nd, - q: CoFloating_1nd, + a: _nt.ToDateTime_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.datetime64]: ... +) -> _nt.Array[np.datetime64]: ... @overload def percentile( - a: ToObject_nd, - q: CoFloating_0d, + a: _nt.ToObject_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Any: ... +) -> Incomplete: ... @overload def percentile( - a: ToObject_nd, - q: CoFloating_1nd, + a: _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: L[False] = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.object_]: ... +) -> _nt.Array[np.object_]: ... @overload def percentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: bool = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Any: ... +) -> Incomplete: ... @overload def percentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None = None, *, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: bool = False, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> _ArrayT: ... @overload def percentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: bool = False, *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> _ArrayT: ... @@ -953,190 +911,190 @@ quantile = percentile @overload def trapezoid( - y: _ToArray2_1ds[np.float64 | np.integer | np.bool[Any], float], - x: _ToArray2_1ds[np.float64 | np.integer | np.bool[Any], float] | None = None, - dx: CoFloat64_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt._ToArray2_1ds[np.float64 | _nt.co_integer, float], + x: _nt._ToArray2_1ds[np.float64 | _nt.co_integer, float] | None = None, + dx: _nt.CoFloat64_0d = 1.0, + axis: CanIndex = -1, ) -> np.float64: ... @overload def trapezoid( - y: _ToArray2_2nd[np.float64 | np.integer | np.bool[Any], float], - x: _ToArray2_1nd[np.float64 | np.integer | np.bool[Any], float] | None = None, - dx: CoFloat64_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.float64]: ... + y: _nt._ToArray2_2nd[np.float64 | _nt.co_integer, float], + x: _nt._ToArray2_1nd[np.float64 | _nt.co_integer, float] | None = None, + dx: _nt.CoFloat64_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.float64]: ... @overload def trapezoid( - y: _ToArray2_1nd[np.float64 | np.integer | np.bool[Any], float], - x: _ToArray2_2nd[np.float64 | np.integer | np.bool[Any], float], - dx: CoFloat64_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.float64]: ... + y: _nt._ToArray2_1nd[np.float64 | _nt.co_integer, float], + x: _nt._ToArray2_2nd[np.float64 | _nt.co_integer, float], + dx: _nt.CoFloat64_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.float64]: ... @overload def trapezoid( - y: CoFloating_1ds, - x: CoFloating_1ds | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt.CoFloating_1ds, + x: _nt.CoFloating_1ds | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, ) -> np.floating: ... @overload def trapezoid( - y: CoFloating_2nd, - x: CoFloating_1nd | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.floating]: ... + y: _nt.CoFloating_2nd, + x: _nt.CoFloating_1nd | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.floating]: ... @overload def trapezoid( - y: CoFloating_1nd, - x: CoFloating_2nd, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.floating]: ... + y: _nt.CoFloating_1nd, + x: _nt.CoFloating_2nd, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.floating]: ... @overload def trapezoid( - y: CoFloating_1nd, - x: CoFloating_1nd | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> np.floating | Array[np.floating]: ... + y: _nt.CoFloating_1nd, + x: _nt.CoFloating_1nd | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> np.floating | _nt.Array[np.floating]: ... @overload def trapezoid( - y: ToComplex_1ds, - x: CoComplex_1ds | None = None, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt.ToComplex_1ds, + x: _nt.CoComplex_1ds | None = None, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, ) -> np.complexfloating: ... @overload def trapezoid( - y: ToComplex_2nd, - x: CoComplex_1nd | None = None, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.complexfloating]: ... + y: _nt.ToComplex_2nd, + x: _nt.CoComplex_1nd | None = None, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: ToComplex_1nd, - x: CoComplex_2nd, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.complexfloating]: ... + y: _nt.ToComplex_1nd, + x: _nt.CoComplex_2nd, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: ToComplex_1nd, - x: CoComplex_1nd | None = None, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> np.complexfloating | Array[np.complexfloating]: ... + y: _nt.ToComplex_1nd, + x: _nt.CoComplex_1nd | None = None, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> np.complexfloating | _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: CoComplex_1ds, - x: ToComplex_1ds, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt.CoComplex_1ds, + x: _nt.ToComplex_1ds, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, ) -> np.complexfloating: ... @overload def trapezoid( - y: CoComplex_2nd, - x: ToComplex_1nd, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.complexfloating]: ... + y: _nt.CoComplex_2nd, + x: _nt.ToComplex_1nd, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: CoComplex_1nd, - x: ToComplex_2nd, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.complexfloating]: ... + y: _nt.CoComplex_1nd, + x: _nt.ToComplex_2nd, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: CoComplex_1nd, - x: ToComplex_1nd, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, -) -> np.complexfloating | Array[np.complexfloating]: ... + y: _nt.CoComplex_1nd, + x: _nt.ToComplex_1nd, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, +) -> np.complexfloating | _nt.Array[np.complexfloating]: ... @overload def trapezoid( - y: ToTimeDelta_1ds, - x: CoTimeDelta_1ds | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt.ToTimeDelta_1ds, + x: _nt.CoTimeDelta_1ds | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, ) -> np.timedelta64: ... @overload def trapezoid( - y: ToTimeDelta_2nd, - x: CoTimeDelta_1nd | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.timedelta64]: ... + y: _nt.ToTimeDelta_2nd, + x: _nt.CoTimeDelta_1nd | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.timedelta64]: ... @overload def trapezoid( - y: ToTimeDelta_1nd, - x: CoTimeDelta_2nd, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.timedelta64]: ... + y: _nt.ToTimeDelta_1nd, + x: _nt.CoTimeDelta_2nd, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.timedelta64]: ... @overload def trapezoid( - y: ToTimeDelta_1nd, - x: CoTimeDelta_1nd | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> np.timedelta64 | Array[np.timedelta64]: ... + y: _nt.ToTimeDelta_1nd, + x: _nt.CoTimeDelta_1nd | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> np.timedelta64 | _nt.Array[np.timedelta64]: ... @overload def trapezoid( - y: CoTimeDelta_1ds, - x: ToTimeDelta_1ds, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, + y: _nt.CoTimeDelta_1ds, + x: _nt.ToTimeDelta_1ds, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, ) -> np.timedelta64: ... @overload def trapezoid( - y: CoTimeDelta_2nd, - x: ToTimeDelta_1nd, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.timedelta64]: ... + y: _nt.CoTimeDelta_2nd, + x: _nt.ToTimeDelta_1nd, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.timedelta64]: ... @overload def trapezoid( - y: CoTimeDelta_1nd, - x: ToTimeDelta_2nd, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Array[np.timedelta64]: ... + y: _nt.CoTimeDelta_1nd, + x: _nt.ToTimeDelta_2nd, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> _nt.Array[np.timedelta64]: ... @overload def trapezoid( - y: CoTimeDelta_1nd, - x: ToTimeDelta_1nd, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> np.timedelta64 | Array[np.timedelta64]: ... + y: _nt.CoTimeDelta_1nd, + x: _nt.ToTimeDelta_1nd, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> np.timedelta64 | _nt.Array[np.timedelta64]: ... @overload def trapezoid( y: Sequence[dt.timedelta], - x: Sequence[dt.timedelta] | CoFloating_1ds | None = None, - dx: CoComplex_0d = 1.0, - axis: SupportsIndex = -1, + x: Sequence[dt.timedelta] | _nt.CoFloating_1ds | None = None, + dx: _nt.CoComplex_0d = 1.0, + axis: CanIndex = -1, ) -> dt.timedelta: ... @overload def trapezoid( y: Sequence[_CanRMulFloat[_T]], x: Sequence[_CanRMulFloat[_T]] | Sequence[_T] | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, ) -> _T: ... @overload def trapezoid( - y: ToObject_1nd | CoComplex_1nd, - x: ToObject_1nd | CoComplex_1nd | None = None, - dx: CoFloating_0d = 1.0, - axis: SupportsIndex = -1, -) -> Any: ... + y: _nt.ToObject_1nd | _nt.CoComplex_1nd, + x: _nt.ToObject_1nd | _nt.CoComplex_1nd | None = None, + dx: _nt.CoFloating_0d = 1.0, + axis: CanIndex = -1, +) -> Incomplete: ... # @deprecated("Use 'trapezoid' instead") -def trapz(y: ArrayLike, x: ArrayLike | None = None, dx: float = 1.0, axis: int = -1) -> Any: ... +def trapz(y: ArrayLike, x: ArrayLike | None = None, dx: float = 1.0, axis: int = -1) -> Incomplete: ... # @overload @@ -1154,7 +1112,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array1D[_ScalarT]]: ... +) -> tuple[_nt.Array1D[_ScalarT]]: ... @overload def meshgrid( x0: ArrayLike, @@ -1163,7 +1121,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array1D]: ... +) -> tuple[_nt.Array1D]: ... @overload def meshgrid( x0: _ArrayLike[_ScalarT1], @@ -1173,7 +1131,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array2D[_ScalarT1], Array2D[_ScalarT2]]: ... +) -> tuple[_nt.Array2D[_ScalarT1], _nt.Array2D[_ScalarT2]]: ... @overload def meshgrid( x0: ArrayLike, @@ -1183,7 +1141,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array2D, Array2D[_ScalarT]]: ... +) -> tuple[_nt.Array2D[Incomplete], _nt.Array2D[_ScalarT]]: ... @overload def meshgrid( x0: _ArrayLike[_ScalarT], @@ -1193,7 +1151,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array2D[_ScalarT], Array2D]: ... +) -> tuple[_nt.Array2D[_ScalarT], _nt.Array2D[Incomplete]]: ... @overload def meshgrid( x0: ArrayLike, @@ -1203,7 +1161,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array2D, Array2D]: ... +) -> tuple[_nt.Array2D[Incomplete], _nt.Array2D[Incomplete]]: ... @overload def meshgrid( x0: ArrayLike, @@ -1214,7 +1172,7 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array3D, Array3D, Array3D]: ... +) -> tuple[_nt.Array3D[Incomplete], _nt.Array3D[Incomplete], _nt.Array3D[Incomplete]]: ... @overload def meshgrid( x0: ArrayLike, @@ -1226,46 +1184,57 @@ def meshgrid( copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array4D, Array4D, Array4D, Array4D]: ... +) -> tuple[ + _nt.Array4D[Incomplete], + _nt.Array4D[Incomplete], + _nt.Array4D[Incomplete], + _nt.Array4D[Incomplete], +]: ... @overload def meshgrid( *xi: ArrayLike, copy: bool = True, sparse: bool = False, indexing: _Indexing = "xy", -) -> tuple[Array, ...]: ... +) -> tuple[_nt.Array[Incomplete], ...]: ... # @overload def delete( - arr: _ArrayLike[_ScalarT], obj: slice | _ArrayLikeInt_co, axis: SupportsIndex | None = None -) -> Array[_ScalarT]: ... + arr: _ArrayLike[_ScalarT], + obj: slice | _nt.CoInteger_nd, + axis: CanIndex | None = None, +) -> _nt.Array[_ScalarT]: ... @overload -def delete(arr: ArrayLike, obj: slice | _ArrayLikeInt_co, axis: SupportsIndex | None = None) -> Array: ... +def delete( + arr: ArrayLike, + obj: slice | _nt.CoInteger_nd, + axis: CanIndex | None = None, +) -> _nt.Array[Incomplete]: ... # @overload def insert( arr: _ArrayLike[_ScalarT], - obj: slice | CoInteger_nd, + obj: slice | _nt.CoInteger_nd, values: ArrayLike, - axis: SupportsIndex | None = None, -) -> Array[_ScalarT]: ... + axis: CanIndex | None = None, +) -> _nt.Array[_ScalarT]: ... @overload def insert( arr: ArrayLike, - obj: slice | CoInteger_nd, + obj: slice | _nt.CoInteger_nd, values: ArrayLike, - axis: SupportsIndex | None = None, -) -> Array: ... + axis: CanIndex | None = None, +) -> _nt.Array[Incomplete]: ... # -def append(arr: ArrayLike, values: ArrayLike, axis: SupportsIndex | None = ...) -> Array: ... +def append(arr: ArrayLike, values: ArrayLike, axis: CanIndex | None = ...) -> _nt.Array[Incomplete]: ... # @overload -def digitize(x: CoFloating_0d, bins: CoFloating_1d, right: bool = False) -> np.intp: ... +def digitize(x: _nt.CoFloating_0d, bins: _nt.CoFloating_1d, right: bool = False) -> np.intp: ... @overload -def digitize(x: CoFloating_1nd, bins: CoFloating_1d, right: bool = False) -> Array[np.intp]: ... +def digitize(x: _nt.CoFloating_1nd, bins: _nt.CoFloating_1d, right: bool = False) -> _nt.Array[np.intp]: ... @overload -def digitize(x: CoFloating_nd, bins: CoFloating_1d, right: bool = False) -> np.intp | Array[np.intp]: ... +def digitize(x: _nt.CoFloating_nd, bins: _nt.CoFloating_1d, right: bool = False) -> np.intp | _nt.Array[np.intp]: ... diff --git a/src/numpy-stubs/lib/_index_tricks_impl.pyi b/src/numpy-stubs/lib/_index_tricks_impl.pyi index 775b88e6..ac5dce49 100644 --- a/src/numpy-stubs/lib/_index_tricks_impl.pyi +++ b/src/numpy-stubs/lib/_index_tricks_impl.pyi @@ -1,26 +1,10 @@ from _typeshed import Incomplete from collections.abc import Sequence -from typing import Any, ClassVar, Final, Generic, Literal as L, SupportsIndex, TypeAlias, final, overload +from typing import Any, ClassVar, Final, Generic, Literal as L, SupportsIndex as CanIndex, TypeAlias, final, overload from typing_extensions import Self, TypeVar, deprecated +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - JustBytes, - JustComplex, - JustFloat, - JustInt, - JustStr, - Sequence1ND, - ToBool_nd, - ToBytes_nd, - ToComplex128_nd, - ToFloat64_nd, - ToInt_nd, - ToObject_nd, - ToStr_nd, - _ToArray_nd, -) from numpy._core.multiarray import ravel_multi_index, unravel_index from numpy._typing import ArrayLike, _SupportsDType as _HasDType @@ -46,7 +30,7 @@ _DTypeT = TypeVar("_DTypeT", bound=np.dtype) _ScalarT = TypeVar("_ScalarT", bound=np.generic) _ScalarT_co = TypeVar("_ScalarT_co", bound=np.generic, default=Any, covariant=True) _TupleT = TypeVar("_TupleT", bound=tuple[object, ...]) -_ArrayT = TypeVar("_ArrayT", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) _BoolT_co = TypeVar("_BoolT_co", bound=bool, default=bool, covariant=True) @@ -55,32 +39,32 @@ _MatrixT_co = TypeVar("_MatrixT_co", bound=bool, default=L[False], covariant=Tru _NDMinT_co = TypeVar("_NDMinT_co", bound=int, default=L[1], covariant=True) _Trans1DT_co = TypeVar("_Trans1DT_co", bound=int, default=L[-1], covariant=True) -_Arrays: TypeAlias = tuple[Array[_ScalarT], ...] +_Arrays: TypeAlias = tuple[_nt.Array[_ScalarT], ...] ### class ndenumerate(Generic[_ScalarT_co]): @overload - def __init__(self: ndenumerate[_ScalarT], /, arr: _ToArray_nd[_ScalarT]) -> None: ... + def __init__(self: ndenumerate[_ScalarT], /, arr: _nt._ToArray_nd[_ScalarT]) -> None: ... @overload - def __init__(self: ndenumerate[np.bytes_], /, arr: ToBytes_nd) -> None: ... + def __init__(self: ndenumerate[np.bytes_], /, arr: _nt.ToBytes_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.str_], /, arr: ToStr_nd) -> None: ... + def __init__(self: ndenumerate[np.str_], /, arr: _nt.ToStr_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.bool], /, arr: ToBool_nd) -> None: ... + def __init__(self: ndenumerate[np.bool], /, arr: _nt.ToBool_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.intp], /, arr: ToInt_nd) -> None: ... + def __init__(self: ndenumerate[np.intp], /, arr: _nt.ToInt_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.float64], /, arr: ToFloat64_nd) -> None: ... + def __init__(self: ndenumerate[np.float64], /, arr: _nt.ToFloat64_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.complex128], /, arr: ToComplex128_nd) -> None: ... + def __init__(self: ndenumerate[np.complex128], /, arr: _nt.ToComplex128_nd) -> None: ... @overload - def __init__(self: ndenumerate[np.object_], /, arr: ToObject_nd) -> None: ... + def __init__(self: ndenumerate[np.object_], /, arr: _nt.ToObject_nd) -> None: ... # 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 | np.number | np.flexible | np.datetime64 | np.timedelta64], + self: ndenumerate[_nt.co_number | np.flexible | np.datetime64 | np.timedelta64], /, ) -> tuple[tuple[int, ...], _ScalarT_co]: ... @overload @@ -93,9 +77,9 @@ class ndenumerate(Generic[_ScalarT_co]): class ndindex: @overload - def __init__(self, shape: tuple[SupportsIndex, ...], /) -> None: ... + def __init__(self, shape: tuple[CanIndex, ...], /) -> None: ... @overload - def __init__(self, /, *shape: SupportsIndex) -> None: ... + def __init__(self, /, *shape: CanIndex) -> None: ... # def __iter__(self) -> Self: ... @@ -107,9 +91,9 @@ class nd_grid(Generic[_BoolT_co]): sparse: _BoolT_co def __init__(self, sparse: _BoolT_co = ...) -> None: ... @overload - def __getitem__(self: nd_grid[L[False]], key: slice | Sequence[slice]) -> Array: ... + def __getitem__(self: nd_grid[L[False]], key: slice | Sequence[slice]) -> _nt.Array: ... @overload - def __getitem__(self: nd_grid[L[True]], key: slice | Sequence[slice]) -> tuple[Array, ...]: ... + def __getitem__(self: nd_grid[L[True]], key: slice | Sequence[slice]) -> tuple[_nt.Array, ...]: ... @final class MGridClass(nd_grid[L[False]]): @@ -146,13 +130,17 @@ class AxisConcatenator(Generic[_AxisT_co, _MatrixT_co, _NDMinT_co, _Trans1DT_co] # @staticmethod @overload - def concatenate(*a: _ToArray_nd[_ScalarT], axis: SupportsIndex | None = 0, out: None = None) -> Array[_ScalarT]: ... + def concatenate( + *a: _nt._ToArray_nd[_ScalarT], + axis: CanIndex | None = 0, + out: None = None, + ) -> _nt.Array[_ScalarT]: ... @staticmethod @overload - def concatenate(*a: ArrayLike, axis: SupportsIndex | None = 0, out: _ArrayT) -> _ArrayT: ... + def concatenate(*a: ArrayLike, axis: CanIndex | None = 0, out: _ArrayT) -> _ArrayT: ... @staticmethod @overload - def concatenate(*a: ArrayLike, axis: SupportsIndex | None = 0, out: None = None) -> Array: ... + def concatenate(*a: ArrayLike, axis: CanIndex | None = 0, out: None = None) -> _nt.Array: ... @final class RClass(AxisConcatenator[L[0], L[False], L[1], L[-1]]): @@ -176,31 +164,23 @@ class IndexExpression(Generic[_BoolT_co]): def __getitem__(self, item: _T, /) -> _T | tuple[_T]: ... @overload -def ix_( - *args: _HasDType[_DTypeT] | Sequence1ND[_HasDType[_DTypeT]], -) -> tuple[np.ndarray[tuple[int, ...], _DTypeT], ...]: ... +def ix_(*args: _nt.SequenceND[_HasDType[_DTypeT]]) -> tuple[np.ndarray[tuple[int, ...], _DTypeT], ...]: ... @overload -def ix_(*args: bool | Sequence1ND[bool]) -> _Arrays[np.bool]: ... +def ix_(*args: _nt.SequenceND[bool]) -> _Arrays[np.bool]: ... @overload -def ix_(*args: JustInt | Sequence1ND[JustInt]) -> _Arrays[np.intp]: ... +def ix_(*args: _nt.SequenceND[_nt.JustInt]) -> _Arrays[np.intp]: ... @overload -def ix_(*args: JustFloat | Sequence1ND[JustFloat]) -> _Arrays[np.float64]: ... +def ix_(*args: _nt.SequenceND[_nt.JustFloat]) -> _Arrays[np.float64]: ... @overload -def ix_(*args: JustComplex | Sequence1ND[JustComplex]) -> _Arrays[np.complex128]: ... +def ix_(*args: _nt.SequenceND[_nt.JustComplex]) -> _Arrays[np.complex128]: ... @overload -def ix_(*args: JustBytes | Sequence1ND[JustBytes]) -> _Arrays[np.bytes_]: ... +def ix_(*args: _nt.SequenceND[_nt.JustBytes]) -> _Arrays[np.bytes_]: ... @overload -def ix_(*args: JustStr | Sequence1ND[JustStr]) -> _Arrays[np.str_]: ... -@overload -def ix_(*args: int | Sequence1ND[int]) -> _Arrays[np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] -@overload -def ix_(*args: float | Sequence1ND[float]) -> _Arrays[np.float64 | np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] -@overload -def ix_(*args: complex | Sequence1ND[complex]) -> _Arrays[np.complex128 | np.float64 | np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] +def ix_(*args: _nt.SequenceND[_nt.JustStr]) -> _Arrays[np.str_]: ... # -def fill_diagonal(a: Array, val: Any, wrap: bool = ...) -> None: ... -def diag_indices(n: int, ndim: int = ...) -> _Arrays[np.intp]: ... +def fill_diagonal(a: _nt.Array, val: Any, wrap: bool = False) -> None: ... +def diag_indices(n: int, ndim: int = 2) -> _Arrays[np.intp]: ... def diag_indices_from(arr: ArrayLike) -> _Arrays[np.intp]: ... ### diff --git a/src/numpy-stubs/lib/_nanfunctions_impl.pyi b/src/numpy-stubs/lib/_nanfunctions_impl.pyi index f615a518..47e6c589 100644 --- a/src/numpy-stubs/lib/_nanfunctions_impl.pyi +++ b/src/numpy-stubs/lib/_nanfunctions_impl.pyi @@ -1,20 +1,9 @@ +from _typeshed import Incomplete from typing import Any, Literal as L, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - CoComplex_nd, - CoDateTime_nd, - CoFloating_0d, - CoFloating_1nd, - CoFloating_nd, - CoTimeDelta_nd, - ToComplex_nd, - ToDateTime_nd, - ToObject_nd, - ToTimeDelta_nd, -) from numpy._core.fromnumeric import ( amax as nanmax, amin as nanmin, @@ -52,14 +41,14 @@ __all__ = [ ### -_ArrayT = TypeVar("_ArrayT", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) ### # keep in sync with `lib._function_base_impl.median` @overload def nanmedian( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -67,7 +56,7 @@ def nanmedian( ) -> np.floating: ... @overload def nanmedian( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -75,7 +64,7 @@ def nanmedian( ) -> np.complexfloating: ... @overload def nanmedian( - a: ToTimeDelta_nd, + a: _nt.ToTimeDelta_nd, axis: None = None, out: None = None, overwrite_input: bool = False, @@ -83,23 +72,23 @@ def nanmedian( ) -> np.timedelta64: ... @overload def nanmedian( - a: ToObject_nd, + a: _nt.ToObject_nd, axis: None = None, out: None = None, overwrite_input: bool = False, keepdims: _NoValueType | L[False] = ..., -) -> Any: ... +) -> Incomplete: ... @overload def nanmedian( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, out: None = None, overwrite_input: bool = False, keepdims: _NoValueType | bool = ..., -) -> Any: ... +) -> Incomplete: ... @overload def nanmedian( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, @@ -107,7 +96,7 @@ def nanmedian( ) -> _ArrayT: ... @overload def nanmedian( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, *, out: _ArrayT, @@ -118,171 +107,171 @@ def nanmedian( # keep in sync with `lib._function_base_impl.percentile` @overload def nanpercentile( - a: CoFloating_nd, - q: CoFloating_0d, + a: _nt.CoFloating_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.floating: ... @overload def nanpercentile( - a: CoFloating_nd, - q: CoFloating_1nd, + a: _nt.CoFloating_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def nanpercentile( - a: ToComplex_nd, - q: CoFloating_0d, + a: _nt.ToComplex_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.complexfloating: ... @overload def nanpercentile( - a: ToComplex_nd, - q: CoFloating_1nd, + a: _nt.ToComplex_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def nanpercentile( - a: ToTimeDelta_nd, - q: CoFloating_0d, + a: _nt.ToTimeDelta_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.timedelta64: ... @overload def nanpercentile( - a: ToTimeDelta_nd, - q: CoFloating_1nd, + a: _nt.ToTimeDelta_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.timedelta64]: ... +) -> _nt.Array[np.timedelta64]: ... @overload def nanpercentile( - a: ToDateTime_nd, - q: CoFloating_0d, + a: _nt.ToDateTime_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> np.datetime64: ... @overload def nanpercentile( - a: ToDateTime_nd, - q: CoFloating_1nd, + a: _nt.ToDateTime_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.datetime64]: ... +) -> _nt.Array[np.datetime64]: ... @overload def nanpercentile( - a: ToObject_nd, - q: CoFloating_0d, + a: _nt.ToObject_nd, + q: _nt.CoFloating_0d, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> Any: ... @overload def nanpercentile( - a: ToObject_nd, - q: CoFloating_1nd, + a: _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | L[False] = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, -) -> Array[np.object_]: ... +) -> _nt.Array[np.object_]: ... @overload def nanpercentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None = None, out: None = None, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | bool = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> Any: ... @overload def nanpercentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None = None, *, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | bool = ..., - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> _ArrayT: ... @overload def nanpercentile( - a: CoComplex_nd | CoDateTime_nd | ToObject_nd, - q: CoFloating_1nd, + a: _nt.CoComplex_nd | _nt.CoDateTime_nd | _nt.ToObject_nd, + q: _nt.CoFloating_1nd, axis: _ShapeLike | None, out: _ArrayT, overwrite_input: bool = False, method: _PercentileMethod = "linear", keepdims: _NoValueType | bool = ..., *, - weights: CoFloating_1nd | None = None, + weights: _nt.CoFloating_1nd | None = None, interpolation: None = None, ) -> _ArrayT: ... diff --git a/src/numpy-stubs/lib/_polynomial_impl.pyi b/src/numpy-stubs/lib/_polynomial_impl.pyi index 3bc1a23a..f221de95 100644 --- a/src/numpy-stubs/lib/_polynomial_impl.pyi +++ b/src/numpy-stubs/lib/_polynomial_impl.pyi @@ -2,81 +2,8 @@ from collections.abc import Iterator from typing import Any, ClassVar, Generic, Literal as L, SupportsIndex, SupportsInt, TypeAlias, overload from typing_extensions import LiteralString, Self, TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - CoComplex128_0d, - CoComplex128_1d, - CoComplex128_2d, - CoComplex_0d, - CoComplex_1d, - CoComplex_1nd, - CoComplex_2d, - CoComplex_nd, - CoFloat64_0d, - CoFloat64_1d, - CoFloating_0d, - CoFloating_1d, - CoFloating_1nd, - CoFloating_2d, - CoFloating_nd, - CoInt64_0d, - CoInt64_1d, - CoInt64_1nd, - CoInt64_nd, - CoInteger_0d, - CoInteger_1d, - CoInteger_1nd, - CoInteger_2d, - CoUInt64_0d, - CoUInt64_1d, - CoUInt64_1nd, - CoUInt64_nd, - JustComplex, - JustFloat, - ToBool_0d, - ToBool_1d, - ToBool_1nd, - ToBool_nd, - ToCLongDouble_1d, - ToComplex64_0d, - ToComplex64_1d, - ToComplex64_2d, - ToComplex128_0d, - ToComplex128_1d, - ToComplex128_2d, - ToComplex_0d, - ToComplex_1d, - ToComplex_1nd, - ToComplex_2d, - ToComplex_nd, - ToFloat32_1d, - ToFloat32_2d, - ToFloat64_1d, - ToFloat64_2d, - ToFloating_0d, - ToFloating_1d, - ToFloating_1nd, - ToFloating_nd, - ToInteger_0d, - ToInteger_1nd, - ToLongDouble_1d, - ToObject_1d, - ToObject_1nd, - ToObject_2d, - ToObject_nd, - ToSInteger_0d, - ToSInteger_1d, - ToSInteger_1nd, - ToSInteger_nd, - ToUInteger_0d, - ToUInteger_1d, - ToUInteger_1nd, - ToUInteger_nd, - _ToArray2_1d, - _ToArray_1d, -) from numpy._typing import ArrayLike __all__ = [ @@ -97,13 +24,19 @@ __all__ = [ ### _T = TypeVar("_T") -_ScalarT = TypeVar("_ScalarT", bound=np.number | np.bool | np.object_) +_ScalarT = TypeVar("_ScalarT", bound=_nt.co_complex | np.object_) _NumberT = TypeVar("_NumberT", bound=np.number) -_ScalarT_co = TypeVar("_ScalarT_co", bound=np.number | np.bool | np.object_, default=Any, covariant=True) +_ScalarT_co = TypeVar("_ScalarT_co", bound=_nt.co_complex | np.object_, default=Any, covariant=True) _ToInt: TypeAlias = SupportsInt | SupportsIndex _Tuple2: TypeAlias = tuple[_T, _T] -_Tuple_didd: TypeAlias = tuple[_T, Array[np.float64], Array[np.int32], Array[np.float64], Array[np.float64]] +_Tuple_didd: TypeAlias = tuple[ + _T, + _nt.Array[np.float64], + _nt.Array[np.int32], + _nt.Array[np.float64], + _nt.Array[np.float64], +] ### @@ -117,85 +50,85 @@ class poly1d(Generic[_ScalarT_co]): @property def o(self) -> int: ... @property - def roots(self) -> Array1D[np.inexact]: ... + def roots(self) -> _nt.Array1D[np.inexact]: ... @property - def r(self) -> Array1D[np.inexact]: ... + def r(self) -> _nt.Array1D[np.inexact]: ... # @property - def coefficients(self) -> Array1D[_ScalarT_co]: ... + def coefficients(self) -> _nt.Array1D[_ScalarT_co]: ... @coefficients.setter - def coefficients(self: poly1d[_ScalarT], c: Array[_ScalarT], /) -> None: ... + def coefficients(self: poly1d[_ScalarT], c: _nt.Array[_ScalarT], /) -> None: ... # @property - def coeffs(self) -> Array1D[_ScalarT_co]: ... + def coeffs(self) -> _nt.Array1D[_ScalarT_co]: ... @coeffs.setter - def coeffs(self: poly1d[_ScalarT], c: Array[_ScalarT], /) -> None: ... + def coeffs(self: poly1d[_ScalarT], c: _nt.Array[_ScalarT], /) -> None: ... # @property - def coef(self) -> Array1D[_ScalarT_co]: ... + def coef(self) -> _nt.Array1D[_ScalarT_co]: ... @coef.setter - def coef(self: poly1d[_ScalarT], c: Array[_ScalarT], /) -> None: ... + def coef(self: poly1d[_ScalarT], c: _nt.Array[_ScalarT], /) -> None: ... # @property - def c(self) -> Array1D[_ScalarT_co]: ... + def c(self) -> _nt.Array1D[_ScalarT_co]: ... @c.setter - def c(self: poly1d[_ScalarT], c: Array[_ScalarT], /) -> None: ... + def c(self: poly1d[_ScalarT], c: _nt.Array[_ScalarT], /) -> None: ... # @overload def __init__(self, /, c_or_r: poly1d[_ScalarT_co], r: bool = False, variable: str | None = None) -> None: ... @overload def __init__( - self, /, c_or_r: _ToArray_1d[_ScalarT_co], r: L[False] = False, variable: str | None = None + self, /, c_or_r: _nt._ToArray_1d[_ScalarT_co], r: L[False] = False, variable: str | None = None ) -> None: ... @overload - def __init__(self, /, c_or_r: CoComplex_1d, r: L[True], variable: str | None = None) -> None: ... + def __init__(self, /, c_or_r: _nt.CoComplex_1d, r: L[True], variable: str | None = None) -> None: ... # @overload - def __array__(self, /, t: None = None, copy: bool | None = None) -> Array1D[_ScalarT_co]: ... + def __array__(self, /, t: None = None, copy: bool | None = None) -> _nt.Array1D[_ScalarT_co]: ... @overload - def __array__(self, /, t: np.dtype[_ScalarT], copy: bool | None = None) -> Array1D[_ScalarT]: ... + def __array__(self, /, t: np.dtype[_ScalarT], copy: bool | None = None) -> _nt.Array1D[_ScalarT]: ... # @overload def __call__(self, /, val: poly1d) -> poly1d: ... @overload - def __call__(self: poly1d[np.object_], /, val: CoComplex_0d) -> Any: ... + def __call__(self: poly1d[np.object_], /, val: _nt.CoComplex_0d) -> Any: ... @overload - def __call__(self: poly1d[np.bool], /, val: ToBool_0d) -> np.bool: ... + def __call__(self: poly1d[np.bool], /, val: _nt.ToBool_0d) -> np.bool: ... @overload - def __call__(self: poly1d[np.integer], /, val: CoInteger_0d) -> np.integer: ... + def __call__(self: poly1d[np.integer], /, val: _nt.CoInteger_0d) -> np.integer: ... @overload - def __call__(self: poly1d[np.integer | np.bool], /, val: ToInteger_0d) -> np.integer: ... + def __call__(self: poly1d[np.integer | np.bool], /, val: _nt.ToInteger_0d) -> np.integer: ... @overload - def __call__(self: poly1d[np.floating], /, val: CoFloating_0d) -> np.floating: ... + def __call__(self: poly1d[np.floating], /, val: _nt.CoFloating_0d) -> np.floating: ... @overload - def __call__(self: poly1d[np.floating | np.integer | np.bool], /, val: ToFloating_0d) -> np.floating: ... + def __call__(self: poly1d[_nt.co_float], /, val: _nt.ToFloating_0d) -> np.floating: ... @overload - def __call__(self: poly1d[np.complexfloating], /, val: CoComplex_0d) -> np.complexfloating: ... + def __call__(self: poly1d[np.complexfloating], /, val: _nt.CoComplex_0d) -> np.complexfloating: ... @overload - def __call__(self: poly1d[np.number | np.bool], /, val: ToComplex_0d) -> np.complexfloating: ... + def __call__(self: poly1d[_nt.co_complex], /, val: _nt.ToComplex_0d) -> np.complexfloating: ... @overload - def __call__(self: poly1d[np.object_], /, val: CoComplex_1nd | ToObject_1nd) -> Array[Any]: ... + def __call__(self: poly1d[np.object_], /, val: _nt.CoComplex_1nd | _nt.ToObject_1nd) -> _nt.Array[Any]: ... @overload - def __call__(self: poly1d[np.bool], /, val: ToBool_1nd) -> Array[np.bool]: ... + def __call__(self: poly1d[np.bool], /, val: _nt.ToBool_1nd) -> _nt.Array[np.bool]: ... @overload - def __call__(self: poly1d[np.integer], /, val: CoInteger_1nd) -> Array[np.integer]: ... + def __call__(self: poly1d[np.integer], /, val: _nt.CoInteger_1nd) -> _nt.Array[np.integer]: ... @overload - def __call__(self: poly1d[np.integer | np.bool], /, val: ToInteger_1nd) -> Array[np.integer]: ... + def __call__(self: poly1d[np.integer | np.bool], /, val: _nt.ToInteger_1nd) -> _nt.Array[np.integer]: ... @overload - def __call__(self: poly1d[np.floating], /, val: CoFloating_1nd) -> Array[np.floating]: ... + def __call__(self: poly1d[np.floating], /, val: _nt.CoFloating_1nd) -> _nt.Array[np.floating]: ... @overload - def __call__(self: poly1d[np.floating | np.integer | np.bool], /, val: ToFloating_1nd) -> Array[np.floating]: ... + def __call__(self: poly1d[_nt.co_float], /, val: _nt.ToFloating_1nd) -> _nt.Array[np.floating]: ... @overload - def __call__(self: poly1d[np.complexfloating], /, val: CoComplex_1nd) -> Array[np.complexfloating]: ... + def __call__(self: poly1d[np.complexfloating], /, val: _nt.CoComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload - def __call__(self: poly1d[np.number | np.bool], /, val: ToComplex_1nd) -> Array[np.complexfloating]: ... + def __call__(self: poly1d[_nt.co_complex], /, val: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... # def __len__(self) -> int: ... @@ -227,7 +160,7 @@ class poly1d(Generic[_ScalarT_co]): def __rmul__(self, other: ArrayLike, /) -> poly1d: ... def __sub__(self, other: ArrayLike, /) -> poly1d: ... def __rsub__(self, other: ArrayLike, /) -> poly1d: ... - def __pow__(self, val: CoFloating_0d, /) -> poly1d: ... # Integral floats are accepted + def __pow__(self, val: _nt.CoFloating_0d, /) -> poly1d: ... # Integral floats are accepted def __truediv__(self, other: ArrayLike, /) -> poly1d: ... def __rtruediv__(self, other: ArrayLike, /) -> poly1d: ... def __div__(self, other: ArrayLike, /) -> poly1d: ... @@ -242,355 +175,369 @@ class poly1d(Generic[_ScalarT_co]): def deriv(self: poly1d[np.object_], /, m: _ToInt = 1) -> poly1d[np.object_]: ... # - def integ(self, /, m: _ToInt = 1, k: CoComplex_0d | CoComplex_1d | ToObject_1d | None = 0) -> poly1d: ... + def integ( + self, /, m: _ToInt = 1, k: _nt.CoComplex_0d | _nt.CoComplex_1d | _nt.ToObject_1d | None = 0 + ) -> poly1d: ... ### # @overload -def poly(seq_of_zeros: poly1d) -> Array1D[np.float64]: ... +def poly(seq_of_zeros: poly1d) -> _nt.Array1D[np.float64]: ... @overload -def poly(seq_of_zeros: CoInteger_1d | CoInteger_2d) -> Array1D[np.float64]: ... +def poly(seq_of_zeros: _nt.CoInteger_1d | _nt.CoInteger_2d) -> _nt.Array1D[np.float64]: ... @overload -def poly(seq_of_zeros: ToFloat64_1d | ToFloat64_2d) -> Array1D[np.float64]: ... +def poly(seq_of_zeros: _nt.ToFloat64_1d | _nt.ToFloat64_2d) -> _nt.Array1D[np.float64]: ... @overload -def poly(seq_of_zeros: ToComplex128_1d | ToComplex128_2d) -> Array1D[np.complex128]: ... +def poly(seq_of_zeros: _nt.ToComplex128_1d | _nt.ToComplex128_2d) -> _nt.Array1D[np.complex128]: ... @overload -def poly(seq_of_zeros: ToFloat32_1d | ToFloat32_2d) -> Array1D[np.float32]: ... +def poly(seq_of_zeros: _nt.ToFloat32_1d | _nt.ToFloat32_2d) -> _nt.Array1D[np.float32]: ... @overload -def poly(seq_of_zeros: ToComplex64_1d | ToComplex64_2d) -> Array1D[np.complex64]: ... +def poly(seq_of_zeros: _nt.ToComplex64_1d | _nt.ToComplex64_2d) -> _nt.Array1D[np.complex64]: ... @overload -def poly(seq_of_zeros: ToObject_1d | ToObject_2d) -> Array1D[np.object_]: ... +def poly(seq_of_zeros: _nt.ToObject_1d | _nt.ToObject_2d) -> _nt.Array1D[np.object_]: ... @overload -def poly(seq_of_zeros: CoComplex128_1d | CoComplex128_2d) -> Array1D[np.inexact]: ... +def poly(seq_of_zeros: _nt.CoComplex128_1d | _nt.CoComplex128_2d) -> _nt.Array1D[np.inexact]: ... # returns either a float or complex array depending on the input values. See `np.linalg.eigvals`. @overload -def roots(p: CoInteger_1d) -> Array1D[np.float64 | np.complex128]: ... +def roots(p: _nt.CoInteger_1d) -> _nt.Array1D[_nt.inexact64]: ... @overload -def roots(p: ToFloat64_1d) -> Array1D[np.float64 | np.complex128]: ... +def roots(p: _nt.ToFloat64_1d) -> _nt.Array1D[_nt.inexact64]: ... @overload -def roots(p: ToComplex128_1d) -> Array1D[np.complex128]: ... +def roots(p: _nt.ToComplex128_1d) -> _nt.Array1D[np.complex128]: ... @overload -def roots(p: ToFloat32_1d) -> Array1D[np.float32 | np.complex64]: ... +def roots(p: _nt.ToFloat32_1d) -> _nt.Array1D[_nt.inexact32]: ... @overload -def roots(p: ToComplex64_1d) -> Array1D[np.complex64]: ... +def roots(p: _nt.ToComplex64_1d) -> _nt.Array1D[np.complex64]: ... @overload -def roots(p: CoComplex128_1d) -> Array1D[np.inexact]: ... +def roots(p: _nt.CoComplex128_1d) -> _nt.Array1D[np.inexact]: ... # @overload def polyder(p: poly1d, m: _ToInt = 1) -> poly1d: ... @overload -def polyder(p: CoInteger_1d, m: _ToInt = 1) -> Array1D[np.intp]: ... +def polyder(p: _nt.CoInteger_1d, m: _ToInt = 1) -> _nt.Array1D[np.intp]: ... @overload -def polyder(p: _ToArray2_1d[np.float64 | np.float32 | np.float16, JustFloat], m: _ToInt = 1) -> Array1D[np.float64]: ... +def polyder( + p: _nt._ToArray2_1d[np.float64 | np.float32 | np.float16, _nt.JustFloat], + m: _ToInt = 1, +) -> _nt.Array1D[np.float64]: ... @overload -def polyder(p: _ToArray2_1d[np.complex128 | np.complex64, JustComplex], m: _ToInt = 1) -> Array1D[np.complex128]: ... +def polyder( + p: _nt._ToArray2_1d[np.complex128 | np.complex64, _nt.JustComplex], + m: _ToInt = 1, +) -> _nt.Array1D[np.complex128]: ... @overload -def polyder(p: ToLongDouble_1d, m: _ToInt = 1) -> Array1D[np.longdouble]: ... +def polyder(p: _nt.ToLongDouble_1d, m: _ToInt = 1) -> _nt.Array1D[np.longdouble]: ... @overload -def polyder(p: ToCLongDouble_1d, m: _ToInt = 1) -> Array1D[np.clongdouble]: ... +def polyder(p: _nt.ToCLongDouble_1d, m: _ToInt = 1) -> _nt.Array1D[np.clongdouble]: ... @overload -def polyder(p: ToObject_1d, m: _ToInt = 1) -> Array1D[np.object_]: ... +def polyder(p: _nt.ToObject_1d, m: _ToInt = 1) -> _nt.Array1D[np.object_]: ... @overload -def polyder(p: CoComplex128_1d, m: _ToInt = 1) -> Array1D[np.complex128 | np.float64 | np.intp]: ... +def polyder(p: _nt.CoComplex128_1d, m: _ToInt = 1) -> _nt.Array1D[np.complex128 | np.float64 | np.intp]: ... # @overload -def polyint(p: poly1d, m: _ToInt = 1, k: CoComplex_nd | ToObject_nd | None = None) -> poly1d: ... +def polyint(p: poly1d, m: _ToInt = 1, k: _nt.CoComplex_nd | _nt.ToObject_nd | None = None) -> poly1d: ... @overload -def polyint(p: CoFloat64_1d, m: _ToInt = 1, k: CoFloat64_0d | CoFloat64_1d | None = None) -> Array1D[np.float64]: ... +def polyint( + p: _nt.CoFloat64_1d, + m: _ToInt = 1, + k: _nt.CoFloat64_0d | _nt.CoFloat64_1d | None = None, +) -> _nt.Array1D[np.float64]: ... @overload def polyint( - p: ToLongDouble_1d, m: _ToInt = 1, k: CoFloating_0d | CoFloating_1d | None = None -) -> Array1D[np.longdouble]: ... + p: _nt.ToLongDouble_1d, + m: _ToInt = 1, + k: _nt.CoFloating_0d | _nt.CoFloating_1d | None = None, +) -> _nt.Array1D[np.longdouble]: ... @overload def polyint( - p: ToComplex128_1d | ToComplex64_1d, + p: _nt.ToComplex128_1d | _nt.ToComplex64_1d, m: _ToInt = 1, - k: CoComplex128_0d | CoComplex128_1d | None = None, -) -> Array1D[np.complex128]: ... + k: _nt.CoComplex128_0d | _nt.CoComplex128_1d | None = None, +) -> _nt.Array1D[np.complex128]: ... @overload def polyint( - p: CoComplex128_1d, + p: _nt.CoComplex128_1d, m: _ToInt, - k: ToComplex128_0d | ToComplex128_1d | ToComplex64_0d | ToComplex64_1d, -) -> Array1D[np.complex128]: ... + k: _nt.ToComplex128_0d | _nt.ToComplex128_1d | _nt.ToComplex64_0d | _nt.ToComplex64_1d, +) -> _nt.Array1D[np.complex128]: ... @overload def polyint( - p: CoComplex128_1d, + p: _nt.CoComplex128_1d, m: _ToInt = 1, *, - k: ToComplex128_0d | ToComplex128_1d | ToComplex64_0d | ToComplex64_1d, -) -> Array1D[np.complex128]: ... + k: _nt.ToComplex128_0d | _nt.ToComplex128_1d | _nt.ToComplex64_0d | _nt.ToComplex64_1d, +) -> _nt.Array1D[np.complex128]: ... @overload def polyint( - p: ToCLongDouble_1d, + p: _nt.ToCLongDouble_1d, m: _ToInt = 1, - k: CoComplex_0d | CoComplex_1d | None = None, -) -> Array1D[np.clongdouble]: ... + k: _nt.CoComplex_0d | _nt.CoComplex_1d | None = None, +) -> _nt.Array1D[np.clongdouble]: ... @overload def polyint( - p: ToObject_1d, + p: _nt.ToObject_1d, m: _ToInt = 1, - k: CoComplex_0d | CoComplex_1d | ToObject_1d | None = None, -) -> Array1D[np.object_]: ... + k: _nt.CoComplex_0d | _nt.CoComplex_1d | _nt.ToObject_1d | None = None, +) -> _nt.Array1D[np.object_]: ... # @overload def polyfit( - x: CoFloating_1d, - y: CoFloating_1d | CoFloating_2d, + x: _nt.CoFloating_1d, + y: _nt.CoFloating_1d | _nt.CoFloating_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: L[False] = False, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload def polyfit( - x: CoFloating_1d, - y: CoFloating_1d | CoFloating_2d, + x: _nt.CoFloating_1d, + y: _nt.CoFloating_1d | _nt.CoFloating_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, *, cov: L[True, "unscaled"], -) -> _Tuple2[Array[np.float64]]: ... +) -> _Tuple2[_nt.Array[np.float64]]: ... @overload def polyfit( - x: CoFloating_1d, - y: CoFloating_1d | CoFloating_2d, + x: _nt.CoFloating_1d, + y: _nt.CoFloating_1d | _nt.CoFloating_2d, deg: _ToInt, rcond: float | None, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.float64]]: ... +) -> _Tuple_didd[_nt.Array[np.float64]]: ... @overload def polyfit( - x: CoFloating_1d, - y: CoFloating_1d | CoFloating_2d, + x: _nt.CoFloating_1d, + y: _nt.CoFloating_1d | _nt.CoFloating_2d, deg: _ToInt, rcond: float | None = None, *, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.float64]]: ... +) -> _Tuple_didd[_nt.Array[np.float64]]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_1d | ToComplex_2d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_1d | _nt.ToComplex_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: L[False] = False, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_1d | ToComplex_2d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_1d | _nt.ToComplex_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, *, cov: L[True, "unscaled"], -) -> _Tuple2[Array[np.complex128]]: ... +) -> _Tuple2[_nt.Array[np.complex128]]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_1d | ToComplex_2d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_1d | _nt.ToComplex_2d, deg: _ToInt, rcond: float | None, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.complex128]]: ... +) -> _Tuple_didd[_nt.Array[np.complex128]]: ... @overload def polyfit( - x: CoComplex_1d, - y: ToComplex_1d | ToComplex_2d, + x: _nt.CoComplex_1d, + y: _nt.ToComplex_1d | _nt.ToComplex_2d, deg: _ToInt, rcond: float | None = None, *, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.complex128]]: ... +) -> _Tuple_didd[_nt.Array[np.complex128]]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_1d | CoComplex_2d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_1d | _nt.CoComplex_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: L[False] = False, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_1d | CoComplex_2d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_1d | _nt.CoComplex_2d, deg: _ToInt, rcond: float | None = None, full: L[False] = False, - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, *, cov: L[True, "unscaled"], -) -> _Tuple2[Array[np.complex128]]: ... +) -> _Tuple2[_nt.Array[np.complex128]]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_1d | CoComplex_2d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_1d | _nt.CoComplex_2d, deg: _ToInt, rcond: float | None, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.complex128]]: ... +) -> _Tuple_didd[_nt.Array[np.complex128]]: ... @overload def polyfit( - x: ToComplex_1d, - y: CoComplex_1d | CoComplex_2d, + x: _nt.ToComplex_1d, + y: _nt.CoComplex_1d | _nt.CoComplex_2d, deg: _ToInt, rcond: float | None = None, *, full: L[True], - w: CoFloating_1d | None = None, + w: _nt.CoFloating_1d | None = None, cov: bool | L["unscaled"] = False, -) -> _Tuple_didd[Array[np.complex128]]: ... +) -> _Tuple_didd[_nt.Array[np.complex128]]: ... # @overload -def polyval(p: ToBool_1d, x: ToBool_0d) -> np.bool: ... +def polyval(p: _nt.ToBool_1d, x: _nt.ToBool_0d) -> np.bool: ... @overload -def polyval(p: ToUInteger_1d, x: CoUInt64_0d) -> np.unsignedinteger: ... +def polyval(p: _nt.ToUInteger_1d, x: _nt.CoUInt64_0d) -> np.unsignedinteger: ... @overload -def polyval(p: CoUInt64_1d, x: ToUInteger_0d) -> np.unsignedinteger: ... +def polyval(p: _nt.CoUInt64_1d, x: _nt.ToUInteger_0d) -> np.unsignedinteger: ... @overload -def polyval(p: ToSInteger_1d, x: CoInt64_0d) -> np.signedinteger: ... +def polyval(p: _nt.ToSInteger_1d, x: _nt.CoInt64_0d) -> np.signedinteger: ... @overload -def polyval(p: CoInt64_1d, x: ToSInteger_0d) -> np.signedinteger: ... +def polyval(p: _nt.CoInt64_1d, x: _nt.ToSInteger_0d) -> np.signedinteger: ... @overload -def polyval(p: ToFloating_1d, x: CoFloating_0d) -> np.floating: ... +def polyval(p: _nt.ToFloating_1d, x: _nt.CoFloating_0d) -> np.floating: ... @overload -def polyval(p: CoFloating_1d, x: ToFloating_0d) -> np.floating: ... +def polyval(p: _nt.CoFloating_1d, x: _nt.ToFloating_0d) -> np.floating: ... @overload -def polyval(p: ToComplex_1d, x: CoComplex_0d) -> np.complexfloating: ... +def polyval(p: _nt.ToComplex_1d, x: _nt.CoComplex_0d) -> np.complexfloating: ... @overload -def polyval(p: CoComplex_1d, x: ToComplex_0d) -> np.complexfloating: ... +def polyval(p: _nt.CoComplex_1d, x: _nt.ToComplex_0d) -> np.complexfloating: ... @overload -def polyval(p: ToBool_1d, x: ToBool_1nd) -> Array[np.bool]: ... +def polyval(p: _nt.ToBool_1d, x: _nt.ToBool_1nd) -> _nt.Array[np.bool]: ... @overload -def polyval(p: ToUInteger_1d, x: CoUInt64_1nd) -> Array[np.unsignedinteger]: ... +def polyval(p: _nt.ToUInteger_1d, x: _nt.CoUInt64_1nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polyval(p: CoUInt64_1d, x: ToUInteger_1nd) -> Array[np.unsignedinteger]: ... +def polyval(p: _nt.CoUInt64_1d, x: _nt.ToUInteger_1nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polyval(p: ToSInteger_1d, x: CoInt64_1nd) -> Array[np.signedinteger]: ... +def polyval(p: _nt.ToSInteger_1d, x: _nt.CoInt64_1nd) -> _nt.Array[np.signedinteger]: ... @overload -def polyval(p: CoInt64_1d, x: ToSInteger_1nd) -> Array[np.signedinteger]: ... +def polyval(p: _nt.CoInt64_1d, x: _nt.ToSInteger_1nd) -> _nt.Array[np.signedinteger]: ... @overload -def polyval(p: ToFloating_1d, x: CoFloating_1nd) -> Array[np.floating]: ... +def polyval(p: _nt.ToFloating_1d, x: _nt.CoFloating_1nd) -> _nt.Array[np.floating]: ... @overload -def polyval(p: CoFloating_1d, x: ToFloating_1nd) -> Array[np.floating]: ... +def polyval(p: _nt.CoFloating_1d, x: _nt.ToFloating_1nd) -> _nt.Array[np.floating]: ... @overload -def polyval(p: ToComplex_1d, x: CoComplex_1nd) -> Array[np.complexfloating]: ... +def polyval(p: _nt.ToComplex_1d, x: _nt.CoComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def polyval(p: CoComplex_1d, x: ToComplex_1nd) -> Array[np.complexfloating]: ... +def polyval(p: _nt.CoComplex_1d, x: _nt.ToComplex_1nd) -> _nt.Array[np.complexfloating]: ... @overload -def polyval(p: ToObject_1d, x: ToObject_1nd) -> Array[np.object_]: ... +def polyval(p: _nt.ToObject_1d, x: _nt.ToObject_1nd) -> _nt.Array[np.object_]: ... # @overload -def polyadd(a1: poly1d, a2: CoComplex_nd | ToObject_nd) -> poly1d: ... +def polyadd(a1: poly1d, a2: _nt.CoComplex_nd | _nt.ToObject_nd) -> poly1d: ... @overload -def polyadd(a1: CoComplex_nd | ToObject_nd, a2: poly1d) -> poly1d: ... +def polyadd(a1: _nt.CoComplex_nd | _nt.ToObject_nd, a2: poly1d) -> poly1d: ... @overload -def polyadd(a1: ToBool_nd, a2: ToBool_nd) -> Array[np.bool]: ... +def polyadd(a1: _nt.ToBool_nd, a2: _nt.ToBool_nd) -> _nt.Array[np.bool]: ... @overload -def polyadd(a1: ToUInteger_nd, a2: CoUInt64_nd) -> Array[np.unsignedinteger]: ... +def polyadd(a1: _nt.ToUInteger_nd, a2: _nt.CoUInt64_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polyadd(a1: CoUInt64_nd, a2: ToUInteger_nd) -> Array[np.unsignedinteger]: ... +def polyadd(a1: _nt.CoUInt64_nd, a2: _nt.ToUInteger_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polyadd(a1: ToSInteger_nd, a2: CoInt64_nd) -> Array[np.signedinteger]: ... +def polyadd(a1: _nt.ToSInteger_nd, a2: _nt.CoInt64_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polyadd(a1: CoInt64_nd, a2: ToSInteger_nd) -> Array[np.signedinteger]: ... +def polyadd(a1: _nt.CoInt64_nd, a2: _nt.ToSInteger_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polyadd(a1: ToFloating_nd, a2: CoFloating_nd) -> Array[np.floating]: ... +def polyadd(a1: _nt.ToFloating_nd, a2: _nt.CoFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polyadd(a1: CoFloating_nd, a2: ToFloating_nd) -> Array[np.floating]: ... +def polyadd(a1: _nt.CoFloating_nd, a2: _nt.ToFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polyadd(a1: ToComplex_nd, a2: CoComplex_nd) -> Array[np.complexfloating]: ... +def polyadd(a1: _nt.ToComplex_nd, a2: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polyadd(a1: CoComplex_nd, a2: ToComplex_nd) -> Array[np.complexfloating]: ... +def polyadd(a1: _nt.CoComplex_nd, a2: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polyadd(a1: ToObject_nd, a2: ToObject_nd) -> Array[np.object_]: ... +def polyadd(a1: _nt.ToObject_nd, a2: _nt.ToObject_nd) -> _nt.Array[np.object_]: ... # keep in sync with polymul @overload -def polymul(a1: poly1d, a2: CoComplex_nd | ToObject_nd) -> poly1d: ... +def polymul(a1: poly1d, a2: _nt.CoComplex_nd | _nt.ToObject_nd) -> poly1d: ... @overload -def polymul(a1: CoComplex_nd | ToObject_nd, a2: poly1d) -> poly1d: ... +def polymul(a1: _nt.CoComplex_nd | _nt.ToObject_nd, a2: poly1d) -> poly1d: ... @overload -def polymul(a1: ToBool_nd, a2: ToBool_nd) -> Array[np.bool]: ... +def polymul(a1: _nt.ToBool_nd, a2: _nt.ToBool_nd) -> _nt.Array[np.bool]: ... @overload -def polymul(a1: ToUInteger_nd, a2: CoUInt64_nd) -> Array[np.unsignedinteger]: ... +def polymul(a1: _nt.ToUInteger_nd, a2: _nt.CoUInt64_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polymul(a1: CoUInt64_nd, a2: ToUInteger_nd) -> Array[np.unsignedinteger]: ... +def polymul(a1: _nt.CoUInt64_nd, a2: _nt.ToUInteger_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polymul(a1: ToSInteger_nd, a2: CoInt64_nd) -> Array[np.signedinteger]: ... +def polymul(a1: _nt.ToSInteger_nd, a2: _nt.CoInt64_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polymul(a1: CoInt64_nd, a2: ToSInteger_nd) -> Array[np.signedinteger]: ... +def polymul(a1: _nt.CoInt64_nd, a2: _nt.ToSInteger_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polymul(a1: ToFloating_nd, a2: CoFloating_nd) -> Array[np.floating]: ... +def polymul(a1: _nt.ToFloating_nd, a2: _nt.CoFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polymul(a1: CoFloating_nd, a2: ToFloating_nd) -> Array[np.floating]: ... +def polymul(a1: _nt.CoFloating_nd, a2: _nt.ToFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polymul(a1: ToComplex_nd, a2: CoComplex_nd) -> Array[np.complexfloating]: ... +def polymul(a1: _nt.ToComplex_nd, a2: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polymul(a1: CoComplex_nd, a2: ToComplex_nd) -> Array[np.complexfloating]: ... +def polymul(a1: _nt.CoComplex_nd, a2: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polymul(a1: ToObject_nd, a2: ToObject_nd) -> Array[np.object_]: ... +def polymul(a1: _nt.ToObject_nd, a2: _nt.ToObject_nd) -> _nt.Array[np.object_]: ... # @overload -def polysub(a1: poly1d, a2: CoComplex_nd | ToObject_nd) -> poly1d: ... +def polysub(a1: poly1d, a2: _nt.CoComplex_nd | _nt.ToObject_nd) -> poly1d: ... @overload -def polysub(a1: CoComplex_nd | ToObject_nd, a2: poly1d) -> poly1d: ... +def polysub(a1: _nt.CoComplex_nd | _nt.ToObject_nd, a2: poly1d) -> poly1d: ... @overload -def polysub(a1: ToUInteger_nd, a2: CoUInt64_nd) -> Array[np.unsignedinteger]: ... +def polysub(a1: _nt.ToUInteger_nd, a2: _nt.CoUInt64_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polysub(a1: CoUInt64_nd, a2: ToUInteger_nd) -> Array[np.unsignedinteger]: ... +def polysub(a1: _nt.CoUInt64_nd, a2: _nt.ToUInteger_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def polysub(a1: ToSInteger_nd, a2: CoInt64_nd) -> Array[np.signedinteger]: ... +def polysub(a1: _nt.ToSInteger_nd, a2: _nt.CoInt64_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polysub(a1: CoInt64_nd, a2: ToSInteger_nd) -> Array[np.signedinteger]: ... +def polysub(a1: _nt.CoInt64_nd, a2: _nt.ToSInteger_nd) -> _nt.Array[np.signedinteger]: ... @overload -def polysub(a1: ToFloating_nd, a2: CoFloating_nd) -> Array[np.floating]: ... +def polysub(a1: _nt.ToFloating_nd, a2: _nt.CoFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polysub(a1: CoFloating_nd, a2: ToFloating_nd) -> Array[np.floating]: ... +def polysub(a1: _nt.CoFloating_nd, a2: _nt.ToFloating_nd) -> _nt.Array[np.floating]: ... @overload -def polysub(a1: ToComplex_nd, a2: CoComplex_nd) -> Array[np.complexfloating]: ... +def polysub(a1: _nt.ToComplex_nd, a2: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polysub(a1: CoComplex_nd, a2: ToComplex_nd) -> Array[np.complexfloating]: ... +def polysub(a1: _nt.CoComplex_nd, a2: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def polysub(a1: ToObject_nd, a2: ToObject_nd) -> Array[np.object_]: ... +def polysub(a1: _nt.ToObject_nd, a2: _nt.ToObject_nd) -> _nt.Array[np.object_]: ... # @overload -def polydiv(u: poly1d, v: CoComplex_nd | ToObject_nd) -> _Tuple2[poly1d]: ... +def polydiv(u: poly1d, v: _nt.CoComplex_nd | _nt.ToObject_nd) -> _Tuple2[poly1d]: ... @overload -def polydiv(u: CoComplex_nd | ToObject_nd, v: poly1d) -> _Tuple2[poly1d]: ... +def polydiv(u: _nt.CoComplex_nd | _nt.ToObject_nd, v: poly1d) -> _Tuple2[poly1d]: ... @overload -def polydiv(u: CoFloating_nd, v: CoFloating_nd) -> _Tuple2[Array[np.floating]]: ... +def polydiv(u: _nt.CoFloating_nd, v: _nt.CoFloating_nd) -> _Tuple2[_nt.Array[np.floating]]: ... @overload -def polydiv(u: ToComplex_nd, v: CoComplex_nd) -> _Tuple2[Array[np.complexfloating]]: ... +def polydiv(u: _nt.ToComplex_nd, v: _nt.CoComplex_nd) -> _Tuple2[_nt.Array[np.complexfloating]]: ... @overload -def polydiv(u: CoComplex_nd, v: ToComplex_nd) -> _Tuple2[Array[np.complexfloating]]: ... +def polydiv(u: _nt.CoComplex_nd, v: _nt.ToComplex_nd) -> _Tuple2[_nt.Array[np.complexfloating]]: ... @overload -def polydiv(u: ToObject_nd, v: ToObject_nd) -> _Tuple2[Array[Any]]: ... +def polydiv(u: _nt.ToObject_nd, v: _nt.ToObject_nd) -> _Tuple2[_nt.Array[Any]]: ... diff --git a/src/numpy-stubs/lib/_shape_base_impl.pyi b/src/numpy-stubs/lib/_shape_base_impl.pyi index 66423f2b..d383752e 100644 --- a/src/numpy-stubs/lib/_shape_base_impl.pyi +++ b/src/numpy-stubs/lib/_shape_base_impl.pyi @@ -1,22 +1,12 @@ +from _typeshed import Incomplete from collections.abc import Callable, Sequence -from typing import Any, Concatenate, Protocol, SupportsIndex, overload, type_check_only +from typing import Any, Concatenate, Protocol, SupportsIndex as CanIndex, TypeAlias, overload, type_check_only from typing_extensions import ParamSpec, TypeVar, deprecated +import _numtype as _nt import numpy as np -from _numtype import ( - CoComplex_nd, - CoFloating_nd, - CoInt64_nd, - CoUInt64_nd, - ToBool_nd, - ToComplex_nd, - ToFloating_nd, - ToObject_nd, - ToSInteger_nd, - ToUInteger_nd, -) from numpy import _CastingKind # noqa: ICN003 -from numpy._typing import ArrayLike, DTypeLike, NDArray, _ArrayLike, _ShapeLike +from numpy._typing import ArrayLike, DTypeLike, _ArrayLike as _ToArray, _ShapeLike as _ToShape __all__ = [ "apply_along_axis", @@ -39,12 +29,14 @@ __all__ = [ _Tss = ParamSpec("_Tss") _ScalarT = TypeVar("_ScalarT", bound=np.generic) +_ArrayList: TypeAlias = list[_nt.Array[_ScalarT]] + # Signature of `__array_wrap__` @type_check_only class _DoesArrayWrap(Protocol): def __call__( self, - array: NDArray[Any], + array: _nt.Array, context: tuple[np.ufunc, tuple[Any, ...], int] | None = ..., return_scalar: bool = ..., /, @@ -59,44 +51,49 @@ class _CanArrayWrap(Protocol): # def take_along_axis( - arr: _ScalarT | NDArray[_ScalarT], indices: NDArray[np.integer], axis: int | None -) -> NDArray[_ScalarT]: ... + arr: _ScalarT | _nt.Array[_ScalarT], + indices: _nt.Array[np.integer], + axis: int | None, +) -> _nt.Array[_ScalarT]: ... # def put_along_axis( - arr: NDArray[_ScalarT], indices: NDArray[np.integer], values: ArrayLike, axis: int | None + arr: _nt.Array[_ScalarT], + indices: _nt.Array[np.integer], + values: ArrayLike, + axis: int | None, ) -> None: ... # @overload def apply_along_axis( - func1d: Callable[Concatenate[NDArray[Any], _Tss], _ArrayLike[_ScalarT]], - axis: SupportsIndex, + func1d: Callable[Concatenate[_nt.Array, _Tss], _ToArray[_ScalarT]], + axis: CanIndex, arr: ArrayLike, *args: _Tss.args, **kwargs: _Tss.kwargs, -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def apply_along_axis( - func1d: Callable[Concatenate[NDArray[Any], _Tss], Any], - axis: SupportsIndex, + func1d: Callable[Concatenate[_nt.Array, _Tss], Any], + axis: CanIndex, arr: ArrayLike, *args: _Tss.args, **kwargs: _Tss.kwargs, -) -> NDArray[Any]: ... +) -> _nt.Array[Incomplete]: ... # def apply_over_axes( - func: Callable[[NDArray[Any], int], NDArray[_ScalarT]], + func: Callable[[_nt.Array, int], _nt.Array[_ScalarT]], a: ArrayLike, axes: int | Sequence[int], -) -> NDArray[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... # @overload -def expand_dims(a: _ArrayLike[_ScalarT], axis: _ShapeLike) -> NDArray[_ScalarT]: ... +def expand_dims(a: _ToArray[_ScalarT], axis: _ToShape) -> _nt.Array[_ScalarT]: ... @overload -def expand_dims(a: ArrayLike, axis: _ShapeLike) -> NDArray[Any]: ... +def expand_dims(a: ArrayLike, axis: _ToShape) -> _nt.Array[Incomplete]: ... # Deprecated in NumPy 2.0, 2023-08-1 @deprecated("`row_stack` alias is deprecated. Use `np.vstack` directly.") @@ -105,55 +102,49 @@ def row_stack( *, dtype: DTypeLike | None = None, casting: _CastingKind = "same_kind", -) -> NDArray[Any]: ... +) -> _nt.Array[Incomplete]: ... # @overload -def column_stack(tup: Sequence[_ArrayLike[_ScalarT]]) -> NDArray[_ScalarT]: ... +def column_stack(tup: Sequence[_ToArray[_ScalarT]]) -> _nt.Array[_ScalarT]: ... @overload -def column_stack(tup: Sequence[ArrayLike]) -> NDArray[Any]: ... +def column_stack(tup: Sequence[ArrayLike]) -> _nt.Array[Incomplete]: ... # @overload -def dstack(tup: Sequence[_ArrayLike[_ScalarT]]) -> NDArray[_ScalarT]: ... +def dstack(tup: Sequence[_ToArray[_ScalarT]]) -> _nt.Array[_ScalarT]: ... @overload -def dstack(tup: Sequence[ArrayLike]) -> NDArray[Any]: ... +def dstack(tup: Sequence[ArrayLike]) -> _nt.Array[Incomplete]: ... # @overload -def array_split( - ary: _ArrayLike[_ScalarT], - indices_or_sections: _ShapeLike, - axis: SupportsIndex = 0, -) -> list[NDArray[_ScalarT]]: ... +def array_split(ary: _ToArray[_ScalarT], indices_or_sections: _ToShape, axis: CanIndex = 0) -> _ArrayList[_ScalarT]: ... @overload -def array_split(ary: ArrayLike, indices_or_sections: _ShapeLike, axis: SupportsIndex = 0) -> list[NDArray[Any]]: ... +def array_split(ary: ArrayLike, indices_or_sections: _ToShape, axis: CanIndex = 0) -> list[_nt.Array[Incomplete]]: ... # @overload -def split( - ary: _ArrayLike[_ScalarT], indices_or_sections: _ShapeLike, axis: SupportsIndex = 0 -) -> list[NDArray[_ScalarT]]: ... +def split(ary: _ToArray[_ScalarT], indices_or_sections: _ToShape, axis: CanIndex = 0) -> _ArrayList[_ScalarT]: ... @overload -def split(ary: ArrayLike, indices_or_sections: _ShapeLike, axis: SupportsIndex = 0) -> list[NDArray[Any]]: ... +def split(ary: ArrayLike, indices_or_sections: _ToShape, axis: CanIndex = 0) -> list[_nt.Array[Incomplete]]: ... # @overload -def hsplit(ary: _ArrayLike[_ScalarT], indices_or_sections: _ShapeLike) -> list[NDArray[_ScalarT]]: ... +def hsplit(ary: _ToArray[_ScalarT], indices_or_sections: _ToShape) -> _ArrayList[_ScalarT]: ... @overload -def hsplit(ary: ArrayLike, indices_or_sections: _ShapeLike) -> list[NDArray[Any]]: ... +def hsplit(ary: ArrayLike, indices_or_sections: _ToShape) -> list[_nt.Array[Incomplete]]: ... # @overload -def vsplit(ary: _ArrayLike[_ScalarT], indices_or_sections: _ShapeLike) -> list[NDArray[_ScalarT]]: ... +def vsplit(ary: _ToArray[_ScalarT], indices_or_sections: _ToShape) -> _ArrayList[_ScalarT]: ... @overload -def vsplit(ary: ArrayLike, indices_or_sections: _ShapeLike) -> list[NDArray[Any]]: ... +def vsplit(ary: ArrayLike, indices_or_sections: _ToShape) -> list[_nt.Array[Incomplete]]: ... # @overload -def dsplit(ary: _ArrayLike[_ScalarT], indices_or_sections: _ShapeLike) -> list[NDArray[_ScalarT]]: ... +def dsplit(ary: _ToArray[_ScalarT], indices_or_sections: _ToShape) -> _ArrayList[_ScalarT]: ... @overload -def dsplit(ary: ArrayLike, indices_or_sections: _ShapeLike) -> list[NDArray[Any]]: ... +def dsplit(ary: ArrayLike, indices_or_sections: _ToShape) -> list[_nt.Array[Incomplete]]: ... # @overload @@ -163,28 +154,28 @@ def get_array_wrap(*args: object) -> _DoesArrayWrap | None: ... # @overload -def kron(a: ToBool_nd, b: ToBool_nd) -> NDArray[np.bool]: ... +def kron(a: _nt.ToBool_nd, b: _nt.ToBool_nd) -> _nt.Array[np.bool]: ... @overload -def kron(a: ToUInteger_nd, b: CoUInt64_nd) -> NDArray[np.unsignedinteger]: ... +def kron(a: _nt.ToUInteger_nd, b: _nt.CoUInt64_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def kron(a: CoUInt64_nd, b: ToUInteger_nd) -> NDArray[np.unsignedinteger]: ... +def kron(a: _nt.CoUInt64_nd, b: _nt.ToUInteger_nd) -> _nt.Array[np.unsignedinteger]: ... @overload -def kron(a: ToSInteger_nd, b: CoInt64_nd) -> NDArray[np.signedinteger]: ... +def kron(a: _nt.ToSInteger_nd, b: _nt.CoInt64_nd) -> _nt.Array[np.signedinteger]: ... @overload -def kron(a: CoInt64_nd, b: ToSInteger_nd) -> NDArray[np.signedinteger]: ... +def kron(a: _nt.CoInt64_nd, b: _nt.ToSInteger_nd) -> _nt.Array[np.signedinteger]: ... @overload -def kron(a: ToFloating_nd, b: CoFloating_nd) -> NDArray[np.floating]: ... +def kron(a: _nt.ToFloating_nd, b: _nt.CoFloating_nd) -> _nt.Array[np.floating]: ... @overload -def kron(a: CoFloating_nd, b: ToFloating_nd) -> NDArray[np.floating]: ... +def kron(a: _nt.CoFloating_nd, b: _nt.ToFloating_nd) -> _nt.Array[np.floating]: ... @overload -def kron(a: ToComplex_nd, b: CoComplex_nd) -> NDArray[np.complexfloating]: ... +def kron(a: _nt.ToComplex_nd, b: _nt.CoComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def kron(a: CoComplex_nd, b: ToComplex_nd) -> NDArray[np.complexfloating]: ... +def kron(a: _nt.CoComplex_nd, b: _nt.ToComplex_nd) -> _nt.Array[np.complexfloating]: ... @overload -def kron(a: ToObject_nd, b: ToObject_nd) -> NDArray[np.object_]: ... +def kron(a: _nt.ToObject_nd, b: _nt.ToObject_nd) -> _nt.Array[np.object_]: ... # @overload -def tile(A: _ArrayLike[_ScalarT], reps: int | Sequence[int]) -> NDArray[_ScalarT]: ... +def tile(A: _ToArray[_ScalarT], reps: int | Sequence[int]) -> _nt.Array[_ScalarT]: ... @overload -def tile(A: ArrayLike, reps: int | Sequence[int]) -> NDArray[Any]: ... +def tile(A: ArrayLike, reps: int | Sequence[int]) -> _nt.Array[Incomplete]: ... diff --git a/src/numpy-stubs/lib/_twodim_base_impl.pyi b/src/numpy-stubs/lib/_twodim_base_impl.pyi index f3c16f2e..4843a565 100644 --- a/src/numpy-stubs/lib/_twodim_base_impl.pyi +++ b/src/numpy-stubs/lib/_twodim_base_impl.pyi @@ -2,30 +2,10 @@ from collections.abc import Callable, Sequence from typing import Literal as L, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - CoComplex_1d, - CoFloat64_1d, - JustFloat, - ToBool_1d, - ToBool_1nd, - ToBytes_1nd, - ToComplex128_1nd, - ToComplex_1d, - ToFloat64_1nd, - ToFloat64_2d, - ToFloating_1d, - ToInt_1d, - ToInt_1nd, - ToInteger_1d, - ToObject_1d, - ToStr_1nd, - _ToArray_1d, - _ToArray_1nd, -) from numpy import _OrderCF # noqa: ICN003 -from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _SupportsArrayFunc as _CanArrayFunc +from numpy._typing import _SupportsArrayFunc as _Like __all__ = [ "diag", @@ -49,30 +29,31 @@ _T = TypeVar("_T") _ScalarT = TypeVar("_ScalarT", bound=np.generic) _ComplexT = TypeVar("_ComplexT", bound=np.complexfloating) _InexactT = TypeVar("_InexactT", bound=np.inexact) -_NumericT = TypeVar("_NumericT", bound=_CoComplex) +_CoComplexT = TypeVar("_CoComplexT", bound=_nt.co_complex) # The returned arrays dtype must be compatible with `np.equal` +_Device: TypeAlias = L["cpu"] _MaskFunc: TypeAlias = Callable[ - [Array[np.intp], _T], - Array[np.number | np.bool | np.timedelta64 | np.datetime64 | np.object_], + [_nt.Array[np.intp], _T], + _nt.Array[_nt.co_complex | np.datetime64 | np.timedelta64 | np.object_], ] -_CoInt: TypeAlias = np.integer | np.bool -_CoFloat: TypeAlias = np.floating | _CoInt -_CoComplex: TypeAlias = np.number | np.bool +_Sequence01D: TypeAlias = _T | Sequence[_T] +_Indices2D: TypeAlias = tuple[_nt.Array[np.intp], _nt.Array[np.intp]] +_Histogram2D: TypeAlias = tuple[_nt.Array[np.float64], _nt.Array[_ScalarT], _nt.Array[_ScalarT]] ### @overload -def fliplr(m: _ArrayLike[_ScalarT]) -> Array[_ScalarT]: ... +def fliplr(m: _nt._ToArray_nd[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def fliplr(m: ArrayLike) -> Array: ... +def fliplr(m: _nt.ToGeneric_nd) -> _nt.Array: ... # @overload -def flipud(m: _ArrayLike[_ScalarT]) -> Array[_ScalarT]: ... +def flipud(m: _nt._ToArray_nd[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def flipud(m: ArrayLike) -> Array: ... +def flipud(m: _nt.ToGeneric_nd) -> _nt.Array: ... # @overload @@ -80,292 +61,264 @@ def eye( N: int, M: int | None = None, k: int = 0, - dtype: type[JustFloat] | None = ..., + dtype: _nt.ToDTypeFloat64 | None = ..., order: _OrderCF = "C", *, - device: L["cpu"] | None = None, - like: _CanArrayFunc | None = None, -) -> Array[np.float64]: ... + device: _Device | None = None, + like: _Like | None = None, +) -> _nt.Array[np.float64]: ... @overload def eye( N: int, M: int | None, k: int, - dtype: _DTypeLike[_ScalarT], + dtype: _nt._ToDType[_ScalarT], order: _OrderCF = "C", *, - device: L["cpu"] | None = None, - like: _CanArrayFunc | None = None, -) -> Array[_ScalarT]: ... + device: _Device | None = None, + like: _Like | None = None, +) -> _nt.Array[_ScalarT]: ... @overload def eye( N: int, M: int | None = None, k: int = 0, *, - dtype: _DTypeLike[_ScalarT], + dtype: _nt._ToDType[_ScalarT], order: _OrderCF = "C", - device: L["cpu"] | None = None, - like: _CanArrayFunc | None = None, -) -> Array[_ScalarT]: ... + device: _Device | None = None, + like: _Like | None = None, +) -> _nt.Array[_ScalarT]: ... @overload def eye( N: int, M: int | None = None, k: int = 0, - dtype: DTypeLike = ..., + dtype: _nt.ToDType = ..., order: _OrderCF = "C", *, - device: L["cpu"] | None = None, - like: _CanArrayFunc | None = None, -) -> Array: ... + device: _Device | None = None, + like: _Like | None = None, +) -> _nt.Array: ... # @overload -def diag(v: _ArrayLike[_ScalarT], k: int = 0) -> Array[_ScalarT]: ... +def diag(v: _nt._ToArray_nd[_ScalarT], k: int = 0) -> _nt.Array[_ScalarT]: ... @overload -def diag(v: ArrayLike, k: int = 0) -> Array: ... +def diag(v: _nt.ToGeneric_nd, k: int = 0) -> _nt.Array: ... # @overload -def diagflat(v: _ArrayLike[_ScalarT], k: int = 0) -> Array[_ScalarT]: ... +def diagflat(v: _nt._ToArray_nd[_ScalarT], k: int = 0) -> _nt.Array[_ScalarT]: ... @overload -def diagflat(v: ArrayLike, k: int = 0) -> Array: ... +def diagflat(v: _nt.ToGeneric_nd, k: int = 0) -> _nt.Array: ... # @overload def tri( - N: int, - M: int | None = None, - k: int = 0, - dtype: type[JustFloat] | None = ..., - *, - like: _CanArrayFunc | None = None, -) -> Array[np.float64]: ... + N: int, M: int | None = None, k: int = 0, dtype: _nt.ToDTypeFloat64 | None = ..., *, like: _Like | None = None +) -> _nt.Array[np.float64]: ... @overload def tri( - N: int, - M: int | None, - k: int, - dtype: _DTypeLike[_ScalarT], - *, - like: _CanArrayFunc | None = None, -) -> Array[_ScalarT]: ... + N: int, M: int | None, k: int, dtype: _nt._ToDType[_ScalarT], *, like: _Like | None = None +) -> _nt.Array[_ScalarT]: ... @overload def tri( - N: int, - M: int | None = None, - k: int = 0, - *, - dtype: _DTypeLike[_ScalarT], - like: _CanArrayFunc | None = None, -) -> Array[_ScalarT]: ... + N: int, M: int | None = None, k: int = 0, *, dtype: _nt._ToDType[_ScalarT], like: _Like | None = None +) -> _nt.Array[_ScalarT]: ... @overload def tri( - N: int, - M: int | None = None, - k: int = 0, - dtype: DTypeLike = ..., - *, - like: _CanArrayFunc | None = None, -) -> Array: ... + N: int, M: int | None = None, k: int = 0, dtype: _nt.ToDType = ..., *, like: _Like | None = None +) -> _nt.Array: ... # @overload -def tril(m: ToBool_1nd, k: int = 0) -> Array[np.bool]: ... +def tril(m: _nt.ToBool_1nd, k: int = 0) -> _nt.Array[np.bool]: ... @overload -def tril(m: _ToArray_1nd[_ScalarT], k: int = 0) -> Array[_ScalarT]: ... +def tril(m: _nt._ToArray_1nd[_ScalarT], k: int = 0) -> _nt.Array[_ScalarT]: ... @overload -def tril(m: ToInt_1nd, k: int = 0) -> Array[np.intp]: ... +def tril(m: _nt.ToInt_1nd, k: int = 0) -> _nt.Array[np.intp]: ... @overload -def tril(m: ToFloat64_1nd, k: int = 0) -> Array[np.float64]: ... +def tril(m: _nt.ToFloat64_1nd, k: int = 0) -> _nt.Array[np.float64]: ... @overload -def tril(m: ToComplex128_1nd, k: int = 0) -> Array[np.complex128]: ... +def tril(m: _nt.ToComplex128_1nd, k: int = 0) -> _nt.Array[np.complex128]: ... @overload -def tril(m: ToBytes_1nd, k: int = 0) -> Array[np.bytes_]: ... +def tril(m: _nt.ToBytes_1nd, k: int = 0) -> _nt.Array[np.bytes_]: ... @overload -def tril(m: ToStr_1nd, k: int = 0) -> Array[np.str_]: ... +def tril(m: _nt.ToStr_1nd, k: int = 0) -> _nt.Array[np.str_]: ... @overload -def tril(m: ArrayLike, k: int = 0) -> Array: ... +def tril(m: _nt.ToGeneric_nd, k: int = 0) -> _nt.Array: ... # @overload -def triu(m: ToBool_1nd, k: int = 0) -> Array[np.bool]: ... +def triu(m: _nt.ToBool_1nd, k: int = 0) -> _nt.Array[np.bool]: ... @overload -def triu(m: _ToArray_1nd[_ScalarT], k: int = 0) -> Array[_ScalarT]: ... +def triu(m: _nt._ToArray_1nd[_ScalarT], k: int = 0) -> _nt.Array[_ScalarT]: ... @overload -def triu(m: ToInt_1nd, k: int = 0) -> Array[np.intp]: ... +def triu(m: _nt.ToInt_1nd, k: int = 0) -> _nt.Array[np.intp]: ... @overload -def triu(m: ToFloat64_1nd, k: int = 0) -> Array[np.float64]: ... +def triu(m: _nt.ToFloat64_1nd, k: int = 0) -> _nt.Array[np.float64]: ... @overload -def triu(m: ToComplex128_1nd, k: int = 0) -> Array[np.complex128]: ... +def triu(m: _nt.ToComplex128_1nd, k: int = 0) -> _nt.Array[np.complex128]: ... @overload -def triu(m: ToBytes_1nd, k: int = 0) -> Array[np.bytes_]: ... +def triu(m: _nt.ToBytes_1nd, k: int = 0) -> _nt.Array[np.bytes_]: ... @overload -def triu(m: ToStr_1nd, k: int = 0) -> Array[np.str_]: ... +def triu(m: _nt.ToStr_1nd, k: int = 0) -> _nt.Array[np.str_]: ... @overload -def triu(m: ArrayLike, k: int = 0) -> Array: ... +def triu(m: _nt.ToGeneric_nd, k: int = 0) -> _nt.Array: ... # @overload -def vander(x: ToBool_1d, N: int | None = None, increasing: bool = False) -> Array[np.intp]: ... +def vander(x: _nt.ToBool_1d, N: int | None = None, increasing: bool = False) -> _nt.Array[np.intp]: ... @overload -def vander(x: ToInteger_1d, N: int | None = None, increasing: bool = False) -> Array[np.signedinteger]: ... +def vander(x: _nt.ToInteger_1d, N: int | None = None, increasing: bool = False) -> _nt.Array[np.signedinteger]: ... @overload -def vander(x: ToFloating_1d, N: int | None = None, increasing: bool = False) -> Array[np.floating]: ... +def vander(x: _nt.ToFloating_1d, N: int | None = None, increasing: bool = False) -> _nt.Array[np.floating]: ... @overload -def vander(x: ToComplex_1d, N: int | None = None, increasing: bool = False) -> Array[np.complexfloating]: ... +def vander(x: _nt.ToComplex_1d, N: int | None = None, increasing: bool = False) -> _nt.Array[np.complexfloating]: ... @overload -def vander(x: ToObject_1d, N: int | None = None, increasing: bool = False) -> Array[np.object_]: ... +def vander(x: _nt.ToObject_1d, N: int | None = None, increasing: bool = False) -> _nt.Array[np.object_]: ... # @overload def histogram2d( - x: _ToArray_1d[_ComplexT], - y: _ToArray_1d[_ComplexT | _CoFloat], - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + x: _nt._ToArray_1d[_ComplexT], + y: _nt._ToArray_1d[_ComplexT | _nt.co_float], + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_ComplexT], Array[_ComplexT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_ComplexT]: ... @overload def histogram2d( - x: _ToArray_1d[_ComplexT | _CoFloat], - y: _ToArray_1d[_ComplexT], - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + x: _nt._ToArray_1d[_ComplexT | _nt.co_float], + y: _nt._ToArray_1d[_ComplexT], + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_ComplexT], Array[_ComplexT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_ComplexT]: ... @overload def histogram2d( - x: _ToArray_1d[_InexactT], - y: _ToArray_1d[_InexactT | _CoInt], - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + x: _nt._ToArray_1d[_InexactT], + y: _nt._ToArray_1d[_InexactT | _nt.co_integer], + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_InexactT], Array[_InexactT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_InexactT]: ... @overload def histogram2d( - x: _ToArray_1d[_InexactT | _CoInt], - y: _ToArray_1d[_InexactT], - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + x: _nt._ToArray_1d[_InexactT | _nt.co_integer], + y: _nt._ToArray_1d[_InexactT], + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_InexactT], Array[_InexactT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_InexactT]: ... @overload def histogram2d( - x: CoFloat64_1d, - y: CoFloat64_1d, - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + x: _nt.CoFloat64_1d, + y: _nt.CoFloat64_1d, + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[np.float64], Array[np.float64]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[np.float64]: ... @overload def histogram2d( x: Sequence[complex], y: Sequence[complex], - bins: int | Sequence[int] = 10, - range: ToFloat64_2d | None = None, + bins: _Sequence01D[int] = 10, + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[np.complex128 | np.float64], Array[np.complex128 | np.float64]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_nt.inexact64]: ... @overload def histogram2d( - x: CoComplex_1d, - y: CoComplex_1d, - bins: _ToArray_1d[_NumericT] | Sequence[_ToArray_1d[_NumericT]], - range: ToFloat64_2d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + bins: _Sequence01D[_nt._ToArray_1d[_CoComplexT]], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_NumericT], Array[_NumericT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_CoComplexT]: ... @overload def histogram2d( - x: _ToArray_1d[_InexactT], - y: _ToArray_1d[_InexactT], - bins: Sequence[_ToArray_1d[_NumericT] | int], - range: ToFloat64_2d | None = None, + x: _nt._ToArray_1d[_InexactT], + y: _nt._ToArray_1d[_InexactT], + bins: Sequence[_nt._ToArray_1d[_CoComplexT] | int], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_NumericT | _InexactT], Array[_NumericT | _InexactT]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_CoComplexT | _InexactT]: ... @overload def histogram2d( - x: ToInt_1d | Sequence[float], - y: ToInt_1d | Sequence[float], - bins: Sequence[_ToArray_1d[_NumericT] | int], - range: ToFloat64_2d | None = None, + x: _nt.ToInt_1d | Sequence[float], + y: _nt.ToInt_1d | Sequence[float], + bins: Sequence[_nt._ToArray_1d[_CoComplexT] | int], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[_NumericT | np.float64], Array[_NumericT | np.float64]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_CoComplexT | np.float64]: ... @overload def histogram2d( x: Sequence[complex], y: Sequence[complex], - bins: Sequence[_ToArray_1d[_NumericT] | int], - range: ToFloat64_2d | None = None, + bins: Sequence[_nt._ToArray_1d[_CoComplexT] | int], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[ - Array[np.float64], - Array[_NumericT | np.complex128 | np.float64], - Array[_NumericT | np.complex128 | np.float64], -]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[_CoComplexT | _nt.inexact64]: ... @overload def histogram2d( - x: CoComplex_1d, - y: CoComplex_1d, - bins: Sequence[Sequence[bool]], - range: ToFloat64_2d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + bins: _nt.Sequence2D[bool], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[np.bool], Array[np.bool]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[np.bool]: ... @overload def histogram2d( - x: CoComplex_1d, - y: CoComplex_1d, - bins: Sequence[Sequence[int]], - range: ToFloat64_2d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + bins: _nt.Sequence2D[_nt.JustInt], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[np.intp | np.bool], Array[np.intp | np.bool]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[np.intp]: ... @overload def histogram2d( - x: CoComplex_1d, - y: CoComplex_1d, - bins: Sequence[Sequence[float]], - range: ToFloat64_2d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + bins: _nt.Sequence2D[_nt.JustFloat], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[Array[np.float64], Array[np.float64 | np.intp | np.bool], Array[np.float64 | np.intp | np.bool]]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[np.float64]: ... @overload def histogram2d( - x: CoComplex_1d, - y: CoComplex_1d, - bins: Sequence[Sequence[complex]], - range: ToFloat64_2d | None = None, + x: _nt.CoComplex_1d, + y: _nt.CoComplex_1d, + bins: _nt.Sequence2D[_nt.JustComplex], + range: _nt.ToFloat64_2d | None = None, density: bool | None = None, - weights: CoFloat64_1d | None = None, -) -> tuple[ - Array[np.float64], - Array[np.complex128 | np.float64 | np.intp | np.bool], - Array[np.complex128 | np.float64 | np.intp | np.bool], -]: ... + weights: _nt.CoFloat64_1d | None = None, +) -> _Histogram2D[np.complex128]: ... # NOTE: we're assuming/demanding here the `mask_func` returns # an ndarray of shape `(n, n)`; otherwise there is the possibility # of the output tuple having more or less than 2 elements @overload -def mask_indices(n: int, mask_func: _MaskFunc[int], k: int = 0) -> tuple[Array[np.intp], Array[np.intp]]: ... +def mask_indices(n: int, mask_func: _MaskFunc[int], k: int = 0) -> _Indices2D: ... @overload -def mask_indices(n: int, mask_func: _MaskFunc[_T], k: _T) -> tuple[Array[np.intp], Array[np.intp]]: ... +def mask_indices(n: int, mask_func: _MaskFunc[_T], k: _T) -> _Indices2D: ... # -def tril_indices(n: int, k: int = 0, m: int | None = None) -> tuple[Array[np.intp], Array[np.intp]]: ... -def triu_indices(n: int, k: int = 0, m: int | None = None) -> tuple[Array[np.intp], Array[np.intp]]: ... +def tril_indices(n: int, k: int = 0, m: int | None = None) -> _Indices2D: ... +def triu_indices(n: int, k: int = 0, m: int | None = None) -> _Indices2D: ... # -def tril_indices_from(arr: Array, k: int = 0) -> tuple[Array[np.intp], Array[np.intp]]: ... -def triu_indices_from(arr: Array, k: int = 0) -> tuple[Array[np.intp], Array[np.intp]]: ... +def tril_indices_from(arr: _nt.Array, k: int = 0) -> _Indices2D: ... +def triu_indices_from(arr: _nt.Array, k: int = 0) -> _Indices2D: ... diff --git a/src/numpy-stubs/lib/_type_check_impl.pyi b/src/numpy-stubs/lib/_type_check_impl.pyi index 8119e7d9..f070ad5f 100644 --- a/src/numpy-stubs/lib/_type_check_impl.pyi +++ b/src/numpy-stubs/lib/_type_check_impl.pyi @@ -2,28 +2,8 @@ from collections.abc import Container, Iterable from typing import Any, Literal as L, overload, type_check_only from typing_extensions import Protocol, TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - ToBool_nd, - ToBytes_nd, - ToCLongDouble_nd, - ToComplex64_nd, - ToComplex128_nd, - ToFloat64_nd, - ToGeneric_0d, - ToGeneric_1nd, - ToGeneric_nd, - ToInt_nd, - ToStr_nd, - _ToArray_1nd, - _ToArray_nd, - co_number, - inexact32, - number16, - number32, - number64, -) __all__ = [ "common_type", @@ -43,8 +23,9 @@ __all__ = [ _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) + +_RealT = TypeVar("_RealT", bound=_nt.co_number) _ScalarT = TypeVar("_ScalarT", bound=np.generic) -_RealT = TypeVar("_RealT", bound=co_number) _ScalarT_co = TypeVar("_ScalarT_co", bound=np.generic, covariant=True) @type_check_only @@ -66,64 +47,66 @@ class _HasDType(Protocol[_ScalarT_co]): # def mintypecode( - typechars: Iterable[str | ToGeneric_nd], typeset: str | Container[str] = "GDFgdf", default: str = "d" + typechars: Iterable[_nt.ToGeneric_nd], + typeset: str | Container[str] = "GDFgdf", + default: str = "d", ) -> str: ... # @overload def real(val: _HasReal[_T]) -> _T: ... # type: ignore[overload-overlap] @overload -def real(val: ToBool_nd) -> Array[np.bool]: ... +def real(val: _nt.ToBool_nd) -> _nt.Array[np.bool]: ... @overload -def real(val: ToInt_nd) -> Array[np.intp]: ... +def real(val: _nt.ToInt_nd) -> _nt.Array[np.intp]: ... @overload -def real(val: ToFloat64_nd) -> Array[np.float64]: ... +def real(val: _nt.ToFloat64_nd) -> _nt.Array[np.float64]: ... @overload -def real(val: ToComplex128_nd) -> Array[np.complex128]: ... +def real(val: _nt.ToComplex128_nd) -> _nt.Array[np.complex128]: ... @overload -def real(val: ToBytes_nd) -> Array[np.bytes_]: ... +def real(val: _nt.ToBytes_nd) -> _nt.Array[np.bytes_]: ... @overload -def real(val: ToStr_nd) -> Array[np.str_]: ... +def real(val: _nt.ToStr_nd) -> _nt.Array[np.str_]: ... @overload -def real(val: _ToArray_nd[_ScalarT]) -> Array[_ScalarT]: ... +def real(val: _nt._ToArray_nd[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def real(val: ToGeneric_nd) -> Array: ... +def real(val: _nt.ToGeneric_nd) -> _nt.Array: ... # @overload def imag(val: _HasImag[_T]) -> _T: ... # type: ignore[overload-overlap] @overload -def imag(val: ToBool_nd) -> Array[np.bool]: ... +def imag(val: _nt.ToBool_nd) -> _nt.Array[np.bool]: ... @overload -def imag(val: ToInt_nd) -> Array[np.intp]: ... +def imag(val: _nt.ToInt_nd) -> _nt.Array[np.intp]: ... @overload -def imag(val: ToFloat64_nd) -> Array[np.float64]: ... +def imag(val: _nt.ToFloat64_nd) -> _nt.Array[np.float64]: ... @overload -def imag(val: ToComplex128_nd) -> Array[np.complex128]: ... +def imag(val: _nt.ToComplex128_nd) -> _nt.Array[np.complex128]: ... @overload -def imag(val: ToBytes_nd) -> Array[np.bytes_]: ... +def imag(val: _nt.ToBytes_nd) -> _nt.Array[np.bytes_]: ... @overload -def imag(val: ToStr_nd) -> Array[np.str_]: ... +def imag(val: _nt.ToStr_nd) -> _nt.Array[np.str_]: ... @overload -def imag(val: _ToArray_nd[_ScalarT]) -> Array[_ScalarT]: ... +def imag(val: _nt._ToArray_nd[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def imag(val: ToGeneric_nd) -> Array: ... +def imag(val: _nt.ToGeneric_nd) -> _nt.Array: ... # @overload -def iscomplex(x: ToGeneric_0d) -> np.bool: ... +def iscomplex(x: _nt.ToGeneric_0d) -> np.bool: ... @overload -def iscomplex(x: ToGeneric_1nd) -> Array[np.bool]: ... +def iscomplex(x: _nt.ToGeneric_1nd) -> _nt.Array[np.bool]: ... # @overload -def isreal(x: ToGeneric_0d) -> np.bool: ... +def isreal(x: _nt.ToGeneric_0d) -> np.bool: ... @overload -def isreal(x: ToGeneric_1nd) -> Array[np.bool]: ... +def isreal(x: _nt.ToGeneric_1nd) -> _nt.Array[np.bool]: ... # -def iscomplexobj(x: _HasDType[Any] | ToGeneric_nd) -> bool: ... -def isrealobj(x: _HasDType[Any] | ToGeneric_nd) -> bool: ... +def iscomplexobj(x: _HasDType[Any] | _nt.ToGeneric_nd) -> bool: ... +def isrealobj(x: _HasDType[Any] | _nt.ToGeneric_nd) -> bool: ... # @overload @@ -136,15 +119,15 @@ def nan_to_num( ) -> _ScalarT: ... @overload def nan_to_num( - x: _ToArray_1nd[_ScalarT], + x: _nt._ToArray_1nd[_ScalarT], copy: bool = True, nan: float = 0.0, posinf: float | None = None, neginf: float | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def nan_to_num( - x: ToGeneric_0d, + x: _nt.ToGeneric_0d, copy: bool = True, nan: float = 0.0, posinf: float | None = None, @@ -152,26 +135,26 @@ def nan_to_num( ) -> Any: ... @overload def nan_to_num( - x: ToGeneric_1nd, + x: _nt.ToGeneric_1nd, copy: bool = True, nan: float = 0.0, posinf: float | None = None, neginf: float | None = None, -) -> Array: ... +) -> _nt.Array: ... # If one passes a complex array to `real_if_close`, then one is reasonably # expected to verify the output dtype (so we can return an unsafe union here) @overload -def real_if_close(a: ToCLongDouble_nd, tol: float = 100) -> Array[np.longdouble | np.clongdouble]: ... +def real_if_close(a: _nt.ToCLongDouble_nd, tol: float = 100) -> _nt.Array[_nt.inexact64l]: ... @overload -def real_if_close(a: ToComplex128_nd, tol: float = 100) -> Array[np.float64 | np.complex128]: ... +def real_if_close(a: _nt.ToComplex128_nd, tol: float = 100) -> _nt.Array[_nt.inexact64]: ... @overload -def real_if_close(a: ToComplex64_nd, tol: float = 100) -> Array[np.float32 | np.complex64]: ... +def real_if_close(a: _nt.ToComplex64_nd, tol: float = 100) -> _nt.Array[_nt.inexact32]: ... @overload -def real_if_close(a: _ToArray_nd[_RealT], tol: float = 100) -> Array[_RealT]: ... +def real_if_close(a: _nt._ToArray_nd[_RealT], tol: float = 100) -> _nt.Array[_RealT]: ... @overload -def real_if_close(a: ToGeneric_nd, tol: float = 100) -> Array: ... +def real_if_close(a: _nt.ToGeneric_nd, tol: float = 100) -> _nt.Array: ... # @overload @@ -242,13 +225,13 @@ def common_type( def common_type( a0: _HasDType[np.complex64], /, - *ai: _HasDType[inexact32 | np.float16], + *ai: _HasDType[_nt.inexact32 | np.float16], ) -> type[np.complex64]: ... @overload def common_type( a0: _HasDType[np.complex128], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( @@ -279,45 +262,45 @@ def common_type( ) -> type[np.longdouble]: ... @overload def common_type( - a0: _HasDType[inexact32 | np.float16], + a0: _HasDType[_nt.inexact32 | np.float16], array1: _HasDType[np.complex64], /, - *ai: _HasDType[inexact32 | np.float16], + *ai: _HasDType[_nt.inexact32 | np.float16], ) -> type[np.complex64]: ... @overload def common_type( a0: _HasDType[np.float64], array1: _HasDType[np.complex128 | np.complex64], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( a0: _HasDType[np.complex128 | np.complex64], array1: _HasDType[np.float64], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( - a0: _HasDType[number64 | number32 | number16 | np.integer], + a0: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], array1: _HasDType[np.complex128], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( a0: _HasDType[np.complex128 | np.complex64], array1: _HasDType[np.complex128 | np.integer], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( a0: _HasDType[np.complex128 | np.integer], array1: _HasDType[np.complex128 | np.complex64], /, - *ai: _HasDType[number64 | number32 | number16 | np.integer], + *ai: _HasDType[_nt.inexact64 | _nt.inexact32 | np.float16 | np.integer], ) -> type[np.complex128]: ... @overload def common_type( diff --git a/src/numpy-stubs/lib/_ufunclike_impl.pyi b/src/numpy-stubs/lib/_ufunclike_impl.pyi index 573a8fb8..291a86d5 100644 --- a/src/numpy-stubs/lib/_ufunclike_impl.pyi +++ b/src/numpy-stubs/lib/_ufunclike_impl.pyi @@ -1,102 +1,75 @@ from typing import overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - Array2D, - Array3D, - CanArray0D, - CanLenArray, - CoFloating_0d, - CoFloating_1ds, - CoFloating_1nd, - CoFloating_2ds, - CoFloating_3ds, - CoFloating_nd, - ToBool_0d, - ToBool_1nd, - ToFloat64_0d, - ToFloat64_1nd, - ToInt_0d, - ToInt_1nd, - _ToArray_1ds, - _ToArray_1nd, - _ToArray_2ds, - _ToArray_3ds, -) __all__ = ["fix", "isneginf", "isposinf"] ### -_ArrayT = TypeVar("_ArrayT", bound=Array) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) _ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...]) -_RealT = TypeVar("_RealT", bound=np.floating | np.integer | np.object_) +_RealT = TypeVar("_RealT", bound=np.integer | np.floating | np.object_) ### # @overload -def fix(x: CoFloating_nd, out: _ArrayT) -> _ArrayT: ... +def fix(x: _nt.CoFloating_nd, out: _ArrayT) -> _ArrayT: ... @overload def fix(x: _ArrayT, out: None) -> _ArrayT: ... @overload -def fix(x: ToBool_0d, out: None = None) -> np.bool: ... +def fix(x: _nt.ToBool_0d, out: None = None) -> np.bool: ... @overload -def fix(x: ToInt_0d, out: None = None) -> np.intp: ... +def fix(x: _nt.ToInt_0d, out: None = None) -> np.intp: ... @overload -def fix(x: ToFloat64_0d, out: None = None) -> np.float64: ... +def fix(x: _nt.ToFloat64_0d, out: None = None) -> np.float64: ... @overload -def fix(x: CanArray0D[_RealT], out: None = None) -> _RealT: ... +def fix(x: _nt.CanArray0D[_RealT], out: None = None) -> _RealT: ... @overload -def fix(x: _ToArray_1ds[_RealT], out: None = None) -> Array1D[_RealT]: ... +def fix(x: _nt._ToArray_1ds[_RealT], out: None = None) -> _nt.Array1D[_RealT]: ... @overload -def fix(x: _ToArray_2ds[_RealT], out: None = None) -> Array2D[_RealT]: ... +def fix(x: _nt._ToArray_2ds[_RealT], out: None = None) -> _nt.Array2D[_RealT]: ... @overload -def fix(x: _ToArray_3ds[_RealT], out: None = None) -> Array3D[_RealT]: ... +def fix(x: _nt._ToArray_3ds[_RealT], out: None = None) -> _nt.Array3D[_RealT]: ... @overload -def fix(x: ToBool_1nd, out: None = None) -> Array[np.bool]: ... +def fix(x: _nt.ToBool_1nd, out: None = None) -> _nt.Array[np.bool]: ... @overload -def fix(x: ToInt_1nd, out: None = None) -> Array[np.intp]: ... +def fix(x: _nt.ToInt_1nd, out: None = None) -> _nt.Array[np.intp]: ... @overload -def fix(x: ToFloat64_1nd, out: None = None) -> Array[np.float64]: ... +def fix(x: _nt.ToFloat64_1nd, out: None = None) -> _nt.Array[np.float64]: ... @overload -def fix(x: _ToArray_1nd[_RealT], out: None = None) -> Array[_RealT]: ... +def fix(x: _nt._ToArray_1nd[_RealT], out: None = None) -> _nt.Array[_RealT]: ... # @overload -def isposinf(x: CoFloating_0d, out: None = None) -> np.bool: ... +def isposinf(x: _nt.CoFloating_0d, out: None = None) -> np.bool: ... @overload -def isposinf( - x: CanLenArray[np.floating | np.integer | np.bool, _ShapeT], out: None = None -) -> Array[np.bool, _ShapeT]: ... +def isposinf(x: _nt.CanLenArray[_nt.co_float, _ShapeT], out: None = None) -> _nt.Array[np.bool, _ShapeT]: ... @overload -def isposinf(x: CoFloating_1ds, out: None = None) -> Array1D[np.bool]: ... +def isposinf(x: _nt.CoFloating_1ds, out: None = None) -> _nt.Array1D[np.bool]: ... @overload -def isposinf(x: CoFloating_2ds, out: None = None) -> Array2D[np.bool]: ... +def isposinf(x: _nt.CoFloating_2ds, out: None = None) -> _nt.Array2D[np.bool]: ... @overload -def isposinf(x: CoFloating_3ds, out: None = None) -> Array3D[np.bool]: ... +def isposinf(x: _nt.CoFloating_3ds, out: None = None) -> _nt.Array3D[np.bool]: ... @overload -def isposinf(x: CoFloating_1nd, out: None = None) -> Array[np.bool]: ... +def isposinf(x: _nt.CoFloating_1nd, out: None = None) -> _nt.Array[np.bool]: ... @overload -def isposinf(x: CoFloating_nd, out: _ArrayT) -> _ArrayT: ... +def isposinf(x: _nt.CoFloating_nd, out: _ArrayT) -> _ArrayT: ... # @overload -def isneginf(x: CoFloating_0d, out: None = None) -> np.bool: ... +def isneginf(x: _nt.CoFloating_0d, out: None = None) -> np.bool: ... @overload -def isneginf( - x: CanLenArray[np.floating | np.integer | np.bool, _ShapeT], out: None = None -) -> Array[np.bool, _ShapeT]: ... +def isneginf(x: _nt.CanLenArray[_nt.co_float, _ShapeT], out: None = None) -> _nt.Array[np.bool, _ShapeT]: ... @overload -def isneginf(x: CoFloating_1ds, out: None = None) -> Array1D[np.bool]: ... +def isneginf(x: _nt.CoFloating_1ds, out: None = None) -> _nt.Array1D[np.bool]: ... @overload -def isneginf(x: CoFloating_2ds, out: None = None) -> Array2D[np.bool]: ... +def isneginf(x: _nt.CoFloating_2ds, out: None = None) -> _nt.Array2D[np.bool]: ... @overload -def isneginf(x: CoFloating_3ds, out: None = None) -> Array3D[np.bool]: ... +def isneginf(x: _nt.CoFloating_3ds, out: None = None) -> _nt.Array3D[np.bool]: ... @overload -def isneginf(x: CoFloating_1nd, out: None = None) -> Array[np.bool]: ... +def isneginf(x: _nt.CoFloating_1nd, out: None = None) -> _nt.Array[np.bool]: ... @overload -def isneginf(x: CoFloating_nd, out: _ArrayT) -> _ArrayT: ... +def isneginf(x: _nt.CoFloating_nd, out: _ArrayT) -> _ArrayT: ... From c77a7be9d5f2e5aef5d92c9be9c067f134373e6e Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:10:13 +0200 Subject: [PATCH 06/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`ma`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/ma/core.pyi | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/numpy-stubs/ma/core.pyi b/src/numpy-stubs/ma/core.pyi index e35c2860..a49a5e7c 100644 --- a/src/numpy-stubs/ma/core.pyi +++ b/src/numpy-stubs/ma/core.pyi @@ -2,8 +2,8 @@ from _typeshed import Incomplete from typing import Any, ClassVar, Final, Generic, Literal as L, SupportsIndex as CanIndex, TypeAlias, type_check_only from typing_extensions import Never, Self, TypeVar, deprecated, overload, override +import _numtype as _nt import numpy as np -from _numtype import Array, ToGeneric_0d, ToGeneric_1nd, ToGeneric_nd from numpy import _OrderACF, _OrderKACF, amax, amin, bool_, expand_dims # noqa: ICN003 from numpy._globals import _NoValueType from numpy._typing import ArrayLike, _ArrayLike, _BoolCodes, _ScalarLike_co, _ShapeLike @@ -197,12 +197,12 @@ _ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], default=tuple[int, ... _DTypeT = TypeVar("_DTypeT", bound=np.dtype) _DTypeT_co = TypeVar("_DTypeT_co", bound=np.dtype, default=np.dtype, covariant=True) -_DTypeLikeBool: TypeAlias = type[bool | np.bool] | np.dtype[np.bool] | _BoolCodes +_DTypeLikeBool: TypeAlias = type[bool | np.bool_] | np.dtype[np.bool_] | _BoolCodes ### -MaskType: Final[type[np.bool]] = ... -nomask: np.bool[L[False]] = ... +MaskType: Final[type[np.bool_]] = ... +nomask: np.bool_[L[False]] = ... masked_print_option: Final[_MaskedPrintOption] = ... ### @@ -216,9 +216,9 @@ class MaskError(MAError): ... @type_check_only class _DomainBase: @overload - def __call__(self, /, x: ToGeneric_0d) -> np.bool: ... + def __call__(self, /, x: _nt.ToGeneric_0d) -> np.bool_: ... @overload - def __call__(self, /, x: ToGeneric_1nd) -> Array[np.bool]: ... + def __call__(self, /, x: _nt.ToGeneric_1nd) -> _nt.Array[np.bool_]: ... class _DomainCheckInterval(_DomainBase): a: Final[float] @@ -240,7 +240,7 @@ class _DomainGreaterEqual(_DomainBase): class _DomainSafeDivide: tolerance: float def __init__(self, /, tolerance: float | None = None) -> None: ... - def __call__(self, /, a: ToGeneric_nd, b: ToGeneric_nd) -> Array[Incomplete]: ... + def __call__(self, /, a: _nt.ToGeneric_nd, b: _nt.ToGeneric_nd) -> _nt.Array[Incomplete]: ... ### @@ -332,7 +332,7 @@ class MaskedArray(np.ndarray[_ShapeT_co, _DTypeT_co]): # @property - def recordmask(self) -> Array[np.bool]: ... + def recordmask(self) -> _nt.Array[np.bool_]: ... @recordmask.setter def recordmask(self, mask: Never, /) -> None: ... @@ -1040,11 +1040,13 @@ less: _MaskedBinaryOperation greater: _MaskedBinaryOperation logical_and: _MaskedBinaryOperation -def alltrue(target: ToGeneric_nd, axis: CanIndex | None = 0, dtype: _DTypeLikeBool | None = None) -> Incomplete: ... +def alltrue(target: _nt.ToGeneric_nd, axis: CanIndex | None = 0, dtype: _DTypeLikeBool | None = None) -> Incomplete: ... logical_or: _MaskedBinaryOperation -def sometrue(target: ToGeneric_nd, axis: CanIndex | None = 0, dtype: _DTypeLikeBool | None = None) -> Incomplete: ... +def sometrue( + target: _nt.ToGeneric_nd, axis: CanIndex | None = 0, dtype: _DTypeLikeBool | None = None +) -> Incomplete: ... logical_xor: _MaskedBinaryOperation bitwise_and: _MaskedBinaryOperation From d3bd20f4e932e244465f824137055c1a32eef1bb Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:32:04 +0200 Subject: [PATCH 07/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`=5Fcore`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/_asarray.pyi | 92 +-- src/numpy-stubs/_core/_multiarray_umath.pyi | 605 +++++++------- src/numpy-stubs/_core/fromnumeric.pyi | 838 ++++++++++---------- src/numpy-stubs/_core/numeric.pyi | 814 +++++++++---------- 4 files changed, 1111 insertions(+), 1238 deletions(-) diff --git a/src/numpy-stubs/_core/_asarray.pyi b/src/numpy-stubs/_core/_asarray.pyi index e4caf6ef..5b531961 100644 --- a/src/numpy-stubs/_core/_asarray.pyi +++ b/src/numpy-stubs/_core/_asarray.pyi @@ -2,15 +2,15 @@ from collections.abc import Iterable from typing import Any, Final, Literal as L, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ToBool_nd, ToBytes_nd, ToComplex128_nd, ToFloat64_nd, ToInt_nd, ToObject_nd, ToStr_nd -from numpy._typing import DTypeLike, NDArray, _ArrayLike, _DTypeLike, _SupportsArrayFunc as _Like +from numpy._typing import _SupportsArrayFunc as _Like __all__ = ["require"] ### -_ArrayT = TypeVar("_ArrayT", bound=NDArray[Any]) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array[Any]) _ScalarT = TypeVar("_ScalarT", bound=np.generic[Any]) _Req: TypeAlias = L[ @@ -30,89 +30,45 @@ POSSIBLE_FLAGS: Final[dict[_ReqE, L["C", "F", "A", "W", "O", "E"]]] @overload def require( - a: _ArrayT, - dtype: None = None, - requirements: _ToReqs | None = None, - *, - like: _Like | None = None, + a: _ArrayT, dtype: None = None, requirements: _ToReqs | None = None, *, like: _Like | None = None ) -> _ArrayT: ... @overload def require( - a: ToBool_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.bool]: ... + a: _nt.ToBool_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.bool]: ... @overload def require( - a: ToInt_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.intp]: ... + a: _nt.ToInt_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.intp]: ... @overload def require( - a: ToFloat64_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.float64]: ... + a: _nt.ToFloat64_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.float64]: ... @overload def require( - a: ToComplex128_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.complex128]: ... + a: _nt.ToComplex128_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.complex128]: ... @overload def require( - a: ToBytes_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.bytes_]: ... + a: _nt.ToBytes_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.bytes_]: ... @overload def require( - a: ToStr_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.str_]: ... + a: _nt.ToStr_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.str_]: ... @overload def require( - a: ToObject_nd, - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[np.object_]: ... + a: _nt.ToObject_nd, dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[np.object_]: ... @overload def require( - a: _ArrayLike[_ScalarT], - dtype: None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[_ScalarT]: ... + a: _nt._ToArray_nd[_ScalarT], dtype: None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[_ScalarT]: ... @overload def require( - a: object, - dtype: _DTypeLike[_ScalarT], - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[_ScalarT]: ... + a: object, dtype: _nt._ToDType[_ScalarT], requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[_ScalarT]: ... @overload def require( - a: object, - dtype: DTypeLike | None = None, - requirements: _ToReqsE | None = None, - *, - like: _Like | None = None, -) -> NDArray[Any]: ... + a: object, dtype: _nt.ToDType | None = None, requirements: _ToReqsE | None = None, *, like: _Like | None = None +) -> _nt.Array[Any]: ... diff --git a/src/numpy-stubs/_core/_multiarray_umath.pyi b/src/numpy-stubs/_core/_multiarray_umath.pyi index e0f81fab..00b9e0ca 100644 --- a/src/numpy-stubs/_core/_multiarray_umath.pyi +++ b/src/numpy-stubs/_core/_multiarray_umath.pyi @@ -12,8 +12,8 @@ from typing import ( Generic, Literal as L, Protocol, - SupportsIndex, - SupportsInt, + SupportsIndex as CanIndex, + SupportsInt as CanInt, TypeAlias, TypedDict, final, @@ -22,40 +22,9 @@ from typing import ( ) from typing_extensions import Buffer, CapsuleType, Self, TypeAliasType, TypeVar, Unpack, deprecated +import _numtype as _nt import numpy as np import numpy.typing as npt -from _numtype import ( - Array, - Array0D, - Array1D, - Array2D, - Array3D, - AtLeast1D, - AtLeast2D, - JustComplex, - JustFloat, - JustInt, - ToBool_0d, - ToBool_1ds, - ToBool_2ds, - ToBool_3ds, - ToBool_nd, - ToComplex128_0d, - ToComplex128_1ds, - ToComplex128_2ds, - ToComplex128_3ds, - ToComplex128_nd, - ToFloat64_0d, - ToFloat64_1ds, - ToFloat64_2ds, - ToFloat64_3ds, - ToFloat64_nd, - ToInt_0d, - ToInt_1ds, - ToInt_2ds, - ToInt_3ds, - ToInt_nd, -) from numpy import _AnyShapeT, _CanSeekTellFileNo, _CastingKind, _ModeKind, _OrderCF, _OrderKACF # noqa: ICN003 from numpy._globals import _CopyMode from numpy._typing import ( @@ -72,10 +41,9 @@ from numpy._typing import ( _NestedSequence, _ScalarLike_co, _ShapeLike, - _SupportsArrayFunc, - _SupportsDType, + _SupportsArrayFunc as _CanArrayFunc, + _SupportsDType as _HasDType, ) -from numpy._typing._char_codes import _BoolCodes, _Complex128Codes, _Float64Codes, _IntPCodes # needed for stubtest from .umath import ( @@ -94,19 +62,16 @@ from .umath import ( _T_contra = TypeVar("_T_contra", default=None, contravariant=True) _ShapeT = TypeVar("_ShapeT", bound=tuple[int, ...]) +_DTypeT = TypeVar("_DTypeT", bound=np.dtype) _ScalarT = TypeVar("_ScalarT", bound=np.generic) -_NumericT = TypeVar("_NumericT", bound=np.bool | np.number | np.timedelta64 | np.object_) -_SafeScalarT = TypeVar( - "_SafeScalarT", bound=np.bool | np.number | np.flexible | np.timedelta64 | np.datetime64 -) # no `object_` - -_DTypeT = TypeVar("_DTypeT", bound=np.dtype) +_NumericT = TypeVar("_NumericT", bound=_nt.co_complex | np.timedelta64 | np.object_) +_SafeScalarT = TypeVar("_SafeScalarT", bound=_nt.co_complex | np.flexible | np.timedelta64 | np.datetime64) -_ArrayT = TypeVar("_ArrayT", bound=Array) -_Array1T = TypeVar("_Array1T", bound=Array[Any, AtLeast1D]) -_Array2T = TypeVar("_Array2T", bound=Array[Any, AtLeast2D]) -_ArrayT_co = TypeVar("_ArrayT_co", bound=Array, default=Array, covariant=True) +_ArrayT = TypeVar("_ArrayT", bound=_nt.Array) +_ArrayT_co = TypeVar("_ArrayT_co", bound=_nt.Array, default=_nt.Array, covariant=True) +_Array1T = TypeVar("_Array1T", bound=_nt.Array[Any, _nt.AtLeast1D]) +_Array2T = TypeVar("_Array2T", bound=_nt.Array[Any, _nt.AtLeast2D]) ### @@ -156,14 +121,9 @@ _IterFlagOp: TypeAlias = L[ "virtual", # undocumented ] # fmt: skip -_ShapeLike1D: TypeAlias = SupportsIndex | tuple[SupportsIndex] -_ShapeLike2D: TypeAlias = tuple[SupportsIndex, SupportsIndex] -_ShapeLike3D: TypeAlias = tuple[SupportsIndex, SupportsIndex, SupportsIndex] - -_DTypeLikeBool: TypeAlias = type[bool] | _DTypeLike[np.bool] | _BoolCodes -_DTypeLikeIntP: TypeAlias = type[JustInt] | _IntPCodes -_DTypeLikeFloat64: TypeAlias = type[JustFloat] | _DTypeLike[np.float64] | _Float64Codes | None -_DTypeLikeComplex128: TypeAlias = type[JustComplex] | _DTypeLike[np.complex128] | _Complex128Codes +_ShapeLike1D: TypeAlias = CanIndex | tuple[CanIndex] +_ShapeLike2D: TypeAlias = tuple[CanIndex, CanIndex] +_ShapeLike3D: TypeAlias = tuple[CanIndex, CanIndex, CanIndex] _FlatIterIndex0: TypeAlias = int | np.integer _FlatIterIndex: TypeAlias = _FlatIterIndex0 | tuple[_FlatIterIndex0] @@ -185,24 +145,22 @@ _Copy: TypeAlias = py_bool | L[2] | _CopyMode _WeekMask: TypeAlias = str | Sequence[L[0, 1] | py_bool | np.bool] _ToInt: TypeAlias = int | np.integer | np.bool -_ToDT64: TypeAlias = np.datetime64[Any] | _ToInt -_ToTD64: TypeAlias = np.timedelta64[Any] | _ToInt +_ToDT64: TypeAlias = np.datetime64 | _ToInt +_ToTD64: TypeAlias = np.timedelta64 | _ToInt _ToFloat: TypeAlias = float | np.floating | np.integer | np.bool _ToComplex: TypeAlias = complex | np.number | np.bool _ToDate: TypeAlias = _ToDT64 | dt.date | str # accepts strings like "1993-06-29" -_ToDelta: TypeAlias = ( - np.timedelta64[Any] | SupportsIndex | SupportsInt | dt.timedelta | str -) # accepts same strings as `builtins.int` +_ToDelta: TypeAlias = np.timedelta64 | CanIndex | CanInt | dt.timedelta | str # accepts same strings as `builtins.int` _ToDateArray = TypeAliasType( "_ToDateArray", - _ArrayLike[np.datetime64[Any] | np.floating | np.integer | np.character] + _ArrayLike[np.datetime64 | np.floating | np.integer | np.character] | _NestedSequence[_ToDT64 | dt.date] | _NestedSequence[str], ) _ToDeltaArray = TypeAliasType( "_ToDeltaArray", - _ArrayLike[np.timedelta64[Any] | np.integer] | _NestedSequence[_ToDelta], + _ArrayLike[np.timedelta64 | np.integer] | _NestedSequence[_ToDelta], ) _ToFile: TypeAlias = StrOrBytesPath | _CanSeekTellFileNo @@ -233,23 +191,23 @@ class _KwargsD(TypedDict, total=False): @type_check_only class _KwargsL(TypedDict, total=False): - like: _SupportsArrayFunc | None + like: _CanArrayFunc | None @type_check_only class _KwargsCL(TypedDict, total=False): copy: _Copy | None - like: _SupportsArrayFunc | None + like: _CanArrayFunc | None @type_check_only class _KwargsDL(TypedDict, total=False): device: _Device | None - like: _SupportsArrayFunc | None + like: _CanArrayFunc | None @type_check_only class _KwargsDCL(TypedDict, total=False): device: _Device | None copy: _Copy | None - like: _SupportsArrayFunc | None + like: _CanArrayFunc | None @type_check_only class _ExtObjDict(TypedDict): @@ -401,24 +359,24 @@ class flatiter(Generic[_ArrayT_co]): # def __len__(self) -> int: ... def __iter__(self) -> Self: ... - def __next__(self: flatiter[Array[_ScalarT]]) -> _ScalarT: ... + def __next__(self: flatiter[_nt.Array[_ScalarT]]) -> _ScalarT: ... # @overload - def __getitem__(self: flatiter[Array[_SafeScalarT]], i: _FlatIterIndex, /) -> _SafeScalarT: ... + def __getitem__(self: flatiter[_nt.Array[_SafeScalarT]], i: _FlatIterIndex, /) -> _SafeScalarT: ... @overload - def __getitem__(self: flatiter[Array[np.object_]], i: _FlatIterIndex, /) -> Any: ... + def __getitem__(self: flatiter[_nt.Array[np.object_]], i: _FlatIterIndex, /) -> Any: ... @overload def __getitem__(self, i: _FlatIterSlice, /) -> _ArrayT_co: ... def __setitem__(self, i: _FlatIterIndex | _FlatIterSlice, value: object, /) -> None: ... # @overload - def __array__(self: flatiter[Array[_ScalarT]], dtype: None = None, /) -> Array1D[_ScalarT]: ... + def __array__(self: flatiter[_nt.Array[_ScalarT]], dtype: None = None, /) -> _nt.Array1D[_ScalarT]: ... @overload - def __array__(self, dtype: _DTypeLike[_ScalarT], /) -> Array1D[_ScalarT]: ... + def __array__(self, dtype: _DTypeLike[_ScalarT], /) -> _nt.Array1D[_ScalarT]: ... @overload - def __array__(self, dtype: npt.DTypeLike | None = None, /) -> Array1D: ... + def __array__(self, dtype: npt.DTypeLike | None = None, /) -> _nt.Array1D: ... @final class nditer: @@ -455,11 +413,11 @@ class nditer: @property def iterrange(self) -> tuple[int, ...]: ... @property - def itviews(self) -> tuple[Array, ...]: ... + def itviews(self) -> tuple[_nt.Array, ...]: ... @property - def operands(self) -> tuple[Array, ...]: ... + def operands(self) -> tuple[_nt.Array, ...]: ... @property - def value(self) -> tuple[Array, ...]: ... + def value(self) -> tuple[_nt.Array, ...]: ... # def __init__( @@ -471,15 +429,15 @@ class nditer: op_dtypes: Sequence[npt.DTypeLike] | npt.DTypeLike = None, order: _OrderKACF = "K", casting: _CastingKind = "safe", - op_axes: Sequence[Sequence[SupportsIndex]] | None = None, + op_axes: Sequence[Sequence[CanIndex]] | None = None, itershape: _ShapeLike | None = None, - buffersize: SupportsIndex = 0, + buffersize: CanIndex = 0, ) -> None: ... # def __enter__(self) -> Self: ... def __exit__( - self, cls: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, / + self, tp: type[BaseException] | None, e: BaseException | None, tb: TracebackType | None, / ) -> None: ... def close(self) -> None: ... def reset(self) -> None: ... @@ -487,15 +445,15 @@ class nditer: # def __len__(self) -> int: ... def __iter__(self) -> Self: ... - def __next__(self) -> tuple[Array, ...]: ... + def __next__(self) -> tuple[_nt.Array, ...]: ... def iternext(self) -> py_bool: ... # @overload - def __getitem__(self, index: SupportsIndex, /) -> Array: ... + def __getitem__(self, index: CanIndex, /) -> _nt.Array[Incomplete]: ... @overload - def __getitem__(self, index: slice, /) -> tuple[Array, ...]: ... - def __setitem__(self, index: slice | SupportsIndex, value: npt.ArrayLike, /) -> None: ... + def __getitem__(self, index: slice, /) -> tuple[_nt.Array, ...]: ... + def __setitem__(self, index: slice | CanIndex, value: npt.ArrayLike, /) -> None: ... # def __copy__(self) -> Self: ... @@ -506,18 +464,18 @@ class nditer: def enable_external_loop(self) -> None: ... # - def remove_axis(self, i: SupportsIndex, /) -> None: ... + def remove_axis(self, i: CanIndex, /) -> None: ... def remove_multi_index(self) -> None: ... def nested_iters( op: Sequence[npt.ArrayLike] | npt.ArrayLike, - axes: Sequence[Sequence[SupportsIndex]], + axes: Sequence[Sequence[CanIndex]], flags: Sequence[_IterFlag] | None = None, op_flags: Sequence[Sequence[_IterFlagOp]] | None = None, op_dtypes: Sequence[npt.DTypeLike] | npt.DTypeLike = None, order: _OrderKACF = "K", casting: _CastingKind = "safe", - buffersize: SupportsIndex = 0, + buffersize: CanIndex = 0, ) -> tuple[nditer, ...]: ... ### @@ -527,8 +485,8 @@ def set_datetimeparse_function(*args: Incomplete, **kwargs: Incomplete) -> None: def set_typeDict(dict: Mapping[str, np.dtype]) -> None: ... # -def get_handler_name(a: Array = ..., /) -> str | None: ... -def get_handler_version(a: Array = ..., /) -> int | None: ... +def get_handler_name(a: _nt.Array = ..., /) -> str | None: ... +def get_handler_version(a: _nt.Array = ..., /) -> int | None: ... ### @@ -536,14 +494,14 @@ def get_handler_version(a: Array = ..., /) -> int | None: ... @overload # 1d shape, default dtype (float64) def empty( shape: _ShapeLike1D, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, known dtype def empty( shape: _ShapeLike1D, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[tuple[int], _DTypeT]: ... @@ -553,25 +511,25 @@ def empty( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, unknown dtype def empty( shape: _ShapeLike1D, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D: ... +) -> _nt.Array1D: ... @overload # known shape, default dtype (float64) def empty( shape: _AnyShapeT, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[np.float64, _AnyShapeT]: ... +) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, known dtype (mypy reports a false positive) def empty( # type: ignore[overload-overlap] shape: _AnyShapeT, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[_AnyShapeT, _DTypeT]: ... @@ -581,25 +539,25 @@ def empty( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, unknown scalar-type def empty( shape: _AnyShapeT, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, default dtype def empty( shape: _ShapeLike, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def empty( shape: _ShapeLike, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[tuple[int, ...], _DTypeT]: ... @@ -609,27 +567,27 @@ def empty( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def empty( shape: _ShapeLike, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # NOTE: Keep in sync with `empty` (below) and `numpy._core.numeric.ones` @overload # 1d shape, default dtype (float64) def zeros( shape: _ShapeLike1D, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, known dtype def zeros( shape: _ShapeLike1D, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[tuple[int], _DTypeT]: ... @@ -639,25 +597,25 @@ def zeros( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, unknown dtype def zeros( shape: _ShapeLike1D, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array1D: ... +) -> _nt.Array1D: ... @overload # known shape, default dtype (float64) def zeros( shape: _AnyShapeT, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[np.float64, _AnyShapeT]: ... +) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, known dtype (mypy reports a false positive) def zeros( # type: ignore[overload-overlap] shape: _AnyShapeT, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[_AnyShapeT, _DTypeT]: ... @@ -667,25 +625,25 @@ def zeros( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, unknown scalar-type def zeros( shape: _AnyShapeT, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, default dtype def zeros( shape: _ShapeLike, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def zeros( shape: _ShapeLike, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], ) -> np.ndarray[tuple[int, ...], _DTypeT]: ... @@ -695,14 +653,14 @@ def zeros( dtype: _DTypeLike[_ScalarT], order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def zeros( shape: _ShapeLike, dtype: npt.DTypeLike = ..., order: _OrderCF = "C", **kwargs: Unpack[_KwargsDL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # NOTE: Keep in sync with `.numeric.{zeros,ones}_like` (all 30 overloads...) @overload # known array, subok=True @@ -718,7 +676,7 @@ def empty_like( @overload # array-like with known shape and type def empty_like( prototype: _CanArray[np.ndarray[_ShapeT, _DTypeT]], - dtype: _DTypeT | _SupportsDType[_DTypeT] | None = None, + dtype: _DTypeT | _HasDType[_DTypeT] | None = None, order: _OrderKACF = "K", subok: bool = True, shape: None = None, @@ -727,164 +685,164 @@ def empty_like( ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload # bool 0d array-like def empty_like( - prototype: ToBool_0d, - dtype: _DTypeLikeBool | None = None, + prototype: _nt.ToBool_0d, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.bool_]: ... +) -> _nt.Array0D[np.bool_]: ... @overload # bool 1d array-like def empty_like( - prototype: ToBool_1ds, - dtype: _DTypeLikeBool | None = None, + prototype: _nt.ToBool_1ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.bool_]: ... +) -> _nt.Array1D[np.bool_]: ... @overload # bool 2d array-like def empty_like( - prototype: ToBool_2ds, - dtype: _DTypeLikeBool | None = None, + prototype: _nt.ToBool_2ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.bool_]: ... +) -> _nt.Array2D[np.bool_]: ... @overload # bool 3d array-like def empty_like( - prototype: ToBool_3ds, - dtype: _DTypeLikeBool | None = None, + prototype: _nt.ToBool_3ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.bool_]: ... +) -> _nt.Array3D[np.bool_]: ... @overload # int 0d array-like def empty_like( - prototype: ToInt_0d, - dtype: _DTypeLikeIntP | None = None, + prototype: _nt.ToInt_0d, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.intp]: ... +) -> _nt.Array0D[np.intp]: ... @overload # int 1d array-like def empty_like( - prototype: ToInt_1ds, - dtype: _DTypeLikeIntP | None = None, + prototype: _nt.ToInt_1ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # int 2d array-like def empty_like( - prototype: ToInt_2ds, - dtype: _DTypeLikeIntP | None = None, + prototype: _nt.ToInt_2ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.intp]: ... +) -> _nt.Array2D[np.intp]: ... @overload # int 3d array-like def empty_like( - prototype: ToInt_3ds, - dtype: _DTypeLikeIntP | None = None, + prototype: _nt.ToInt_3ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.intp]: ... +) -> _nt.Array3D[np.intp]: ... @overload # float 0d array-like def empty_like( - prototype: ToFloat64_0d, - dtype: _DTypeLikeFloat64 = None, + prototype: _nt.ToFloat64_0d, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.float64]: ... +) -> _nt.Array0D[np.float64]: ... @overload # float 1d array-like def empty_like( - prototype: ToFloat64_1ds, - dtype: _DTypeLikeFloat64 = None, + prototype: _nt.ToFloat64_1ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # float 2d array-like def empty_like( - prototype: ToFloat64_2ds, - dtype: _DTypeLikeFloat64 = None, + prototype: _nt.ToFloat64_2ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.float64]: ... +) -> _nt.Array2D[np.float64]: ... @overload # float 3d array-like def empty_like( - prototype: ToFloat64_3ds, - dtype: _DTypeLikeFloat64 = None, + prototype: _nt.ToFloat64_3ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.float64]: ... +) -> _nt.Array3D[np.float64]: ... @overload # complex 0d array-like def empty_like( - prototype: ToComplex128_0d, - dtype: _DTypeLikeComplex128 | None = None, + prototype: _nt.ToComplex128_0d, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.complex128]: ... +) -> _nt.Array0D[np.complex128]: ... @overload # complex 1d array-like def empty_like( - prototype: ToComplex128_1ds, - dtype: _DTypeLikeComplex128 | None = None, + prototype: _nt.ToComplex128_1ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload # complex 2d array-like def empty_like( - prototype: ToComplex128_2ds, - dtype: _DTypeLikeComplex128 | None = None, + prototype: _nt.ToComplex128_2ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.complex128]: ... +) -> _nt.Array2D[np.complex128]: ... @overload # complex 3d array-like def empty_like( - prototype: ToComplex128_3ds, - dtype: _DTypeLikeComplex128 | None = None, + prototype: _nt.ToComplex128_3ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.complex128]: ... +) -> _nt.Array3D[np.complex128]: ... @overload # array-like with known scalar-type, given shape def empty_like( # type: ignore[overload-overlap] prototype: _ArrayLike[_ScalarT], @@ -894,7 +852,7 @@ def empty_like( # type: ignore[overload-overlap] *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # array-like with known scalar-type, unknown shape def empty_like( # type: ignore[overload-overlap] prototype: _ArrayLike[_ScalarT], @@ -904,11 +862,11 @@ def empty_like( # type: ignore[overload-overlap] shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # given shape, given dtype def empty_like( # type: ignore[overload-overlap] prototype: object, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, *, @@ -918,7 +876,7 @@ def empty_like( # type: ignore[overload-overlap] @overload # unknown shape, given dtype def empty_like( # type: ignore[overload-overlap] prototype: object, - dtype: _DTypeT | _SupportsDType[_DTypeT], + dtype: _DTypeT | _HasDType[_DTypeT], order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike | None = None, @@ -934,7 +892,7 @@ def empty_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # unknown shape, given scalar-type def empty_like( prototype: object, @@ -944,47 +902,47 @@ def empty_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # bool array-like def empty_like( # type: ignore[overload-overlap] - prototype: ToBool_nd, - dtype: _DTypeLikeBool | None = None, + prototype: _nt.ToBool_nd, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.bool_]: ... +) -> _nt.Array[np.bool_]: ... @overload # int array-like def empty_like( # type: ignore[overload-overlap] - prototype: ToInt_nd, - dtype: _DTypeLikeIntP | None = None, + prototype: _nt.ToInt_nd, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... @overload # float array-like def empty_like( # type: ignore[overload-overlap] - prototype: ToFloat64_nd, - dtype: _DTypeLikeFloat64 = None, + prototype: _nt.ToFloat64_nd, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # complex array-like def empty_like( # type: ignore[overload-overlap] - prototype: ToComplex128_nd, - dtype: _DTypeLikeComplex128 | None = None, + prototype: _nt.ToComplex128_nd, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload # given shape, unknown scalar-type def empty_like( prototype: object, @@ -994,7 +952,7 @@ def empty_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, unknown scalar-type def empty_like( prototype: object, @@ -1004,7 +962,7 @@ def empty_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload @@ -1056,7 +1014,7 @@ def array( subok: bool = False, ndmin: int = 0, **kwargs: Unpack[_KwargsCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def array( object: _ScalarLike_co, @@ -1066,7 +1024,7 @@ def array( subok: bool = False, ndmin: L[0] = 0, **kwargs: Unpack[_KwargsCL], -) -> Array[_ScalarT, tuple[()]]: ... +) -> _nt.Array[_ScalarT, tuple[()]]: ... @overload def array( object: _ScalarLike_co, @@ -1076,7 +1034,7 @@ def array( subok: bool = False, ndmin: L[0] = 0, **kwargs: Unpack[_KwargsCL], -) -> Array[Any, tuple[()]]: ... +) -> _nt.Array[Any, tuple[()]]: ... @overload def array( object: object, @@ -1086,7 +1044,7 @@ def array( subok: bool = False, ndmin: int = 0, **kwargs: Unpack[_KwargsCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def array( object: object, @@ -1096,7 +1054,7 @@ def array( subok: bool = False, ndmin: int = 0, **kwargs: Unpack[_KwargsCL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload @@ -1112,35 +1070,35 @@ def asarray( dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def asarray( a: _ScalarLike_co, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[_ScalarT, tuple[()]]: ... +) -> _nt.Array[_ScalarT, tuple[()]]: ... @overload def asarray( a: _ScalarLike_co, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[Any, tuple[()]]: ... +) -> _nt.Array[Any, tuple[()]]: ... @overload def asarray( a: object, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def asarray( a: object, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload @@ -1163,171 +1121,179 @@ def asanyarray( dtype: None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def asanyarray( a: object, dtype: _DTypeLike[_ScalarT], order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def asanyarray( a: object, dtype: npt.DTypeLike | None = None, order: _OrderKACF = None, **kwargs: Unpack[_KwargsDCL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # keep in sync with asfortranarray @overload def ascontiguousarray( - a: _CanArray[Array[_ScalarT, _ShapeT]], + a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT, _ShapeT]: ... +) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def ascontiguousarray(a: _ArrayLike[_ScalarT], dtype: None = None, **kwargs: Unpack[_KwargsL]) -> Array[_ScalarT]: ... +def ascontiguousarray( + a: _ArrayLike[_ScalarT], + dtype: None = None, + **kwargs: Unpack[_KwargsL], +) -> _nt.Array[_ScalarT]: ... @overload -def ascontiguousarray(a: object, dtype: None = None, *, like: Array[_ScalarT]) -> Array[_ScalarT]: ... +def ascontiguousarray(a: object, dtype: None = None, *, like: _nt.Array[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def ascontiguousarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> Array[_ScalarT]: ... +def ascontiguousarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... @overload -def ascontiguousarray(a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL]) -> Array: ... +def ascontiguousarray( + a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL] +) -> _nt.Array[Incomplete]: ... # keep in sync with ascontiguousarray @overload def asfortranarray( - a: _CanArray[Array[_ScalarT, _ShapeT]], + a: _CanArray[_nt.Array[_ScalarT, _ShapeT]], dtype: None = None, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT, _ShapeT]: ... +) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def asfortranarray(a: _ArrayLike[_ScalarT], dtype: None = None, **kwargs: Unpack[_KwargsL]) -> Array[_ScalarT]: ... +def asfortranarray(a: _ArrayLike[_ScalarT], dtype: None = None, **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... @overload -def asfortranarray(a: object, dtype: None = None, *, like: Array[_ScalarT]) -> Array[_ScalarT]: ... +def asfortranarray(a: object, dtype: None = None, *, like: _nt.Array[_ScalarT]) -> _nt.Array[_ScalarT]: ... @overload -def asfortranarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> Array[_ScalarT]: ... +def asfortranarray(a: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsL]) -> _nt.Array[_ScalarT]: ... @overload -def asfortranarray(a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL]) -> Array: ... +def asfortranarray( + a: object, dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsL] +) -> _nt.Array[Incomplete]: ... # `sep` is a de facto mandatory argument, as its default value is deprecated @overload def fromstring( string: bytes | str, - dtype: type[JustFloat] | None = ..., - count: SupportsIndex = -1, + dtype: type[_nt.JustFloat] | None = ..., + count: CanIndex = -1, *, sep: str, **kwargs: Unpack[_KwargsL], -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload def fromstring( string: bytes | str, dtype: _DTypeLike[_ScalarT], - count: SupportsIndex = -1, + count: CanIndex = -1, *, sep: str, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def fromstring( string: bytes | str, dtype: npt.DTypeLike = ..., - count: SupportsIndex = -1, + count: CanIndex = -1, *, sep: str, - like: Array[_ScalarT], -) -> Array[_ScalarT]: ... + like: _nt.Array[_ScalarT], +) -> _nt.Array[_ScalarT]: ... @overload def fromstring( string: bytes | str, dtype: npt.DTypeLike, - count: SupportsIndex = -1, + count: CanIndex = -1, *, sep: str, **kwargs: Unpack[_KwargsL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload def fromfile( file: _ToFile, *, - count: SupportsIndex = -1, + count: CanIndex = -1, sep: str = "", - offset: SupportsIndex = 0, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload def fromfile( file: _ToFile, dtype: _DTypeLike[_ScalarT], - count: SupportsIndex = -1, + count: CanIndex = -1, sep: str = "", - offset: SupportsIndex = 0, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def fromfile( file: _ToFile, dtype: npt.DTypeLike, - count: SupportsIndex = -1, + count: CanIndex = -1, sep: str = "", - offset: SupportsIndex = 0, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload def fromiter( iter: Iterable[object], dtype: _DTypeLike[_ScalarT], - count: SupportsIndex = -1, + count: CanIndex = -1, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def fromiter( iter: Iterable[object], dtype: npt.DTypeLike, - count: SupportsIndex = -1, + count: CanIndex = -1, **kwargs: Unpack[_KwargsL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload def frombuffer( buffer: Buffer, *, - count: SupportsIndex = -1, - offset: SupportsIndex = 0, + count: CanIndex = -1, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload def frombuffer( buffer: Buffer, dtype: _DTypeLike[_ScalarT], - count: SupportsIndex = -1, - offset: SupportsIndex = 0, + count: CanIndex = -1, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def frombuffer( buffer: Buffer, dtype: npt.DTypeLike, - count: SupportsIndex = -1, - offset: SupportsIndex = 0, + count: CanIndex = -1, + offset: CanIndex = 0, **kwargs: Unpack[_KwargsL], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # -def from_dlpack(x: _CanDLPack, /, *, copy: py_bool | None = None, **kwargs: Unpack[_KwargsD]) -> Array: ... +def from_dlpack(x: _CanDLPack, /, *, copy: py_bool | None = None, **kwargs: Unpack[_KwargsD]) -> _nt.Array: ... ### # @overload # (stop, dtype=_) -def arange(stop: object, *, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL]) -> Array1D[_ScalarT]: ... +def arange(stop: object, *, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL]) -> _nt.Array1D[_ScalarT]: ... @overload # (start, stop step, dtype) def arange( start: object, @@ -1335,7 +1301,7 @@ def arange( step: object, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL], -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # (start, stop, step?, dtype=) def arange( start: object, @@ -1344,14 +1310,14 @@ def arange( *, dtype: _DTypeLike[_ScalarT], **kwargs: Unpack[_KwargsDL], -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # (stop: int) def arange( stop: int | np.int_, *, dtype: _DTypeLike[np.int_] | type[int] | None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.int_]: ... +) -> _nt.Array1D[np.int_]: ... @overload # (start: int, stop: int, step?: int) def arange( start: int | np.int_, @@ -1359,14 +1325,14 @@ def arange( step: int | np.int_ = ..., dtype: _DTypeLike[np.int_] | type[int] | None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.int_]: ... +) -> _nt.Array1D[np.int_]: ... @overload # (stop: float) def arange( stop: float | np.float64, *, dtype: _DTypeLike[np.float64] | type[float] | None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.float64 | np.int_]: ... +) -> _nt.Array1D[np.float64 | np.int_]: ... @overload # (start: float, stop: float, step?: float) def arange( start: float | np.float64, @@ -1374,14 +1340,14 @@ def arange( step: float | np.float64 = ..., dtype: _DTypeLike[np.float64] | type[float] | None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.float64 | np.int_]: ... +) -> _nt.Array1D[np.float64 | np.int_]: ... @overload # int-like def arange( stop: _ToInt, *, dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.signedinteger]: ... +) -> _nt.Array1D[np.signedinteger]: ... @overload # int-like def arange( start: _ToInt, @@ -1389,14 +1355,14 @@ def arange( step: _ToInt = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.signedinteger]: ... +) -> _nt.Array1D[np.signedinteger]: ... @overload # float-like def arange( stop: _ToFloat, *, dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.floating | np.signedinteger]: ... +) -> _nt.Array1D[np.floating | np.signedinteger]: ... @overload # float-like def arange( start: _ToFloat, @@ -1404,14 +1370,14 @@ def arange( step: _ToFloat = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.floating | np.signedinteger]: ... +) -> _nt.Array1D[np.floating | np.signedinteger]: ... @overload # timedelta64 def arange( stop: np.timedelta64, *, dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.timedelta64]: ... +) -> _nt.Array1D[np.timedelta64]: ... @overload # timedelta64 def arange( start: _ToTD64, @@ -1419,7 +1385,7 @@ def arange( step: _ToTD64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.timedelta64]: ... +) -> _nt.Array1D[np.timedelta64]: ... @overload # timedelta64 def arange( start: np.timedelta64, @@ -1427,7 +1393,7 @@ def arange( step: _ToTD64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.timedelta64]: ... +) -> _nt.Array1D[np.timedelta64]: ... @overload # datetime64 (requires both start and stop) def arange( start: np.datetime64, @@ -1435,14 +1401,14 @@ def arange( step: _ToDT64 = ..., dtype: None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[np.datetime64]: ... +) -> _nt.Array1D[np.datetime64]: ... @overload # fallback def arange( stop: object, *, dtype: npt.DTypeLike, **kwargs: Unpack[_KwargsDL], -) -> Array1D[Any]: ... +) -> _nt.Array1D[Incomplete]: ... @overload # fallback def arange( start: object, @@ -1450,7 +1416,7 @@ def arange( step: object = ..., dtype: npt.DTypeLike | None = None, **kwargs: Unpack[_KwargsDL], -) -> Array1D[Any]: ... +) -> _nt.Array1D[Incomplete]: ... ### @@ -1459,27 +1425,27 @@ def arange( def concatenate( arrays: _ArrayLike[_ScalarT], /, - axis: SupportsIndex | None = 0, + axis: CanIndex | None = 0, out: None = None, *, dtype: None = None, casting: _CastingKind = "same_kind", -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def concatenate( arrays: SupportsLenAndGetItem[_ArrayLike[_ScalarT]], /, - axis: SupportsIndex | None = 0, + axis: CanIndex | None = 0, out: None = None, *, dtype: None = None, casting: _CastingKind = "same_kind", -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def concatenate( arrays: SupportsLenAndGetItem[npt.ArrayLike], /, - axis: SupportsIndex | None, + axis: CanIndex | None, out: _ArrayT, *, dtype: None = None, @@ -1489,7 +1455,7 @@ def concatenate( def concatenate( arrays: SupportsLenAndGetItem[npt.ArrayLike], /, - axis: SupportsIndex | None = 0, + axis: CanIndex | None = 0, *, out: _ArrayT, dtype: None = None, @@ -1499,43 +1465,43 @@ def concatenate( def concatenate( arrays: SupportsLenAndGetItem[npt.ArrayLike], /, - axis: SupportsIndex | None = 0, + axis: CanIndex | None = 0, out: None = None, *, dtype: _DTypeLike[_ScalarT], casting: _CastingKind = "same_kind", -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def concatenate( arrays: SupportsLenAndGetItem[npt.ArrayLike], /, - axis: SupportsIndex | None = 0, + axis: CanIndex | None = 0, out: None = None, *, dtype: npt.DTypeLike | None = None, casting: _CastingKind = "same_kind", -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # def unpackbits( - a: Array[np.uint8], + a: _nt.Array[np.uint8], /, - axis: SupportsIndex | None = None, - count: SupportsIndex | None = None, + axis: CanIndex | None = None, + count: CanIndex | None = None, bitorder: L["big", "little"] = "big", -) -> Array[np.uint8]: ... +) -> _nt.Array[np.uint8]: ... # def packbits( a: _ArrayLikeInt_co, /, - axis: SupportsIndex | None = None, + axis: CanIndex | None = None, bitorder: L["big", "little"] = "big", -) -> Array[np.uint8]: ... +) -> _nt.Array[np.uint8]: ... # def copyto( - dst: Array, + dst: _nt.Array, src: npt.ArrayLike, casting: _CastingKind = "same_kind", where: _ArrayLikeBool_co | None = True, @@ -1543,14 +1509,14 @@ def copyto( # @overload -def where(condition: npt.ArrayLike, /) -> tuple[Array[np.int_], ...]: ... +def where(condition: npt.ArrayLike, /) -> tuple[_nt.Array[np.int_], ...]: ... @overload -def where(condition: npt.ArrayLike, x: _ArrayLike[_ScalarT], y: _ArrayLike[_ScalarT], /) -> Array[_ScalarT]: ... +def where(condition: npt.ArrayLike, x: _ArrayLike[_ScalarT], y: _ArrayLike[_ScalarT], /) -> _nt.Array[_ScalarT]: ... @overload -def where(condition: npt.ArrayLike, x: npt.ArrayLike, y: npt.ArrayLike, /) -> Array: ... +def where(condition: npt.ArrayLike, x: npt.ArrayLike, y: npt.ArrayLike, /) -> _nt.Array[Incomplete]: ... # -def putmask(a: Array, /, mask: _ArrayLikeBool_co, values: npt.ArrayLike) -> None: ... +def putmask(a: _nt.Array, /, mask: _ArrayLikeBool_co, values: npt.ArrayLike) -> None: ... # @overload @@ -1560,7 +1526,7 @@ def unravel_index( indices: _ArrayLike[np.integer] | _NestedSequence[_ToInt] | _NestedSequence[_ArrayLike[np.integer]], shape: _ShapeLike, order: _OrderCF = "C", -) -> tuple[Array[np.intp], ...]: ... +) -> tuple[_nt.Array[np.intp], ...]: ... # @overload @@ -1576,7 +1542,7 @@ def ravel_multi_index( dims: _ShapeLike, mode: _ModeKind | tuple[_ModeKind, ...] = "raise", order: _OrderCF = "C", -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... ### @@ -1592,7 +1558,7 @@ def promote_types(type1: npt.DTypeLike, type2: npt.DTypeLike, /) -> np.dtype: .. # @overload -def dot(a: npt.ArrayLike, b: npt.ArrayLike, out: None = None) -> Any: ... +def dot(a: npt.ArrayLike, b: npt.ArrayLike, out: None = None) -> Incomplete: ... @overload def dot(a: npt.ArrayLike, b: npt.ArrayLike, out: _ArrayT) -> _ArrayT: ... @@ -1610,7 +1576,7 @@ def vdot(a: _ArrayLikeNumber_co, b: _ArrayLikeNumber_co, /) -> np.inexact | np.s @overload def inner(a: _ScalarT, b: _ScalarT, /) -> _ScalarT: ... @overload -def inner(a: Array1D[_ScalarT], b: Array1D[_ScalarT], /) -> _ScalarT: ... +def inner(a: _nt.Array1D[_ScalarT], b: _nt.Array1D[_ScalarT], /) -> _ScalarT: ... @overload def inner(a: npt.ArrayLike, b: npt.ArrayLike, /) -> Incomplete: ... @@ -1625,12 +1591,12 @@ def interp( ) -> np.float64: ... @overload def interp( - x: Array[np.floating | np.integer, _ShapeT], + x: _nt.Array[np.floating | np.integer, _ShapeT], xp: _ArrayLikeFloat_co, fp: _ArrayLikeFloat_co, left: _ToFloat | None = None, right: _ToFloat | None = None, -) -> Array[np.float64, _ShapeT]: ... +) -> _nt.Array[np.float64, _ShapeT]: ... @overload def interp( x: _NestedSequence[_ToFloat], @@ -1638,7 +1604,7 @@ def interp( fp: _ArrayLikeFloat_co, left: _ToFloat | None = None, right: _ToFloat | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload def interp( x: _ArrayLikeFloat_co, @@ -1646,7 +1612,7 @@ def interp( fp: _ArrayLikeFloat_co, left: _ToFloat | None = None, right: _ToFloat | None = None, -) -> np.float64 | Array[np.float64]: ... +) -> np.float64 | _nt.Array[np.float64]: ... # @overload @@ -1659,12 +1625,12 @@ def interp_complex( ) -> np.complex128: ... @overload def interp_complex( - x: Array[np.floating | np.integer, _ShapeT], + x: _nt.Array[np.floating | np.integer, _ShapeT], xp: _ArrayLikeFloat_co, fp: _ArrayLikeNumber_co, left: _ToComplex | None = None, right: _ToComplex | None = None, -) -> Array[np.complex128, _ShapeT]: ... +) -> _nt.Array[np.complex128, _ShapeT]: ... @overload def interp_complex( x: _NestedSequence[_ToFloat], @@ -1672,7 +1638,7 @@ def interp_complex( fp: _ArrayLikeNumber_co, left: _ToComplex | None = None, right: _ToComplex | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload def interp_complex( x: _ArrayLikeFloat_co, @@ -1680,7 +1646,7 @@ def interp_complex( fp: _ArrayLikeNumber_co, left: _ToComplex | None = None, right: _ToComplex | None = None, -) -> np.complex128 | Array[np.complex128]: ... +) -> np.complex128 | _nt.Array[np.complex128]: ... # def count_nonzero(a: object, /) -> int: ... @@ -1688,19 +1654,16 @@ def bincount( x: _ArrayLikeInt_co, /, weights: _ArrayLikeFloat_co | None = None, - minlength: SupportsIndex = 0, -) -> Array[np.intp]: ... + minlength: CanIndex = 0, +) -> _nt.Array[np.intp]: ... # -@overload # 2d -> 1d -def lexsort( - keys: Array[Any, tuple[int, int]] | Sequence[Sequence[np.generic | complex | float | int]], - axis: SupportsIndex = -1, -) -> Array1D[np.intp]: ... @overload # 1d -> 0d -def lexsort(keys: Array1D | Sequence[np.generic | complex | float | int], axis: SupportsIndex = -1) -> np.intp: ... -@overload # TODO(jorenham) -def lexsort(keys: npt.ArrayLike, axis: SupportsIndex = -1) -> Incomplete: ... +def lexsort(keys: _nt.ToGeneric_1ds, axis: CanIndex = -1) -> np.intp: ... +@overload # 2d -> 1d +def lexsort(keys: _nt.ToGeneric_2ds, axis: CanIndex = -1) -> _nt.Array1D[np.intp]: ... +@overload +def lexsort(keys: npt.ArrayLike, axis: CanIndex = -1) -> Incomplete: ... ### @@ -1708,9 +1671,9 @@ def lexsort(keys: npt.ArrayLike, axis: SupportsIndex = -1) -> Incomplete: ... @final class busdaycalendar: @property - def weekmask(self) -> Array1D[np.bool]: ... + def weekmask(self) -> _nt.Array1D[np.bool]: ... @property - def holidays(self) -> Array1D[np.datetime64[dt.datetime]]: ... + def holidays(self) -> _nt.Array1D[np.datetime64[dt.datetime]]: ... def __init__(self, /, weekmask: _WeekMask = "1111100", holidays: _ToDateArray | None = None) -> None: ... # @@ -1729,7 +1692,7 @@ def is_busday( holidays: _ToDateArray | None = None, busdaycal: busdaycalendar | None = None, out: None = None, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... @overload def is_busday( dates: _ToDateArray, @@ -1766,7 +1729,7 @@ def busday_count( holidays: _ToDateArray | None = None, busdaycal: busdaycalendar | None = None, out: None = None, -) -> Array[np.int_]: ... +) -> _nt.Array[np.int_]: ... @overload def busday_count( begindates: _ToDateArray, @@ -1775,7 +1738,7 @@ def busday_count( holidays: _ToDateArray | None = None, busdaycal: busdaycalendar | None = None, out: None = None, -) -> Array[np.int_]: ... +) -> _nt.Array[np.int_]: ... @overload def busday_count( begindates: _ToDate | _ToDateArray, @@ -1816,7 +1779,7 @@ def busday_offset( holidays: _ToDateArray | None = None, busdaycal: busdaycalendar | None = None, out: None = None, -) -> Array[np.datetime64[dt.datetime]]: ... +) -> _nt.Array[np.datetime64[dt.datetime]]: ... @overload def busday_offset( dates: _ToDateArray, @@ -1826,7 +1789,7 @@ def busday_offset( holidays: _ToDateArray | None = None, busdaycal: busdaycalendar | None = None, out: None = None, -) -> Array[np.datetime64[dt.datetime]]: ... +) -> _nt.Array[np.datetime64[dt.datetime]]: ... @overload def busday_offset( dates: _ToDate | _ToDateArray, @@ -1863,7 +1826,7 @@ def datetime_as_string( unit: L["auto"] | _TimeUnit | None = None, timezone: _TimeZone = "naive", casting: _CastingKind = "same_kind", -) -> Array[np.str_]: ... +) -> _nt.Array[np.str_]: ... # def datetime_data(dtype: str | _DTypeLike[np.datetime64 | np.timedelta64], /) -> tuple[str, int]: ... @@ -1872,15 +1835,15 @@ def datetime_data(dtype: str | _DTypeLike[np.datetime64 | np.timedelta64], /) -> # keep in sync with correlate2 @overload -def correlate(a: _ArrayLike[_NumericT], v: _ArrayLike[_NumericT], mode: _CorrMode = 0) -> Array1D[_NumericT]: ... +def correlate(a: _ArrayLike[_NumericT], v: _ArrayLike[_NumericT], mode: _CorrMode = 0) -> _nt.Array1D[_NumericT]: ... @overload -def correlate(a: npt.ArrayLike, v: npt.ArrayLike, mode: _CorrMode = 0) -> Array1D: ... +def correlate(a: npt.ArrayLike, v: npt.ArrayLike, mode: _CorrMode = 0) -> _nt.Array1D: ... # keep in sync with correlate @overload -def correlate2(a: _ArrayLike[_NumericT], v: _ArrayLike[_NumericT], mode: _CorrMode = 0) -> Array1D[_NumericT]: ... +def correlate2(a: _ArrayLike[_NumericT], v: _ArrayLike[_NumericT], mode: _CorrMode = 0) -> _nt.Array1D[_NumericT]: ... @overload -def correlate2(a: npt.ArrayLike, v: npt.ArrayLike, mode: _CorrMode = 0) -> Array1D: ... +def correlate2(a: npt.ArrayLike, v: npt.ArrayLike, mode: _CorrMode = 0) -> _nt.Array1D: ... # @overload @@ -1900,7 +1863,7 @@ def c_einsum( dtype: npt.DTypeLike | None = None, order: _OrderKACF = "K", casting: _CastingKind = "safe", -) -> Any: ... +) -> Incomplete: ... ### @@ -1921,14 +1884,14 @@ def compare_chararrays( a2: _ArrayLikeStr_co, cmp: L["<", "<=", "==", ">=", ">", "!="], rstrip: bool, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... @overload def compare_chararrays( a1: _ArrayLikeBytes_co, a2: _ArrayLikeBytes_co, cmp: L["<", "<=", "==", ">=", ">", "!="], rstrip: bool, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... ### @@ -1960,8 +1923,8 @@ def _make_extobj() -> CapsuleType: ... def _monotonicity(x: _ArrayLikeFloat_co) -> L[0, 1]: ... def _place(input: npt.ArrayLike, mask: _ArrayLikeBool_co, vals: npt.ArrayLike) -> None: ... def _reconstruct( - subtype: type[Array], + subtype: type[_nt.Array], shape: _AnyShapeT, dtype: _DTypeT, ) -> np.ndarray[_AnyShapeT, _DTypeT]: ... -def _vec_string(a: _ArrayLikeAnyString_co, dtype: npt.DTypeLike, attr: str, /) -> Array: ... +def _vec_string(a: _ArrayLikeAnyString_co, dtype: npt.DTypeLike, attr: str, /) -> _nt.Array[Incomplete]: ... diff --git a/src/numpy-stubs/_core/fromnumeric.pyi b/src/numpy-stubs/_core/fromnumeric.pyi index 3bece196..a482d7db 100644 --- a/src/numpy-stubs/_core/fromnumeric.pyi +++ b/src/numpy-stubs/_core/fromnumeric.pyi @@ -3,48 +3,8 @@ from collections.abc import Sequence from typing import Any, Literal as L, Protocol, SupportsIndex as CanIndex, TypeAlias, overload, type_check_only from typing_extensions import TypeVar, TypedDict, Unpack, deprecated +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array0D, - Array1D, - CanArray0D, - CanLenArray, - CoComplex_0d, - CoComplex_1nd, - CoComplex_nd, - CoFloating_nd, - CoInteger_0d, - CoInteger_1nd, - CoInteger_nd, - JustComplex, - JustFloat, - JustInt, - ToBool_0d, - ToBool_1nd, - ToBool_nd, - ToBytes_nd, - ToComplex128_nd, - ToComplex_nd, - ToFloat64_nd, - ToFloating_nd, - ToGeneric_0d, - ToGeneric_1ds, - ToGeneric_1nd, - ToGeneric_2ds, - ToGeneric_3ds, - ToGeneric_nd, - ToInt_nd, - ToInteger_1d, - ToInteger_nd, - ToObject_nd, - ToSInteger_nd, - ToStr_nd, - ToTimeDelta_nd, - ToUInteger_nd, - _ToArray_1nd, - _ToArray_nd, -) from numpy import _CastingKind, _ModeKind, _OrderACF, _OrderKACF, _PartitionKind, _SortKind, _SortSide # noqa: ICN003 from numpy._globals import _NoValueType from numpy._typing import ArrayLike, DTypeLike, _DTypeLike, _ShapeLike @@ -134,7 +94,7 @@ class _HasShape(Protocol[_ShapeT_co]): @type_check_only class UFuncKwargs(TypedDict, total=False): - where: ToBool_nd | None + where: _nt.ToBool_nd | None order: _OrderKACF subok: bool signature: str | tuple[str | None, ...] @@ -144,32 +104,32 @@ class UFuncKwargs(TypedDict, total=False): @overload def take( - a: _ToArray_nd[_ScalarT], - indices: CoInteger_0d, + a: _nt._ToArray_nd[_ScalarT], + indices: _nt.CoInteger_0d, axis: None = None, out: None = None, mode: _ModeKind = "raise", ) -> _ScalarT: ... @overload def take( - a: _ToArray_nd[_ScalarT], - indices: CoInteger_1nd, + a: _nt._ToArray_nd[_ScalarT], + indices: _nt.CoInteger_1nd, axis: CanIndex | None = None, out: None = None, mode: _ModeKind = "raise", -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def take( a: ArrayLike, - indices: CoInteger_1nd, + indices: _nt.CoInteger_1nd, axis: CanIndex | None = None, out: None = None, mode: _ModeKind = "raise", -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def take( a: ArrayLike, - indices: CoInteger_1nd, + indices: _nt.CoInteger_1nd, axis: CanIndex | None = None, *, out: _ArrayT, @@ -178,11 +138,11 @@ def take( @overload def take( a: ArrayLike, - indices: CoInteger_0d, + indices: _nt.CoInteger_0d, axis: CanIndex | None = None, out: None = None, mode: _ModeKind = "raise", -) -> Any: ... +) -> Incomplete: ... # def put( @@ -191,47 +151,49 @@ def put( # @overload -def choose(a: CoInteger_nd, choices: ArrayLike, out: _ArrayT, mode: _ModeKind = "raise") -> _ArrayT: ... +def choose(a: _nt.CoInteger_nd, choices: ArrayLike, out: _ArrayT, mode: _ModeKind = "raise") -> _ArrayT: ... @overload -def choose(a: CoInteger_0d, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise") -> Any: ... +def choose(a: _nt.CoInteger_0d, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise") -> Incomplete: ... @overload def choose( - a: CoInteger_1nd, choices: _ToArray_nd[_ScalarT], out: None = None, mode: _ModeKind = "raise" -) -> Array[_ScalarT]: ... + a: _nt.CoInteger_1nd, choices: _nt._ToArray_nd[_ScalarT], out: None = None, mode: _ModeKind = "raise" +) -> _nt.Array[_ScalarT]: ... @overload -def choose(a: CoInteger_1nd, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise") -> Array: ... +def choose( + a: _nt.CoInteger_1nd, choices: ArrayLike, out: None = None, mode: _ModeKind = "raise" +) -> _nt.Array[Incomplete]: ... # @overload # shape: index def reshape( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], /, shape: CanIndex, order: _OrderACF = "C", *, newshape: None = None, copy: bool | None = None, -) -> np.ndarray[tuple[int], np.dtype[_ScalarT]]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # shape: _AnyShape def reshape( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], /, shape: _AnyShapeT, order: _OrderACF = "C", *, newshape: None = None, copy: bool | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # shape: Sequence[index] def reshape( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], /, shape: Sequence[CanIndex], order: _OrderACF = "C", *, newshape: None = None, copy: bool | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # shape: index def reshape( a: ArrayLike, @@ -241,7 +203,7 @@ def reshape( *, newshape: None = None, copy: bool | None = None, -) -> Array[Any, tuple[int]]: ... +) -> _nt.Array1D[Incomplete]: ... @overload def reshape( # shape: _AnyShape a: ArrayLike, @@ -251,7 +213,7 @@ def reshape( # shape: _AnyShape *, newshape: None = None, copy: bool | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Incomplete, _AnyShapeT]: ... @overload # shape: Sequence[index] def reshape( a: ArrayLike, @@ -261,7 +223,7 @@ def reshape( *, newshape: None = None, copy: bool | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload @deprecated("`newshape` is deprecated, `shape` instead. (deprecated in NumPy 2.1)") def reshape( @@ -272,96 +234,98 @@ def reshape( *, newshape: _ShapeLike, copy: bool | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # @overload -def swapaxes(a: _ToArray_nd[_ScalarT], axis1: CanIndex, axis2: CanIndex) -> Array[_ScalarT]: ... +def swapaxes(a: _nt._ToArray_nd[_ScalarT], axis1: CanIndex, axis2: CanIndex) -> _nt.Array[_ScalarT]: ... @overload -def swapaxes(a: ArrayLike, axis1: CanIndex, axis2: CanIndex) -> Array: ... +def swapaxes(a: ArrayLike, axis1: CanIndex, axis2: CanIndex) -> _nt.Array[Incomplete]: ... # @overload -def repeat(a: _ToArray_nd[_ScalarT], repeats: CoInteger_nd, axis: CanIndex | None = None) -> Array[_ScalarT]: ... +def repeat( + a: _nt._ToArray_nd[_ScalarT], repeats: _nt.CoInteger_nd, axis: CanIndex | None = None +) -> _nt.Array[_ScalarT]: ... @overload -def repeat(a: ArrayLike, repeats: CoInteger_nd, axis: CanIndex | None = None) -> Array: ... +def repeat(a: ArrayLike, repeats: _nt.CoInteger_nd, axis: CanIndex | None = None) -> _nt.Array[Incomplete]: ... # @overload -def transpose(a: _ToArray_nd[_ScalarT], axes: _ShapeLike | None = ...) -> Array[_ScalarT]: ... +def transpose(a: _nt._ToArray_nd[_ScalarT], axes: _ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... @overload -def transpose(a: ArrayLike, axes: _ShapeLike | None = ...) -> Array: ... +def transpose(a: ArrayLike, axes: _ShapeLike | None = ...) -> _nt.Array[Incomplete]: ... # @overload -def matrix_transpose(x: _ToArray_nd[_ScalarT], /) -> Array[_ScalarT]: ... +def matrix_transpose(x: _nt._ToArray_nd[_ScalarT], /) -> _nt.Array[_ScalarT]: ... @overload -def matrix_transpose(x: ArrayLike, /) -> Array: ... +def matrix_transpose(x: ArrayLike, /) -> _nt.Array[Incomplete]: ... # @overload def partition( - a: _ToArray_nd[_ScalarT], - kth: ToInteger_nd, + a: _nt._ToArray_nd[_ScalarT], + kth: _nt.ToInteger_nd, axis: CanIndex | None = None, kind: _PartitionKind = "introselect", order: _Order | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def partition( a: ArrayLike, - kth: ToInteger_nd, + kth: _nt.ToInteger_nd, axis: CanIndex | None = None, kind: _PartitionKind = "introselect", order: _Order | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... # def argpartition( a: ArrayLike, - kth: ToInteger_nd, + kth: _nt.ToInteger_nd, axis: CanIndex | None = -1, kind: _PartitionKind = "introselect", order: _Order | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... # @overload # known shape, known dtype, axis= def sort( - a: CanLenArray[_ScalarT, _ShapeT], + a: _nt.CanLenArray[_ScalarT, _ShapeT], axis: CanIndex = -1, kind: _SortKind | None = None, order: _Order | None = None, *, stable: bool | None = None, -) -> Array[_ScalarT, _ShapeT]: ... +) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload # 0d, known dtype, axis=None def sort( - a: CanArray0D[_ScalarT], + a: _nt.CanArray0D[_ScalarT], axis: None, kind: CanIndex | None = -1, order: _Order | None = None, *, stable: bool | None = None, -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # unknown shape, known dtype, axis= def sort( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: CanIndex = -1, kind: _SortKind | None = None, order: _Order | None = None, *, stable: bool | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, known dtype, axis=None def sort( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: None, kind: _SortKind | None = None, order: _Order | None = None, *, stable: bool | None = None, -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # unknown shape, unknown dtype, axis= def sort( a: ArrayLike, @@ -370,7 +334,7 @@ def sort( order: _Order | None = None, *, stable: bool | None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload # unknown shape, unknown dtype, axis=None def sort( a: ArrayLike, @@ -379,27 +343,27 @@ def sort( order: _Order | None = None, *, stable: bool | None = None, -) -> Array1D[Any]: ... +) -> _nt.Array1D[Any]: ... # @overload # known shape def argsort( - a: CanLenArray[Any, _ShapeT], + a: _nt.CanLenArray[Any, _ShapeT], axis: CanIndex = -1, kind: _SortKind | None = None, order: _Order | None = None, *, stable: bool | None = None, -) -> Array[np.intp, _ShapeT]: ... +) -> _nt.Array[np.intp, _ShapeT]: ... @overload # 0d or 1d array-like def argsort( - a: ToGeneric_0d | ToGeneric_1ds, + a: _nt.ToGeneric_0d | _nt.ToGeneric_1ds, axis: CanIndex | None = -1, kind: _SortKind | None = None, order: _Order | None = None, *, stable: bool | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # axis=None def argsort( a: ArrayLike, @@ -408,7 +372,7 @@ def argsort( order: _Order | None = None, *, stable: bool | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # fallback def argsort( a: ArrayLike, @@ -417,12 +381,12 @@ def argsort( order: _Order | None = None, *, stable: bool | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... # @overload # 0d or 1d , keepdims=False def argmax( - a: ToGeneric_0d | ToGeneric_1ds, + a: _nt.ToGeneric_0d | _nt.ToGeneric_1ds, axis: CanIndex, out: None = None, *, @@ -430,21 +394,41 @@ def argmax( ) -> np.intp: ... @overload # axis=None, keepdims=False def argmax( - a: ArrayLike, axis: None = None, out: None = None, *, keepdims: L[False] | _NoValueType = ... + a: ArrayLike, + axis: None = None, + out: None = None, + *, + keepdims: L[False] | _NoValueType = ..., ) -> np.intp: ... @overload # keepdims=True -def argmax(a: ArrayLike, axis: CanIndex | None = None, out: None = None, *, keepdims: L[True]) -> Array[np.intp]: ... +def argmax( + a: ArrayLike, + axis: CanIndex | None = None, + out: None = None, + *, + keepdims: L[True], +) -> _nt.Array[np.intp]: ... @overload # out= (positional) -def argmax(a: ArrayLike, axis: CanIndex | None, out: _ArrayT, *, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... +def argmax( + a: ArrayLike, + axis: CanIndex | None, + out: _ArrayT, + *, + keepdims: bool | _NoValueType = ..., +) -> _ArrayT: ... @overload # out= (keyword) def argmax( - a: ArrayLike, axis: CanIndex | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, + axis: CanIndex | None = None, + *, + out: _ArrayT, + keepdims: bool | _NoValueType = ..., ) -> _ArrayT: ... @overload # fallback def argmax( a: ArrayLike, axis: CanIndex | None = None, - out: Array | None = None, + out: _nt.Array | None = None, *, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @@ -452,7 +436,7 @@ def argmax( # @overload # 0d or 1d , keepdims=False def argmin( - a: ToGeneric_0d | ToGeneric_1ds, + a: _nt.ToGeneric_0d | _nt.ToGeneric_1ds, axis: CanIndex, out: None = None, *, @@ -460,21 +444,41 @@ def argmin( ) -> np.intp: ... @overload # axis=None, keepdims=False def argmin( - a: ArrayLike, axis: None = None, out: None = None, *, keepdims: L[False] | _NoValueType = ... + a: ArrayLike, + axis: None = None, + out: None = None, + *, + keepdims: L[False] | _NoValueType = ..., ) -> np.intp: ... @overload # keepdims=True -def argmin(a: ArrayLike, axis: CanIndex | None = None, out: None = None, *, keepdims: L[True]) -> Array[np.intp]: ... +def argmin( + a: ArrayLike, + axis: CanIndex | None = None, + out: None = None, + *, + keepdims: L[True], +) -> _nt.Array[np.intp]: ... @overload # out= (positional) -def argmin(a: ArrayLike, axis: CanIndex | None, out: _ArrayT, *, keepdims: bool | _NoValueType = ...) -> _ArrayT: ... +def argmin( + a: ArrayLike, + axis: CanIndex | None, + out: _ArrayT, + *, + keepdims: bool | _NoValueType = ..., +) -> _ArrayT: ... @overload # out= (keyword) def argmin( - a: ArrayLike, axis: CanIndex | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... + a: ArrayLike, + axis: CanIndex | None = None, + *, + out: _ArrayT, + keepdims: bool | _NoValueType = ..., ) -> _ArrayT: ... @overload # fallback def argmin( a: ArrayLike, axis: CanIndex | None = None, - out: Array | None = None, + out: _nt.Array | None = None, *, keepdims: bool | _NoValueType = ..., ) -> Incomplete: ... @@ -483,47 +487,47 @@ def argmin( @overload def searchsorted( a: ArrayLike, - v: ToGeneric_0d, + v: _nt.ToGeneric_0d, side: _SortSide = "left", - sorter: ToInteger_1d | None = None, + sorter: _nt.ToInteger_1d | None = None, ) -> np.intp: ... @overload def searchsorted( a: ArrayLike, - v: ToGeneric_1nd, + v: _nt.ToGeneric_1nd, side: _SortSide = "left", - sorter: ToInteger_1d | None = None, -) -> Array[np.intp]: ... + sorter: _nt.ToInteger_1d | None = None, +) -> _nt.Array[np.intp]: ... # @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: CanIndex) -> Array1D[_ScalarT]: ... +def resize(a: _nt._ToArray_nd[_ScalarT], new_shape: CanIndex) -> _nt.Array1D[_ScalarT]: ... @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: _AnyShapeT) -> Array[_ScalarT, _AnyShapeT]: ... +def resize(a: _nt._ToArray_nd[_ScalarT], new_shape: _AnyShapeT) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload -def resize(a: _ToArray_nd[_ScalarT], new_shape: Sequence[CanIndex]) -> Array[_ScalarT]: ... +def resize(a: _nt._ToArray_nd[_ScalarT], new_shape: Sequence[CanIndex]) -> _nt.Array[_ScalarT]: ... @overload -def resize(a: ArrayLike, new_shape: CanIndex) -> Array1D[Any]: ... +def resize(a: ArrayLike, new_shape: CanIndex) -> _nt.Array1D[Any]: ... @overload -def resize(a: ArrayLike, new_shape: _AnyShapeT) -> Array[Any, _AnyShapeT]: ... +def resize(a: ArrayLike, new_shape: _AnyShapeT) -> _nt.Array[Any, _AnyShapeT]: ... @overload -def resize(a: ArrayLike, new_shape: Sequence[CanIndex]) -> Array: ... +def resize(a: ArrayLike, new_shape: Sequence[CanIndex]) -> _nt.Array[Incomplete]: ... # @overload -def squeeze(a: CanArray0D[_ScalarT], axis: _ShapeLike | None = None) -> Array0D[_ScalarT]: ... +def squeeze(a: _nt.CanArray0D[_ScalarT], axis: _ShapeLike | None = None) -> _nt.Array0D[_ScalarT]: ... @overload -def squeeze(a: _ToArray_nd[_ScalarT], axis: _ShapeLike | None = None) -> Array[_ScalarT]: ... +def squeeze(a: _nt._ToArray_nd[_ScalarT], axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def squeeze(a: ArrayLike, axis: _ShapeLike | None = None) -> Array: ... +def squeeze(a: ArrayLike, axis: _ShapeLike | None = None) -> _nt.Array[Incomplete]: ... # @overload def diagonal( - a: _ToArray_nd[_ScalarT], offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1 -) -> Array[_ScalarT]: ... + a: _nt._ToArray_nd[_ScalarT], offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1 +) -> _nt.Array[_ScalarT]: ... @overload -def diagonal(a: ArrayLike, offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1) -> Array: ... +def diagonal(a: ArrayLike, offset: CanIndex = 0, axis1: CanIndex = 0, axis2: CanIndex = 1) -> _nt.Array[Incomplete]: ... # @overload @@ -557,124 +561,126 @@ def trace( # @overload -def ravel(a: _ToArray_nd[_ScalarT], order: _OrderKACF = "C") -> Array1D[_ScalarT]: ... # type: ignore[overload-overlap] +def ravel(a: _nt._ToArray_nd[_ScalarT], order: _OrderKACF = "C") -> _nt.Array1D[_ScalarT]: ... # type: ignore[overload-overlap] @overload -def ravel(a: ToBytes_nd, order: _OrderKACF = "C") -> Array1D[np.bytes_]: ... +def ravel(a: _nt.ToBytes_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.bytes_]: ... @overload -def ravel(a: ToStr_nd, order: _OrderKACF = "C") -> Array1D[np.str_]: ... +def ravel(a: _nt.ToStr_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.str_]: ... @overload -def ravel(a: ToBool_nd, order: _OrderKACF = "C") -> Array1D[np.bool]: ... +def ravel(a: _nt.ToBool_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.bool]: ... @overload -def ravel(a: ToInt_nd, order: _OrderKACF = "C") -> Array1D[np.intp]: ... +def ravel(a: _nt.ToInt_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.intp]: ... @overload -def ravel(a: ToFloat64_nd, order: _OrderKACF = "C") -> Array1D[np.float64]: ... +def ravel(a: _nt.ToFloat64_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.float64]: ... @overload -def ravel(a: ToComplex128_nd, order: _OrderKACF = "C") -> Array1D[np.complex128]: ... +def ravel(a: _nt.ToComplex128_nd, order: _OrderKACF = "C") -> _nt.Array1D[np.complex128]: ... @overload -def ravel(a: ArrayLike, order: _OrderKACF = "C") -> Array1D[Any]: ... +def ravel(a: ArrayLike, order: _OrderKACF = "C") -> _nt.Array1D[Any]: ... # -def nonzero(a: ToGeneric_1nd) -> tuple[Array[np.int_], ...]: ... +def nonzero(a: _nt.ToGeneric_1nd) -> tuple[_nt.Array[np.int_], ...]: ... # @overload def shape(a: _HasShape[_ShapeT]) -> _ShapeT: ... @overload -def shape(a: ToGeneric_0d) -> tuple[()]: ... +def shape(a: _nt.ToGeneric_0d) -> tuple[()]: ... @overload -def shape(a: ToGeneric_1ds) -> tuple[int]: ... +def shape(a: _nt.ToGeneric_1ds) -> tuple[int]: ... @overload -def shape(a: ToGeneric_2ds) -> tuple[int, int]: ... +def shape(a: _nt.ToGeneric_2ds) -> tuple[int, int]: ... @overload -def shape(a: ToGeneric_3ds) -> tuple[int, int, int]: ... +def shape(a: _nt.ToGeneric_3ds) -> tuple[int, int, int]: ... @overload -def shape(a: ToGeneric_nd) -> tuple[int, ...]: ... +def shape(a: _nt.ToGeneric_nd) -> tuple[int, ...]: ... # @overload def compress( - condition: ToBool_nd, - a: _ToArray_nd[_ScalarT], + condition: _nt.ToBool_nd, + a: _nt._ToArray_nd[_ScalarT], axis: CanIndex | None = None, out: None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload -def compress(condition: ToBool_nd, a: ArrayLike, axis: CanIndex | None = None, out: None = None) -> Array: ... +def compress( + condition: _nt.ToBool_nd, a: ArrayLike, axis: CanIndex | None = None, out: None = None +) -> _nt.Array[Incomplete]: ... @overload -def compress(condition: ToBool_nd, a: ArrayLike, axis: CanIndex | None, out: _ArrayT) -> _ArrayT: ... +def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: CanIndex | None, out: _ArrayT) -> _ArrayT: ... @overload -def compress(condition: ToBool_nd, a: ArrayLike, axis: CanIndex | None = None, *, out: _ArrayT) -> _ArrayT: ... +def compress(condition: _nt.ToBool_nd, a: ArrayLike, axis: CanIndex | None = None, *, out: _ArrayT) -> _ArrayT: ... # @overload def clip( a: _ScalarT, - a_min: CoComplex_nd | _NoValueType | None = ..., - a_max: CoComplex_nd | _NoValueType | None = ..., + a_min: _nt.CoComplex_nd | _NoValueType | None = ..., + a_max: _nt.CoComplex_nd | _NoValueType | None = ..., out: None = None, *, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: None = None, **kwargs: Unpack[UFuncKwargs], ) -> _ScalarT: ... @overload def clip( - a: _ToArray_1nd[_ScalarT], - a_min: CoComplex_nd | _NoValueType | None = ..., - a_max: CoComplex_nd | _NoValueType | None = ..., + a: _nt._ToArray_1nd[_ScalarT], + a_min: _nt.CoComplex_nd | _NoValueType | None = ..., + a_max: _nt.CoComplex_nd | _NoValueType | None = ..., out: None = None, *, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: None = None, **kwargs: Unpack[UFuncKwargs], -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def clip( - a: ToGeneric_1nd, - a_min: CoComplex_nd | _NoValueType | None = ..., - a_max: CoComplex_nd | _NoValueType | None = ..., + a: _nt.ToGeneric_1nd, + a_min: _nt.CoComplex_nd | _NoValueType | None = ..., + a_max: _nt.CoComplex_nd | _NoValueType | None = ..., out: None = None, *, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: None = None, **kwargs: Unpack[UFuncKwargs], -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def clip( - a: ToGeneric_0d, - a_min: CoComplex_nd | _NoValueType | None = ..., - a_max: CoComplex_nd | _NoValueType | None = ..., + a: _nt.ToGeneric_0d, + a_min: _nt.CoComplex_nd | _NoValueType | None = ..., + a_max: _nt.CoComplex_nd | _NoValueType | None = ..., out: None = None, *, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: None = None, **kwargs: Unpack[UFuncKwargs], -) -> Any: ... +) -> Incomplete: ... @overload def clip( a: ArrayLike, - a_min: CoComplex_nd | _NoValueType | None, - a_max: CoComplex_nd | _NoValueType | None, + a_min: _nt.CoComplex_nd | _NoValueType | None, + a_max: _nt.CoComplex_nd | _NoValueType | None, out: _ArrayT, *, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: DTypeLike | None = None, **kwargs: Unpack[UFuncKwargs], ) -> _ArrayT: ... @overload def clip( a: ArrayLike, - a_min: CoComplex_nd | _NoValueType | None = ..., - a_max: CoComplex_nd | _NoValueType | None = ..., + a_min: _nt.CoComplex_nd | _NoValueType | None = ..., + a_max: _nt.CoComplex_nd | _NoValueType | None = ..., *, out: _ArrayT, - min: CoComplex_nd | _NoValueType | None = ..., - max: CoComplex_nd | _NoValueType | None = ..., + min: _nt.CoComplex_nd | _NoValueType | None = ..., + max: _nt.CoComplex_nd | _NoValueType | None = ..., dtype: DTypeLike | None = None, **kwargs: Unpack[UFuncKwargs], ) -> _ArrayT: ... @@ -682,24 +688,24 @@ def clip( # @overload def sum( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: None = None, dtype: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def sum( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: None = None, dtype: None = None, out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> _ScalarT | Array[_ScalarT]: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _ScalarT | _nt.Array[_ScalarT]: ... @overload def sum( a: ArrayLike, @@ -707,8 +713,8 @@ def sum( dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: L[False] | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def sum( @@ -718,8 +724,8 @@ def sum( dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: L[False] | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def sum( @@ -728,9 +734,9 @@ def sum( dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> _ScalarT | Array[_ScalarT]: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _ScalarT | _nt.Array[_ScalarT]: ... @overload def sum( a: ArrayLike, @@ -739,9 +745,9 @@ def sum( dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> _ScalarT | Array[_ScalarT]: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _ScalarT | _nt.Array[_ScalarT]: ... @overload def sum( a: ArrayLike, @@ -749,9 +755,9 @@ def sum( dtype: DTypeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> Any: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> Incomplete: ... @overload def sum( a: ArrayLike, @@ -760,19 +766,19 @@ def sum( *, out: _ArrayT, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... # @overload def all( - a: ToGeneric_1ds, + a: _nt.ToGeneric_1ds, axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: L[False, 0] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.bool: ... @overload def all( @@ -781,7 +787,7 @@ def all( out: None = None, keepdims: L[False, 0] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.bool: ... @overload def all( @@ -790,8 +796,8 @@ def all( out: None, keepdims: L[True, 1], *, - where: ToBool_nd | _NoValueType = ..., -) -> Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _nt.Array[np.bool]: ... @overload def all( a: ArrayLike, @@ -799,25 +805,25 @@ def all( out: None = None, *, keepdims: L[True, 1], - where: ToBool_nd | _NoValueType = ..., -) -> Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _nt.Array[np.bool]: ... @overload def all( a: ArrayLike, axis: int | tuple[int, ...] | None = None, out: None = None, - keepdims: ToBool_0d | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., -) -> np.bool | Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> np.bool | _nt.Array[np.bool]: ... @overload def all( a: ArrayLike, axis: int | tuple[int, ...] | None, out: _ArrayT, - keepdims: ToBool_0d | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def all( @@ -825,19 +831,19 @@ def all( axis: int | tuple[int, ...] | None = None, *, out: _ArrayT, - keepdims: ToBool_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... # keep in sync with `all` @overload def any( - a: ToGeneric_1ds, + a: _nt.ToGeneric_1ds, axis: int | tuple[int, ...] | None = None, out: None = None, keepdims: L[False, 0] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.bool: ... @overload def any( @@ -846,7 +852,7 @@ def any( out: None = None, keepdims: L[False, 0] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.bool: ... @overload def any( @@ -855,8 +861,8 @@ def any( out: None, keepdims: L[True, 1], *, - where: ToBool_nd | _NoValueType = ..., -) -> Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _nt.Array[np.bool]: ... @overload def any( a: ArrayLike, @@ -864,25 +870,25 @@ def any( out: None = None, *, keepdims: L[True, 1], - where: ToBool_nd | _NoValueType = ..., -) -> Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _nt.Array[np.bool]: ... @overload def any( a: ArrayLike, axis: int | tuple[int, ...] | None = None, out: None = None, - keepdims: ToBool_0d | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., -) -> np.bool | Array[np.bool]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> np.bool | _nt.Array[np.bool]: ... @overload def any( a: ArrayLike, axis: int | tuple[int, ...] | None, out: _ArrayT, - keepdims: ToBool_0d | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def any( @@ -890,37 +896,41 @@ def any( axis: int | tuple[int, ...] | None = None, *, out: _ArrayT, - keepdims: ToBool_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + keepdims: _nt.ToBool_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... # @overload def cumsum( - a: _ToArray_nd[_ScalarT], axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[_ScalarT]: ... + a: _nt._ToArray_nd[_ScalarT], axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[_ScalarT]: ... @overload -def cumsum(a: ArrayLike, axis: CanIndex | None = None, dtype: None = None, out: None = None) -> Array: ... +def cumsum( + a: ArrayLike, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[Incomplete]: ... @overload def cumsum( a: ArrayLike, axis: CanIndex | None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload -def cumsum(a: ArrayLike, axis: CanIndex | None = None, dtype: DTypeLike | None = None, out: None = None) -> Array: ... +def cumsum( + a: ArrayLike, axis: CanIndex | None = None, dtype: DTypeLike | None = None, out: None = None +) -> _nt.Array[Incomplete]: ... @overload def cumsum(a: ArrayLike, axis: CanIndex | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT) -> _ArrayT: ... # @overload def cumulative_sum( - x: _ToArray_nd[_ScalarT], + x: _nt._ToArray_nd[_ScalarT], /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cumulative_sum( x: ArrayLike, @@ -930,7 +940,7 @@ def cumulative_sum( dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def cumulative_sum( x: ArrayLike, @@ -940,7 +950,7 @@ def cumulative_sum( dtype: _DTypeLike[_ScalarT], out: None = None, include_initial: bool = False, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cumulative_sum( x: ArrayLike, @@ -950,7 +960,7 @@ def cumulative_sum( dtype: DTypeLike | None = None, out: None = None, include_initial: bool = False, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def cumulative_sum( x: ArrayLike, @@ -965,10 +975,12 @@ def cumulative_sum( # @overload def ptp( - a: _ToArray_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ... + a: _nt._ToArray_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ... ) -> _ScalarT: ... @overload -def ptp(a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ...) -> Any: ... +def ptp( + a: ArrayLike, axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ... +) -> Incomplete: ... @overload def ptp( a: ArrayLike, axis: _ShapeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ... @@ -977,12 +989,12 @@ def ptp( # @overload def amax( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def amax( @@ -990,17 +1002,17 @@ def amax( axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> Any: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> Incomplete: ... @overload def amax( a: ArrayLike, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def amax( @@ -1009,19 +1021,19 @@ def amax( *, out: _ArrayT, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... # @overload def amin( - a: _ToArray_nd[_ScalarT], + a: _nt._ToArray_nd[_ScalarT], axis: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def amin( @@ -1029,17 +1041,17 @@ def amin( axis: _ShapeLike | None = None, out: None = None, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> Any: ... + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., +) -> Incomplete: ... @overload def amin( a: ArrayLike, axis: _ShapeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def amin( @@ -1048,8 +1060,8 @@ def amin( *, out: _ArrayT, keepdims: bool | _NoValueType = ..., - initial: CoComplex_0d | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + initial: _nt.CoComplex_0d | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... # TODO: `np.prod()``: For object arrays `initial` does not necessarily have to be a numerical scalar. @@ -1057,172 +1069,174 @@ def amin( # Note that the same situation holds for all wrappers around `np.ufunc.reduce`, e.g. `np.sum()` (`.__add__()`). @overload def prod( - a: ToBool_nd, + a: _nt.ToBool_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> np.int_: ... @overload def prod( - a: ToUInteger_nd, + a: _nt.ToUInteger_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> np.uint64: ... @overload def prod( - a: ToSInteger_nd, + a: _nt.ToSInteger_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> np.int64: ... @overload def prod( - a: ToFloating_nd, + a: _nt.ToFloating_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> np.floating: ... @overload def prod( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> np.complexfloating: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: None = None, out: None = None, keepdims: _NoValueType | bool = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., -) -> Any: ... + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., +) -> Incomplete: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> _ScalarT: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: _NoValueType | L[False] = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> _ScalarT: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: DTypeLike | None = ..., out: None = None, keepdims: _NoValueType | bool = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., -) -> Any: ... + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., +) -> Incomplete: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: _NoValueType | bool = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> _ArrayT: ... @overload def prod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: DTypeLike | None = ..., *, out: _ArrayT, keepdims: _NoValueType | bool = ..., - initial: _NoValueType | CoComplex_0d = ..., - where: _NoValueType | ToBool_nd = ..., + initial: _NoValueType | _nt.CoComplex_0d = ..., + where: _NoValueType | _nt.ToBool_nd = ..., ) -> _ArrayT: ... # @overload -def cumprod(a: ToBool_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None) -> Array[np.int_]: ... +def cumprod( + a: _nt.ToBool_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.int_]: ... @overload def cumprod( - a: ToUInteger_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[np.uint64]: ... + a: _nt.ToUInteger_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.uint64]: ... @overload def cumprod( - a: ToSInteger_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[np.int64]: ... + a: _nt.ToSInteger_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.int64]: ... @overload def cumprod( - a: ToFloating_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[np.floating]: ... + a: _nt.ToFloating_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.floating]: ... @overload def cumprod( - a: ToComplex_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[np.complexfloating]: ... + a: _nt.ToComplex_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.complexfloating]: ... @overload def cumprod( - a: ToObject_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None -) -> Array[np.object_]: ... + a: _nt.ToObject_nd, axis: CanIndex | None = None, dtype: None = None, out: None = None +) -> _nt.Array[np.object_]: ... @overload def cumprod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: CanIndex | None, dtype: _DTypeLike[_ScalarT], out: None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cumprod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: CanIndex | None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cumprod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: CanIndex | None = None, dtype: DTypeLike | None = None, out: None = None, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def cumprod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: CanIndex | None, dtype: DTypeLike | None, out: _ArrayT, ) -> _ArrayT: ... @overload def cumprod( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: CanIndex | None = None, dtype: DTypeLike | None = None, *, @@ -1232,87 +1246,87 @@ def cumprod( # @overload def cumulative_prod( - x: ToBool_nd, + x: _nt.ToBool_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.int_]: ... +) -> _nt.Array[np.int_]: ... @overload def cumulative_prod( - x: ToUInteger_nd, + x: _nt.ToUInteger_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.uint64]: ... +) -> _nt.Array[np.uint64]: ... @overload def cumulative_prod( - x: ToSInteger_nd, + x: _nt.ToSInteger_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.int64]: ... +) -> _nt.Array[np.int64]: ... @overload def cumulative_prod( - x: ToFloating_nd, + x: _nt.ToFloating_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def cumulative_prod( - x: ToComplex_nd, + x: _nt.ToComplex_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def cumulative_prod( - x: ToObject_nd, + x: _nt.ToObject_nd, /, *, axis: CanIndex | None = None, dtype: None = None, out: None = None, include_initial: bool = False, -) -> Array[np.object_]: ... +) -> _nt.Array[np.object_]: ... @overload def cumulative_prod( - x: CoComplex_nd | ToObject_nd, + x: _nt.CoComplex_nd | _nt.ToObject_nd, /, *, axis: CanIndex | None = None, dtype: _DTypeLike[_ScalarT], out: None = None, include_initial: bool = False, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload def cumulative_prod( - x: CoComplex_nd | ToObject_nd, + x: _nt.CoComplex_nd | _nt.ToObject_nd, /, *, axis: CanIndex | None = None, dtype: DTypeLike | None = None, out: None = None, include_initial: bool = False, -) -> Array: ... +) -> _nt.Array[Incomplete]: ... @overload def cumulative_prod( - x: CoComplex_nd | ToObject_nd, + x: _nt.CoComplex_nd | _nt.ToObject_nd, /, *, axis: CanIndex | None = None, @@ -1327,323 +1341,323 @@ def size(a: ArrayLike, axis: int | None = None) -> int: ... # @overload -def around(a: ToBool_0d, decimals: CanIndex = 0, out: None = None) -> np.float16: ... +def around(a: _nt.ToBool_0d, decimals: CanIndex = 0, out: None = None) -> np.float16: ... @overload -def around(a: ToBool_1nd, decimals: CanIndex = 0, out: None = None) -> Array[np.float16]: ... +def around(a: _nt.ToBool_1nd, decimals: CanIndex = 0, out: None = None) -> _nt.Array[np.float16]: ... @overload -def around(a: CanArray0D[_NumberT], decimals: CanIndex = 0, out: None = None) -> _NumberT: ... +def around(a: _nt.CanArray0D[_NumberT], decimals: CanIndex = 0, out: None = None) -> _NumberT: ... @overload -def around(a: _ToArray_1nd[_NumberT], decimals: CanIndex = 0, out: None = None) -> Array[_NumberT]: ... +def around(a: _nt._ToArray_1nd[_NumberT], decimals: CanIndex = 0, out: None = None) -> _nt.Array[_NumberT]: ... @overload -def around(a: JustInt, decimals: CanIndex = 0, out: None = None) -> np.intp: ... +def around(a: _nt.JustInt, decimals: CanIndex = 0, out: None = None) -> np.intp: ... @overload -def around(a: JustFloat, decimals: CanIndex = 0, out: None = None) -> np.float64: ... +def around(a: _nt.JustFloat, decimals: CanIndex = 0, out: None = None) -> np.float64: ... @overload -def around(a: JustComplex, decimals: CanIndex = 0, out: None = None) -> np.complex128: ... +def around(a: _nt.JustComplex, decimals: CanIndex = 0, out: None = None) -> np.complex128: ... @overload -def around(a: CoComplex_nd, decimals: CanIndex, out: _ArrayT) -> _ArrayT: ... +def around(a: _nt.CoComplex_nd, decimals: CanIndex, out: _ArrayT) -> _ArrayT: ... @overload -def around(a: CoComplex_nd, decimals: CanIndex = 0, *, out: _ArrayT) -> _ArrayT: ... +def around(a: _nt.CoComplex_nd, decimals: CanIndex = 0, *, out: _ArrayT) -> _ArrayT: ... @overload -def around(a: CoComplex_1nd, decimals: CanIndex = 0, out: Array | None = None) -> Array: ... +def around(a: _nt.CoComplex_1nd, decimals: CanIndex = 0, out: _nt.Array | None = None) -> _nt.Array[Incomplete]: ... # @overload def mean( - a: CoFloating_nd, + a: _nt.CoFloating_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.floating: ... @overload def mean( - a: ToComplex_nd, + a: _nt.ToComplex_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.complexfloating: ... @overload def mean( - a: ToTimeDelta_nd, + a: _nt.ToTimeDelta_nd, axis: None = None, dtype: None = None, out: None = None, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> np.timedelta64: ... @overload def mean( - a: ToObject_nd, + a: _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: None = None, out: None = None, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> Any: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: L[False] | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ScalarT: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., -) -> _ScalarT | Array[_ScalarT]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _ScalarT | _nt.Array[_ScalarT]: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, keepdims: bool | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., -) -> _ScalarT | Array[_ScalarT]: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> _ScalarT | _nt.Array[_ScalarT]: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, keepdims: bool | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., ) -> _ArrayT: ... @overload def mean( - a: CoComplex_nd | ToTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToTimeDelta_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, - out: Array | None = None, + out: _nt.Array | None = None, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., -) -> Any: ... + where: _nt.ToBool_nd | _NoValueType = ..., +) -> Incomplete: ... # @overload def std( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None = None, dtype: None = None, out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> np.floating: ... @overload def std( - a: ToObject_nd, + a: _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: None = None, out: None = None, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> Any: ... @overload def std( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ScalarT: ... @overload def std( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ScalarT: ... @overload def std( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ArrayT: ... @overload def std( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, ddof: float = 0, keepdims: bool | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ArrayT: ... @overload def std( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, - out: Array | None = None, + out: _nt.Array | None = None, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., -) -> Any: ... +) -> Incomplete: ... # @overload def var( - a: CoComplex_nd, + a: _nt.CoComplex_nd, axis: None = None, dtype: None = None, out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> np.floating: ... @overload def var( - a: ToObject_nd, + a: _nt.ToObject_nd, axis: _ShapeLike | None = ..., dtype: None = None, out: None = None, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> Any: ... @overload def var( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None, dtype: _DTypeLike[_ScalarT], out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ScalarT: ... @overload def var( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: None = None, *, dtype: _DTypeLike[_ScalarT], out: None = None, ddof: float = 0, keepdims: L[False] | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ScalarT: ... @overload def var( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None, dtype: DTypeLike | None, out: _ArrayT, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ArrayT: ... @overload def var( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, *, out: _ArrayT, ddof: float = 0, keepdims: bool | _NoValueType = ..., - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., ) -> _ArrayT: ... @overload def var( - a: CoComplex_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.ToObject_nd, axis: _ShapeLike | None = None, dtype: DTypeLike | None = None, - out: Array | None = None, + out: _nt.Array | None = None, ddof: float = 0, keepdims: bool | _NoValueType = ..., *, - where: ToBool_nd | _NoValueType = ..., - mean: CoComplex_nd | ToObject_nd | _NoValueType = ..., + where: _nt.ToBool_nd | _NoValueType = ..., + mean: _nt.CoComplex_nd | _nt.ToObject_nd | _NoValueType = ..., correction: float | _NoValueType = ..., -) -> Any: ... +) -> Incomplete: ... max = amax min = amin diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index 0fe84d2e..c124b870 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -14,80 +14,11 @@ from typing import ( ) from typing_extensions import TypeIs, TypeVar +import _numtype as _nt import numpy as np import numpy.typing as npt -from _numtype import ( - Array, - Array0D, - Array1D, - Array2D, - Array3D, - CoComplex_1d, - CoComplex_1nd, - CoComplex_nd, - CoFloating_1d, - CoFloating_1nd, - CoFloating_nd, - CoInt64_1d, - CoInt64_1nd, - CoInt64_nd, - CoTimeDelta_1d, - CoTimeDelta_1nd, - CoTimeDelta_nd, - CoUInt64_1d, - CoUInt64_1nd, - CoUInt64_nd, - JustComplex, - JustFloat, - JustInt, - ToBool_0d, - ToBool_1d, - ToBool_1ds, - ToBool_1nd, - ToBool_2ds, - ToBool_3ds, - ToBool_nd, - ToComplex128_0d, - ToComplex128_1ds, - ToComplex128_2ds, - ToComplex128_3ds, - ToComplex128_nd, - ToComplex_1d, - ToComplex_1nd, - ToComplex_nd, - ToFloat64_0d, - ToFloat64_1ds, - ToFloat64_2ds, - ToFloat64_3ds, - ToFloat64_nd, - ToFloating_1d, - ToFloating_1nd, - ToFloating_nd, - ToGeneric_0d, - ToGeneric_1nd, - ToGeneric_nd, - ToInt_0d, - ToInt_1ds, - ToInt_2ds, - ToInt_3ds, - ToInt_nd, - ToInteger_1d, - ToObject_1d, - ToObject_1nd, - ToObject_nd, - ToSInteger_1d, - ToSInteger_1nd, - ToSInteger_nd, - ToTimeDelta_1d, - ToTimeDelta_1nd, - ToTimeDelta_nd, - ToUInteger_1d, - ToUInteger_1nd, - ToUInteger_nd, -) from numpy import _AnyShapeT, _OrderCF, _OrderKACF, ufunc # noqa: ICN003 from numpy._typing import ArrayLike, DTypeLike, _ArrayLike, _DTypeLike, _ShapeLike, _SupportsArrayFunc, _SupportsDType -from numpy._typing._char_codes import _BoolCodes, _Complex128Codes, _Float64Codes, _IntPCodes from numpy.lib._array_utils_impl import normalize_axis_tuple as normalize_axis_tuple from ._asarray import require @@ -670,11 +601,6 @@ _ShapeLike1D: TypeAlias = SupportsIndex | tuple[SupportsIndex] _ShapeLike2D: TypeAlias = tuple[SupportsIndex, SupportsIndex] _ShapeLike3D: TypeAlias = tuple[SupportsIndex, SupportsIndex, SupportsIndex] -_DTypeLikeBool: TypeAlias = type[bool] | _DTypeLike[np.bool] | _BoolCodes -_DTypeLikeIntP: TypeAlias = type[JustInt] | _IntPCodes -_DTypeLikeFloat64: TypeAlias = type[JustFloat] | _DTypeLike[np.float64] | _Float64Codes | None -_DTypeLikeComplex128: TypeAlias = type[JustComplex] | _DTypeLike[np.complex128] | _Complex128Codes - _PyScalar: TypeAlias = complex | str | bytes _Device: TypeAlias = L["cpu"] _Mode: TypeAlias = L["valid", "same", "full"] @@ -702,12 +628,12 @@ True_: Final[np.bool[L[True]]] = ... @overload # 1d shape, default dtype (float64) def ones( shape: _ShapeLike1D, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, known dtype def ones( shape: _ShapeLike1D, @@ -725,7 +651,7 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, unknown dtype def ones( shape: _ShapeLike1D, @@ -734,16 +660,16 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D: ... +) -> _nt.Array1D: ... @overload # known shape, default dtype (float64) def ones( shape: _AnyShapeT, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64, _AnyShapeT]: ... +) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, known dtype def ones( # type: ignore[overload-overlap] shape: _AnyShapeT, @@ -761,7 +687,7 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, unknown scalar-type def ones( shape: _AnyShapeT, @@ -770,16 +696,16 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, default dtype def ones( shape: _ShapeLike, - dtype: _DTypeLikeFloat64 = ..., + dtype: _nt.ToDTypeFloat64 = ..., order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # unknown shape, known dtype def ones( shape: _ShapeLike, @@ -797,7 +723,7 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, unknown dtype def ones( shape: _ShapeLike, @@ -806,7 +732,7 @@ def ones( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array: ... +) -> _nt.Array: ... # NOTE: keep in sync with `ones` (but note that `full` has 18 additional overloads) # NOTE: The mypy [overload-overlap] errors are false-positives that are caused by a @@ -820,7 +746,7 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, bool fill def full( # type: ignore[overload-overlap] shape: _ShapeLike1D, @@ -830,37 +756,37 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.bool]: ... +) -> _nt.Array1D[np.bool]: ... @overload # 1d shape, int fill def full( # type: ignore[overload-overlap] shape: _ShapeLike1D, - fill_value: JustInt, + fill_value: _nt.JustInt, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # 1d shape, float fill def full( shape: _ShapeLike1D, - fill_value: JustFloat, + fill_value: _nt.JustFloat, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, complex fill def full( # type: ignore[overload-overlap] shape: _ShapeLike1D, - fill_value: JustComplex, + fill_value: _nt.JustComplex, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload # 1d shape, known dtype def full( shape: _ShapeLike1D, @@ -880,17 +806,17 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[_ScalarT]: ... +) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, float64 dtype def full( # type: ignore[overload-overlap] shape: _ShapeLike1D, fill_value: object, - dtype: _DTypeLikeFloat64, + dtype: _nt.ToDTypeFloat64, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, unknown dtype def full( shape: _ShapeLike1D, @@ -900,7 +826,7 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array1D: ... +) -> _nt.Array1D: ... @overload # known shape, known fill scalar-type def full( # type: ignore[overload-overlap] shape: _AnyShapeT, @@ -910,7 +836,7 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, bool fill def full( # type: ignore[overload-overlap] shape: _AnyShapeT, @@ -920,37 +846,37 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.bool, _AnyShapeT]: ... +) -> _nt.Array[np.bool, _AnyShapeT]: ... @overload # known shape, int fill def full( # type: ignore[overload-overlap] shape: _AnyShapeT, - fill_value: JustInt, + fill_value: _nt.JustInt, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.intp, _AnyShapeT]: ... +) -> _nt.Array[np.intp, _AnyShapeT]: ... @overload # known shape, float fill def full( # type: ignore[overload-overlap] shape: _AnyShapeT, - fill_value: JustFloat, + fill_value: _nt.JustFloat, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64, _AnyShapeT]: ... +) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, complex fill def full( # type: ignore[overload-overlap] shape: _AnyShapeT, - fill_value: JustComplex, + fill_value: _nt.JustComplex, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.complex128, _AnyShapeT]: ... +) -> _nt.Array[np.complex128, _AnyShapeT]: ... @overload # known shape, known scalar-type def full( # type: ignore[overload-overlap] shape: _AnyShapeT, @@ -970,17 +896,17 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # known shape, float64 def full( # type: ignore[overload-overlap] shape: _AnyShapeT, fill_value: object, - dtype: _DTypeLikeFloat64, + dtype: _nt.ToDTypeFloat64, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64, _AnyShapeT]: ... +) -> _nt.Array[np.float64, _AnyShapeT]: ... @overload # known shape, unknown dtype def full( shape: _AnyShapeT, @@ -990,7 +916,7 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, known fill scalar-type def full( # type: ignore[overload-overlap] shape: _ShapeLike, @@ -1000,7 +926,7 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, bool fill def full( # type: ignore[overload-overlap] shape: _ShapeLike, @@ -1010,37 +936,37 @@ def full( # type: ignore[overload-overlap] *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... @overload # unknown shape, int fill def full( # type: ignore[overload-overlap] shape: _ShapeLike, - fill_value: JustInt, + fill_value: _nt.JustInt, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... @overload # unknown shape, float fill def full( shape: _ShapeLike, - fill_value: JustFloat, + fill_value: _nt.JustFloat, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # unknown shape, complex fill def full( # type: ignore[overload-overlap] shape: _ShapeLike, - fill_value: JustComplex, + fill_value: _nt.JustComplex, dtype: None = None, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload # unknown shape, known dtype def full( shape: _ShapeLike, @@ -1060,17 +986,17 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, float64 def full( shape: _ShapeLike, fill_value: object, - dtype: _DTypeLikeFloat64, + dtype: _nt.ToDTypeFloat64, order: _OrderCF = "C", *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # unknown shape, unknown dtype def full( shape: _ShapeLike, @@ -1080,7 +1006,7 @@ def full( *, device: _Device | None = None, like: _SupportsArrayFunc | None = None, -) -> Array: ... +) -> _nt.Array: ... # NOTE: Keep in sync with `ones_like` and `._multiarray_umath.empty_like` @overload # known array, subok=True @@ -1105,164 +1031,164 @@ def zeros_like( ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload # bool 0d array-like def zeros_like( - a: ToBool_0d, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_0d, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.bool_]: ... +) -> _nt.Array0D[np.bool_]: ... @overload # bool 1d array-like def zeros_like( - a: ToBool_1ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_1ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.bool_]: ... +) -> _nt.Array1D[np.bool_]: ... @overload # bool 2d array-like def zeros_like( - a: ToBool_2ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_2ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.bool_]: ... +) -> _nt.Array2D[np.bool_]: ... @overload # bool 3d array-like def zeros_like( - a: ToBool_3ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_3ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.bool_]: ... +) -> _nt.Array3D[np.bool_]: ... @overload # int 0d array-like def zeros_like( - a: ToInt_0d, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_0d, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.intp]: ... +) -> _nt.Array0D[np.intp]: ... @overload # int 1d array-like def zeros_like( - a: ToInt_1ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_1ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # int 2d array-like def zeros_like( - a: ToInt_2ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_2ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.intp]: ... +) -> _nt.Array2D[np.intp]: ... @overload # int 3d array-like def zeros_like( - a: ToInt_3ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_3ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.intp]: ... +) -> _nt.Array3D[np.intp]: ... @overload # float 0d array-like def zeros_like( - a: ToFloat64_0d, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_0d, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.float64]: ... +) -> _nt.Array0D[np.float64]: ... @overload # float 1d array-like def zeros_like( - a: ToFloat64_1ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_1ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # float 2d array-like def zeros_like( - a: ToFloat64_2ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_2ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.float64]: ... +) -> _nt.Array2D[np.float64]: ... @overload # float 3d array-like def zeros_like( - a: ToFloat64_3ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_3ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.float64]: ... +) -> _nt.Array3D[np.float64]: ... @overload # complex 0d array-like def zeros_like( - a: ToComplex128_0d, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_0d, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.complex128]: ... +) -> _nt.Array0D[np.complex128]: ... @overload # complex 1d array-like def zeros_like( - a: ToComplex128_1ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_1ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload # complex 2d array-like def zeros_like( - a: ToComplex128_2ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_2ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.complex128]: ... +) -> _nt.Array2D[np.complex128]: ... @overload # complex 3d array-like def zeros_like( - a: ToComplex128_3ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_3ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.complex128]: ... +) -> _nt.Array3D[np.complex128]: ... @overload # array-like with known scalar-type, given shape def zeros_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1272,7 +1198,7 @@ def zeros_like( # type: ignore[overload-overlap] *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # array-like with known scalar-type, unknown shape def zeros_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1282,7 +1208,7 @@ def zeros_like( # type: ignore[overload-overlap] shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # given shape, given dtype def zeros_like( # type: ignore[overload-overlap] a: object, @@ -1312,7 +1238,7 @@ def zeros_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # unknown shape, given scalar-type def zeros_like( a: object, @@ -1322,47 +1248,47 @@ def zeros_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # bool array-like def zeros_like( # type: ignore[overload-overlap] - a: ToBool_nd, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_nd, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.bool_]: ... +) -> _nt.Array[np.bool_]: ... @overload # int array-like def zeros_like( # type: ignore[overload-overlap] - a: ToInt_nd, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_nd, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... @overload # float array-like def zeros_like( # type: ignore[overload-overlap] - a: ToFloat64_nd, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_nd, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # complex array-like def zeros_like( # type: ignore[overload-overlap] - a: ToComplex128_nd, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_nd, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload # given shape, unknown scalar-type def zeros_like( a: object, @@ -1372,7 +1298,7 @@ def zeros_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, unknown scalar-type def zeros_like( a: object, @@ -1382,7 +1308,7 @@ def zeros_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array: ... +) -> _nt.Array: ... # NOTE: Keep in sync with `zeros_like` and `._multiarray_umath.empty_like` @overload # known array, subok=True @@ -1407,164 +1333,164 @@ def ones_like( ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload # bool 0d array-like def ones_like( - a: ToBool_0d, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_0d, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.bool_]: ... +) -> _nt.Array0D[np.bool_]: ... @overload # bool 1d array-like def ones_like( - a: ToBool_1ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_1ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.bool_]: ... +) -> _nt.Array1D[np.bool_]: ... @overload # bool 2d array-like def ones_like( - a: ToBool_2ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_2ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.bool_]: ... +) -> _nt.Array2D[np.bool_]: ... @overload # bool 3d array-like def ones_like( - a: ToBool_3ds, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_3ds, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.bool_]: ... +) -> _nt.Array3D[np.bool_]: ... @overload # int 0d array-like def ones_like( - a: ToInt_0d, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_0d, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.intp]: ... +) -> _nt.Array0D[np.intp]: ... @overload # int 1d array-like def ones_like( - a: ToInt_1ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_1ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # int 2d array-like def ones_like( - a: ToInt_2ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_2ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.intp]: ... +) -> _nt.Array2D[np.intp]: ... @overload # int 3d array-like def ones_like( - a: ToInt_3ds, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_3ds, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.intp]: ... +) -> _nt.Array3D[np.intp]: ... @overload # float 0d array-like def ones_like( - a: ToFloat64_0d, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_0d, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.float64]: ... +) -> _nt.Array0D[np.float64]: ... @overload # float 1d array-like def ones_like( - a: ToFloat64_1ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_1ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # float 2d array-like def ones_like( - a: ToFloat64_2ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_2ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.float64]: ... +) -> _nt.Array2D[np.float64]: ... @overload # float 3d array-like def ones_like( - a: ToFloat64_3ds, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_3ds, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.float64]: ... +) -> _nt.Array3D[np.float64]: ... @overload # complex 0d array-like def ones_like( - a: ToComplex128_0d, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_0d, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.complex128]: ... +) -> _nt.Array0D[np.complex128]: ... @overload # complex 1d array-like def ones_like( - a: ToComplex128_1ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_1ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload # complex 2d array-like def ones_like( - a: ToComplex128_2ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_2ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.complex128]: ... +) -> _nt.Array2D[np.complex128]: ... @overload # complex 3d array-like def ones_like( - a: ToComplex128_3ds, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_3ds, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.complex128]: ... +) -> _nt.Array3D[np.complex128]: ... @overload # array-like with known scalar-type, given shape def ones_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1574,7 +1500,7 @@ def ones_like( # type: ignore[overload-overlap] *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # array-like with known scalar-type, unknown shape def ones_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1584,7 +1510,7 @@ def ones_like( # type: ignore[overload-overlap] shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # given shape, given dtype def ones_like( # type: ignore[overload-overlap] a: object, @@ -1614,7 +1540,7 @@ def ones_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # unknown shape, given scalar-type def ones_like( a: object, @@ -1624,47 +1550,47 @@ def ones_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # bool array-like def ones_like( # type: ignore[overload-overlap] - a: ToBool_nd, - dtype: _DTypeLikeBool | None = None, + a: _nt.ToBool_nd, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.bool_]: ... +) -> _nt.Array[np.bool_]: ... @overload # int array-like def ones_like( # type: ignore[overload-overlap] - a: ToInt_nd, - dtype: _DTypeLikeIntP | None = None, + a: _nt.ToInt_nd, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... @overload # float array-like def ones_like( # type: ignore[overload-overlap] - a: ToFloat64_nd, - dtype: _DTypeLikeFloat64 = None, + a: _nt.ToFloat64_nd, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # complex array-like def ones_like( # type: ignore[overload-overlap] - a: ToComplex128_nd, - dtype: _DTypeLikeComplex128 | None = None, + a: _nt.ToComplex128_nd, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload # given shape, unknown scalar-type def ones_like( a: object, @@ -1674,7 +1600,7 @@ def ones_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, unknown scalar-type def ones_like( a: object, @@ -1684,7 +1610,7 @@ def ones_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array: ... +) -> _nt.Array: ... # NOTE: Keep in sync with `{zeros,ones}_like` and `._multiarray_umath.empty_like` @overload # known array, subok=True @@ -1711,180 +1637,180 @@ def full_like( ) -> np.ndarray[_ShapeT, _DTypeT]: ... @overload # bool 0d array-like def full_like( - a: ToBool_0d, + a: _nt.ToBool_0d, fill_value: object, - dtype: _DTypeLikeBool | None = None, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.bool_]: ... +) -> _nt.Array0D[np.bool_]: ... @overload # bool 1d array-like def full_like( - a: ToBool_1ds, + a: _nt.ToBool_1ds, fill_value: object, - dtype: _DTypeLikeBool | None = None, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.bool_]: ... +) -> _nt.Array1D[np.bool_]: ... @overload # bool 2d array-like def full_like( - a: ToBool_2ds, + a: _nt.ToBool_2ds, fill_value: object, - dtype: _DTypeLikeBool | None = None, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.bool_]: ... +) -> _nt.Array2D[np.bool_]: ... @overload # bool 3d array-like def full_like( - a: ToBool_3ds, + a: _nt.ToBool_3ds, fill_value: object, - dtype: _DTypeLikeBool | None = None, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.bool_]: ... +) -> _nt.Array3D[np.bool_]: ... @overload # int 0d array-like def full_like( - a: ToInt_0d, + a: _nt.ToInt_0d, fill_value: object, - dtype: _DTypeLikeIntP | None = None, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.intp]: ... +) -> _nt.Array0D[np.intp]: ... @overload # int 1d array-like def full_like( - a: ToInt_1ds, + a: _nt.ToInt_1ds, fill_value: object, - dtype: _DTypeLikeIntP | None = None, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.intp]: ... +) -> _nt.Array1D[np.intp]: ... @overload # int 2d array-like def full_like( - a: ToInt_2ds, + a: _nt.ToInt_2ds, fill_value: object, - dtype: _DTypeLikeIntP | None = None, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.intp]: ... +) -> _nt.Array2D[np.intp]: ... @overload # int 3d array-like def full_like( - a: ToInt_3ds, + a: _nt.ToInt_3ds, fill_value: object, - dtype: _DTypeLikeIntP | None = None, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.intp]: ... +) -> _nt.Array3D[np.intp]: ... @overload # float 0d array-like def full_like( - a: ToFloat64_0d, + a: _nt.ToFloat64_0d, fill_value: object, - dtype: _DTypeLikeFloat64 = None, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.float64]: ... +) -> _nt.Array0D[np.float64]: ... @overload # float 1d array-like def full_like( - a: ToFloat64_1ds, + a: _nt.ToFloat64_1ds, fill_value: object, - dtype: _DTypeLikeFloat64 = None, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.float64]: ... +) -> _nt.Array1D[np.float64]: ... @overload # float 2d array-like def full_like( - a: ToFloat64_2ds, + a: _nt.ToFloat64_2ds, fill_value: object, - dtype: _DTypeLikeFloat64 = None, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.float64]: ... +) -> _nt.Array2D[np.float64]: ... @overload # float 3d array-like def full_like( - a: ToFloat64_3ds, + a: _nt.ToFloat64_3ds, fill_value: object, - dtype: _DTypeLikeFloat64 = None, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.float64]: ... +) -> _nt.Array3D[np.float64]: ... @overload # complex 0d array-like def full_like( - a: ToComplex128_0d, + a: _nt.ToComplex128_0d, fill_value: object, - dtype: _DTypeLikeComplex128 | None = None, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: tuple[()] | None = None, *, device: _Device | None = None, -) -> Array0D[np.complex128]: ... +) -> _nt.Array0D[np.complex128]: ... @overload # complex 1d array-like def full_like( - a: ToComplex128_1ds, + a: _nt.ToComplex128_1ds, fill_value: object, - dtype: _DTypeLikeComplex128 | None = None, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike1D | None = None, *, device: _Device | None = None, -) -> Array1D[np.complex128]: ... +) -> _nt.Array1D[np.complex128]: ... @overload # complex 2d array-like def full_like( - a: ToComplex128_2ds, + a: _nt.ToComplex128_2ds, fill_value: object, - dtype: _DTypeLikeComplex128 | None = None, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike2D | None = None, *, device: _Device | None = None, -) -> Array2D[np.complex128]: ... +) -> _nt.Array2D[np.complex128]: ... @overload # complex 3d array-like def full_like( - a: ToComplex128_3ds, + a: _nt.ToComplex128_3ds, fill_value: object, - dtype: _DTypeLikeComplex128 | None = None, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike3D | None = None, *, device: _Device | None = None, -) -> Array3D[np.complex128]: ... +) -> _nt.Array3D[np.complex128]: ... @overload # array-like with known scalar-type, given shape def full_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1895,7 +1821,7 @@ def full_like( # type: ignore[overload-overlap] *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # array-like with known scalar-type, unknown shape def full_like( # type: ignore[overload-overlap] a: _ArrayLike[_ScalarT], @@ -1906,7 +1832,7 @@ def full_like( # type: ignore[overload-overlap] shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # given shape, given dtype def full_like( # type: ignore[overload-overlap] a: object, @@ -1939,7 +1865,7 @@ def full_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[_ScalarT, _AnyShapeT]: ... +) -> _nt.Array[_ScalarT, _AnyShapeT]: ... @overload # unknown shape, given scalar-type def full_like( a: object, @@ -1950,51 +1876,51 @@ def full_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[_ScalarT]: ... +) -> _nt.Array[_ScalarT]: ... @overload # bool array-like def full_like( # type: ignore[overload-overlap] - a: ToBool_nd, + a: _nt.ToBool_nd, fill_value: object, - dtype: _DTypeLikeBool | None = None, + dtype: _nt.ToDTypeBool | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.bool_]: ... +) -> _nt.Array[np.bool_]: ... @overload # int array-like def full_like( # type: ignore[overload-overlap] - a: ToInt_nd, + a: _nt.ToInt_nd, fill_value: object, - dtype: _DTypeLikeIntP | None = None, + dtype: _nt.ToDTypeInt64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.intp]: ... +) -> _nt.Array[np.intp]: ... @overload # float array-like def full_like( # type: ignore[overload-overlap] - a: ToFloat64_nd, + a: _nt.ToFloat64_nd, fill_value: object, - dtype: _DTypeLikeFloat64 = None, + dtype: _nt.ToDTypeFloat64 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.float64]: ... +) -> _nt.Array[np.float64]: ... @overload # complex array-like def full_like( # type: ignore[overload-overlap] - a: ToComplex128_nd, + a: _nt.ToComplex128_nd, fill_value: object, - dtype: _DTypeLikeComplex128 | None = None, + dtype: _nt.ToDTypeComplex128 | None = None, order: _OrderKACF = "K", subok: py_bool = True, shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array[np.complex128]: ... +) -> _nt.Array[np.complex128]: ... @overload # given shape, unknown scalar-type def full_like( a: object, @@ -2005,7 +1931,7 @@ def full_like( *, shape: _AnyShapeT, device: _Device | None = None, -) -> Array[Any, _AnyShapeT]: ... +) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, unknown scalar-type def full_like( a: object, @@ -2016,7 +1942,7 @@ def full_like( shape: _ShapeLike | None = None, *, device: _Device | None = None, -) -> Array: ... +) -> _nt.Array: ... # @overload @@ -2025,155 +1951,157 @@ def count_nonzero(a: ArrayLike, axis: None = None, *, keepdims: L[False] = False def count_nonzero(a: ArrayLike, axis: _ShapeLike | None = None, *, keepdims: py_bool = False) -> Any: ... # -def flatnonzero(a: ArrayLike) -> Array1D[np.intp]: ... -def argwhere(a: ArrayLike) -> Array[np.intp]: ... +def flatnonzero(a: ArrayLike) -> _nt.Array1D[np.intp]: ... +def argwhere(a: ArrayLike) -> _nt.Array[np.intp]: ... # -def isfortran(a: Array | np.generic) -> py_bool: ... +def isfortran(a: _nt.Array | np.generic) -> py_bool: ... # @overload -def correlate(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array1D[np.bool]: ... +def correlate(a: _nt.ToBool_1d, v: _nt.ToBool_1d, mode: _Mode = "valid") -> _nt.Array1D[np.bool]: ... @overload -def correlate(a: ToUInteger_1d, v: CoUInt64_1d, mode: _Mode = "valid") -> Array1D[np.unsignedinteger]: ... +def correlate(a: _nt.ToUInteger_1d, v: _nt.CoUInt64_1d, mode: _Mode = "valid") -> _nt.Array1D[np.unsignedinteger]: ... @overload -def correlate(a: CoUInt64_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array1D[np.unsignedinteger]: ... # +def correlate( + a: _nt.CoUInt64_1d, v: _nt.ToUInteger_1d, mode: _Mode = "valid" +) -> _nt.Array1D[np.unsignedinteger]: ... # @overload -def correlate(a: ToSInteger_1d, v: CoInt64_1d, mode: _Mode = "valid") -> Array1D[np.signedinteger]: ... +def correlate(a: _nt.ToSInteger_1d, v: _nt.CoInt64_1d, mode: _Mode = "valid") -> _nt.Array1D[np.signedinteger]: ... @overload -def correlate(a: CoInt64_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array1D[np.signedinteger]: ... +def correlate(a: _nt.CoInt64_1d, v: _nt.ToSInteger_1d, mode: _Mode = "valid") -> _nt.Array1D[np.signedinteger]: ... @overload -def correlate(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array1D[np.floating]: ... +def correlate(a: _nt.ToFloating_1d, v: _nt.CoFloating_1d, mode: _Mode = "valid") -> _nt.Array1D[np.floating]: ... @overload -def correlate(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array1D[np.floating]: ... +def correlate(a: _nt.CoFloating_1d, v: _nt.ToFloating_1d, mode: _Mode = "valid") -> _nt.Array1D[np.floating]: ... @overload -def correlate(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array1D[np.complexfloating]: ... +def correlate(a: _nt.ToComplex_1d, v: _nt.CoComplex_1d, mode: _Mode = "valid") -> _nt.Array1D[np.complexfloating]: ... @overload -def correlate(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array1D[np.complexfloating]: ... +def correlate(a: _nt.CoComplex_1d, v: _nt.ToComplex_1d, mode: _Mode = "valid") -> _nt.Array1D[np.complexfloating]: ... @overload -def correlate(a: ToTimeDelta_1d, v: CoTimeDelta_1d, mode: _Mode = "valid") -> Array1D[np.timedelta64]: ... +def correlate(a: _nt.ToTimeDelta_1d, v: _nt.CoTimeDelta_1d, mode: _Mode = "valid") -> _nt.Array1D[np.timedelta64]: ... @overload -def correlate(a: CoTimeDelta_1d, v: ToTimeDelta_1d, mode: _Mode = "valid") -> Array1D[np.timedelta64]: ... +def correlate(a: _nt.CoTimeDelta_1d, v: _nt.ToTimeDelta_1d, mode: _Mode = "valid") -> _nt.Array1D[np.timedelta64]: ... @overload -def correlate(a: ToObject_1d, v: ToObject_1d, mode: _Mode = "valid") -> Array1D[np.object_]: ... +def correlate(a: _nt.ToObject_1d, v: _nt.ToObject_1d, mode: _Mode = "valid") -> _nt.Array1D[np.object_]: ... @overload def correlate( - a: CoComplex_1d | CoTimeDelta_1d | ToObject_1d, - v: CoComplex_1d | CoTimeDelta_1d | ToObject_1d, + a: _nt.CoComplex_1d | _nt.CoTimeDelta_1d | _nt.ToObject_1d, + v: _nt.CoComplex_1d | _nt.CoTimeDelta_1d | _nt.ToObject_1d, mode: _Mode = "valid", -) -> Array1D[Any]: ... +) -> _nt.Array1D[Any]: ... # @overload -def convolve(a: ToBool_1d, v: ToBool_1d, mode: _Mode = "valid") -> Array1D[np.bool]: ... +def convolve(a: _nt.ToBool_1d, v: _nt.ToBool_1d, mode: _Mode = "valid") -> _nt.Array1D[np.bool]: ... @overload -def convolve(a: ToUInteger_1d, v: CoUInt64_1d, mode: _Mode = "valid") -> Array1D[np.unsignedinteger]: ... +def convolve(a: _nt.ToUInteger_1d, v: _nt.CoUInt64_1d, mode: _Mode = "valid") -> _nt.Array1D[np.unsignedinteger]: ... @overload -def convolve(a: CoUInt64_1d, v: ToUInteger_1d, mode: _Mode = "valid") -> Array1D[np.unsignedinteger]: ... +def convolve(a: _nt.CoUInt64_1d, v: _nt.ToUInteger_1d, mode: _Mode = "valid") -> _nt.Array1D[np.unsignedinteger]: ... @overload -def convolve(a: ToSInteger_1d, v: CoInt64_1d, mode: _Mode = "valid") -> Array1D[np.signedinteger]: ... +def convolve(a: _nt.ToSInteger_1d, v: _nt.CoInt64_1d, mode: _Mode = "valid") -> _nt.Array1D[np.signedinteger]: ... @overload -def convolve(a: CoInt64_1d, v: ToSInteger_1d, mode: _Mode = "valid") -> Array1D[np.signedinteger]: ... +def convolve(a: _nt.CoInt64_1d, v: _nt.ToSInteger_1d, mode: _Mode = "valid") -> _nt.Array1D[np.signedinteger]: ... @overload -def convolve(a: ToFloating_1d, v: CoFloating_1d, mode: _Mode = "valid") -> Array1D[np.floating]: ... +def convolve(a: _nt.ToFloating_1d, v: _nt.CoFloating_1d, mode: _Mode = "valid") -> _nt.Array1D[np.floating]: ... @overload -def convolve(a: CoFloating_1d, v: ToFloating_1d, mode: _Mode = "valid") -> Array1D[np.floating]: ... +def convolve(a: _nt.CoFloating_1d, v: _nt.ToFloating_1d, mode: _Mode = "valid") -> _nt.Array1D[np.floating]: ... @overload -def convolve(a: ToComplex_1d, v: CoComplex_1d, mode: _Mode = "valid") -> Array1D[np.complexfloating]: ... +def convolve(a: _nt.ToComplex_1d, v: _nt.CoComplex_1d, mode: _Mode = "valid") -> _nt.Array1D[np.complexfloating]: ... @overload -def convolve(a: CoComplex_1d, v: ToComplex_1d, mode: _Mode = "valid") -> Array1D[np.complexfloating]: ... +def convolve(a: _nt.CoComplex_1d, v: _nt.ToComplex_1d, mode: _Mode = "valid") -> _nt.Array1D[np.complexfloating]: ... @overload -def convolve(a: ToTimeDelta_1d, v: CoTimeDelta_1d, mode: _Mode = "valid") -> Array1D[np.timedelta64]: ... +def convolve(a: _nt.ToTimeDelta_1d, v: _nt.CoTimeDelta_1d, mode: _Mode = "valid") -> _nt.Array1D[np.timedelta64]: ... @overload -def convolve(a: CoTimeDelta_1d, v: ToTimeDelta_1d, mode: _Mode = "valid") -> Array1D[np.timedelta64]: ... +def convolve(a: _nt.CoTimeDelta_1d, v: _nt.ToTimeDelta_1d, mode: _Mode = "valid") -> _nt.Array1D[np.timedelta64]: ... @overload -def convolve(a: ToObject_1d, v: ToObject_1d, mode: _Mode = "valid") -> Array1D[np.object_]: ... +def convolve(a: _nt.ToObject_1d, v: _nt.ToObject_1d, mode: _Mode = "valid") -> _nt.Array1D[np.object_]: ... @overload def convolve( - a: CoComplex_1d | CoTimeDelta_1d | ToObject_1d, - v: CoComplex_1d | CoTimeDelta_1d | ToObject_1d, + a: _nt.CoComplex_1d | _nt.CoTimeDelta_1d | _nt.ToObject_1d, + v: _nt.CoComplex_1d | _nt.CoTimeDelta_1d | _nt.ToObject_1d, mode: _Mode = "valid", -) -> Array1D[Any]: ... +) -> _nt.Array1D[Any]: ... # @overload -def outer(a: ToBool_nd, b: ToBool_nd, out: None = None) -> Array2D[np.bool]: ... +def outer(a: _nt.ToBool_nd, b: _nt.ToBool_nd, out: None = None) -> _nt.Array2D[np.bool]: ... @overload -def outer(a: ToUInteger_nd, b: CoUInt64_nd, out: None = None) -> Array2D[np.unsignedinteger]: ... +def outer(a: _nt.ToUInteger_nd, b: _nt.CoUInt64_nd, out: None = None) -> _nt.Array2D[np.unsignedinteger]: ... @overload -def outer(a: CoUInt64_nd, b: ToUInteger_nd, out: None = None) -> Array2D[np.unsignedinteger]: ... +def outer(a: _nt.CoUInt64_nd, b: _nt.ToUInteger_nd, out: None = None) -> _nt.Array2D[np.unsignedinteger]: ... @overload -def outer(a: ToSInteger_nd, b: CoInt64_nd, out: None = None) -> Array2D[np.signedinteger]: ... +def outer(a: _nt.ToSInteger_nd, b: _nt.CoInt64_nd, out: None = None) -> _nt.Array2D[np.signedinteger]: ... @overload -def outer(a: CoInt64_nd, b: ToSInteger_nd, out: None = None) -> Array2D[np.signedinteger]: ... +def outer(a: _nt.CoInt64_nd, b: _nt.ToSInteger_nd, out: None = None) -> _nt.Array2D[np.signedinteger]: ... @overload -def outer(a: ToFloating_nd, b: CoFloating_nd, out: None = None) -> Array2D[np.floating]: ... +def outer(a: _nt.ToFloating_nd, b: _nt.CoFloating_nd, out: None = None) -> _nt.Array2D[np.floating]: ... @overload -def outer(a: CoFloating_nd, b: ToFloating_nd, out: None = None) -> Array2D[np.floating]: ... +def outer(a: _nt.CoFloating_nd, b: _nt.ToFloating_nd, out: None = None) -> _nt.Array2D[np.floating]: ... @overload -def outer(a: ToComplex_nd, b: CoComplex_nd, out: None = None) -> Array2D[np.complexfloating]: ... +def outer(a: _nt.ToComplex_nd, b: _nt.CoComplex_nd, out: None = None) -> _nt.Array2D[np.complexfloating]: ... @overload -def outer(a: CoComplex_nd, b: ToComplex_nd, out: None = None) -> Array2D[np.complexfloating]: ... +def outer(a: _nt.CoComplex_nd, b: _nt.ToComplex_nd, out: None = None) -> _nt.Array2D[np.complexfloating]: ... @overload -def outer(a: ToTimeDelta_nd, b: CoTimeDelta_nd, out: None = None) -> Array2D[np.timedelta64]: ... +def outer(a: _nt.ToTimeDelta_nd, b: _nt.CoTimeDelta_nd, out: None = None) -> _nt.Array2D[np.timedelta64]: ... @overload -def outer(a: CoTimeDelta_nd, b: ToTimeDelta_nd, out: None = None) -> Array2D[np.timedelta64]: ... +def outer(a: _nt.CoTimeDelta_nd, b: _nt.ToTimeDelta_nd, out: None = None) -> _nt.Array2D[np.timedelta64]: ... @overload -def outer(a: ToObject_nd, b: ToObject_nd, out: None = None) -> Array2D[np.object_]: ... +def outer(a: _nt.ToObject_nd, b: _nt.ToObject_nd, out: None = None) -> _nt.Array2D[np.object_]: ... @overload def outer( - a: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, - b: CoComplex_nd | CoTimeDelta_nd | ToObject_nd, + a: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, + b: _nt.CoComplex_nd | _nt.CoTimeDelta_nd | _nt.ToObject_nd, out: _ArrayT, ) -> _ArrayT: ... # @overload -def tensordot(a: ToBool_1nd, b: ToBool_1nd, axes: _Axes = 2) -> Array[np.bool]: ... +def tensordot(a: _nt.ToBool_1nd, b: _nt.ToBool_1nd, axes: _Axes = 2) -> _nt.Array[np.bool]: ... @overload -def tensordot(a: ToUInteger_1nd, b: CoUInt64_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... +def tensordot(a: _nt.ToUInteger_1nd, b: _nt.CoUInt64_1nd, axes: _Axes = 2) -> _nt.Array[np.unsignedinteger]: ... @overload -def tensordot(a: CoUInt64_1nd, b: ToUInteger_1nd, axes: _Axes = 2) -> Array[np.unsignedinteger]: ... +def tensordot(a: _nt.CoUInt64_1nd, b: _nt.ToUInteger_1nd, axes: _Axes = 2) -> _nt.Array[np.unsignedinteger]: ... @overload -def tensordot(a: ToSInteger_1nd, b: CoInt64_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... +def tensordot(a: _nt.ToSInteger_1nd, b: _nt.CoInt64_1nd, axes: _Axes = 2) -> _nt.Array[np.signedinteger]: ... @overload -def tensordot(a: CoInt64_1nd, b: ToSInteger_1nd, axes: _Axes = 2) -> Array[np.signedinteger]: ... +def tensordot(a: _nt.CoInt64_1nd, b: _nt.ToSInteger_1nd, axes: _Axes = 2) -> _nt.Array[np.signedinteger]: ... @overload -def tensordot(a: ToFloating_1nd, b: CoFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... +def tensordot(a: _nt.ToFloating_1nd, b: _nt.CoFloating_1nd, axes: _Axes = 2) -> _nt.Array[np.floating]: ... @overload -def tensordot(a: CoFloating_1nd, b: ToFloating_1nd, axes: _Axes = 2) -> Array[np.floating]: ... +def tensordot(a: _nt.CoFloating_1nd, b: _nt.ToFloating_1nd, axes: _Axes = 2) -> _nt.Array[np.floating]: ... @overload -def tensordot(a: ToComplex_1nd, b: CoComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... +def tensordot(a: _nt.ToComplex_1nd, b: _nt.CoComplex_1nd, axes: _Axes = 2) -> _nt.Array[np.complexfloating]: ... @overload -def tensordot(a: CoComplex_1nd, b: ToComplex_1nd, axes: _Axes = 2) -> Array[np.complexfloating]: ... +def tensordot(a: _nt.CoComplex_1nd, b: _nt.ToComplex_1nd, axes: _Axes = 2) -> _nt.Array[np.complexfloating]: ... @overload -def tensordot(a: ToTimeDelta_1nd, b: CoTimeDelta_1nd, axes: _Axes = 2) -> Array[np.timedelta64]: ... +def tensordot(a: _nt.ToTimeDelta_1nd, b: _nt.CoTimeDelta_1nd, axes: _Axes = 2) -> _nt.Array[np.timedelta64]: ... @overload -def tensordot(a: CoTimeDelta_1nd, b: ToTimeDelta_1nd, axes: _Axes = 2) -> Array[np.timedelta64]: ... +def tensordot(a: _nt.CoTimeDelta_1nd, b: _nt.ToTimeDelta_1nd, axes: _Axes = 2) -> _nt.Array[np.timedelta64]: ... @overload -def tensordot(a: ToObject_1nd, b: ToObject_1nd, axes: _Axes = 2) -> Array[np.object_]: ... +def tensordot(a: _nt.ToObject_1nd, b: _nt.ToObject_1nd, axes: _Axes = 2) -> _nt.Array[np.object_]: ... @overload def tensordot( - a: CoComplex_1nd | CoTimeDelta_1nd | ToObject_1nd, - b: CoComplex_1nd | CoTimeDelta_1nd | ToObject_1nd, + a: _nt.CoComplex_1nd | _nt.CoTimeDelta_1nd | _nt.ToObject_1nd, + b: _nt.CoComplex_1nd | _nt.CoTimeDelta_1nd | _nt.ToObject_1nd, axes: _Axes = 2, -) -> Array[Any]: ... +) -> _nt.Array[Any]: ... # @overload -def roll(a: _ArrayLike[_ScalarT], shift: _ShapeLike, axis: _ShapeLike | None = None) -> Array[_ScalarT]: ... +def roll(a: _ArrayLike[_ScalarT], shift: _ShapeLike, axis: _ShapeLike | None = None) -> _nt.Array[_ScalarT]: ... @overload -def roll(a: ArrayLike, shift: _ShapeLike, axis: _ShapeLike | None = None) -> Array: ... +def roll(a: ArrayLike, shift: _ShapeLike, axis: _ShapeLike | None = None) -> _nt.Array: ... # -def rollaxis(a: Array[_ScalarT], axis: int, start: int = ...) -> Array[_ScalarT]: ... -def moveaxis(a: Array[_ScalarT], source: _ShapeLike, destination: _ShapeLike) -> Array[_ScalarT]: ... +def rollaxis(a: _nt.Array[_ScalarT], axis: int, start: int = ...) -> _nt.Array[_ScalarT]: ... +def moveaxis(a: _nt.Array[_ScalarT], source: _ShapeLike, destination: _ShapeLike) -> _nt.Array[_ScalarT]: ... # @overload def cross( - a: ToBool_1nd, - b: ToBool_1nd, + a: _nt.ToBool_1nd, + b: _nt.ToBool_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, @@ -2181,103 +2109,113 @@ def cross( ) -> NoReturn: ... @overload def cross( - a: ToUInteger_1nd, - b: CoUInt64_1nd, + a: _nt.ToUInteger_1nd, + b: _nt.CoUInt64_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.unsignedinteger]: ... +) -> _nt.Array[np.unsignedinteger]: ... @overload def cross( - a: CoUInt64_1nd, - b: ToUInteger_1nd, + a: _nt.CoUInt64_1nd, + b: _nt.ToUInteger_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.unsignedinteger]: ... +) -> _nt.Array[np.unsignedinteger]: ... @overload def cross( - a: ToSInteger_1nd, - b: CoInt64_1nd, + a: _nt.ToSInteger_1nd, + b: _nt.CoInt64_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.signedinteger]: ... +) -> _nt.Array[np.signedinteger]: ... @overload def cross( - a: CoInt64_1nd, - b: ToSInteger_1nd, + a: _nt.CoInt64_1nd, + b: _nt.ToSInteger_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.signedinteger]: ... +) -> _nt.Array[np.signedinteger]: ... @overload def cross( - a: ToFloating_1nd, - b: CoFloating_1nd, + a: _nt.ToFloating_1nd, + b: _nt.CoFloating_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def cross( - a: CoFloating_1nd, - b: ToFloating_1nd, + a: _nt.CoFloating_1nd, + b: _nt.ToFloating_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.floating]: ... +) -> _nt.Array[np.floating]: ... @overload def cross( - a: ToComplex_1nd, - b: CoComplex_1nd, + a: _nt.ToComplex_1nd, + b: _nt.CoComplex_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def cross( - a: CoComplex_1nd, - b: ToComplex_1nd, + a: _nt.CoComplex_1nd, + b: _nt.ToComplex_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[np.complexfloating]: ... +) -> _nt.Array[np.complexfloating]: ... @overload def cross( - a: CoComplex_1nd, - b: CoComplex_1nd, + a: _nt.CoComplex_1nd, + b: _nt.CoComplex_1nd, axisa: int = -1, axisb: int = -1, axisc: int = -1, axis: int | None = None, -) -> Array[Any]: ... +) -> _nt.Array[Any]: ... # @overload -def indices(dimensions: ToInteger_1d, dtype: type[JustInt] = ..., sparse: L[False] = False) -> Array[np.intp]: ... +def indices( + dimensions: _nt.ToInteger_1d, dtype: type[_nt.JustInt] = ..., sparse: L[False] = False +) -> _nt.Array[np.intp]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: type[JustInt], sparse: L[True]) -> tuple[Array[np.intp], ...]: ... +def indices( + dimensions: _nt.ToInteger_1d, dtype: type[_nt.JustInt], sparse: L[True] +) -> tuple[_nt.Array[np.intp], ...]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: type[JustInt] = ..., *, sparse: L[True]) -> tuple[Array[np.intp], ...]: ... +def indices( + dimensions: _nt.ToInteger_1d, dtype: type[_nt.JustInt] = ..., *, sparse: L[True] +) -> tuple[_nt.Array[np.intp], ...]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: _DTypeLike[_ScalarT], sparse: L[False] = False) -> Array[_ScalarT]: ... +def indices( + dimensions: _nt.ToInteger_1d, dtype: _DTypeLike[_ScalarT], sparse: L[False] = False +) -> _nt.Array[_ScalarT]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: _DTypeLike[_ScalarT], sparse: L[True]) -> tuple[Array[_ScalarT], ...]: ... +def indices( + dimensions: _nt.ToInteger_1d, dtype: _DTypeLike[_ScalarT], sparse: L[True] +) -> tuple[_nt.Array[_ScalarT], ...]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: DTypeLike = ..., sparse: L[False] = False) -> Array: ... +def indices(dimensions: _nt.ToInteger_1d, dtype: DTypeLike = ..., sparse: L[False] = False) -> _nt.Array: ... @overload -def indices(dimensions: ToInteger_1d, dtype: DTypeLike, sparse: L[True]) -> tuple[Array, ...]: ... +def indices(dimensions: _nt.ToInteger_1d, dtype: DTypeLike, sparse: L[True]) -> tuple[_nt.Array, ...]: ... @overload -def indices(dimensions: ToInteger_1d, dtype: DTypeLike = ..., *, sparse: L[True]) -> tuple[Array, ...]: ... +def indices(dimensions: _nt.ToInteger_1d, dtype: DTypeLike = ..., *, sparse: L[True]) -> tuple[_nt.Array, ...]: ... # def fromfunction( @@ -2298,11 +2236,13 @@ def base_repr(number: SupportsAbs[float], base: float = 2, padding: SupportsInde # @overload -def identity(n: int, dtype: None = None, *, like: _SupportsArrayFunc | None = None) -> Array2D[np.float64]: ... +def identity(n: int, dtype: None = None, *, like: _SupportsArrayFunc | None = None) -> _nt.Array2D[np.float64]: ... @overload -def identity(n: int, dtype: _DTypeLike[_ScalarT], *, like: _SupportsArrayFunc | None = None) -> Array2D[_ScalarT]: ... +def identity( + n: int, dtype: _DTypeLike[_ScalarT], *, like: _SupportsArrayFunc | None = None +) -> _nt.Array2D[_ScalarT]: ... @overload -def identity(n: int, dtype: DTypeLike, *, like: _SupportsArrayFunc | None = None) -> Array2D: ... +def identity(n: int, dtype: DTypeLike, *, like: _SupportsArrayFunc | None = None) -> _nt.Array2D: ... # def allclose( @@ -2312,28 +2252,28 @@ def allclose( # @overload def isclose( - a: ToGeneric_0d, - b: ToGeneric_0d, + a: _nt.ToGeneric_0d, + b: _nt.ToGeneric_0d, rtol: ArrayLike = 1e-5, atol: ArrayLike = 1e-8, equal_nan: py_bool = False, ) -> np.bool: ... @overload def isclose( - a: ToGeneric_1nd, - b: ToGeneric_nd, + a: _nt.ToGeneric_1nd, + b: _nt.ToGeneric_nd, rtol: ArrayLike = 1e-5, atol: ArrayLike = 1e-8, equal_nan: py_bool = False, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... @overload def isclose( - a: ToGeneric_nd, - b: ToGeneric_1nd, + a: _nt.ToGeneric_nd, + b: _nt.ToGeneric_1nd, rtol: ArrayLike = 1e-5, atol: ArrayLike = 1e-8, equal_nan: py_bool = False, -) -> Array[np.bool]: ... +) -> _nt.Array[np.bool]: ... # def array_equal(a1: ArrayLike, a2: ArrayLike, equal_nan: py_bool = False) -> py_bool: ... @@ -2342,7 +2282,7 @@ def array_equiv(a1: ArrayLike, a2: ArrayLike) -> py_bool: ... # @overload def astype( - x: Array[Any, _ShapeT], + x: _nt.Array[Any, _ShapeT], dtype: _DTypeLike[_ScalarT], /, *, @@ -2351,7 +2291,7 @@ def astype( ) -> ndarray[_ShapeT, dtype[_ScalarT]]: ... @overload def astype( - x: Array[Any, _ShapeT], + x: _nt.Array[Any, _ShapeT], dtype: DTypeLike, /, *, From 55aba9437b84cda464fa4324bf373b32afa8ece9 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:34:30 +0200 Subject: [PATCH 08/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`fft`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/fft/_helper.pyi | 161 +++++++++++++++----------------- 1 file changed, 73 insertions(+), 88 deletions(-) diff --git a/src/numpy-stubs/fft/_helper.pyi b/src/numpy-stubs/fft/_helper.pyi index d5e38a29..bea7381e 100644 --- a/src/numpy-stubs/fft/_helper.pyi +++ b/src/numpy-stubs/fft/_helper.pyi @@ -1,29 +1,8 @@ from typing import Any, Final, Literal as L, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import ( - Array, - Array1D, - CanLenArray, - JustComplex, - ToBool_1d, - ToBool_1nd, - ToBytes_1d, - ToBytes_1nd, - ToComplex128_1d, - ToComplex128_1nd, - ToFloat64_1d, - ToFloat64_1nd, - ToGeneric_1nd, - ToInt_1d, - ToInt_1nd, - ToStr_1d, - ToStr_1nd, - co_complex, - co_float, - co_integer, -) from numpy._typing import _ShapeLike __all__ = ["fftfreq", "fftshift", "ifftshift", "rfftfreq"] @@ -44,140 +23,146 @@ integer_types: Final[tuple[type[int], type[np.integer]]] = ... # keep in sync with `ifftshift` @overload -def fftshift(x: ToBool_1d, axes: _ShapeLike | None = None) -> Array1D[np.bool]: ... +def fftshift(x: _nt.ToBool_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... @overload -def fftshift(x: ToBool_1nd, axes: _ShapeLike | None = None) -> Array[np.bool]: ... +def fftshift(x: _nt.ToBool_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bool]: ... @overload -def fftshift(x: CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None) -> Array[_ScalarT, _ShapeT]: ... +def fftshift(x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def fftshift(x: ToInt_1d, axes: _ShapeLike | None = None) -> Array1D[np.intp]: ... +def fftshift(x: _nt.ToInt_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... @overload -def fftshift(x: ToInt_1nd, axes: _ShapeLike | None = None) -> Array[np.intp]: ... +def fftshift(x: _nt.ToInt_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.intp]: ... @overload -def fftshift(x: ToFloat64_1d, axes: _ShapeLike | None = None) -> Array1D[np.float64]: ... +def fftshift(x: _nt.ToFloat64_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... @overload -def fftshift(x: ToFloat64_1nd, axes: _ShapeLike | None = None) -> Array[np.float64]: ... +def fftshift(x: _nt.ToFloat64_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... @overload -def fftshift(x: ToComplex128_1d, axes: _ShapeLike | None = None) -> Array1D[np.complex128]: ... +def fftshift(x: _nt.ToComplex128_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... @overload -def fftshift(x: ToComplex128_1nd, axes: _ShapeLike | None = None) -> Array[np.complex128]: ... +def fftshift(x: _nt.ToComplex128_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.complex128]: ... @overload -def fftshift(x: ToBytes_1d, axes: _ShapeLike | None = None) -> Array1D[np.bytes_]: ... +def fftshift(x: _nt.ToBytes_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... @overload -def fftshift(x: ToBytes_1nd, axes: _ShapeLike | None = None) -> Array[np.bytes_]: ... +def fftshift(x: _nt.ToBytes_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... @overload -def fftshift(x: ToStr_1d, axes: _ShapeLike | None = None) -> Array1D[np.str_]: ... +def fftshift(x: _nt.ToStr_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... @overload -def fftshift(x: ToStr_1nd, axes: _ShapeLike | None = None) -> Array[np.str_]: ... +def fftshift(x: _nt.ToStr_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.str_]: ... @overload -def fftshift(x: ToGeneric_1nd, axes: _ShapeLike | None = None) -> Array[Any]: ... +def fftshift(x: _nt.ToGeneric_1nd, axes: _ShapeLike | None = None) -> _nt.Array[Any]: ... # keep in sync with `fftshift` @overload -def ifftshift(x: ToBool_1d, axes: _ShapeLike | None = None) -> Array1D[np.bool]: ... +def ifftshift(x: _nt.ToBool_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bool]: ... @overload -def ifftshift(x: ToBool_1nd, axes: _ShapeLike | None = None) -> Array[np.bool]: ... +def ifftshift(x: _nt.ToBool_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bool]: ... @overload -def ifftshift(x: CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None) -> Array[_ScalarT, _ShapeT]: ... +def ifftshift( + x: _nt.CanLenArray[_ScalarT, _ShapeT], axes: _ShapeLike | None = None +) -> _nt.Array[_ScalarT, _ShapeT]: ... @overload -def ifftshift(x: ToInt_1d, axes: _ShapeLike | None = None) -> Array1D[np.intp]: ... +def ifftshift(x: _nt.ToInt_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.intp]: ... @overload -def ifftshift(x: ToInt_1nd, axes: _ShapeLike | None = None) -> Array[np.intp]: ... +def ifftshift(x: _nt.ToInt_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.intp]: ... @overload -def ifftshift(x: ToFloat64_1d, axes: _ShapeLike | None = None) -> Array1D[np.float64]: ... +def ifftshift(x: _nt.ToFloat64_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.float64]: ... @overload -def ifftshift(x: ToFloat64_1nd, axes: _ShapeLike | None = None) -> Array[np.float64]: ... +def ifftshift(x: _nt.ToFloat64_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.float64]: ... @overload -def ifftshift(x: ToComplex128_1d, axes: _ShapeLike | None = None) -> Array1D[np.complex128]: ... +def ifftshift(x: _nt.ToComplex128_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.complex128]: ... @overload -def ifftshift(x: ToComplex128_1nd, axes: _ShapeLike | None = None) -> Array[np.complex128]: ... +def ifftshift(x: _nt.ToComplex128_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.complex128]: ... @overload -def ifftshift(x: ToBytes_1d, axes: _ShapeLike | None = None) -> Array1D[np.bytes_]: ... +def ifftshift(x: _nt.ToBytes_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.bytes_]: ... @overload -def ifftshift(x: ToBytes_1nd, axes: _ShapeLike | None = None) -> Array[np.bytes_]: ... +def ifftshift(x: _nt.ToBytes_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.bytes_]: ... @overload -def ifftshift(x: ToStr_1d, axes: _ShapeLike | None = None) -> Array1D[np.str_]: ... +def ifftshift(x: _nt.ToStr_1d, axes: _ShapeLike | None = None) -> _nt.Array1D[np.str_]: ... @overload -def ifftshift(x: ToStr_1nd, axes: _ShapeLike | None = None) -> Array[np.str_]: ... +def ifftshift(x: _nt.ToStr_1nd, axes: _ShapeLike | None = None) -> _nt.Array[np.str_]: ... @overload -def ifftshift(x: ToGeneric_1nd, axes: _ShapeLike | None = None) -> Array[Any]: ... +def ifftshift(x: _nt.ToGeneric_1nd, axes: _ShapeLike | None = None) -> _nt.Array[Any]: ... # keep in sync with `rfftfreq` @overload # 0d float | integer -> 1d float64 -def fftfreq(n: _Int, d: float | co_integer = 1.0, device: _Device | None = None) -> Array1D[np.float64]: ... +def fftfreq(n: _Int, d: float | _nt.co_integer = 1.0, device: _Device | None = None) -> _nt.Array1D[np.float64]: ... @overload # 0d longdouble -> 1d longdouble -def fftfreq(n: _Int, d: np.longdouble, device: _Device | None = None) -> Array1D[np.longdouble]: ... +def fftfreq(n: _Int, d: np.longdouble, device: _Device | None = None) -> _nt.Array1D[np.longdouble]: ... @overload # 0d float{16,32,64} -> 1d float64 -def fftfreq(n: _Int, d: _Floating64Max, device: _Device | None = None) -> Array1D[np.float64]: ... +def fftfreq(n: _Int, d: _Floating64Max, device: _Device | None = None) -> _nt.Array1D[np.float64]: ... @overload # 0d complex -> 1d complex128 -def fftfreq(n: _Int, d: JustComplex, device: _Device | None = None) -> Array1D[np.complex128]: ... +def fftfreq(n: _Int, d: _nt.JustComplex, device: _Device | None = None) -> _nt.Array1D[np.complex128]: ... @overload # 0d clongdouble -> 1d clongdouble -def fftfreq(n: _Int, d: np.clongdouble, device: _Device | None = None) -> Array1D[np.clongdouble]: ... +def fftfreq(n: _Int, d: np.clongdouble, device: _Device | None = None) -> _nt.Array1D[np.clongdouble]: ... @overload # 0d complex{64,128} -> 1d complex128 -def fftfreq(n: _Int, d: _CFloating64Max, device: _Device | None = None) -> Array1D[np.complex128]: ... +def fftfreq(n: _Int, d: _CFloating64Max, device: _Device | None = None) -> _nt.Array1D[np.complex128]: ... @overload # Nd +integer -> Nd float64 -def fftfreq(n: _Int, d: Array[co_integer, _ShapeT], device: _Device | None = None) -> Array[np.float64, _ShapeT]: ... +def fftfreq( + n: _Int, d: _nt.Array[_nt.co_integer, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.float64, _ShapeT]: ... @overload # Nd longdouble -> Nd longdouble def fftfreq( - n: _Int, d: Array[np.longdouble, _ShapeT], device: _Device | None = None -) -> Array[np.longdouble, _ShapeT]: ... + n: _Int, d: _nt.Array[np.longdouble, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.longdouble, _ShapeT]: ... @overload # Nd float{16,32,64} -> Nd float64 def fftfreq( - n: _Int, d: Array[_Floating64Max, _ShapeT], device: _Device | None = None -) -> Array[np.float64, _ShapeT]: ... + n: _Int, d: _nt.Array[_Floating64Max, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.float64, _ShapeT]: ... @overload # Nd complex longdouble -> Nd complex longdouble def fftfreq( - n: _Int, d: Array[np.clongdouble, _ShapeT], device: _Device | None = None -) -> Array[np.clongdouble, _ShapeT]: ... + n: _Int, d: _nt.Array[np.clongdouble, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.clongdouble, _ShapeT]: ... @overload # Nd complex{64,128} -> Nd complex128 def fftfreq( - n: _Int, d: Array[_CFloating64Max, _ShapeT], device: _Device | None = None -) -> Array[np.complex128, _ShapeT]: ... + n: _Int, d: _nt.Array[_CFloating64Max, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.complex128, _ShapeT]: ... @overload # ?d +floating -> Nd floating def fftfreq( - n: _Int, d: float | co_float | Array[co_float] = 1.0, device: _Device | None = None -) -> Array[np.floating]: ... + n: _Int, d: float | _nt.co_float | _nt.Array[_nt.co_float] = 1.0, device: _Device | None = None +) -> _nt.Array[np.floating]: ... @overload # ?d +complex -> Nd inexact def fftfreq( - n: _Int, d: complex | co_complex | Array[co_complex] = 1.0, device: _Device | None = None -) -> Array[np.inexact]: ... + n: _Int, d: complex | _nt.co_complex | _nt.Array[_nt.co_complex] = 1.0, device: _Device | None = None +) -> _nt.Array[np.inexact]: ... # keep in sync with `fftfreq` @overload # 0d float | integer -> 1d float64 -def rfftfreq(n: _Int, d: float | co_integer = 1.0, device: _Device | None = None) -> Array1D[np.float64]: ... +def rfftfreq(n: _Int, d: float | _nt.co_integer = 1.0, device: _Device | None = None) -> _nt.Array1D[np.float64]: ... @overload # 0d longdouble -> 1d longdouble -def rfftfreq(n: _Int, d: np.longdouble, device: _Device | None = None) -> Array1D[np.longdouble]: ... +def rfftfreq(n: _Int, d: np.longdouble, device: _Device | None = None) -> _nt.Array1D[np.longdouble]: ... @overload # 0d float{16,32,64} -> 1d float64 -def rfftfreq(n: _Int, d: _Floating64Max, device: _Device | None = None) -> Array1D[np.float64]: ... +def rfftfreq(n: _Int, d: _Floating64Max, device: _Device | None = None) -> _nt.Array1D[np.float64]: ... @overload # 0d complex -> 1d complex128 -def rfftfreq(n: _Int, d: JustComplex, device: _Device | None = None) -> Array1D[np.complex128]: ... +def rfftfreq(n: _Int, d: _nt.JustComplex, device: _Device | None = None) -> _nt.Array1D[np.complex128]: ... @overload # 0d clongdouble -> 1d clongdouble -def rfftfreq(n: _Int, d: np.clongdouble, device: _Device | None = None) -> Array1D[np.clongdouble]: ... +def rfftfreq(n: _Int, d: np.clongdouble, device: _Device | None = None) -> _nt.Array1D[np.clongdouble]: ... @overload # 0d complex{64,128} -> 1d complex128 -def rfftfreq(n: _Int, d: _CFloating64Max, device: _Device | None = None) -> Array1D[np.complex128]: ... +def rfftfreq(n: _Int, d: _CFloating64Max, device: _Device | None = None) -> _nt.Array1D[np.complex128]: ... @overload # Nd +integer -> Nd float64 -def rfftfreq(n: _Int, d: Array[co_integer, _ShapeT], device: _Device | None = None) -> Array[np.float64, _ShapeT]: ... +def rfftfreq( + n: _Int, d: _nt.Array[_nt.co_integer, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.float64, _ShapeT]: ... @overload # Nd longdouble -> Nd longdouble def rfftfreq( - n: _Int, d: Array[np.longdouble, _ShapeT], device: _Device | None = None -) -> Array[np.longdouble, _ShapeT]: ... + n: _Int, d: _nt.Array[np.longdouble, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.longdouble, _ShapeT]: ... @overload # Nd float{16,32,64} -> Nd float64 def rfftfreq( - n: _Int, d: Array[_Floating64Max, _ShapeT], device: _Device | None = None -) -> Array[np.float64, _ShapeT]: ... + n: _Int, d: _nt.Array[_Floating64Max, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.float64, _ShapeT]: ... @overload # Nd complex longdouble -> Nd complex longdouble def rfftfreq( - n: _Int, d: Array[np.clongdouble, _ShapeT], device: _Device | None = None -) -> Array[np.clongdouble, _ShapeT]: ... + n: _Int, d: _nt.Array[np.clongdouble, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.clongdouble, _ShapeT]: ... @overload # Nd complex{64,128} -> Nd complex128 def rfftfreq( - n: _Int, d: Array[_CFloating64Max, _ShapeT], device: _Device | None = None -) -> Array[np.complex128, _ShapeT]: ... + n: _Int, d: _nt.Array[_CFloating64Max, _ShapeT], device: _Device | None = None +) -> _nt.Array[np.complex128, _ShapeT]: ... @overload # ?d +floating -> Nd floating def rfftfreq( - n: _Int, d: float | co_float | Array[co_float] = 1.0, device: _Device | None = None -) -> Array[np.floating]: ... + n: _Int, d: float | _nt.co_float | _nt.Array[_nt.co_float] = 1.0, device: _Device | None = None +) -> _nt.Array[np.floating]: ... @overload # ?d +complex -> Nd inexact def rfftfreq( - n: _Int, d: complex | co_complex | Array[co_complex] = 1.0, device: _Device | None = None -) -> Array[np.inexact]: ... + n: _Int, d: complex | _nt.co_complex | _nt.Array[_nt.co_complex] = 1.0, device: _Device | None = None +) -> _nt.Array[np.inexact]: ... From 899756cf0850e5088fab8430f49cb3ba1512555d Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:34:59 +0200 Subject: [PATCH 09/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`ctypeslib`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/ctypeslib.pyi | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/numpy-stubs/ctypeslib.pyi b/src/numpy-stubs/ctypeslib.pyi index 4d04a8ba..c8b43ec1 100644 --- a/src/numpy-stubs/ctypeslib.pyi +++ b/src/numpy-stubs/ctypeslib.pyi @@ -5,11 +5,11 @@ from collections.abc import Iterable, Sequence from typing import Any, ClassVar, Generic, Literal as L, TypeAlias, overload from typing_extensions import TypeVar +import _numtype as _nt import numpy as np -from _numtype import JustInt from numpy._core._internal import _ctypes from numpy._core.multiarray import flagsobj -from numpy._typing import NDArray, _ArrayLike, _BoolCodes, _DTypeLike, _Shape, _ShapeLike, _VoidDTypeLike +from numpy._typing import _ArrayLike, _BoolCodes, _DTypeLike, _Shape, _ShapeLike, _VoidDTypeLike from numpy._typing._char_codes import ( _Float32Codes, _Float64Codes, @@ -66,7 +66,7 @@ class _ndptr(ct.c_void_p, Generic[_DTypeT0_co, _ShapeT0_co]): def from_param(cls: type[_ndptr[_DTypeT, _ShapeT]], obj: np.ndarray[_ShapeT, _DTypeT]) -> _ctypes[int]: ... @overload @classmethod - def from_param(cls: type[_ndptr], obj: NDArray[Any]) -> _ctypes[int]: ... # pyright: ignore[reportIncompatibleMethodOverride] + def from_param(cls: type[_ndptr], obj: _nt.Array[Any]) -> _ctypes[int]: ... # pyright: ignore[reportIncompatibleMethodOverride] class _concrete_ndptr(_ndptr[_DTypeT_co, _ShapeT_co], Generic[_DTypeT_co, _ShapeT_co]): def _check_retval_(self) -> np.ndarray[_ShapeT_co, _DTypeT_co]: ... @@ -116,11 +116,11 @@ def ndpointer( # @overload -def as_array(obj: ct._PointerLike, shape: Sequence[int]) -> NDArray[Any]: ... +def as_array(obj: ct._PointerLike, shape: Sequence[int]) -> _nt.Array[Any]: ... @overload -def as_array(obj: _ArrayLike[_ScalarT], shape: _ShapeLike | None = ...) -> NDArray[_ScalarT]: ... +def as_array(obj: _ArrayLike[_ScalarT], shape: _ShapeLike | None = ...) -> _nt.Array[_ScalarT]: ... @overload -def as_array(obj: object, shape: _ShapeLike | None = ...) -> NDArray[Any]: ... +def as_array(obj: object, shape: _ShapeLike | None = ...) -> _nt.Array[Any]: ... # NOTE: The overlapping overloads ignores are a temporary workaround for the non-unique # intp/long/longlong issues, and otherwise mypy false positives. @@ -128,53 +128,53 @@ def as_array(obj: object, shape: _ShapeLike | None = ...) -> NDArray[Any]: ... @overload # bool def as_ctypes(obj: np.bool) -> ct.c_bool: ... @overload -def as_ctypes(obj: NDArray[np.bool]) -> ct.Array[ct.c_bool]: ... +def as_ctypes(obj: _nt.Array[np.bool]) -> ct.Array[ct.c_bool]: ... @overload # int8 / byte def as_ctypes(obj: np.int8) -> ct.c_int8: ... @overload -def as_ctypes(obj: NDArray[np.int8]) -> ct.Array[ct.c_int8]: ... +def as_ctypes(obj: _nt.Array[np.int8]) -> ct.Array[ct.c_int8]: ... @overload # int16 / short def as_ctypes(obj: np.int16) -> ct.c_int16: ... @overload -def as_ctypes(obj: NDArray[np.int16]) -> ct.Array[ct.c_int16]: ... +def as_ctypes(obj: _nt.Array[np.int16]) -> ct.Array[ct.c_int16]: ... @overload # int32 / int[c] def as_ctypes(obj: np.int32) -> ct.c_int32: ... @overload -def as_ctypes(obj: NDArray[np.int32]) -> ct.Array[ct.c_int32]: ... +def as_ctypes(obj: _nt.Array[np.int32]) -> ct.Array[ct.c_int32]: ... @overload # int64 / longlong (which might be an alias for for `long`) def as_ctypes(obj: np.int64) -> ct.c_int64: ... @overload -def as_ctypes(obj: NDArray[np.int64]) -> ct.Array[ct.c_int64]: ... +def as_ctypes(obj: _nt.Array[np.int64]) -> ct.Array[ct.c_int64]: ... @overload # uint8 / ubyte def as_ctypes(obj: np.uint8) -> ct.c_uint8: ... @overload -def as_ctypes(obj: NDArray[np.uint8]) -> ct.Array[ct.c_uint8]: ... +def as_ctypes(obj: _nt.Array[np.uint8]) -> ct.Array[ct.c_uint8]: ... @overload # uint16 / ushort def as_ctypes(obj: np.uint16) -> ct.c_uint16: ... @overload -def as_ctypes(obj: NDArray[np.uint16]) -> ct.Array[ct.c_uint16]: ... +def as_ctypes(obj: _nt.Array[np.uint16]) -> ct.Array[ct.c_uint16]: ... @overload # uint32 / uint def as_ctypes(obj: np.uint32) -> ct.c_uint32: ... @overload -def as_ctypes(obj: NDArray[np.uint32]) -> ct.Array[ct.c_uint32]: ... +def as_ctypes(obj: _nt.Array[np.uint32]) -> ct.Array[ct.c_uint32]: ... @overload # uint64 / ulonglong def as_ctypes(obj: np.uint64) -> ct.c_uint64: ... @overload -def as_ctypes(obj: NDArray[np.uint64]) -> ct.Array[ct.c_uint64]: ... +def as_ctypes(obj: _nt.Array[np.uint64]) -> ct.Array[ct.c_uint64]: ... @overload # float32 / single / float def as_ctypes(obj: np.float32) -> ct.c_float: ... @overload -def as_ctypes(obj: NDArray[np.float32]) -> ct.Array[ct.c_float]: ... +def as_ctypes(obj: _nt.Array[np.float32]) -> ct.Array[ct.c_float]: ... @overload # float64 / double def as_ctypes(obj: np.float64) -> ct.c_double: ... @overload -def as_ctypes(obj: NDArray[np.float64]) -> ct.Array[ct.c_double]: ... +def as_ctypes(obj: _nt.Array[np.float64]) -> ct.Array[ct.c_double]: ... @overload # float96 / float128 / longdouble def as_ctypes(obj: np.longdouble) -> ct.c_longdouble: ... @overload -def as_ctypes(obj: NDArray[np.longdouble]) -> ct.Array[ct.c_longdouble]: ... +def as_ctypes(obj: _nt.Array[np.longdouble]) -> ct.Array[ct.c_longdouble]: ... -# +# TODO(jorenham): https://github.com/numpy/numtype/issues/522 @overload def as_ctypes_type(dtype: _DTypeLike[np.bool] | type[bool | ct.c_bool] | _BoolCodes) -> type[ct.c_bool]: ... @overload @@ -186,7 +186,7 @@ def as_ctypes_type(dtype: _DTypeLike[np.int32] | type[ct.c_int32 | ct.c_int] | _ @overload def as_ctypes_type(dtype: type[ct.c_long] | _LongCodes) -> type[ct.c_long]: ... @overload -def as_ctypes_type(dtype: type[JustInt | ct.c_ssize_t] | _IntPCodes) -> type[ct.c_ssize_t]: ... +def as_ctypes_type(dtype: type[_nt.JustInt | ct.c_ssize_t] | _IntPCodes) -> type[ct.c_ssize_t]: ... @overload def as_ctypes_type(dtype: _DTypeLike[np.int64] | type[ct.c_int64] | _Int64Codes) -> type[ct.c_int64]: ... @overload From 6ceee910bd6524892fd10ecaa6f5878563bdade6 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:39:06 +0200 Subject: [PATCH 10/13] =?UTF-8?q?=F0=9F=8E=A8=20refactor=20`from=20=5Fnumt?= =?UTF-8?q?ype=20import`=20in=20`@test`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@test/static/accept/arraysetops.pyi | 93 +++++++++---------- .../@test/static/accept/linalg.pyi | 6 +- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/src/numpy-stubs/@test/static/accept/arraysetops.pyi b/src/numpy-stubs/@test/static/accept/arraysetops.pyi index 75ba98eb..8bec72ff 100644 --- a/src/numpy-stubs/@test/static/accept/arraysetops.pyi +++ b/src/numpy-stubs/@test/static/accept/arraysetops.pyi @@ -1,97 +1,96 @@ from typing import Any from typing_extensions import assert_type +import _numtype as _nt import numpy as np -import numpy.typing as npt -from _numtype import Array1D from numpy.lib._arraysetops_impl import UniqueAllResult, UniqueCountsResult, UniqueInverseResult -AR_b: npt.NDArray[np.bool] -AR_i_: npt.NDArray[np.intp] -AR_f8: npt.NDArray[np.float64] -AR_M: npt.NDArray[np.datetime64] -AR_O: npt.NDArray[np.object_] +AR_b: _nt.Array[np.bool] +AR_i_: _nt.Array[np.intp] +AR_f8: _nt.Array[np.float64] +AR_M: _nt.Array[np.datetime64] +AR_O: _nt.Array[np.object_] AR_LIKE_i_: list[int] ### -assert_type(np.intersect1d(AR_i_, AR_i_), Array1D[np.intp]) -assert_type(np.intersect1d(AR_f8, AR_i_), Array1D[np.float64]) -assert_type(np.intersect1d(AR_M, AR_M, assume_unique=True), Array1D[np.datetime64]) +assert_type(np.intersect1d(AR_i_, AR_i_), _nt.Array1D[np.intp]) +assert_type(np.intersect1d(AR_f8, AR_i_), _nt.Array1D[np.float64]) +assert_type(np.intersect1d(AR_M, AR_M, assume_unique=True), _nt.Array1D[np.datetime64]) assert_type( np.intersect1d(AR_f8, AR_f8, return_indices=True), - tuple[Array1D[np.float64], Array1D[np.intp], Array1D[np.intp]], + tuple[_nt.Array1D[np.float64], _nt.Array1D[np.intp], _nt.Array1D[np.intp]], ) -assert_type(np.union1d(AR_i_, AR_i_), Array1D[np.intp]) -assert_type(np.union1d(AR_f8, AR_i_), Array1D[np.float64]) -assert_type(np.union1d(AR_M, AR_M), Array1D[np.datetime64]) +assert_type(np.union1d(AR_i_, AR_i_), _nt.Array1D[np.intp]) +assert_type(np.union1d(AR_f8, AR_i_), _nt.Array1D[np.float64]) +assert_type(np.union1d(AR_M, AR_M), _nt.Array1D[np.datetime64]) -assert_type(np.ediff1d(AR_b), Array1D[np.int8]) -assert_type(np.ediff1d(AR_M), Array1D[np.timedelta64]) -assert_type(np.ediff1d(AR_O), Array1D[np.object_]) -assert_type(np.ediff1d(AR_i_, to_end=[1, 2, 3]), Array1D[np.intp]) -assert_type(np.ediff1d(AR_LIKE_i_, to_begin=[0, 1]), Array1D[np.intp]) +assert_type(np.ediff1d(AR_b), _nt.Array1D[np.int8]) +assert_type(np.ediff1d(AR_M), _nt.Array1D[np.timedelta64]) +assert_type(np.ediff1d(AR_O), _nt.Array1D[np.object_]) +assert_type(np.ediff1d(AR_i_, to_end=[1, 2, 3]), _nt.Array1D[np.intp]) +assert_type(np.ediff1d(AR_LIKE_i_, to_begin=[0, 1]), _nt.Array1D[np.intp]) -assert_type(np.setxor1d(AR_i_, AR_i_), Array1D[np.intp]) -assert_type(np.setxor1d(AR_f8, AR_i_), Array1D[np.float64]) -assert_type(np.setxor1d(AR_M, AR_M, assume_unique=True), Array1D[np.datetime64]) +assert_type(np.setxor1d(AR_i_, AR_i_), _nt.Array1D[np.intp]) +assert_type(np.setxor1d(AR_f8, AR_i_), _nt.Array1D[np.float64]) +assert_type(np.setxor1d(AR_M, AR_M, assume_unique=True), _nt.Array1D[np.datetime64]) -assert_type(np.setdiff1d(AR_i_, AR_i_), Array1D[np.intp]) -assert_type(np.setdiff1d(AR_f8, AR_i_), Array1D[np.float64]) -assert_type(np.setdiff1d(AR_M, AR_M, assume_unique=True), Array1D[np.datetime64]) +assert_type(np.setdiff1d(AR_i_, AR_i_), _nt.Array1D[np.intp]) +assert_type(np.setdiff1d(AR_f8, AR_i_), _nt.Array1D[np.float64]) +assert_type(np.setdiff1d(AR_M, AR_M, assume_unique=True), _nt.Array1D[np.datetime64]) -assert_type(np.isin(AR_i_, AR_i_), npt.NDArray[np.bool]) -assert_type(np.isin(AR_f8, AR_i_), npt.NDArray[np.bool]) -assert_type(np.isin(AR_M, AR_M, assume_unique=True), npt.NDArray[np.bool]) -assert_type(np.isin(AR_f8, AR_LIKE_i_, invert=True), npt.NDArray[np.bool]) +assert_type(np.isin(AR_i_, AR_i_), _nt.Array[np.bool]) +assert_type(np.isin(AR_f8, AR_i_), _nt.Array[np.bool]) +assert_type(np.isin(AR_M, AR_M, assume_unique=True), _nt.Array[np.bool]) +assert_type(np.isin(AR_f8, AR_LIKE_i_, invert=True), _nt.Array[np.bool]) -assert_type(np.unique(AR_f8), npt.NDArray[np.float64]) -assert_type(np.unique(AR_f8, return_index=True), tuple[npt.NDArray[np.float64], npt.NDArray[np.intp]]) -assert_type(np.unique(AR_f8, return_inverse=True), tuple[npt.NDArray[np.float64], npt.NDArray[np.intp]]) -assert_type(np.unique(AR_f8, return_counts=True), tuple[npt.NDArray[np.float64], npt.NDArray[np.intp]]) -assert_type(np.unique(AR_LIKE_i_, axis=0), npt.NDArray[Any]) -assert_type(np.unique(AR_LIKE_i_, return_index=True), tuple[npt.NDArray[Any], npt.NDArray[np.intp]]) -assert_type(np.unique(AR_LIKE_i_, return_inverse=True), tuple[npt.NDArray[Any], npt.NDArray[np.intp]]) -assert_type(np.unique(AR_LIKE_i_, return_counts=True), tuple[npt.NDArray[Any], npt.NDArray[np.intp]]) +assert_type(np.unique(AR_f8), _nt.Array[np.float64]) +assert_type(np.unique(AR_f8, return_index=True), tuple[_nt.Array[np.float64], _nt.Array[np.intp]]) +assert_type(np.unique(AR_f8, return_inverse=True), tuple[_nt.Array[np.float64], _nt.Array[np.intp]]) +assert_type(np.unique(AR_f8, return_counts=True), tuple[_nt.Array[np.float64], _nt.Array[np.intp]]) +assert_type(np.unique(AR_LIKE_i_, axis=0), _nt.Array[Any]) +assert_type(np.unique(AR_LIKE_i_, return_index=True), tuple[_nt.Array[Any], _nt.Array[np.intp]]) +assert_type(np.unique(AR_LIKE_i_, return_inverse=True), tuple[_nt.Array[Any], _nt.Array[np.intp]]) +assert_type(np.unique(AR_LIKE_i_, return_counts=True), tuple[_nt.Array[Any], _nt.Array[np.intp]]) assert_type( np.unique(AR_f8, return_index=True, return_inverse=True), - tuple[npt.NDArray[np.float64], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[np.float64], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_LIKE_i_, return_index=True, return_inverse=True), - tuple[npt.NDArray[Any], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_f8, return_index=True, return_counts=True), - tuple[npt.NDArray[np.float64], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[np.float64], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_LIKE_i_, return_index=True, return_counts=True), - tuple[npt.NDArray[Any], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_f8, return_inverse=True, return_counts=True), - tuple[npt.NDArray[np.float64], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[np.float64], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_LIKE_i_, return_inverse=True, return_counts=True), - tuple[npt.NDArray[Any], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_f8, return_index=True, return_inverse=True, return_counts=True), - tuple[npt.NDArray[np.float64], npt.NDArray[np.intp], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[np.float64], _nt.Array[np.intp], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type( np.unique(AR_LIKE_i_, return_index=True, return_inverse=True, return_counts=True), - tuple[npt.NDArray[Any], npt.NDArray[np.intp], npt.NDArray[np.intp], npt.NDArray[np.intp]], + tuple[_nt.Array[Any], _nt.Array[np.intp], _nt.Array[np.intp], _nt.Array[np.intp]], ) assert_type(np.unique_all(AR_f8), UniqueAllResult[np.float64]) assert_type(np.unique_counts(AR_f8), UniqueCountsResult[np.float64]) assert_type(np.unique_inverse(AR_f8), UniqueInverseResult[np.float64]) -assert_type(np.unique_values(AR_f8), Array1D[np.float64]) +assert_type(np.unique_values(AR_f8), _nt.Array1D[np.float64]) assert_type(np.unique_all(AR_LIKE_i_), UniqueAllResult[np.intp]) assert_type(np.unique_counts(AR_LIKE_i_), UniqueCountsResult[np.intp]) assert_type(np.unique_inverse(AR_LIKE_i_), UniqueInverseResult[np.intp]) -assert_type(np.unique_values(AR_LIKE_i_), Array1D[np.intp]) +assert_type(np.unique_values(AR_LIKE_i_), _nt.Array1D[np.intp]) diff --git a/src/numpy-stubs/@test/static/accept/linalg.pyi b/src/numpy-stubs/@test/static/accept/linalg.pyi index 20e6e935..98c1bc16 100644 --- a/src/numpy-stubs/@test/static/accept/linalg.pyi +++ b/src/numpy-stubs/@test/static/accept/linalg.pyi @@ -1,14 +1,14 @@ from typing import Any, Literal, TypeAlias from typing_extensions import TypeVar, assert_type +import _numtype as _nt import numpy as np import numpy.typing as npt -from _numtype import Array, AtLeast2D from numpy.linalg._linalg import EigResult, EighResult, QRResult, SVDResult, SlogdetResult _ScalarT = TypeVar("_ScalarT", bound=np.generic) -_Array_2d: TypeAlias = Array[_ScalarT, tuple[int, int]] -_Array_2nd: TypeAlias = Array[_ScalarT, AtLeast2D] +_Array_2d: TypeAlias = _nt.Array[_ScalarT, tuple[int, int]] +_Array_2nd: TypeAlias = _nt.Array[_ScalarT, _nt.AtLeast2D] ### From 77850df33dfad9baa166f96acd4503cf1c88f002 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:39:49 +0200 Subject: [PATCH 11/13] =?UTF-8?q?=F0=9F=94=A7=20enforce=20`import=20=5Fnum?= =?UTF-8?q?type=20as=20=5Fnt`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 87763a33..758cd874 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -225,6 +225,7 @@ preview = true "sys", "numpy", "numpy.typing", + "_numtype", ] [tool.ruff.lint.flake8-import-conventions.extend-aliases] "ctypes" = "ct" From f5579b5b523ff901b5a0d7c595cb6522447021be Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:48:34 +0200 Subject: [PATCH 12/13] =?UTF-8?q?=E2=9C=85=20minor=20test=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/@test/static/accept/polynomial_polybase.pyi | 2 +- src/numpy-stubs/@test/static/reject/lib_function_base.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/numpy-stubs/@test/static/accept/polynomial_polybase.pyi b/src/numpy-stubs/@test/static/accept/polynomial_polybase.pyi index cd70486a..438b052f 100644 --- a/src/numpy-stubs/@test/static/accept/polynomial_polybase.pyi +++ b/src/numpy-stubs/@test/static/accept/polynomial_polybase.pyi @@ -122,7 +122,7 @@ assert_type(PS_lag.integ(SC_i_co, SC_f_co), npp.Laguerre) assert_type(PS_poly.deriv(), npp.Polynomial) assert_type(PS_herm.deriv(SC_i_co), npp.Hermite) -assert_type(PS_poly.roots(), _Array1D[np.float64] | _Array1D[np.complex128]) +assert_type(PS_poly.roots(), _Array1D[np.float64 | np.complex128]) assert_type( PS_poly.linspace(), diff --git a/src/numpy-stubs/@test/static/reject/lib_function_base.pyi b/src/numpy-stubs/@test/static/reject/lib_function_base.pyi index d1429562..185c2ecf 100644 --- a/src/numpy-stubs/@test/static/reject/lib_function_base.pyi +++ b/src/numpy-stubs/@test/static/reject/lib_function_base.pyi @@ -28,7 +28,7 @@ np.piecewise(AR_f8, AR_b_list, [fn_ar_i], 42, _=None) # pyright: ignore[reportC np.interp(AR_f8, AR_c16, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue] np.interp(AR_c16, AR_f8, AR_f8) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue] -np.interp(AR_f8, AR_f8, AR_f8, period=AR_c16) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue] +np.interp(AR_f8, AR_f8, AR_f8, period=AR_c16) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue] np.interp(AR_f8, AR_f8, AR_O) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue] np.average(AR_m) # type: ignore[arg-type] # pyright: ignore[reportArgumentType, reportCallIssue] From 95dc8432eda4b6fca26d66e990741098e9837c12 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 16 Apr 2025 02:49:44 +0200 Subject: [PATCH 13/13] =?UTF-8?q?=F0=9F=90=B4=20workarounds=20for=20mypy..?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/_core/numeric.pyi | 18 +++++++++--------- src/numpy-stubs/lib/_index_tricks_impl.pyi | 6 ++++++ src/numpy-stubs/linalg/_linalg.pyi | 16 ++++------------ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/numpy-stubs/_core/numeric.pyi b/src/numpy-stubs/_core/numeric.pyi index c124b870..d411bd54 100644 --- a/src/numpy-stubs/_core/numeric.pyi +++ b/src/numpy-stubs/_core/numeric.pyi @@ -738,7 +738,7 @@ def ones( # NOTE: The mypy [overload-overlap] errors are false-positives that are caused by a # bug that's related to constrained type-vars. @overload # 1d shape, known fill scalar-type -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike1D, fill_value: _ScalarT, dtype: None = None, @@ -748,7 +748,7 @@ def full( # type: ignore[overload-overlap] like: _SupportsArrayFunc | None = None, ) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, bool fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike1D, fill_value: py_bool, dtype: None = None, @@ -758,7 +758,7 @@ def full( # type: ignore[overload-overlap] like: _SupportsArrayFunc | None = None, ) -> _nt.Array1D[np.bool]: ... @overload # 1d shape, int fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike1D, fill_value: _nt.JustInt, dtype: None = None, @@ -778,7 +778,7 @@ def full( like: _SupportsArrayFunc | None = None, ) -> _nt.Array1D[np.float64]: ... @overload # 1d shape, complex fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike1D, fill_value: _nt.JustComplex, dtype: None = None, @@ -808,7 +808,7 @@ def full( like: _SupportsArrayFunc | None = None, ) -> _nt.Array1D[_ScalarT]: ... @overload # 1d shape, float64 dtype -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike1D, fill_value: object, dtype: _nt.ToDTypeFloat64, @@ -918,7 +918,7 @@ def full( like: _SupportsArrayFunc | None = None, ) -> _nt.Array[Any, _AnyShapeT]: ... @overload # unknown shape, known fill scalar-type -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike, fill_value: _ScalarT, dtype: None = None, @@ -928,7 +928,7 @@ def full( # type: ignore[overload-overlap] like: _SupportsArrayFunc | None = None, ) -> _nt.Array[_ScalarT]: ... @overload # unknown shape, bool fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike, fill_value: py_bool, dtype: None = None, @@ -938,7 +938,7 @@ def full( # type: ignore[overload-overlap] like: _SupportsArrayFunc | None = None, ) -> _nt.Array[np.bool]: ... @overload # unknown shape, int fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike, fill_value: _nt.JustInt, dtype: None = None, @@ -958,7 +958,7 @@ def full( like: _SupportsArrayFunc | None = None, ) -> _nt.Array[np.float64]: ... @overload # unknown shape, complex fill -def full( # type: ignore[overload-overlap] +def full( shape: _ShapeLike, fill_value: _nt.JustComplex, dtype: None = None, diff --git a/src/numpy-stubs/lib/_index_tricks_impl.pyi b/src/numpy-stubs/lib/_index_tricks_impl.pyi index ac5dce49..888c46f8 100644 --- a/src/numpy-stubs/lib/_index_tricks_impl.pyi +++ b/src/numpy-stubs/lib/_index_tricks_impl.pyi @@ -177,6 +177,12 @@ def ix_(*args: _nt.SequenceND[_nt.JustComplex]) -> _Arrays[np.complex128]: ... def ix_(*args: _nt.SequenceND[_nt.JustBytes]) -> _Arrays[np.bytes_]: ... @overload def ix_(*args: _nt.SequenceND[_nt.JustStr]) -> _Arrays[np.str_]: ... +@overload # the redundant overloads below are a workaround for a mypy bug +def ix_(*args: _nt.SequenceND[int]) -> _Arrays[np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] +@overload +def ix_(*args: _nt.SequenceND[float]) -> _Arrays[np.float64 | np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] +@overload +def ix_(*args: _nt.SequenceND[complex]) -> _Arrays[np.complex128 | np.float64 | np.intp | np.bool]: ... # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload] # def fill_diagonal(a: _nt.Array, val: Any, wrap: bool = False) -> None: ... diff --git a/src/numpy-stubs/linalg/_linalg.pyi b/src/numpy-stubs/linalg/_linalg.pyi index 810b2db2..84a66620 100644 --- a/src/numpy-stubs/linalg/_linalg.pyi +++ b/src/numpy-stubs/linalg/_linalg.pyi @@ -845,9 +845,9 @@ def norm( @overload # float64 | complex128 | character, axis= (positional) def norm(x: _ToUnsafe64_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.float64]: ... # type: ignore[overload-overlap] @overload # float64 | complex128 | character, axis= (keyword) -def norm( +def norm( # type: ignore[overload-overlap] x: _ToUnsafe64_1nd, ord: _Ord | None = None, *, axis: _Ax2, keepdims: bool = False -) -> _nt.Array[np.float64]: ... # type: ignore[overload-overlap] +) -> _nt.Array[np.float64]: ... @overload # float16, axis=None, keepdims=False def norm(x: _nt.ToFloat16_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.float16: ... @overload # float16, keepdims=True (keyword) @@ -862,11 +862,7 @@ def norm( def norm(x: _Toinexact32_1nd, ord: _Ord | None = None, axis: None = None, keepdims: _False = False) -> np.float32: ... @overload # float32 | complex64, keepdims=True (keyword) def norm( - x: _Toinexact32_1nd, - ord: _Ord | None = None, - axis: _Ax2 | None = None, - *, - keepdims: _True, + x: _Toinexact32_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.float32]: ... @overload # float32 | complex64, axis= (positional) def norm(x: _Toinexact32_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.float32]: ... @@ -880,11 +876,7 @@ def norm( ) -> np.longdouble: ... @overload # longdouble | clongdouble, keepdims=True (keyword) def norm( - x: _Toinexact64l_1nd, - ord: _Ord | None = None, - axis: _Ax2 | None = None, - *, - keepdims: _True, + x: _Toinexact64l_1nd, ord: _Ord | None = None, axis: _Ax2 | None = None, *, keepdims: _True ) -> _Array_2nd[np.longdouble]: ... @overload # longdouble | clongdouble, axis= (positional) def norm(x: _Toinexact64l_1nd, ord: _Ord | None, axis: _Ax2, keepdims: bool = False) -> _nt.Array[np.longdouble]: ...