Enable ruff UP (pyupgrade) rule and fix all 56 violations#3768
Open
Zephyr-Blessed wants to merge 1 commit intoencode:masterfrom
Open
Enable ruff UP (pyupgrade) rule and fix all 56 violations#3768Zephyr-Blessed wants to merge 1 commit intoencode:masterfrom
Zephyr-Blessed wants to merge 1 commit intoencode:masterfrom
Conversation
Enable the ruff `UP` rule set for automatic Python modernization checks.
Changes across 17 files:
- UP006: Replace deprecated typing.Tuple/Dict/List with builtin equivalents
- UP012: Remove unnecessary .encode('utf-8') calls
- UP015: Remove redundant open() modes
- UP028: Replace yield-over-for with yield from
- UP031/UP032: Modernize string formatting to f-strings/format specs
- UP035: Import from collections.abc instead of typing
Also fixes import ordering (I001) caused by the import changes.
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.
Summary
Enables the ruff
UP(pyupgrade) rule set and fixes all 56 existing violations across 17 files.Changes
tuple/dict/listinstead oftyping.Tuple/Dict/List.encode('utf-8')callsyield-over-forwithyield fromcollections.abcinstead oftyping.format()open()modesThe
UPrule is now enabled inpyproject.tomlalongside the existingE,F,I,B,PIErules to prevent regressions.All existing ruff checks continue to pass.