55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
"""Type stubs for NumPy."""
|
|
|
|
from typing import Any, Self
|
|
|
|
# Basic numpy types
|
|
dtype = Any
|
|
float64 = Any
|
|
float32 = Any
|
|
int64 = Any
|
|
int32 = Any
|
|
bool_ = Any
|
|
|
|
class ndarray:
|
|
"""NumPy array type stub."""
|
|
def __init__(self, data: Any) -> None: ...
|
|
@property
|
|
def shape(self) -> tuple[int, ...]: ...
|
|
@property
|
|
def dtype(self) -> dtype: ...
|
|
@property
|
|
def size(self) -> int: ...
|
|
def reshape(self, *args: Any) -> Self: ...
|
|
def astype(self, dtype: Any) -> Self: ...
|
|
def __getitem__(self, key: Any) -> Any: ...
|
|
def __setitem__(self, key: Any, value: Any) -> None: ...
|
|
def mean(self, axis: int | None = None) -> Any: ...
|
|
def sum(self, axis: int | None = None) -> Any: ...
|
|
def max(self, axis: int | None = None) -> Any: ...
|
|
def min(self, axis: int | None = None) -> Any: ...
|
|
|
|
def array(data: Any, dtype: dtype | None = None) -> ndarray: ...
|
|
def zeros(shape: int | tuple[int, ...], dtype: dtype | None = None) -> ndarray: ...
|
|
def ones(shape: int | tuple[int, ...], dtype: dtype | None = None) -> ndarray: ...
|
|
def empty(shape: int | tuple[int, ...], dtype: dtype | None = None) -> ndarray: ...
|
|
def arange(
|
|
start: Any,
|
|
stop: Any | None = None,
|
|
step: Any | None = None,
|
|
dtype: dtype | None = None,
|
|
) -> ndarray: ...
|
|
def concatenate(arrays: list[ndarray], axis: int | None = None) -> ndarray: ...
|
|
def stack(arrays: list[ndarray], axis: int = 0) -> ndarray: ...
|
|
def split(ary: ndarray, indices_or_sections: Any, axis: int = 0) -> list[ndarray]: ...
|
|
def reshape(a: ndarray, newshape: int | tuple[int, ...]) -> ndarray: ...
|
|
def transpose(a: ndarray, axes: tuple[int, ...] | None = None) -> ndarray: ...
|
|
def random() -> Any: ...
|
|
def sqrt(x: Any) -> Any: ...
|
|
def exp(x: Any) -> Any: ...
|
|
def log(x: Any) -> Any: ...
|
|
def sin(x: Any) -> Any: ...
|
|
def cos(x: Any) -> Any: ...
|
|
def maximum(x1: Any, x2: Any) -> Any: ...
|
|
def minimum(x1: Any, x2: Any) -> Any: ...
|
|
def clip(a: Any, a_min: Any, a_max: Any) -> Any: ...
|