diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-02-26 18:28:48 -0700 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-02-26 18:28:48 -0700 |
commit | 16030e4e6931b81997b6c2d8d0ef4f15e39b6057 (patch) | |
tree | 1e738b55f1b3d0bac20afdd8becd85f72d6c531a /numpy/_array_api | |
parent | 73d2c1e1675ed9e7fe2bc389ec0079c5c6ce73ee (diff) | |
download | numpy-16030e4e6931b81997b6c2d8d0ef4f15e39b6057.tar.gz |
Clean up some imports
Diffstat (limited to 'numpy/_array_api')
-rw-r--r-- | numpy/_array_api/_creation_functions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py index 197960211..888f24558 100644 --- a/numpy/_array_api/_creation_functions.py +++ b/numpy/_array_api/_creation_functions.py @@ -12,8 +12,9 @@ def asarray(obj: Union[float, NestedSequence[bool|int|float], SupportsDLPack, Su See its docstring for more information. """ + # _array_object imports in this file are inside the functions to avoid + # circular imports from ._array_object import ndarray - from . import _dtypes if device is not None: # Note: Device support is not yet implemented on ndarray raise NotImplementedError("Device support is not yet implemented") @@ -23,7 +24,7 @@ def asarray(obj: Union[float, NestedSequence[bool|int|float], SupportsDLPack, Su if isinstance(obj, ndarray): return obj res = np.asarray(obj, dtype=dtype) - if res.dtype not in _dtypes._all_dtypes: + if res.dtype not in _all_dtypes: raise TypeError(f"The array_api namespace does not support the dtype '{res.dtype}'") return ndarray._new(res) |