Significantly revamped the base project to use more robust static checking including benchmarks and integration test support
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""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: ...
|
||||
@@ -0,0 +1,27 @@
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class dtype:
|
||||
float32: dtype
|
||||
float64: dtype
|
||||
int32: dtype
|
||||
int64: dtype
|
||||
bool: dtype
|
||||
|
||||
class ndarray(Generic[T]):
|
||||
dtype: dtype
|
||||
shape: tuple[int, ...]
|
||||
ndim: int
|
||||
size: int
|
||||
|
||||
def __init__(self, shape: tuple[int, ...], dtype: dtype = None) -> None: ...
|
||||
def __getitem__(self, key: Any) -> ndarray[T]: ...
|
||||
def __setitem__(self, key: Any, value: Any) -> None: ...
|
||||
def reshape(self, *shape: int) -> ndarray[T]: ...
|
||||
def flatten(self) -> ndarray[T]: ...
|
||||
|
||||
def array(object: Any, dtype: dtype = None) -> ndarray[Any]: ...
|
||||
def zeros(shape: tuple[int, ...], dtype: dtype = None) -> ndarray[Any]: ...
|
||||
def ones(shape: tuple[int, ...], dtype: dtype = None) -> ndarray[Any]: ...
|
||||
def empty(shape: tuple[int, ...], dtype: dtype = None) -> ndarray[Any]: ...
|
||||
Reference in New Issue
Block a user