Skip to content

Commit 6e4c164

Browse files
committed
refact: Update zip() calls to include strict=False per B905
Adds `strict=False` to all `zip()` calls to fix Ruff linter Rule B905 (https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/). `strict=False` maintains current behaviour while fixing the linter error. There is no impact on unit tests with this change.
1 parent 33afb66 commit 6e4c164

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

src/lasso/dimred/graph_laplacian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _laplacian_gauss_idw(
9797
for i, (j, d, e, k) in enumerate(
9898
zip(
9999
*tree.query_radius(points, return_distance=True, r=search_radius),
100-
*tree.query(points, return_distance=True, k=1 + min_neighbors),
100+
*tree.query(points, return_distance=True, k=1 + min_neighbors), strict=False,
101101
)
102102
):
103103
# Always search for k neighbors, this prevents strongly connected local areas

src/lasso/dimred/hashing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _join_hash_comparison_thread_files(
211211
thread_weights = thread_file["weights"]
212212

213213
for (i_row, i_col), values, matches in zip(
214-
matrix_indexes, matrix_similarities, matrix_matches
214+
matrix_indexes, matrix_similarities, matrix_matches, strict=False
215215
):
216216
smatrix[i_row, i_col] = values
217217
ds_matches[i_row, i_col] = matches

src/lasso/dyna/binout.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def as_df(self, *args) -> pd.DataFrame:
200200
if args[0] == "rcforc":
201201
ids = [
202202
(str(i) + "m") if j else (str(i) + "s")
203-
for i, j in zip(self.read("rcforc", "ids"), self.read("rcforc", "side"))
203+
for i, j in zip(
204+
self.read("rcforc", "ids"), self.read("rcforc", "side"), strict=False
205+
)
204206
]
205207
else:
206208
ids = self.read(*args[:-1], "ids")

src/lasso/dyna/d3plot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7162,7 +7162,9 @@ def _write_geom_rigid_road_surface(
71627162
rigid_road_segment_road_id = self.arrays[ArrayType.rigid_road_segment_road_id]
71637163
rigid_road_segment_node_ids = self.arrays[ArrayType.rigid_road_segment_node_ids]
71647164

7165-
for segment_id, node_ids in zip(rigid_road_segment_road_id, rigid_road_segment_node_ids):
7165+
for segment_id, node_ids in zip(
7166+
rigid_road_segment_road_id, rigid_road_segment_node_ids, strict=False
7167+
):
71667168
n_bytes_written += fp.write(settings.pack(segment_id))
71677169
n_bytes_written += fp.write(settings.pack(len(node_ids)))
71687170
n_bytes_written += fp.write(settings.pack(node_ids, dtype_hint=np.integer))
@@ -7347,7 +7349,7 @@ def _write_header_part_contact_interface_titles(
73477349
title_wordsize = 4
73487350
max_len = 18 * title_wordsize
73497351
fmt_name = "{0:" + str(max_len) + "}"
7350-
for pid, title in zip(part_titles_ids, part_titles):
7352+
for pid, title in zip(part_titles_ids, part_titles, strict=False):
73517353
title = title.decode("utf-8")
73527354
n_bytes_written += fp.write(settings.pack(pid))
73537355

@@ -7387,7 +7389,7 @@ def _write_header_part_contact_interface_titles(
73877389

73887390
max_len = 18 * self.header.wordsize
73897391
fmt_name = "{0:" + str(max_len) + "}"
7390-
for pid, title in zip(titles_ids, titles):
7392+
for pid, title in zip(titles_ids, titles, strict=False):
73917393
n_bytes_written += fp.write(settings.pack(pid))
73927394

73937395
formatted_title = fmt_name.format(title[:max_len])

test/unit_tests/dyna/test_d3plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def test_write(self):
334334

335335
with tempfile.TemporaryDirectory() as dirpath:
336336
for d3plot_kwargs in d3plot_kwargs_list:
337-
for d3plot_filepath, _ in zip(filepaths, d3plot_kwargs_list):
337+
for d3plot_filepath, _ in zip(filepaths, d3plot_kwargs_list, strict=False):
338338
print(d3plot_filepath)
339339

340340
# read d3plot

0 commit comments

Comments
 (0)