Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Require the iterables in a zip call to have equal length #172

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

jhlegarreta
Copy link
Collaborator

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

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
@effigies effigies merged commit 56fd8df into nipreps:main Apr 17, 2024
5 checks passed
@jhlegarreta jhlegarreta deleted the RequireZipIterablesEqualLength2 branch April 17, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants