Skip to content

Enable ruff UP (pyupgrade) rule and fix all 56 violations#3768

Open
Zephyr-Blessed wants to merge 1 commit intoencode:masterfrom
Zephyr-Blessed:enable-ruff-up-rules
Open

Enable ruff UP (pyupgrade) rule and fix all 56 violations#3768
Zephyr-Blessed wants to merge 1 commit intoencode:masterfrom
Zephyr-Blessed:enable-ruff-up-rules

Conversation

@Zephyr-Blessed
Copy link

Summary

Enables the ruff UP (pyupgrade) rule set and fixes all 56 existing violations across 17 files.

Changes

Rule Description Count
UP006 Use builtin tuple/dict/list instead of typing.Tuple/Dict/List 29
UP012 Remove unnecessary .encode('utf-8') calls 10
UP028 Replace yield-over-for with yield from 6
UP035 Import from collections.abc instead of typing 5
UP032 Use f-strings instead of .format() 2
UP031 Modernize percent string formatting 2
UP015 Remove redundant open() modes 2

The UP rule is now enabled in pyproject.toml alongside the existing E, F, I, B, PIE rules to prevent regressions.

All existing ruff checks continue to pass.

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.
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.

1 participant

Comments