Skip to content

Commit 967c883

Browse files
committed
Silence various ruff warnings
1 parent eb1db37 commit 967c883

File tree

10 files changed

+39
-29
lines changed

10 files changed

+39
-29
lines changed

array_api_compat/common/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from ._helpers import *
1+
from ._helpers import * # noqa: F403

array_api_compat/cupy/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
from cupy import *
1+
from cupy import * # noqa: F403
22

33
# from cupy import * doesn't overwrite these builtin names
4-
from cupy import abs, max, min, round
4+
from cupy import abs, max, min, round # noqa: F401
55

66
# These imports may overwrite names from the import * above.
7-
from ._aliases import *
7+
from ._aliases import * # noqa: F403
88

99
# See the comment in the numpy __init__.py
1010
__import__(__package__ + '.linalg')
1111

12-
from .linalg import matrix_transpose, vecdot
13-
14-
from ..common._helpers import *
12+
from ..common._helpers import * # noqa: F401,F403
1513

1614
__array_api_version__ = '2022.12'

array_api_compat/cupy/_aliases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
from functools import partial
44

5-
from ..common import _aliases
5+
import cupy as cp
66

7+
from ..common import _aliases
78
from .._internal import get_xp
89

910
asarray = asarray_cupy = partial(_aliases._asarray, namespace='cupy')
1011
asarray.__doc__ = _aliases._asarray.__doc__
1112
del partial
1213

13-
import cupy as cp
1414
bool = cp.bool_
1515

1616
# Basic renames

array_api_compat/cupy/linalg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from cupy.linalg import *
1+
from cupy.linalg import * # noqa: F403
22
# cupy.linalg doesn't have __all__. If it is added, replace this with
33
#
44
# from cupy.linalg import __all__ as linalg_all
@@ -10,10 +10,12 @@
1010

1111
from ..common import _linalg
1212
from .._internal import get_xp
13-
from ._aliases import (matmul, matrix_transpose, tensordot, vecdot)
1413

1514
import cupy as cp
1615

16+
# These functions are in both the main and linalg namespaces
17+
from ._aliases import matmul, matrix_transpose, tensordot, vecdot # noqa: F401
18+
1719
cross = get_xp(cp)(_linalg.cross)
1820
outer = get_xp(cp)(_linalg.outer)
1921
EighResult = _linalg.EighResult

array_api_compat/dask/array/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from dask.array import *
1+
from dask.array import * # noqa: F403
22

33
# These imports may overwrite names from the import * above.
4-
from ._aliases import *
4+
from ._aliases import * # noqa: F403
55

66
__array_api_version__ = '2022.12'
77

array_api_compat/dask/array/linalg.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
from __future__ import annotations
22

3-
from dask.array.linalg import *
3+
from dask.array.linalg import svd
44
from ...common import _linalg
55
from ..._internal import get_xp
6-
from dask.array import matmul, tensordot, trace, outer
6+
7+
# Exports
8+
from dask.array.linalg import * # noqa: F403
9+
from dask.array import trace, outer
10+
11+
# These functions are in both the main and linalg namespaces
12+
from dask.array import matmul, tensordot
713
from ._aliases import matrix_transpose, vecdot
814

915
import dask.array as da
@@ -39,9 +45,11 @@ def svdvals(x: ndarray) -> Union[ndarray, Tuple[ndarray, ...]]:
3945
vector_norm = get_xp(da)(_linalg.vector_norm)
4046
diagonal = get_xp(da)(_linalg.diagonal)
4147

42-
__all__ = linalg_all + ["EighResult", "QRResult", "SlogdetResult",
43-
"SVDResult", "qr", "cholesky", "matrix_rank", "matrix_norm",
44-
"svdvals", "vector_norm", "diagonal"]
48+
__all__ = linalg_all + ["trace", "outer", "matmul", "tensordot",
49+
"matrix_transpose", "vecdot", "EighResult",
50+
"QRResult", "SlogdetResult", "SVDResult", "qr",
51+
"cholesky", "matrix_rank", "matrix_norm", "svdvals",
52+
"vector_norm", "diagonal"]
4553

4654
del get_xp
4755
del da

array_api_compat/numpy/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from numpy import *
1+
from numpy import * # noqa: F403
22

33
# from numpy import * doesn't overwrite these builtin names
4-
from numpy import abs, max, min, round
4+
from numpy import abs, max, min, round # noqa: F401
55

66
# These imports may overwrite names from the import * above.
7-
from ._aliases import *
7+
from ._aliases import * # noqa: F403
88

99
# Don't know why, but we have to do an absolute import to import linalg. If we
1010
# instead do
@@ -15,8 +15,8 @@
1515
# dynamically so that the library can be vendored.
1616
__import__(__package__ + '.linalg')
1717

18-
from .linalg import matrix_transpose, vecdot
18+
from .linalg import matrix_transpose, vecdot # noqa: F401
1919

20-
from ..common._helpers import *
20+
from ..common._helpers import * # noqa: F403
2121

2222
__array_api_version__ = '2022.12'

array_api_compat/numpy/linalg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
from numpy.linalg import *
1+
from numpy.linalg import * # noqa: F403
22
from numpy.linalg import __all__ as linalg_all
33

44
from ..common import _linalg
55
from .._internal import get_xp
6-
from ._aliases import (matmul, matrix_transpose, tensordot, vecdot)
6+
7+
# These functions are in both the main and linalg namespaces
8+
from ._aliases import matmul, matrix_transpose, tensordot, vecdot # noqa: F401
79

810
import numpy as np
911

array_api_compat/torch/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from torch import *
1+
from torch import * # noqa: F403
22

33
# Several names are not included in the above import *
44
import torch
@@ -12,11 +12,11 @@
1212
exec(n + ' = torch.' + n)
1313

1414
# These imports may overwrite names from the import * above.
15-
from ._aliases import *
15+
from ._aliases import * # noqa: F403
1616

1717
# See the comment in the numpy __init__.py
1818
__import__(__package__ + '.linalg')
1919

20-
from ..common._helpers import *
20+
from ..common._helpers import * # noqa: F403
2121

2222
__array_api_version__ = '2022.12'

array_api_compat/torch/linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from torch import dtype as Dtype
88
from typing import Optional
99

10-
from torch.linalg import *
10+
from torch.linalg import * # noqa: F403
1111

1212
# torch.linalg doesn't define __all__
1313
# from torch.linalg import __all__ as linalg_all

0 commit comments

Comments
 (0)