Skip to content

Commit 2ee95a2

Browse files
authored
Initial Import Sorting with Ruff (#2177)
* Initial Import Sorting with Ruff * Add CONTRIBUTING docs about import sorting
1 parent 16c29e5 commit 2ee95a2

File tree

128 files changed

+347
-296
lines changed

Some content is hidden

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

128 files changed

+347
-296
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ the formatting is correct.
9595
python make.py format
9696
```
9797

98+
In addition to Black, this will sort the imports using [Ruff](https://docs.astral.sh/ruff/). If you want to setup
99+
your editor to run this, please see [this link](https://docs.astral.sh/ruff/integrations/) for more information on
100+
Ruff integration for your specific editor.
101+
98102
### Use pre-commit hooks to automatically run formatting
99103

100104
You can use `pre-commit <https://pre-commit.com/>`_ to automatically run lint, formatting and type checks against

arcade/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
from arcade.management import show_info
44

5-
65
if __name__ == "__main__":
76
show_info()

arcade/__pyinstaller/hook-arcade.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
from pathlib import Path
1616

17-
import arcade
1817
import pymunk
1918
from PyInstaller.compat import is_darwin, is_unix, is_win
2019

20+
import arcade
21+
2122
pymunk_path = Path(pymunk.__file__).parent
2223
arcade_path = Path(arcade.__file__).parent
2324

arcade/application.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@
1111
from typing import Optional
1212

1313
import pyglet
14-
1514
import pyglet.gl as gl
1615
import pyglet.window.mouse
1716
from pyglet.display.base import ScreenMode
1817
from pyglet.window import MouseCursor
1918

2019
import arcade
21-
from arcade import get_display_size
22-
from arcade import set_window
20+
from arcade import SectionManager, get_display_size, set_window
2321
from arcade.color import TRANSPARENT_BLACK
2422
from arcade.context import ArcadeContext
25-
from arcade.types import Color, RGBOrA255, RGBANormalized
26-
from arcade import SectionManager
23+
from arcade.types import Color, RGBANormalized, RGBOrA255
2724
from arcade.types.rect import LBWH, Rect
2825
from arcade.utils import is_raspberry_pi
2926

arcade/cache/hit_box.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
import gzip
1515
import json
16-
from pathlib import Path
17-
from typing import Optional, Union, TYPE_CHECKING
1816
from collections import OrderedDict
17+
from pathlib import Path
18+
from typing import TYPE_CHECKING, Optional, Union
1919

20-
from arcade.types import Point2List
2120
from arcade.resources import resolve
21+
from arcade.types import Point2List
2222

2323
if TYPE_CHECKING:
2424
from arcade import Texture

arcade/cache/image_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Optional, TYPE_CHECKING
3+
from typing import TYPE_CHECKING, Optional
44

55
if TYPE_CHECKING:
66
from arcade.texture import ImageData

arcade/cache/texture.py

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

3-
from typing import Optional, TYPE_CHECKING, Union
43
from pathlib import Path
4+
from typing import TYPE_CHECKING, Optional, Union
55

66
if TYPE_CHECKING:
77
from arcade import Texture

arcade/camera/camera_2d.py

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

3-
from typing import TYPE_CHECKING, Optional, Generator
4-
from math import degrees, radians, atan2, cos, sin
53
from contextlib import contextmanager
4+
from math import atan2, cos, degrees, radians, sin
5+
from typing import TYPE_CHECKING, Generator, Optional
66

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

910
from arcade.camera.data_types import (
@@ -12,15 +13,13 @@
1213
ZeroProjectionDimension,
1314
)
1415
from arcade.camera.projection_functions import (
15-
generate_view_matrix,
1616
generate_orthographic_matrix,
17+
generate_view_matrix,
1718
project_orthographic,
1819
unproject_orthographic,
1920
)
2021
from arcade.gl import Framebuffer
21-
from pyglet.math import Vec2, Vec3
22-
23-
from arcade.types import Point, Rect, LBWH, LRBT
22+
from arcade.types import LBWH, LRBT, Point, Rect
2423
from arcade.types.vector_like import Point2
2524
from arcade.window_commands import get_window
2625

arcade/camera/data_types.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
"""
66

77
from __future__ import annotations
8+
89
from contextlib import contextmanager
9-
from typing import Protocol, Generator
10+
from typing import Generator, Protocol
1011

11-
from typing_extensions import Self
1212
from pyglet.math import Vec2, Vec3
13+
from typing_extensions import Self
1314

14-
from arcade.types import AsFloat, Point, Point3, Rect, LRBT
15+
from arcade.types import LRBT, AsFloat, Point, Point3, Rect
1516

1617
__all__ = [
1718
"CameraData",

arcade/camera/default.py

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

3-
from typing import Optional, Generator, TYPE_CHECKING
4-
from typing_extensions import Self
53
from contextlib import contextmanager
4+
from typing import TYPE_CHECKING, Generator, Optional
65

76
from pyglet.math import Mat4, Vec2, Vec3
7+
from typing_extensions import Self
88

99
from arcade.types import Point
1010
from arcade.window_commands import get_window

0 commit comments

Comments
 (0)