neovim/typings/numpy/_typing/_array_like.pyi

56 lines
2.9 KiB
Python

"""
This type stub file was generated by pyright.
"""
import sys
from collections.abc import Buffer, Callable, Collection, Sequence
from typing import Any, Protocol, TypeVar, Union, runtime_checkable
from numpy import bool_, bytes_, complexfloating, datetime64, dtype, floating, generic, integer, ndarray, number, object_, str_, timedelta64, unsignedinteger, void
from ._nested_sequence import _NestedSequence
_T = TypeVar("_T")
_ScalarType = TypeVar("_ScalarType", bound=generic)
_ScalarType_co = TypeVar("_ScalarType_co", bound=generic, covariant=True)
_DType = TypeVar("_DType", bound=dtype[Any])
_DType_co = TypeVar("_DType_co", covariant=True, bound=dtype[Any])
NDArray = ndarray[Any, dtype[_ScalarType_co]]
@runtime_checkable
class _SupportsArray(Protocol[_DType_co]):
def __array__(self) -> ndarray[Any, _DType_co]:
...
@runtime_checkable
class _SupportsArrayFunc(Protocol):
"""A protocol class representing `~class.__array_function__`."""
def __array_function__(self, func: Callable[..., Any], types: Collection[type[Any]], args: tuple[Any, ...], kwargs: dict[str, Any]) -> object:
...
_FiniteNestedSequence = Union[_T, Sequence[_T], Sequence[Sequence[_T]], Sequence[Sequence[Sequence[_T]]], Sequence[Sequence[Sequence[Sequence[_T]]]],]
_ArrayLike = Union[_SupportsArray[dtype[_ScalarType]], _NestedSequence[_SupportsArray[dtype[_ScalarType]]],]
_DualArrayLike = Union[_SupportsArray[_DType], _NestedSequence[_SupportsArray[_DType]], _T, _NestedSequence[_T],]
if sys.version_info >= (3, 12):
ArrayLike = Buffer | _DualArrayLike[dtype[Any], Union[bool, int, float, complex, str, bytes],]
else:
...
_ArrayLikeBool_co = _DualArrayLike[dtype[bool_], bool,]
_ArrayLikeUInt_co = _DualArrayLike[dtype[Union[bool_, unsignedinteger[Any]]], bool,]
_ArrayLikeInt_co = _DualArrayLike[dtype[Union[bool_, integer[Any]]], Union[bool, int],]
_ArrayLikeFloat_co = _DualArrayLike[dtype[Union[bool_, integer[Any], floating[Any]]], Union[bool, int, float],]
_ArrayLikeComplex_co = _DualArrayLike[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any],]], Union[bool, int, float, complex],]
_ArrayLikeNumber_co = _DualArrayLike[dtype[Union[bool_, number[Any]]], Union[bool, int, float, complex],]
_ArrayLikeTD64_co = _DualArrayLike[dtype[Union[bool_, integer[Any], timedelta64]], Union[bool, int],]
_ArrayLikeDT64_co = Union[_SupportsArray[dtype[datetime64]], _NestedSequence[_SupportsArray[dtype[datetime64]]],]
_ArrayLikeObject_co = Union[_SupportsArray[dtype[object_]], _NestedSequence[_SupportsArray[dtype[object_]]],]
_ArrayLikeVoid_co = Union[_SupportsArray[dtype[void]], _NestedSequence[_SupportsArray[dtype[void]]],]
_ArrayLikeStr_co = _DualArrayLike[dtype[str_], str,]
_ArrayLikeBytes_co = _DualArrayLike[dtype[bytes_], bytes,]
_ArrayLikeInt = _DualArrayLike[dtype[integer[Any]], int,]
class _UnknownType:
...
_ArrayLikeUnknown = _DualArrayLike[dtype[_UnknownType], _UnknownType,]