Skip to content

Commit

Permalink
Merge pull request #20725 from charris/backport-20719
Browse files Browse the repository at this point in the history
TYP: change type annotation for `__array_namespace__` to ModuleType
  • Loading branch information
charris committed Jan 4, 2022
2 parents 2e61d9f + 4a45d24 commit d39ad3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numpy/array_api/_array_object.py
Expand Up @@ -30,6 +30,7 @@
)

from typing import TYPE_CHECKING, Optional, Tuple, Union, Any
import types

if TYPE_CHECKING:
from ._typing import Any, PyCapsule, Device, Dtype
Expand Down Expand Up @@ -415,7 +416,7 @@ def __and__(self: Array, other: Union[int, bool, Array], /) -> Array:

def __array_namespace__(
self: Array, /, *, api_version: Optional[str] = None
) -> Any:
) -> types.ModuleType:
if api_version is not None and not api_version.startswith("2021."):
raise ValueError(f"Unrecognized array API version: {api_version!r}")
return array_api
Expand Down

0 comments on commit d39ad3a

Please sign in to comment.