From 16030e4e6931b81997b6c2d8d0ef4f15e39b6057 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Fri, 26 Feb 2021 18:28:48 -0700 Subject: Clean up some imports --- numpy/_array_api/_creation_functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'numpy/_array_api/_creation_functions.py') 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) -- cgit v1.2.1