From d8955fe91151124622e811b091fcdd61f4c815cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Tue, 16 Apr 2024 18:11:32 -0400 Subject: [PATCH] ENH: Require the iterables in a zip call to have equal length Require the iterables in a `zip` call to have equal length. Fixes: ``` installing ruff... --- .maint/update_authors.py +++ .maint/update_authors.py @@ -49,7 +49,7 @@ break values = [v.strip() or None for v in line.split("|")][1:-1] - retval.append({k: v for k, v in zip(keys, values) if v}) + retval.append({k: v for k, v in zip(keys, values, strict=False) if v}) return retval @@ -288,7 +288,7 @@ print("Authors (%d):" % len(hits)) print( "%s." - % "; ".join(["%s \\ :sup:`%s`\\ " % (i["name"], idx) for i, idx in zip(hits, aff_indexes)]) + % "; ".join(["%s \\ :sup:`%s`\\ " % (i["name"], idx) for i, idx in zip(hits, aff_indexes, strict=False)]) ) print( Would fix 2 errors. ``` raised for example in: https://github.com/nipreps/eddymotion/actions/runs/8707149384/job/23881469441?pr=169#step:4:36 Documentation: https://docs.astral.sh/ruff/rules/zip-without-explicit-strict/#zip-without-explicit-strict-b905 --- .maint/update_authors.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.maint/update_authors.py b/.maint/update_authors.py index 5b357049..e6082bd9 100644 --- a/.maint/update_authors.py +++ b/.maint/update_authors.py @@ -49,7 +49,7 @@ def read_md_table(md_text): break values = [v.strip() or None for v in line.split("|")][1:-1] - retval.append({k: v for k, v in zip(keys, values) if v}) + retval.append({k: v for k, v in zip(keys, values, strict=True) if v}) return retval @@ -288,7 +288,12 @@ def _aslist(value): print("Authors (%d):" % len(hits)) print( "%s." - % "; ".join(["%s \\ :sup:`%s`\\ " % (i["name"], idx) for i, idx in zip(hits, aff_indexes)]) + % "; ".join( + [ + "%s \\ :sup:`%s`\\ " % (i["name"], idx) + for i, idx in zip(hits, aff_indexes, strict=True) + ] + ) ) print(