Skip to content

Commit 306feae

Browse files
Lint all files with Ruff
1 parent 4f68dd2 commit 306feae

6 files changed

Lines changed: 33 additions & 31 deletions

File tree

auditwheel_emscripten/repair.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from .wheel_utils import WHEEL_INFO_RE, is_emscripten_wheel, pack, unpack
1010

1111

12-
def resolve_sharedlib(wheel_file: str | Path, libdir: str | Path | list[str | Path]) -> dict[str, Path]:
12+
def resolve_sharedlib(
13+
wheel_file: str | Path, libdir: str | Path | list[str | Path]
14+
) -> dict[str, Path]:
1315
"""
1416
Resolve the full path of shared libraries inside the wheel file
1517
"""

test/test_exports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def test_exports(shared_lib, expected):
2626
export_list.append(field)
2727

2828
for expected_export in expected:
29-
assert (
30-
expected_export in export_list
31-
), f"expected import {expected_export} not found"
29+
assert expected_export in export_list, (
30+
f"expected import {expected_export} not found"
31+
)

test/test_function_type.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def test_get_function_type_by_idx(shared_lib, expected):
3030
if func_name in expected:
3131
function_type = get_function_type_by_idx(wasmfile, export.index)
3232
formatted = format_function_type(function_type)
33-
assert (
34-
formatted == expected[func_name]
35-
), f"expected {expected[func_name]} but got {formatted}"
33+
assert formatted == expected[func_name], (
34+
f"expected {expected[func_name]} but got {formatted}"
35+
)
3636

3737

3838
@pytest.mark.parametrize(
@@ -55,6 +55,6 @@ def test_get_function_type_by_typeval(shared_lib, expected):
5555
if func_name in expected:
5656
function_type = get_function_type_by_typeval(wasmfile, _import.type)
5757
formatted = format_function_type(function_type)
58-
assert (
59-
formatted == expected[func_name]
60-
), f"expected {expected[func_name]} but got {formatted}"
58+
assert formatted == expected[func_name], (
59+
f"expected {expected[func_name]} but got {formatted}"
60+
)

test/test_imports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def test_imports(shared_lib, expected):
2727
import_list.append((module, field))
2828

2929
for expected_import in expected:
30-
assert (
31-
expected_import in import_list
32-
), f"expected import {expected_import} not found"
30+
assert expected_import in import_list, (
31+
f"expected import {expected_import} not found"
32+
)

test/test_repair.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def test_copylib(tmp_path, wheel_file, expected):
5555
copylib(extract_dir, dep_map, lib_sdir)
5656

5757
for expected_lib in expected:
58-
assert (
59-
extract_dir / lib_sdir / expected_lib
60-
).is_file(), f"expected lib {expected_lib} not found"
58+
assert (extract_dir / lib_sdir / expected_lib).is_file(), (
59+
f"expected lib {expected_lib} not found"
60+
)
6161

6262

6363
@pytest.mark.parametrize(
@@ -78,9 +78,9 @@ def test_repair(tmp_path, wheel_file, expected):
7878
libs = show(repaired_wheel)
7979
libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()]))
8080
for expected_lib in expected:
81-
assert (
82-
expected_lib in libs_dependencies
83-
), f"expected lib {expected_lib} not found in dependencies"
81+
assert expected_lib in libs_dependencies, (
82+
f"expected lib {expected_lib} not found in dependencies"
83+
)
8484

8585

8686
@pytest.mark.parametrize(
@@ -116,6 +116,6 @@ def test_repair_rpath(tmp_path, wheel_file, libname, expected):
116116
for lib in shared_libs:
117117
lib_dylink = parse_dylink_section(lib)
118118
libname_index = libname.index(lib.name)
119-
assert (
120-
expected[libname_index] in lib_dylink.runtime_paths
121-
), f"expected runtime path {expected[libname_index]} not found in {lib.name}"
119+
assert expected[libname_index] in lib_dylink.runtime_paths, (
120+
f"expected runtime path {expected[libname_index]} not found in {lib.name}"
121+
)

test/test_show.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def test_show(wheel_file, expected):
3636
libs_inside_wheel = libs.keys()
3737

3838
assert libs_inside_wheel, "no libs found inside wheel"
39-
assert all(
40-
[lib.endswith(".so") for lib in libs_inside_wheel]
41-
), "not all libs are .so files"
39+
assert all([lib.endswith(".so") for lib in libs_inside_wheel]), (
40+
"not all libs are .so files"
41+
)
4242
for expected_lib in expected:
43-
assert (
44-
expected_lib in libs_inside_wheel
45-
), f"expected lib {expected_lib} not found"
43+
assert expected_lib in libs_inside_wheel, (
44+
f"expected lib {expected_lib} not found"
45+
)
4646

4747

4848
@pytest.mark.parametrize(
@@ -61,9 +61,9 @@ def test_show_dependencies(wheel_file, expected):
6161

6262
libs_dependencies = list(chain(*[dep for (dep, _) in libs.values()]))
6363
for expected_lib in expected:
64-
assert (
65-
expected_lib in libs_dependencies
66-
), f"expected lib {expected_lib} not found in dependencies"
64+
assert expected_lib in libs_dependencies, (
65+
f"expected lib {expected_lib} not found in dependencies"
66+
)
6767

6868

6969
def test_locate_dependency():

0 commit comments

Comments
 (0)