Repository navigation
Turn on ruff's pyupgrade rules - #2976
Merged
Merged
Conversation
The rules were turned off in #2677 until the arcade.gl abstraction and the pyglet 3 migration merged, to avoid conflicts. Both have merged. Most changes are ruff's own fixes in arcade.gl: typing.List/Dict/Tuple become builtins, Iterable/Sequence/Callable come from collections.abc, Union/Optional become X | Y, and .format() becomes f-strings. By hand: a Union type alias in arcade.gl.types, an unused import ruff won't remove from an __init__.py, and four __repr__ lines ruff made too long. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #2676
#2677 turned on ruff's pyupgrade (
UP) rules, then turned them off again:# "UP", wait for arcade.gl abstraction merge. That merge (#2666) and the pyglet 3 migration have both landed, so this turns the rules on forarcadeandtestsand applies the fixes.What changed (43 files, +195/−217)
Almost all of it is ruff's own autofix, mostly in
arcade/gl:List[int],Dict,Tuple,Type→list[int]and other builtinsIterable,Sequence,Callableand similar imported fromcollections.abcinstead oftyping(the issue's request)from __future__ import annotations.format()→ f-stringsUnion[X, Y]/Optional[X]→X | Y/X | NoneBy hand:
arcade/gl/types.py:BufferOrBufferProtocol = Union[BufferProtocol, Buffer]→BufferProtocol | Buffer. Ruff doesn't rewrite aUnionassigned to a name. It's safe at runtime on Python 3.10+, whichever formBufferProtocolhas.tests/unit/gui/__init__.py: removed an unusedfrom typing import List. Ruff won't remove imports from an__init__.pyautomatically.__repr__methods in the OpenGL and WebGLtexture.py/texture_array.py: UP032 made their f-strings longer than 100 characters, so they're split across two lines.Nothing changes at runtime. These are annotations, imports and string formatting. The examples are outside ruff's scope and unchanged. The changelog entry is under Misc Changes.
Checked
make.py docs-full(nitpicky Sphinx build plus the internal link check) passes. Thearcade.glsignatures now namecollections.abctypes, which link to Python's docs.🤖 Generated with Claude Code