Skip to content

Commit 5b218ac

Browse files
authored
Merge pull request #20719 from rgommers/array-namespace-typehint
TYP: change type annotation for `__array_namespace__` to ModuleType Original NumPy Commit: 79137960472c1f723b983feff4663c3b60e64eb0
2 parents c76538d + a8a10f3 commit 5b218ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

array_api_strict/_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)