Skip to content

Commit 6e54ae0

Browse files
committed
TYP: fix/ignore typing errors in numpy.__init__
1 parent fd32846 commit 6e54ae0

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

array_api_compat/numpy/__init__.py

Lines changed: 16 additions & 10 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,18 +19,18 @@
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-
18-
__import__(__package__ + '.fft')
22+
__import__(__package__ + ".linalg") # pyright: ignore
1923

20-
from .linalg import matrix_transpose, vecdot # noqa: F401
24+
__import__(__package__ + ".fft") # pyright: ignore
2125

22-
from ..common._helpers import * # noqa: F403
26+
from ..common._helpers import * # noqa: F403
27+
from .linalg import matrix_transpose as matrix_transpose
28+
from .linalg import vecdot as vecdot
2329

2430
try:
2531
# Used in asarray(). Not present in older versions.
26-
from numpy import _CopyMode # noqa: F401
32+
from numpy import _CopyMode as _CopyMode # pyright: ignore[reportPrivateUsage]
2733
except ImportError:
2834
pass
2935

30-
__array_api_version__ = '2024.12'
36+
__array_api_version__: Final = "2024.12"

0 commit comments

Comments
 (0)