Skip to content

Commit b3c30bf

Browse files
authored
Upgrade to pyton 3.10 (#2677)
* enable pyupgrade for ruff, migrate to 3.10 featured typing * fix arcade python version warning (req 3.10 * fix formating * revert arcade.gl changes to reduce merge issues for gl abstraction PR
1 parent 441287b commit b3c30bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+284
-298
lines changed

arcade/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
from pathlib import Path
1414

15-
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 9):
16-
sys.exit("The Arcade Library requires Python 3.9 or higher.")
15+
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 10):
16+
sys.exit("The Arcade Library requires Python 3.10 or higher.")
1717

1818

1919
def configure_logging(level: int | None = None):

arcade/application.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import logging
99
import os
1010
import time
11-
from typing import TYPE_CHECKING, Sequence
11+
from collections.abc import Sequence
12+
from typing import TYPE_CHECKING
1213

1314
import pyglet
1415
import pyglet.gl as gl
@@ -36,7 +37,7 @@
3637
MOUSE_BUTTON_MIDDLE = 2
3738
MOUSE_BUTTON_RIGHT = 4
3839

39-
_window: "Window"
40+
_window: Window
4041

4142
__all__ = [
4243
"get_screens",

arcade/cache/hit_box.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def load(self, path: str | Path) -> None:
118118
with gzip.open(path, mode="rb") as fd:
119119
data = json.loads(fd.read())
120120
else:
121-
with open(path, mode="r") as fd:
121+
with open(path) as fd:
122122
data = json.loads(fd.read())
123123

124124
for key, value in data.items():

arcade/cache/image_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class ImageDataCache:
2323
"""
2424

2525
def __init__(self):
26-
self._entries: dict[str, "ImageData"] = {}
26+
self._entries: dict[str, ImageData] = {}
2727

28-
def put(self, name: str, image: "ImageData"):
28+
def put(self, name: str, image: ImageData):
2929
"""
3030
Add an image to the cache.
3131

arcade/camera/camera_2d.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from __future__ import annotations
22

3+
from collections.abc import Generator
34
from contextlib import contextmanager
45
from math import atan2, cos, degrees, radians, sin
5-
from typing import TYPE_CHECKING, Generator
6+
from typing import TYPE_CHECKING
67

78
from pyglet.math import Vec2, Vec3
89
from typing_extensions import Self
@@ -223,12 +224,12 @@ def from_camera_data(
223224
left, right = projection_data.left, projection_data.right
224225
if projection_data.left == projection_data.right:
225226
raise ZeroProjectionDimension(
226-
(f"projection width is 0 due to equal {left=}and {right=} values")
227+
f"projection width is 0 due to equal {left=}and {right=} values"
227228
)
228229
bottom, top = projection_data.bottom, projection_data.top
229230
if bottom == top:
230231
raise ZeroProjectionDimension(
231-
(f"projection height is 0 due to equal {bottom=}and {top=}")
232+
f"projection height is 0 due to equal {bottom=}and {top=}"
232233
)
233234
near, far = projection_data.near, projection_data.far
234235
if near == far:
@@ -583,7 +584,7 @@ def projection(self) -> Rect:
583584
def projection(self, value: Rect) -> None:
584585
# Unpack and validate
585586
if not value:
586-
raise ZeroProjectionDimension((f"Projection area is 0, {value.lrbt}"))
587+
raise ZeroProjectionDimension(f"Projection area is 0, {value.lrbt}")
587588

588589
_z = self._camera_data.zoom
589590

arcade/camera/data_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
wide usage throughout Arcade's camera code.
55
"""
66

7+
from collections.abc import Generator
78
from contextlib import contextmanager
8-
from typing import Final, Generator, Protocol
9+
from typing import Final, Protocol
910

1011
from pyglet.math import Vec2, Vec3
1112
from typing_extensions import Self

arcade/camera/default.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Generator
34
from contextlib import contextmanager
4-
from typing import TYPE_CHECKING, Generator
5+
from typing import TYPE_CHECKING
56

67
from pyglet.math import Mat4, Vec2, Vec3
78
from typing_extensions import Self

arcade/camera/orthographic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Generator
34
from contextlib import contextmanager
4-
from typing import TYPE_CHECKING, Generator
5+
from typing import TYPE_CHECKING
56

67
from pyglet.math import Mat4, Vec2, Vec3
78
from typing_extensions import Self

arcade/camera/perspective.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from __future__ import annotations
22

3+
from collections.abc import Generator
34
from contextlib import contextmanager
45
from math import radians, tan
5-
from typing import TYPE_CHECKING, Generator
6+
from typing import TYPE_CHECKING
67

78
from pyglet.math import Mat4, Vec2, Vec3
89
from typing_extensions import Self

arcade/camera/static.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable, Generator
34
from contextlib import contextmanager
4-
from typing import TYPE_CHECKING, Callable, Generator
5+
from typing import TYPE_CHECKING
56

67
from pyglet.math import Mat4, Vec2, Vec3
78

0 commit comments

Comments
 (0)