Skip to content
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

TYP, MAINT: Add a missing explicit Any parameter to the npt.ArrayLike definition #23150

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions numpy/_typing/_array_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# NOTE: Import `Sequence` from `typing` as we it is needed for a type-alias,
# not an annotation
import sys
from collections.abc import Collection, Callable
from typing import Any, Sequence, Protocol, Union, TypeVar, runtime_checkable
from numpy import (
Expand Down Expand Up @@ -82,10 +83,16 @@ def __array_function__(
# is resolved. See also the mypy issue:
#
# https://github.com/python/typing/issues/593
ArrayLike = _DualArrayLike[
dtype,
Union[bool, int, float, complex, str, bytes],
]
if sys.version_info[:2] < (3, 9):
ArrayLike = _DualArrayLike[
dtype,
Union[bool, int, float, complex, str, bytes],
]
else:
ArrayLike = _DualArrayLike[
dtype[Any],
Union[bool, int, float, complex, str, bytes],
]

# `ArrayLike<X>_co`: array-like objects that can be coerced into `X`
# given the casting rules `same_kind`
Expand Down