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

Commit 23e88e0

Browse files
authored
ENH: Add annotation for empty and emtpy_like (#85)
1 parent 6df1559 commit 23e88e0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

numpy-stubs/__init__.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ def zeros(
483483
def ones(
484484
shape: _ShapeLike, dtype: DtypeLike = ..., order: Optional[str] = ...
485485
) -> ndarray: ...
486+
def empty(
487+
shape: _ShapeLike, dtype: DtypeLike = ..., order: Optional[str] = ...
488+
) -> ndarray: ...
486489
def zeros_like(
487490
a: ArrayLike,
488491
dtype: DtypeLike = ...,
@@ -496,7 +499,14 @@ def ones_like(
496499
order: str = ...,
497500
subok: bool = ...,
498501
shape: Optional[_ShapeLike] = ...,
499-
) -> ndarray[int]: ...
502+
) -> ndarray: ...
503+
def empty_like(
504+
a: ArrayLike,
505+
dtype: DtypeLike = ...,
506+
order: str = ...,
507+
subok: bool = ...,
508+
shape: Optional[_ShapeLike] = ...,
509+
) -> ndarray: ...
500510
def full(
501511
shape: _ShapeLike, fill_value: Any, dtype: DtypeLike = ..., order: str = ...
502512
) -> ndarray: ...

tests/pass/simple.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ def ndarray_func(x):
2020
# Array creation routines checks
2121
ndarray_func(np.zeros([1, 2]))
2222
ndarray_func(np.ones([1, 2]))
23+
ndarray_func(np.empty([1, 2]))
24+
25+
ndarray_func(np.zeros_like(array))
26+
ndarray_func(np.ones_like(array))
27+
ndarray_func(np.empty_like(array))
2328

2429
# Dtype construction
2530
np.dtype(float)

0 commit comments

Comments
 (0)