diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2020-08-30 00:49:55 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2020-10-01 13:56:27 +0200 |
commit | abe1429ee329571b640bf2b59b9be361e4f84c86 (patch) | |
tree | 78a1a04d3ac2f4650bf3860a1ef12f2d8a34d810 | |
parent | d03a906ed6d220fb9a359c51bf8413dfb3012a49 (diff) | |
download | numpy-abe1429ee329571b640bf2b59b9be361e4f84c86.tar.gz |
ENH: Use literals where possible
-rw-r--r-- | numpy/core/_asarray.pyi | 8 | ||||
-rw-r--r-- | numpy/typing/tests/data/pass/literal.py | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/numpy/core/_asarray.pyi b/numpy/core/_asarray.pyi index bcfc5dbd1..57081b760 100644 --- a/numpy/core/_asarray.pyi +++ b/numpy/core/_asarray.pyi @@ -1,7 +1,7 @@ import sys from typing import TypeVar, Optional, Union, Iterable, Tuple, overload -from numpy import ndarray +from numpy import ndarray, _OrderKACF from numpy.typing import ArrayLike, DtypeLike if sys.version_info >= (3, 8): @@ -14,7 +14,7 @@ _ArrayType = TypeVar("_ArrayType", bound=ndarray) def asarray( a: object, dtype: DtypeLike = ..., - order: Optional[str] = ..., + order: _OrderKACF = ..., *, like: ArrayLike = ... ) -> ndarray: ... @@ -22,7 +22,7 @@ def asarray( def asanyarray( a: _ArrayType, dtype: None = ..., - order: Optional[str] = ..., + order: _OrderKACF = ..., *, like: ArrayLike = ... ) -> _ArrayType: ... @@ -30,7 +30,7 @@ def asanyarray( def asanyarray( a: object, dtype: DtypeLike = ..., - order: Optional[str] = ..., + order: _OrderKACF = ..., *, like: ArrayLike = ... ) -> ndarray: ... diff --git a/numpy/typing/tests/data/pass/literal.py b/numpy/typing/tests/data/pass/literal.py index 321ce3c2b..8eaeb6afb 100644 --- a/numpy/typing/tests/data/pass/literal.py +++ b/numpy/typing/tests/data/pass/literal.py @@ -31,6 +31,8 @@ order_list: List[Tuple[frozenset, Callable]] = [ (KACF, partial(np.add, 1, 1)), # i.e. np.ufunc.__call__ (ACF, partial(np.reshape, AR, 1)), (KACF, partial(np.ravel, AR)), + (KACF, partial(np.asarray, 1)), + (KACF, partial(np.asanyarray, 1)), ] for order_set, func in order_list: |