|
19 | 19 | from enum import IntEnum
|
20 | 20 | from ._creation_functions import asarray
|
21 | 21 | from ._dtypes import (_all_dtypes, _boolean_dtypes, _integer_dtypes,
|
22 |
| - _integer_or_boolean_dtypes, _floating_dtypes, _numeric_dtypes) |
| 22 | + _integer_or_boolean_dtypes, _floating_dtypes, |
| 23 | + _numeric_dtypes, _result_type, _dtype_categories) |
23 | 24 |
|
24 | 25 | from typing import TYPE_CHECKING, Optional, Tuple, Union
|
25 | 26 | if TYPE_CHECKING:
|
26 | 27 | from ._typing import PyCapsule, Device, Dtype
|
27 | 28 |
|
28 | 29 | import numpy as np
|
29 | 30 |
|
| 31 | +from numpy import array_api |
| 32 | + |
30 | 33 | class Array:
|
31 | 34 | """
|
32 | 35 | n-d array object for the array API namespace.
|
@@ -98,7 +101,6 @@ def _check_allowed_dtypes(self, other, dtype_category, op):
|
98 | 101 | if other is NotImplemented:
|
99 | 102 | return other
|
100 | 103 | """
|
101 |
| - from ._dtypes import _result_type, _dtype_categories |
102 | 104 |
|
103 | 105 | if self.dtype not in _dtype_categories[dtype_category]:
|
104 | 106 | raise TypeError(f'Only {dtype_category} dtypes are allowed in {op}')
|
@@ -338,7 +340,6 @@ def __and__(self: Array, other: Union[int, bool, Array], /) -> Array:
|
338 | 340 | def __array_namespace__(self: Array, /, *, api_version: Optional[str] = None) -> object:
|
339 | 341 | if api_version is not None and not api_version.startswith('2021.'):
|
340 | 342 | raise ValueError(f"Unrecognized array API version: {api_version!r}")
|
341 |
| - from numpy import array_api |
342 | 343 | return array_api
|
343 | 344 |
|
344 | 345 | def __bool__(self: Array, /) -> bool:
|
|
0 commit comments