[ruff] Apply unsafe autofixes from ruff 0.16 - #14913
Merged
Pierre-Sassoulas merged 8 commits intoAug 19, 2026
Merged
Conversation
One 'list(<genexp>)' in Source.__init__ becomes a list comprehension. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The 'list([0, 2])' in test_assertion.py is already a list, the outer call adds nothing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
'sorted()' already consumes any iterable, the inner 'list()' is dead weight. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
'merge_family' never uses the key of the right hand family, iterate over '.values()' instead of '.items()'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
'_get_assertion_exprs' guard becomes 'bool(util._assertion_pass)'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both 'map(lambda ...)' calls become generator expressions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Iterating a dict already yields its keys. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| elif type == "linelist": | ||
| if isinstance(value, str): | ||
| return [t for t in map(lambda x: x.strip(), value.split("\n")) if t] | ||
| return [t for t in (x.strip() for x in value.split("\n")) if t] |
Member
There was a problem hiding this comment.
Suggested change
| return [t for t in (x.strip() for x in value.split("\n")) if t] | |
| return [xs for x in value.split("\n")) if (xs := x.strip()] |
Member
Author
There was a problem hiding this comment.
I kid you not I considered to do that, I rewrote my branch for it and then reverted and rewrote again :D
Member
Author
There was a problem hiding this comment.
Took the old commit with 'stripped' let me know if you prefer the short variable name
The C417 fix in the previous commit is what ruff generates, and it leaves a generator nested inside a comprehension that then filters it. Binding the stripped line once says the same thing in one pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
RonnyPfannschmidt
approved these changes
Aug 19, 2026
RonnyPfannschmidt
left a comment
Member
There was a problem hiding this comment.
lovely, lets keep the long word
thanks !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #14897 and #14895, now the unsafe autofix. (Verified by me)