summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2020-10-07 18:36:24 +0200
committerBas van Beek <43369155+BvB93@users.noreply.github.com>2021-06-06 20:54:37 +0200
commit7461ab575f8641253340ef90a2d37b1f01891e5a (patch)
tree1e856ae79ad3451d0ecfa84fb38ee28cadfaf207 /numpy
parent07bdbf14eba1dd07eb20bd9d63840f755088b126 (diff)
downloadnumpy-7461ab575f8641253340ef90a2d37b1f01891e5a.tar.gz
MAINT: Move `empty_like` to `np.core.multiarray`
Diffstat (limited to 'numpy')
-rw-r--r--numpy/__init__.pyi5
-rw-r--r--numpy/core/multiarray.pyi31
-rw-r--r--numpy/core/numeric.pyi17
3 files changed, 35 insertions, 18 deletions
diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi
index c6cf0aacf..d5efe19bb 100644
--- a/numpy/__init__.pyi
+++ b/numpy/__init__.pyi
@@ -294,11 +294,14 @@ from numpy.core.einsumfunc import (
einsum_path as einsum_path,
)
+from numpy.core.multiarray import (
+ empty_like as empty_like,
+)
+
from numpy.core.numeric import (
zeros_like as zeros_like,
ones as ones,
ones_like as ones_like,
- empty_like as empty_like,
full as full,
full_like as full_like,
count_nonzero as count_nonzero,
diff --git a/numpy/core/multiarray.pyi b/numpy/core/multiarray.pyi
new file mode 100644
index 000000000..cd8518ed6
--- /dev/null
+++ b/numpy/core/multiarray.pyi
@@ -0,0 +1,31 @@
+from typing import Any, Optional, overload, TypeVar, List, Type, Union
+
+from numpy import dtype, generic, _OrderKACF
+from numpy.typing import ArrayLike, NDArray, DTypeLike, _ShapeLike, _SupportsDType
+
+_SCT = TypeVar("_SCT", bound=generic)
+
+_DTypeLike = Union[
+ dtype[_SCT],
+ Type[_SCT],
+ _SupportsDType[dtype[_SCT]],
+]
+
+__all__: List[str]
+
+@overload
+def empty_like(
+ a: ArrayLike,
+ dtype: _DTypeLike[_SCT],
+ order: _OrderKACF = ...,
+ subok: bool = ...,
+ shape: Optional[_ShapeLike] = ...,
+) -> NDArray[_SCT]: ...
+@overload
+def empty_like(
+ a: ArrayLike,
+ dtype: DTypeLike = ...,
+ order: _OrderKACF = ...,
+ subok: bool = ...,
+ shape: Optional[_ShapeLike] = ...,
+) -> NDArray[Any]: ...
diff --git a/numpy/core/numeric.pyi b/numpy/core/numeric.pyi
index f57951434..3c2b553ec 100644
--- a/numpy/core/numeric.pyi
+++ b/numpy/core/numeric.pyi
@@ -67,23 +67,6 @@ def ones_like(
shape: Optional[_ShapeLike] = ...,
) -> ndarray: ...
-@overload
-def empty_like(
- a: _ArrayType,
- dtype: None = ...,
- order: _OrderKACF = ...,
- subok: Literal[True] = ...,
- shape: None = ...,
-) -> _ArrayType: ...
-@overload
-def empty_like(
- a: ArrayLike,
- dtype: DTypeLike = ...,
- order: _OrderKACF = ...,
- subok: bool = ...,
- shape: Optional[_ShapeLike] = ...,
-) -> ndarray: ...
-
def full(
shape: _ShapeLike,
fill_value: Any,