diff options
author | Bas van Beek <43369155+BvB93@users.noreply.github.com> | 2022-01-04 00:25:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 00:25:50 +0100 |
commit | 79137960472c1f723b983feff4663c3b60e64eb0 (patch) | |
tree | 936f231b01efeafb625c9051428db41791a711cd /numpy | |
parent | d64df4553e7763208e150d6039dcb6fd3d5ef0be (diff) | |
parent | 781c9463673af478b2799549d70ac6d16e0555a5 (diff) | |
download | numpy-79137960472c1f723b983feff4663c3b60e64eb0.tar.gz |
Merge pull request #20719 from rgommers/array-namespace-typehint
TYP: change type annotation for `__array_namespace__` to ModuleType
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/array_api/_array_object.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/array_api/_array_object.py b/numpy/array_api/_array_object.py index 75baf34b0..391e9f575 100644 --- a/numpy/array_api/_array_object.py +++ b/numpy/array_api/_array_object.py @@ -30,6 +30,7 @@ from ._dtypes import ( ) from typing import TYPE_CHECKING, Optional, Tuple, Union, Any +import types if TYPE_CHECKING: from ._typing import Any, PyCapsule, Device, Dtype @@ -415,7 +416,7 @@ class 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 |