[PR #2419] chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version #23636

Closed
opened 2026-02-21 20:21:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/2419

State: closed
Merged: Yes


  • to modernize Python code with the targeted version
  • pyupgrade rules in Ruff: https://docs.astral.sh/ruff/rules/#pyupgrade-up
    • to prefer native builtin collections over from typing, e.g. list instead of List
    • to prefer collections from collections.abc (abstract base class container from Python3.3) over from collections
    • skip UTF-8 encoding in the headline, as it's already the default encoding in Python
    • prefer yield from in generator
  • ignoring the following rules
    • UP007: Use X | Y for type annotations
      • to prevent enforcing Unin[type1, type2] into type1, type2 or breaking Optional[]
    • UP032: Use f-string instead of format call
  • Ruff respects the required Python version from config file, which is >=3.10.
**Original Pull Request:** https://github.com/langgenius/dify/pull/2419 **State:** closed **Merged:** Yes --- - to modernize Python code with the targeted version - `pyupgrade` rules in Ruff: https://docs.astral.sh/ruff/rules/#pyupgrade-up - to prefer native builtin collections over from typing, e.g. `list` instead of `List` - to prefer collections from `collections.abc` (abstract base class container from Python3.3) over from `collections` - skip UTF-8 encoding in the headline, as it's already the default encoding in Python - prefer `yield from` in generator - ignoring the following rules - UP007: Use X \| Y for type annotations - to prevent enforcing `Unin[type1, type2]` into `type1, type2` or breaking `Optional[]` - UP032: Use f-string instead of format call - Ruff respects the required Python version from config file, which is `>=3.10`.
yindo added the pull-request label 2026-02-21 20:21:28 -05:00
yindo closed this issue 2026-02-21 20:21:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#23636