Skip to content

Commit 6c4a75d

Browse files
committed
BUG: Don't import helpers in namespaces
1 parent b6900df commit 6c4a75d

File tree

5 files changed

+4
-17
lines changed

5 files changed

+4
-17
lines changed

array_api_compat/cupy/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
# See the comment in the numpy __init__.py
1010
__import__(__package__ + '.linalg')
11-
1211
__import__(__package__ + '.fft')
1312

14-
from ..common._helpers import * # noqa: F401,F403
15-
1613
__array_api_version__ = '2024.12'

array_api_compat/dask/array/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
__array_api_version__ = '2024.12'
77

8+
# See the comment in the numpy __init__.py
89
__import__(__package__ + '.linalg')
910
__import__(__package__ + '.fft')

array_api_compat/numpy/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,8 @@
1414
# It doesn't overwrite np.linalg from above. The import is generated
1515
# dynamically so that the library can be vendored.
1616
__import__(__package__ + '.linalg')
17-
1817
__import__(__package__ + '.fft')
1918

2019
from .linalg import matrix_transpose, vecdot # noqa: F401
2120

22-
from ..common._helpers import * # noqa: F403
23-
24-
try:
25-
# Used in asarray(). Not present in older versions.
26-
from numpy import _CopyMode # noqa: F401
27-
except ImportError:
28-
pass
29-
3021
__array_api_version__ = '2024.12'

array_api_compat/numpy/_aliases.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def asarray(
8686
*,
8787
dtype: Optional[DType] = None,
8888
device: Optional[Device] = None,
89-
copy: "Optional[Union[bool, np._CopyMode]]" = None,
89+
copy: Optional[Union[bool, np._CopyMode]] = None,
9090
**kwargs,
9191
) -> Array:
9292
"""

array_api_compat/torch/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
or 'cpu' in n
1010
or 'backward' in n):
1111
continue
12-
exec(n + ' = torch.' + n)
12+
exec(f"{n} = torch.{n}")
13+
del n
1314

1415
# These imports may overwrite names from the import * above.
1516
from ._aliases import * # noqa: F403
1617

1718
# See the comment in the numpy __init__.py
1819
__import__(__package__ + '.linalg')
19-
2020
__import__(__package__ + '.fft')
2121

22-
from ..common._helpers import * # noqa: F403
23-
2422
__array_api_version__ = '2024.12'

0 commit comments

Comments
 (0)