8000 MAINT: Move aliases for common scalar unions to `numpy.typing` by BvB93 · Pull Request #17429 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Move aliases for common scalar unions to numpy.typing #17429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 7, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ENH: Use _ScalarLike in the definition of ArrayLike
  • Loading branch information
Bas van Beek committed Oct 5, 2020
commit 652f50a2a44bf5924b1905c40331268ea2d5d37c
8 changes: 7 additions & 1 deletion numpy/typing/_array_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, overload, Sequence, TYPE_CHECKING, Union

from numpy import ndarray
from ._scalars import _ScalarLike
from ._dtype_like import DtypeLike

if sys.version_info >= (3, 8):
Expand Down Expand Up @@ -31,4 +32,9 @@ def __array__(self, dtype: DtypeLike = ...) -> ndarray: ...
# is resolved. See also the mypy issue:
#
# https://github.com/python/typing/issues/593
ArrayLike = Union[bool, int, float, complex, _SupportsArray, Sequence]
ArrayLike = Union[
_ScalarLike,
Sequence[_ScalarLike],
Sequence[Sequence[Any]], # TODO: Wait for support for recursive types
_SupportsArray,
]
0