Skip to content

Commit aa22e7e

Browse files
committed
formatting
1 parent a921edb commit aa22e7e

File tree

8 files changed

+30
-36
lines changed

8 files changed

+30
-36
lines changed

arcade/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
if is_pyodide():
1919
pyglet.options.backend = "webgl"
2020

21-
import pyglet.window.mouse
2221
import pyglet.config
22+
import pyglet.window.mouse
2323
from pyglet.display.base import Screen, ScreenMode
2424
from pyglet.event import EVENT_HANDLE_STATE, EVENT_UNHANDLED
2525
from pyglet.window import MouseCursor

arcade/context.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ def __init__(
205205
self.collision_detection_program_simple["index_data"] = 2
206206

207207
self.collision_buffer = self.buffer(reserve=1024 * 4)
208-
self.collision_query = self.query(
209-
samples=False, time=False, primitives=True
210-
)
208+
self.collision_query = self.query(samples=False, time=False, primitives=True)
211209
else:
212210
self.collision_detection_program = None
213211
self.collision_buffer = None

arcade/gl/backends/webgl/context.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ def __init__(
4040

4141
anistropy_ext = self._gl.getExtension("EXT_texture_filter_anisotropic")
4242
texture_float_linear_ext = self._gl.getExtension("OES_texture_float_linear")
43-
43+
4444
unsupported_extensions = []
4545
if not anistropy_ext:
4646
unsupported_extensions.append("EXT_texture_filter_anisotropic")
4747
if not texture_float_linear_ext:
4848
unsupported_extensions.append("OES_texture_float_linear")
4949

5050
if unsupported_extensions:
51-
raise RuntimeError(f"Tried to create a WebGL constant with the following missing extensions: {unsupported_extensions}")
51+
raise RuntimeError(
52+
f"Tried to create a WebGL constant with the following missing extensions: {unsupported_extensions}"
53+
)
5254

5355
super().__init__(window, gc_mode, gl_api)
5456

arcade/gl/backends/webgl/glsl.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ def inject_common_sources(self, common: Iterable[str] | None) -> None:
8888
if "main()" in line:
8989
break
9090
else:
91-
raise ShaderException(
92-
"No main() function found when injecting common source"
93-
)
91+
raise ShaderException("No main() function found when injecting common source")
9492

9593
# Insert all common sources
9694
for source in common:
@@ -116,9 +114,7 @@ def _find_glsl_version(self) -> int:
116114
except Exception:
117115
pass
118116

119-
source = "\n".join(
120-
f"{str(i + 1).zfill(3)}: {line} " for i, line in enumerate(self._lines)
121-
)
117+
source = "\n".join(f"{str(i + 1).zfill(3)}: {line} " for i, line in enumerate(self._lines))
122118

123119
raise ShaderException(
124120
(
@@ -161,8 +157,6 @@ def _parse_out_attributes(self):
161157
Note that this currently doesn't work for structs.
162158
"""
163159
for line in self._lines:
164-
res = re.match(
165-
r"(layout(.+)\))?(\s+)?(out)(\s+)(\w+)(\s+)(\w+)", line.strip()
166-
)
160+
res = re.match(r"(layout(.+)\))?(\s+)?(out)(\s+)(\w+)(\s+)(\w+)", line.strip())
167161
if res:
168162
self._out_attributes.append(res.groups()[-1])

arcade/gl/backends/webgl/texture.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
from arcade.gl import enums
99
from arcade.gl.texture import Texture2D
10-
from arcade.gl.types import (BufferOrBufferProtocol, compare_funcs,
11-
pixel_formats)
10+
from arcade.gl.types import BufferOrBufferProtocol, compare_funcs, pixel_formats
1211
from arcade.types import BufferProtocol
1312

1413
from .buffer import Buffer

arcade/gl/backends/webgl/texture_array.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import weakref
44
from typing import TYPE_CHECKING
55

6+
from pyodide.ffi import to_js
7+
68
from arcade.gl import enums
79
from arcade.gl.texture_array import TextureArray
810
from arcade.gl.types import BufferOrBufferProtocol, compare_funcs, pixel_formats
911
from arcade.types import BufferProtocol
1012

11-
from pyodide.ffi import to_js
12-
1313
from .buffer import Buffer
1414
from .utils import data_to_memoryview
1515

@@ -277,18 +277,7 @@ def write(self, data: BufferOrBufferProtocol, level: int = 0, viewport=None) ->
277277
self._ctx._gl.pixelStorei(enums.PACK_ALIGNMENT, 1)
278278
self._ctx._gl.pixelStorei(enums.UNPACK_ALIGNMENT, 1)
279279
self._ctx._gl.texSubImage3D(
280-
self._target,
281-
level,
282-
x,
283-
y,
284-
l,
285-
w,
286-
h,
287-
1,
288-
self._format,
289-
self._type,
290-
to_js(data),
291-
0
280+
self._target, level, x, y, l, w, h, 1, self._format, self._type, to_js(data), 0
292281
)
293282

294283
def _validate_data_size(self, byte_data, byte_size, width, height) -> None:

arcade/sprite_list/collision.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ def check_for_collision_with_list(
175175
# Spatial
176176
if sprite_list.spatial_hash is not None and (method == 1 or method == 0):
177177
sprites_to_check = sprite_list.spatial_hash.get_sprites_near_sprite(sprite)
178-
elif method == 3 or (method == 0 and len(sprite_list) <= 1500) or get_window().ctx._gl_api == "webgl":
178+
elif (
179+
method == 3
180+
or (method == 0 and len(sprite_list) <= 1500)
181+
or get_window().ctx._gl_api == "webgl"
182+
):
179183
sprites_to_check = sprite_list
180184
else:
181185
# GPU transform - Not on WebGL
@@ -236,7 +240,11 @@ def check_for_collision_with_lists(
236240
# Spatial
237241
if sprite_list.spatial_hash is not None and (method == 1 or method == 0):
238242
sprites_to_check = sprite_list.spatial_hash.get_sprites_near_sprite(sprite)
239-
elif method == 3 or (method == 0 and len(sprite_list) <= 1500) or get_window().ctx._gl_api == "webgl":
243+
elif (
244+
method == 3
245+
or (method == 0 and len(sprite_list) <= 1500)
246+
or get_window().ctx._gl_api == "webgl"
247+
):
240248
sprites_to_check = sprite_list
241249
else:
242250
# GPU transform - Not on WebGL

arcade/sprite_list/sprite_list.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,13 @@ def _init_deferred(self) -> None:
322322
self._atlas = self.ctx.default_atlas
323323

324324
if self.ctx._gl_api == "webgl":
325-
self._data = SpriteListTextureData(self.ctx, capacity=self._buf_capacity, atlas=self._atlas)
325+
self._data = SpriteListTextureData(
326+
self.ctx, capacity=self._buf_capacity, atlas=self._atlas
327+
)
326328
else:
327-
self._data = SpriteListBufferData(self.ctx, capacity=self._buf_capacity, atlas=self._atlas)
329+
self._data = SpriteListBufferData(
330+
self.ctx, capacity=self._buf_capacity, atlas=self._atlas
331+
)
328332

329333
self._initialized = True
330334

@@ -1886,7 +1890,7 @@ def get_nearby_sprite_indices(self, pos: Point, size: Point, length: int) -> lis
18861890
A list of indices of nearby sprites.
18871891
"""
18881892
ctx = self.ctx
1889-
if (ctx._gl_api == "webgl"):
1893+
if ctx._gl_api == "webgl":
18901894
raise RuntimeError("GPU Collision is not supported on WebGL Backends")
18911895
buffer = ctx.collision_buffer
18921896
program = ctx.collision_detection_program_simple

0 commit comments

Comments
 (0)