8000 Merge pull request #20725 from charris/backport-20719 · numpy/numpy@d39ad3a · GitHub
[go: up one dir, main page]

Skip to content

Commit d39ad3a

Browse files
authored
Merge pull request #20725 from charris/backport-20719
TYP: change type annotation for `__array_namespace__` to ModuleType
2 parents 2e61d9f + 4a45d24 commit d39ad3a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

numpy/array_api/_array_object.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
)
3131

3232
from typing import TYPE_CHECKING, Optional, Tuple, Union, Any
33+
import types
3334

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

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

0 commit comments

Comments
 (0)
0