Skip to content

Commit dc79e3f

Browse files
committed
TYP: fix/ignore typing errors in numpy.__init__
1 parent cbec5f3 commit dc79e3f

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

array_api_compat/numpy/__init__.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
from numpy import * # noqa: F403
1+
# ruff: noqa: PLC0414
2+
from typing import Final
3+
4+
from numpy import * # noqa: F403 # pyright: ignore[reportWildcardImportFromLibrary]
25

36
# from numpy import * doesn't overwrite these builtin names
4-
from numpy import abs, max, min, round # noqa: F401
7+
from numpy import abs as abs
8+
from numpy import max as max
9+
from numpy import min as min
10+
from numpy import round as round
511

612
# These imports may overwrite names from the import * above.
7-
from ._aliases import * # noqa: F403
13+
from ._aliases import * # noqa: F403
814

915
# Don't know why, but we have to do an absolute import to import linalg. If we
1016
# instead do
@@ -13,9 +19,17 @@
1319
#
1420
# It doesn't overwrite np.linalg from above. The import is generated
1521
# dynamically so that the library can be vendored.
16-
__import__(__package__ + '.linalg')
17-
__import__(__package__ + '.fft')
22+
__import__(__package__ + ".linalg")
23+
24+
__import__(__package__ + ".fft")
25+
26+
from ..common._helpers import * # noqa: F403
27+
from .linalg import matrix_transpose, vecdot # noqa: F401
1828

19-
from .linalg import matrix_transpose, vecdot # noqa: F401
29+
try:
30+
# Used in asarray(). Not present in older versions.
31+
from numpy import _CopyMode # noqa: F401
32+
except ImportError:
33+
pass
2034

21-
__array_api_version__ = '2024.12'
35+
__array_api_version__ = "2024.12"

0 commit comments

Comments
 (0)