4 from typing import Any, Container, Dict, IO, Iterable, List, Mapping, Optional, overload, Sequence, Sized, SupportsAbs, SupportsComplex, SupportsFloat, SupportsInt, Text, Tuple, Type, TypeVar, Union
\r
6 # union of built-in scalar types
\r
7 # see https://docs.scipy.org/doc/numpy/reference/arrays.scalars.html
\r
8 _builtinScalarUnion = Union[
\r
9 # TODO: fill the union with aliases from _type_aliases.py
\r
13 # union of types that can be used as dtype
\r
14 # see: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html#specifying-and-constructing-data-types
\r
15 _dtypeUnion = Union[
\r
18 _builtinScalarUnion,
\r
21 Tuple[Any, Union[int, Sequence[int]]],
\r
22 # [(field_name, field_dtype, field_shape), ...]
\r
25 Tuple[Union[str, Tuple[str, str]], Any],
\r
26 Tuple[Union[str, Tuple[str, str]], Any, Union[int, Sequence[int]]]
\r
29 # {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ..., 'itemsize': ...}
\r
30 Dict[str, Union[Sequence[str], Sequence[Any], Sequence[int], Sequence[Union[bytes, Text, None]], int]],
\r
31 # {'field1': ..., 'field2': ..., ...}
\r
32 Dict[str, Tuple[Any, int]],
\r
33 # (base_dtype, new_dtype)
\r
38 # see: https://docs.scipy.org/doc/numpy/reference/generated/numpy.dtype.html
\r
40 def __init__(self, obj: _dtypeUnion, align: bool = ..., copy: bool = ...) -> None: ...
\r
44 def alignment(self) -> int: ...
\r
46 def base(self) -> dtype: ...
\r
48 def byteorder(self) -> str: ...
\r
50 def char(self) -> str: ...
\r
51 @property # https://docs.scipy.org/doc/numpy/reference/arrays.interface.html
\r
52 def descr(self) -> List[Union[Tuple[str, str], Tuple[str, str, Tuple[int, ...]]]]: ...
\r
54 def fields(self) -> Optional[Mapping[str, Union[Tuple[dtype, int], Tuple[dtype, int, Any]]]]: ...
\r
56 def flags(self) -> int: ...
\r
58 def hasobject(self) -> bool: ...
\r
60 def isbuiltin(self) -> int: ...
\r
62 def isnative(self) -> bool: ...
\r
64 def isalignedstruct(self) -> bool: ...
\r
66 def itemsize(self) -> int: ...
\r
68 def kind(self) -> str: ...
\r
70 def metadata(self) -> Any: ...
\r
72 def name(self) -> str: ...
\r
74 def names(self) -> Optional[Tuple[str, ...]]: ...
\r
76 def ndim(self) -> int: ...
\r
78 def num(self) -> int: ...
\r
80 def shape(self) -> Tuple[int, ...]: ...
\r
82 def subdtype(self) -> Optional[Tuple[dtype, Tuple[int, ...]]]: ...
\r
84 def str(self) -> builtins.str: ...
\r
86 def type(self) -> Type[_generic]: ...
\r
89 def newbyteorder(self, new_order: str = ...) -> dtype: ...
\r
92 _array_like = Sequence[Any]
\r
93 _Tndarray = TypeVar("_Tndarray", bound=ndarray)
\r
95 # A 1-D iterator over the array
\r
96 # see: https://docs.scipy.org/doc/numpy/reference/generated/numpy.flatiter.htm
\r
99 def base(self) -> ndarray: ...
\r
101 def coords(self) -> Tuple[int, ...]: ...
\r
103 def index(self) -> int: ...
\r
105 def copy(self) -> ndarray: ...
\r
106 def __iter__(self) -> flatiter: ...
\r
107 def __next__(self) -> Any: ...
\r
112 def base(self) -> Optional[ndarray]: ...
\r
114 def ctypes(self) -> Any: ...
\r
116 def data(self) -> memoryview: ...
\r
118 def dtype(self) -> _dtypeUnion: ...
\r
120 def flags(self) -> Dict[str, bool]: ...
\r
122 def flat(self) -> flatiter: ...
\r
124 def imag(self) -> ndarray: ...
\r
126 def itemsize(self) -> int: ...
\r
128 def nbytes(self) -> int: ...
\r
130 def ndim(self) -> int: ...
\r
132 def real(self) -> ndarray: ...
\r
134 def shape(self) -> Tuple[int, ...]: ...
\r
136 def size(self) -> int: ...
\r
138 def T(self) -> ndarray: ...
\r
140 def all(self, axis: Union[int, Tuple[int, ...]] = ..., out: ndarray = ..., keepdims: bool = ...) -> Union[bool, ndarray]: ...
\r
141 def any(self, axis: Union[int, Tuple[int, ...]] = ..., out: ndarray = ..., keepdims: bool = ...) -> Union[bool, ndarray]: ...
\r
142 def argmax(self, axis: int = ..., out: array_like = ...) -> ndarray: ...
\r
143 def argmin(self, axis: int = ..., out: array_like = ...) -> ndarray: ...
\r
144 def argpartition(self, kth: Union[int, Sequence[int]], axis: int = ..., kind: str = ..., order: Union[str, Sequence[str]] = ...) -> ndarray: ...
\r
145 def argsort(self, axis: int = ..., kind: str = ..., order: Union[str, Sequence[str]] = ...) -> ndarray: ...
\r
146 def astype(self, dtype: _dtypeUnion, order: str = 'K', casting: str = 'unsafe', subok: bool = ..., copy: bool = ...) -> ndarray: ...
\r
147 def byteswap(self, inplace: bool = False) -> ndarray: ...
\r
148 def choose(self, choices: Sequence[array_like], out: ndarray = ..., mode: str = 'raise') -> ndarray: ...
\r
149 def clip(self, min: Union[_generic, array_like] = ..., max: Union[_generic, array_like] = ..., out: ndarray = ...) -> ndarray: ...
\r
150 def compress(self, condition: Sequence[bool], axis: int = ..., out: ndarray = ...) -> ndarray: ...
\r
151 def copy(self, order: str = 'C') -> ndarray: ...
\r
152 def cumprod(self, axis: int = ..., dtype: _dtypeUnion = ..., out: ndarray = ...) -> ndarray: ...
\r
153 def cumsum(self, axis: int = ..., dtype: _dtypeUnion = ..., out: ndarray = ...) -> ndarray: ...
\r
154 def diagonal(self, offset: int = ..., axis1: int = ..., axis2: int = ...) -> ndarray: ...
\r
155 def dot(self, b: array_like, out: ndarray = ...) -> ndarray: ...
\r
156 def dump(self, file: str) -> None: ...
\r
157 def dumps(self) -> bytes: ...
\r
158 def fill(self, value: _generic) -> None: ...
\r
159 def flatten(self, order: str = ...) -> ndarray: ...
\r
160 def getfield(self, dtype: _dtypeUnion, offset: int = ...) -> ndarray: ...
\r
162 def item(self, *args: int) -> _generic: ...
\r
164 def item(self, args: Tuple[int, ...]) -> _generic: ...
\r
166 def itemset(self, value: _generic) -> None: ...
\r
168 def itemset(self, item: Union[int, Tuple[int, ...]], value: _generic) -> None: ...
\r
169 def max(self, axis: Union[int, Tuple[int, ...]] = ..., out: ndarray = ..., keepdims: bool = ...) -> Union[ndarray, _generic]: ...
\r
170 def mean(self, axis: Union[int, Tuple[int, ...]] = ..., dtype: _dtypeUnion = ..., out: ndarray = ..., keepdims: bool = ...) -> Union[ndarray, _generic]: ...
\r
171 def min(self, axis: Union[int, Tuple[int, ...]] = ..., out: ndarray = ..., keepdims: bool = ...) -> Union[ndarray, _generic]: ...
\r
172 def newbyteorder(self, new_order: str = 'S') -> dtype: ...
\r
173 def nonzero(self) -> Tuple[ndarray]: ...
\r
174 def partition(self, kth: Union[int, Sequence[int]], axis: int = -1, kind: str = 'introselect', order: Union[str, Sequence[str]] = ...) -> None: ...
\r
175 def prod(self, axis: Union[int, Tuple[int, ...]] = ..., dtype: _dtypeUnion = ..., out: ndarray = ..., keepdims: bool = False) -> ndarray: ...
\r
176 def ptp(self, axis: Union[int, Tuple[int, ...]] = ..., out: array_like = ..., keepdims: bool = ...) -> ndarray: ...
\r
177 def put(self, ind: Sequence[int], v: array_like, order: str = ...) -> None: ...
\r
178 def ravel(self, order: str = ...) -> ndarray: ...
\r
179 def repeat(self, repeats: Union[int, Sequence[int]] = ..., axis: int = ...) -> ndarray: ...
\r
181 def reshape(self, shape: Sequence[int], order: str = ...) -> ndarray: ...
\r
183 def reshape(self, *shape: int, order: str = ...) -> ndarray: ...
\r
185 def resize(self, new_shape: Sequence[int], *, refcheck: bool = True) -> None: ...
\r
187 def resize(self, *new_shape: int, refcheck: bool = True) -> None: ...
\r
188 def round(self, decimals: int = 0, out: ndarray = ...) -> ndarray: ...
\r
189 def searchsorted(self, v: array_like, side: str = ..., sorter: Sequence[int] = ...) -> List[int]: ...
\r
190 def setfield(self, val: object, dtype: _dtypeUnion, offset: int = ...) -> None: ...
\r
191 def setflags(self, write: bool = ..., align: bool = ..., uic: bool = ...) -> None: ...
\r
192 def sort(self, axis: int = -1, kind: str = 'quicksort', order: Union[str, Sequence[str]] = ...) -> None: ...
\r
193 def squeeze(self, axis: Union[int, Tuple[int, ...]] = ...) -> ndarray: ...
\r
194 def std(self, axis: Union[int, Sequence[int]] = ..., dtype: _dtypeUnion = ..., out: ndarray = ..., ddof: int = 0, keepdims: bool = ...) -> ndarray: ...
\r
195 def strides(self) -> Tuple[int, ...]: ...
\r
196 def sum(self, axis: Union[int, Sequence[int]] = ..., dtype: _dtypeUnion = ..., out: ndarray = ..., keepdims: bool = ...) -> ndarray: ...
\r
197 def swapaxes(self, axis1: int, axis2: int) -> ndarray: ...
\r
198 def take(self, indices: array_like, axis: int = ..., out: ndarray = ..., mode: str = ...) -> ndarray: ...
\r
199 def tobytes(self, order: Optional[str] = ...) -> bytes: ...
\r
200 def tofile(self, fid: Union[IO[bytes], str], sep: str = ..., format: str = ...) -> None: ...
\r
201 def tolist(self) -> List[Any]: ...
\r
202 def tostring(self, order: Optional[str] = ...) -> bytes: ...
\r
203 def trace(self, offset: int = 0, axis1: int = 0, axis2: int = 1, dtype: _dtypeUnion = ..., out: ndarray = ...) -> ndarray: ...
\r
204 def transpose(self, axes: Sequence[int]) -> ndarray: ...
\r
205 def var(self, axis: Union[int, Tuple[int, ...]] = ..., dtype: _dtypeUnion = ..., out: ndarray = ..., ddof: int = 0, keepdims: bool = ...) -> ndarray: ...
\r
207 def view(self, dtype: Type[_Tndarray]) -> _Tndarray: ...
\r
209 def view(self, dtype: _dtypeUnion = ...) -> ndarray: ...
\r
211 def view(self, dtype: _dtypeUnion, type: Type[_Tndarray]) -> _Tndarray: ...
\r
213 def view(self, *, type: Type[_Tndarray]) -> _Tndarray: ...
\r
216 def arange(stop: _builtinScalarUnion, step: _builtinScalarUnion = ..., dtype: _dtypeUnion = ...) -> ndarray: ...
\r
218 def arange(start: _builtinScalarUnion, stop: _builtinScalarUnion, step: _builtinScalarUnion = ..., dtype: _dtypeUnion = ...) -> ndarray: ...
\r
219 def array(object: _array_like, dtype: _dtypeUnion = ..., copy: bool = ..., subok: bool = ..., ndmin: int = ...) -> ndarray: ...
\r
220 def empty(shape: Union[int, Tuple[int, ...]], dtype: _dtypeUnion = ..., order: str = 'C') -> ndarray: ...
\r