from types import EllipsisType, ModuleType # noqa: D100
from typing import Literal, Protocol, Self, overload
from typing_extensions import TypeVar
NamespaceT_co = TypeVar("NamespaceT_co", covariant=True, default=ModuleType)
DTypeT_co = TypeVar("DTypeT_co", covariant=True)
[docs]
class Array(Protocol[DTypeT_co, NamespaceT_co]):
"""Temporary compatibility shim for ``array_api_typing.Array``.
This protocol is parameterized exactly like ``array_api_typing.Array``
(``Array[DTypeT_co, NamespaceT_co]``) and should be treated as a drop-in type.
This should be removed or becomes a trivial alias to ``xpt.Array`` once upstream
``array_api_typing`` is released.
"""
def __array_namespace__( # noqa: D105
self, /, *, api_version: Literal["2021.12"] | None = None
) -> NamespaceT_co: ...
@property
def dtype(self, /) -> DTypeT_co: ... # noqa: D102
@property
def shape(self) -> tuple[int | None, ...]: ... # noqa: D102
def __len__(self) -> int: ... # noqa: D105
@property
def ndim(self) -> int: ... # noqa: D102
def __abs__(self) -> Self: ... # noqa: D105
@overload
def __add__(self, other: complex, /) -> Self: ...
@overload
def __add__(self, other: Self, /) -> Self: ...
@overload
def __radd__(self, other: complex, /) -> Self: ...
@overload
def __radd__(self, other: Self, /) -> Self: ...
@overload
def __and__(self, other: int | bool, /) -> Self: ...
@overload
def __and__(self, other: Self, /) -> Self: ...
@overload
def __rand__(self, other: int | bool, /) -> Self: ...
@overload
def __rand__(self, other: Self, /) -> Self: ...
def __bool__(self) -> bool: ... # noqa: D105
def __complex__(self) -> complex: ... # noqa: D105
def __float__(self) -> float: ... # noqa: D105
@overload
def __floordiv__(self, other: float, /) -> Self: ...
@overload
def __floordiv__(self, other: Self, /) -> Self: ...
@overload
def __rfloordiv__(self, other: float, /) -> Self: ...
@overload
def __rfloordiv__(self, other: Self, /) -> Self: ...
@overload
def __ge__(self, other: float, /) -> Self: ...
@overload
def __ge__(self, other: Self, /) -> Self: ...
@overload
def __getitem__(self, key: int | slice | EllipsisType | None | Self, /) -> Self: ...
@overload
def __getitem__(
self,
key: tuple[int | slice | EllipsisType | None | Self, ...],
/,
) -> Self: ...
@overload
def __gt__(self, other: float, /) -> Self: ...
@overload
def __gt__(self, other: Self, /) -> Self: ...
def __index__(self) -> int: ... # noqa: D105
def __int__(self) -> int: ... # noqa: D105
def __invert__(self) -> Self: ... # noqa: D105
@overload
def __le__(self, other: float, /) -> Self: ...
@overload
def __le__(self, other: Self, /) -> Self: ...
@overload
def __lshift__(self, other: int, /) -> Self: ...
@overload
def __lshift__(self, other: Self, /) -> Self: ...
@overload
def __rlshift__(self, other: int, /) -> Self: ...
@overload
def __rlshift__(self, other: Self, /) -> Self: ...
@overload
def __lt__(self, other: float, /) -> Self: ...
@overload
def __lt__(self, other: Self, /) -> Self: ...
def __matmul__(self, other: Self, /) -> Self: ... # noqa: D105
def __rmatmul__(self, other: Self, /) -> Self: ... # noqa: D105
@overload
def __mod__(self, other: float, /) -> Self: ...
@overload
def __mod__(self, other: Self, /) -> Self: ...
@overload
def __rmod__(self, other: float, /) -> Self: ...
@overload
def __rmod__(self, other: Self, /) -> Self: ...
@overload
def __mul__(self, other: complex, /) -> Self: ...
@overload
def __mul__(self, other: Self, /) -> Self: ...
@overload
def __rmul__(self, other: complex, /) -> Self: ...
@overload
def __rmul__(self, other: Self, /) -> Self: ...
def __neg__(self) -> Self: ... # noqa: D105
@overload
def __or__(self, other: int | bool, /) -> Self: ...
@overload
def __or__(self, other: Self, /) -> Self: ...
@overload
def __ror__(self, other: int | bool, /) -> Self: ...
@overload
def __ror__(self, other: Self, /) -> Self: ...
def __pos__(self) -> Self: ... # noqa: D105
@overload
def __pow__(self, other: complex, /) -> Self: ...
@overload
def __pow__(self, other: Self, /) -> Self: ...
@overload
def __rpow__(self, other: complex, /) -> Self: ...
@overload
def __rpow__(self, other: Self, /) -> Self: ...
@overload
def __rshift__(self, other: int, /) -> Self: ...
@overload
def __rshift__(self, other: Self, /) -> Self: ...
@overload
def __rrshift__(self, other: int, /) -> Self: ...
@overload
def __rrshift__(self, other: Self, /) -> Self: ...
@overload
def __setitem__(
self,
key: int | slice | EllipsisType | None | Self,
value: Self,
/,
) -> None: ...
@overload
def __setitem__(
self,
key: tuple[int | slice | EllipsisType | None | Self, ...],
value: Self,
/,
) -> None: ...
@overload
def __sub__(self, other: complex, /) -> Self: ...
@overload
def __sub__(self, other: Self, /) -> Self: ...
@overload
def __rsub__(self, other: complex, /) -> Self: ...
@overload
def __rsub__(self, other: Self, /) -> Self: ...
@overload
def __truediv__(self, other: complex, /) -> Self: ...
@overload
def __truediv__(self, other: Self, /) -> Self: ...
@overload
def __rtruediv__(self, other: complex, /) -> Self: ...
@overload
def __rtruediv__(self, other: Self, /) -> Self: ...
@overload
def __xor__(self, other: int | bool, /) -> Self: ...
@overload
def __xor__(self, other: Self, /) -> Self: ...
@overload
def __rxor__(self, other: int | bool, /) -> Self: ...
@overload
def __rxor__(self, other: Self, /) -> Self: ...