Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Add annotation for empty and emtpy_like #85

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ def zeros(
def ones(
shape: _ShapeLike, dtype: DtypeLike = ..., order: Optional[str] = ...
) -> ndarray: ...
def empty(
shape: _ShapeLike, dtype: DtypeLike = ..., order: Optional[str] = ...
) -> ndarray: ...
def zeros_like(
a: ArrayLike,
dtype: DtypeLike = ...,
Expand All @@ -496,7 +499,14 @@ def ones_like(
order: str = ...,
subok: bool = ...,
shape: Optional[_ShapeLike] = ...,
) -> ndarray[int]: ...
) -> ndarray: ...
def empty_like(
a: ArrayLike,
dtype: DtypeLike = ...,
order: str = ...,
subok: bool = ...,
shape: Optional[_ShapeLike] = ...,
) -> ndarray: ...
def full(
shape: _ShapeLike, fill_value: Any, dtype: DtypeLike = ..., order: str = ...
) -> ndarray: ...
Expand Down
5 changes: 5 additions & 0 deletions tests/pass/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def ndarray_func(x):
# Array creation routines checks
ndarray_func(np.zeros([1, 2]))
ndarray_func(np.ones([1, 2]))
ndarray_func(np.empty([1, 2]))

ndarray_func(np.zeros_like(array))
ndarray_func(np.ones_like(array))
ndarray_func(np.empty_like(array))

# Dtype construction
np.dtype(float)
Expand Down