Skip to content

Commit

Permalink
Merge pull request #23150 from charris/backport-23144
Browse files Browse the repository at this point in the history
TYP, MAINT: Add a missing explicit ``Any`` parameter to the ``npt.ArrayLike`` definition
  • Loading branch information
charris committed Feb 3, 2023
2 parents 2433fe5 + e5452b9 commit bc47a5b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions numpy/_typing/_array_like.py
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

0 comments on commit bc47a5b

Please sign in to comment.