From afb97b3509b90e5342a8acbb2df17559c86a2164 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 24 Feb 2024 20:11:38 +0100 Subject: [PATCH 1/3] don't ignore F811 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b2cdfeb8a..9e6579def 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,7 +94,7 @@ build-backend = "setuptools.build_meta" line-length = 120 output-format = "full" exclude = ["venv", ".venv*", "tests", "build", "doc", "util", ".mypy_cache", ".pytest_cache", "temp", "bugs", "arcade/examples/platform_tutorial"] -lint.ignore = ["F811", "E731", "E741"] +lint.ignore = ["E731", "E741"] lint.select = [ "E", "F", From e7539441ed7383dff1ef626a0834a7852e6ea843 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 24 Feb 2024 20:12:36 +0100 Subject: [PATCH 2/3] Fix duplicate imports --- arcade/examples/shape_list_demo_skylines.py | 1 - arcade/shape_list.py | 1 - arcade/texture/texture.py | 5 ----- 3 files changed, 7 deletions(-) diff --git a/arcade/examples/shape_list_demo_skylines.py b/arcade/examples/shape_list_demo_skylines.py index dc780cb26..7333ea6c6 100644 --- a/arcade/examples/shape_list_demo_skylines.py +++ b/arcade/examples/shape_list_demo_skylines.py @@ -10,7 +10,6 @@ ShapeElementList, create_rectangle_filled, create_polygon, - create_rectangle_filled, create_rectangles_filled_with_colors, ) diff --git a/arcade/shape_list.py b/arcade/shape_list.py index b8da0e230..3e4543d9e 100644 --- a/arcade/shape_list.py +++ b/arcade/shape_list.py @@ -11,7 +11,6 @@ from collections import OrderedDict import itertools import math -from array import array from typing import ( Dict, List, diff --git a/arcade/texture/texture.py b/arcade/texture/texture.py index 87be9db3f..cf2d50c7e 100644 --- a/arcade/texture/texture.py +++ b/arcade/texture/texture.py @@ -26,11 +26,6 @@ TransverseTransform, ) -from arcade.types import PointList -from arcade.color import TRANSPARENT_BLACK -from arcade.hitbox import HitBoxAlgorithm -from arcade import cache as _cache -from arcade import hitbox from arcade.types import RGBA255, PointList if TYPE_CHECKING: From f4caffdb96c3f9d9c650dd86fe89c33d69400bee Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Sat, 24 Feb 2024 20:36:20 +0100 Subject: [PATCH 3/3] pep8 stuff --- arcade/__init__.py | 1 + arcade/cache/texture.py | 4 ++-- arcade/context.py | 1 + arcade/examples/gl/bindless_texture.py | 2 +- arcade/examples/net_process_animal_facts.py | 2 ++ arcade/experimental/__init__.py | 2 +- arcade/experimental/query_demo.py | 2 +- arcade/experimental/video_cv2.py | 1 - arcade/experimental/video_player.py | 1 + arcade/gl/compute_shader.py | 2 +- arcade/gl/context.py | 4 ++-- arcade/gl/framebuffer.py | 4 ++-- arcade/gl/glsl.py | 2 +- arcade/gl/program.py | 2 +- arcade/gui/property.py | 3 ++- arcade/gui/widgets/slider.py | 1 + arcade/hitbox/base.py | 4 ++-- arcade/joysticks.py | 2 +- arcade/math.py | 1 + arcade/paths.py | 2 +- arcade/perf_graph.py | 4 ++-- arcade/perf_info.py | 2 +- arcade/physics_engines.py | 2 ++ arcade/resources/__init__.py | 1 + arcade/scene.py | 6 +++--- arcade/shape_list.py | 2 +- arcade/sound.py | 8 ++++---- arcade/sprite_list/collision.py | 2 +- arcade/sprite_list/sprite_list.py | 22 ++++++++++----------- arcade/text.py | 2 +- arcade/texture/manager.py | 1 + arcade/tilemap/tilemap.py | 15 +++++++------- 32 files changed, 61 insertions(+), 49 deletions(-) diff --git a/arcade/__init__.py b/arcade/__init__.py index c6c99657e..b8e8f1845 100644 --- a/arcade/__init__.py +++ b/arcade/__init__.py @@ -33,6 +33,7 @@ def configure_logging(level: Optional[int] = None): ch.setFormatter(logging.Formatter('%(relativeCreated)s %(name)s %(levelname)s - %(message)s')) LOG.addHandler(ch) + # The following is used to load ffmpeg libraries. # Currently Arcade is only shipping binaries for Mac OS # as ffmpeg is not needed for support on Windows and Linux. diff --git a/arcade/cache/texture.py b/arcade/cache/texture.py index e2e1bd5b4..20c8af61a 100644 --- a/arcade/cache/texture.py +++ b/arcade/cache/texture.py @@ -93,13 +93,13 @@ def put( name = texture.cache_name if strong: self._strong_entries.put(name, texture) - if self._strong_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 + if self._strong_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 raise ValueError(f"File path {file_path} already in cache") if file_path: self._strong_file_entries.put(str(file_path), texture) else: self._weak_entires.put(name, texture) - if self._weak_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 + if self._weak_file_entries.get(file_path): # type: ignore # pending https://github.com/pythonarcade/arcade/issues/1752 raise ValueError(f"File path {file_path} already in cache") if file_path: self._weak_file_entries.put(str(file_path), texture) diff --git a/arcade/context.py b/arcade/context.py index 5d3d39e6a..ef472b5a6 100644 --- a/arcade/context.py +++ b/arcade/context.py @@ -25,6 +25,7 @@ __all__ = ["ArcadeContext"] + class ArcadeContext(Context): """ An OpenGL context implementation for Arcade with added custom features. diff --git a/arcade/examples/gl/bindless_texture.py b/arcade/examples/gl/bindless_texture.py index 5725b084c..efcf24ba5 100644 --- a/arcade/examples/gl/bindless_texture.py +++ b/arcade/examples/gl/bindless_texture.py @@ -149,7 +149,7 @@ def __init__(self): resource_cycle = cycle(resources) # Load enough textures to cover for each point/sprite - for i in range(16 * 9): + for i in range(16 * 9): texture = self.ctx.load_texture(next(resource_cycle)) texture.wrap_x = self.ctx.CLAMP_TO_EDGE texture.wrap_y = self.ctx.CLAMP_TO_EDGE diff --git a/arcade/examples/net_process_animal_facts.py b/arcade/examples/net_process_animal_facts.py index 418f90195..06b33e996 100644 --- a/arcade/examples/net_process_animal_facts.py +++ b/arcade/examples/net_process_animal_facts.py @@ -217,8 +217,10 @@ def start(self) -> int: class Facts: """Base class for fact providers""" + def get_fact(self) -> str: raise NotImplementedError() + def get_image(self) -> arcade.Texture: raise NotImplementedError() diff --git a/arcade/experimental/__init__.py b/arcade/experimental/__init__.py index a48c3187a..0f75aadab 100644 --- a/arcade/experimental/__init__.py +++ b/arcade/experimental/__init__.py @@ -46,4 +46,4 @@ ]) except ImportError: - pass + pass diff --git a/arcade/experimental/query_demo.py b/arcade/experimental/query_demo.py index 06a09076d..7b8a3975d 100644 --- a/arcade/experimental/query_demo.py +++ b/arcade/experimental/query_demo.py @@ -38,7 +38,7 @@ def __init__(self, width, height, title): self.sprites.draw() # Force the list to build self.sprites.program = self.ctx.sprite_list_program_no_cull - print(f"Initialization time: {time.time() -start}") + print(f"Initialization time: {time.time() - start}") self.query = self.ctx.query() self.frames = 0 diff --git a/arcade/experimental/video_cv2.py b/arcade/experimental/video_cv2.py index 90755fd0f..ec987b5f2 100644 --- a/arcade/experimental/video_cv2.py +++ b/arcade/experimental/video_cv2.py @@ -122,7 +122,6 @@ def update(self, delta_time: float) -> None: self.video.set(cv2.CAP_PROP_POS_FRAMES, 0) - class CV2PlayerView(arcade.View): """ A simple view to hold a video player using cv2. diff --git a/arcade/experimental/video_player.py b/arcade/experimental/video_player.py index 246b38403..6627dd9fd 100644 --- a/arcade/experimental/video_player.py +++ b/arcade/experimental/video_player.py @@ -76,6 +76,7 @@ def get_video_size(self) -> Tuple[int, int]: height /= video_format.sample_aspect return width, height + class VideoPlayerView(arcade.View): def __init__(self, path: Union[str, Path]) -> None: super().__init__() diff --git a/arcade/gl/compute_shader.py b/arcade/gl/compute_shader.py index 5bb556081..439db8bdf 100644 --- a/arcade/gl/compute_shader.py +++ b/arcade/gl/compute_shader.py @@ -53,7 +53,7 @@ def __init__(self, ctx: "Context", glsl_source: str) -> None: f"---- [compute shader] ---\n" ) + "\n".join( - f"{str(i+1).zfill(3)}: {line} " + f"{str(i + 1).zfill(3)}: {line} " for i, line in enumerate(self._source.split("\n")) ) ) diff --git a/arcade/gl/context.py b/arcade/gl/context.py index 5aa6d3c84..f8f267bec 100644 --- a/arcade/gl/context.py +++ b/arcade/gl/context.py @@ -1315,10 +1315,10 @@ def __init__(self, ctx): warn("Error happened while querying of limits. Moving on ..") @overload - def get_int_tuple(self, enum: GLenumLike, length: Literal[2]) -> Tuple[int, int]:... + def get_int_tuple(self, enum: GLenumLike, length: Literal[2]) -> Tuple[int, int]: ... @overload - def get_int_tuple(self, enum: GLenumLike, length: int) -> Tuple[int, ...]:... + def get_int_tuple(self, enum: GLenumLike, length: int) -> Tuple[int, ...]: ... def get_int_tuple(self, enum: GLenumLike, length: int): """Get an enum as an int tuple""" diff --git a/arcade/gl/framebuffer.py b/arcade/gl/framebuffer.py index 775df50e1..649927dc4 100644 --- a/arcade/gl/framebuffer.py +++ b/arcade/gl/framebuffer.py @@ -348,7 +348,7 @@ def _use(self, *, force: bool = False): def clear( self, - color: Union[RGBOrA255, RGBOrANormalized] =(0.0, 0.0, 0.0, 0.0), + color: Union[RGBOrA255, RGBOrANormalized] = (0.0, 0.0, 0.0, 0.0), *, depth: float = 1.0, normalized: bool = False, @@ -393,7 +393,7 @@ def clear( # mypy does not understand that color[3] is guaranteed to work in this codepath, pyright does. # We can remove this type: ignore if we switch to pyright. gl.glClearColor( - color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 255 # type: ignore + color[0] / 255, color[1] / 255, color[2] / 255, color[3] / 255 # type: ignore ) if self.depth_attachment: diff --git a/arcade/gl/glsl.py b/arcade/gl/glsl.py index deca02dec..f4f10d4da 100644 --- a/arcade/gl/glsl.py +++ b/arcade/gl/glsl.py @@ -113,7 +113,7 @@ def _find_glsl_version(self) -> int: pass source = "\n".join( - f"{str(i+1).zfill(3)}: {line} " for i, line in enumerate(self._lines) + f"{str(i + 1).zfill(3)}: {line} " for i, line in enumerate(self._lines) ) raise ShaderException( diff --git a/arcade/gl/program.py b/arcade/gl/program.py index 3b8ca7777..67e45a11d 100644 --- a/arcade/gl/program.py +++ b/arcade/gl/program.py @@ -517,7 +517,7 @@ def compile_shader(source: str, shader_type: PyGLenum) -> gl.GLuint: f"---- [{SHADER_TYPE_NAMES[shader_type]}] ---\n" ) + "\n".join( - f"{str(i+1).zfill(3)}: {line} " + f"{str(i + 1).zfill(3)}: {line} " for i, line in enumerate(source.split("\n")) ) ) diff --git a/arcade/gui/property.py b/arcade/gui/property.py index 6b8747dba..0c378aec0 100644 --- a/arcade/gui/property.py +++ b/arcade/gui/property.py @@ -7,6 +7,7 @@ P = TypeVar("P") + class _Obs(Generic[P]): """ Internal holder for Property value and change listeners @@ -78,7 +79,7 @@ def __set_name__(self, owner, name): def __get__(self, instance, owner) -> P: if instance is None: - return self # type: ignore + return self # type: ignore return self.get(instance) def __set__(self, instance, value): diff --git a/arcade/gui/widgets/slider.py b/arcade/gui/widgets/slider.py index bb748a1aa..ac880e5de 100644 --- a/arcade/gui/widgets/slider.py +++ b/arcade/gui/widgets/slider.py @@ -20,6 +20,7 @@ from arcade.gui.property import Property, bind from arcade.gui.style import UIStyleBase, UIStyledWidget + @dataclass class UISliderStyle(UIStyleBase): """ diff --git a/arcade/hitbox/base.py b/arcade/hitbox/base.py index a860a2d24..cd43a6803 100644 --- a/arcade/hitbox/base.py +++ b/arcade/hitbox/base.py @@ -221,7 +221,7 @@ def get_adjusted_points(self) -> Sequence[Point]: * After properties affecting adjusted position were changed """ if not self._adjusted_cache_dirty: - return self._adjusted_points # type: ignore + return self._adjusted_points # type: ignore def _adjust_point(point) -> Point: x, y = point @@ -233,7 +233,7 @@ def _adjust_point(point) -> Point: self._adjusted_points = [_adjust_point(point) for point in self.points] self._adjusted_cache_dirty = False - return self._adjusted_points # type: ignore [return-value] + return self._adjusted_points # type: ignore [return-value] class RotatableHitBox(HitBox): diff --git a/arcade/joysticks.py b/arcade/joysticks.py index c6adafbe5..af5f239b1 100644 --- a/arcade/joysticks.py +++ b/arcade/joysticks.py @@ -18,7 +18,7 @@ def get_joysticks() -> List[Joystick]: :return: List of game controllers """ - return pyglet.input.get_joysticks() # type: ignore # pending https://github.com/pyglet/pyglet/issues/842 + return pyglet.input.get_joysticks() # type: ignore # pending https://github.com/pyglet/pyglet/issues/842 def get_game_controllers() -> List[Joystick]: diff --git a/arcade/math.py b/arcade/math.py index 9201c1522..fc964112d 100644 --- a/arcade/math.py +++ b/arcade/math.py @@ -27,6 +27,7 @@ "get_angle_radians", ] + def round_fast(value: float, precision: int) -> float: """ A high performance version of python's built-in round() function. diff --git a/arcade/paths.py b/arcade/paths.py index 84e06c411..13ec8267c 100644 --- a/arcade/paths.py +++ b/arcade/paths.py @@ -289,7 +289,7 @@ def recalculate(self): def astar_calculate_path(start_point: Point, end_point: Point, astar_barrier_list: AStarBarrierList, - diagonal_movement: bool=True) -> Optional[List[Point]]: + diagonal_movement: bool = True) -> Optional[List[Point]]: """ Calculates the path using AStarSearch Algorithm and returns the path diff --git a/arcade/perf_graph.py b/arcade/perf_graph.py index 2d8b10a70..cf3952e75 100644 --- a/arcade/perf_graph.py +++ b/arcade/perf_graph.py @@ -229,7 +229,7 @@ def update_graph(self, delta_time: float): # Clear and return if timings are disabled if not arcade.timings_enabled(): # Please forgive the ugly spacing. It makes type checking work. - with atlas.render_into( # type: ignore + with atlas.render_into( # type: ignore self.minimap_texture, projection=self.proj) as fbo: fbo.clear(color=(0, 0, 0, 255)) return @@ -288,7 +288,7 @@ def update_graph(self, delta_time: float): # Render to the internal texture # This ugly spacing is intentional to make type checking work. - with atlas.render_into( # type: ignore + with atlas.render_into( # type: ignore self.minimap_texture, projection=self.proj) as fbo: # Set the background color diff --git a/arcade/perf_info.py b/arcade/perf_info.py index 26c2e084d..ae6319533 100644 --- a/arcade/perf_info.py +++ b/arcade/perf_info.py @@ -164,7 +164,7 @@ def disable_timings() -> None: raise ValueError("Timings are not enabled.") # Restore the original pyglet dispatch event function - pyglet.window.BaseWindow.dispatch_event = _pyglets_dispatch_event # type: ignore + pyglet.window.BaseWindow.dispatch_event = _pyglets_dispatch_event # type: ignore clear_timings() diff --git a/arcade/physics_engines.py b/arcade/physics_engines.py index 0ec18aa3d..5cbd5d6b3 100644 --- a/arcade/physics_engines.py +++ b/arcade/physics_engines.py @@ -219,6 +219,8 @@ def _move_sprite(moving_sprite: Sprite, walls: List[SpriteList[SpriteType]], ram # print(f"Move 2 - {end_time - start_time:7.4f} {loop_count}") return complete_hit_list + + class PhysicsEngineSimple: """ Simplistic physics engine for use in games without gravity, such as top-down diff --git a/arcade/resources/__init__.py b/arcade/resources/__init__.py index 064c46ffb..addb55248 100644 --- a/arcade/resources/__init__.py +++ b/arcade/resources/__init__.py @@ -106,6 +106,7 @@ def resolve(path: Union[str, Path]) -> Path: except FileNotFoundError: raise FileNotFoundError(f"Cannot locate resource : {path}") + def add_resource_handle(handle: str, path: Union[str, Path]) -> None: """ Add a resource handle or path to an existing handle. diff --git a/arcade/scene.py b/arcade/scene.py index 033ccec06..f2aea3a84 100644 --- a/arcade/scene.py +++ b/arcade/scene.py @@ -196,7 +196,7 @@ def add_sprite_list( sprite_list = SpriteList(use_spatial_hash=use_spatial_hash) if name in self._name_mapping.keys(): self.remove_sprite_list_by_name(name) - warn("A Spritelist with the name: "+name+", is already in the scene, will override Spritelist") + warn(f"A Spritelist with the name: '{name}', is already in the scene, will override Spritelist") self._name_mapping[name] = sprite_list self._sprite_lists.append(sprite_list) @@ -228,7 +228,7 @@ def add_sprite_list_before( sprite_list = SpriteList(use_spatial_hash=use_spatial_hash) if name in self._name_mapping.keys(): self.remove_sprite_list_by_name(name) - warn("A Spritelist with the name: "+name+", is already in the scene, will override Spritelist") + warn(f"A Spritelist with the name: '{name}', is already in the scene, will override Spritelist") self._name_mapping[name] = sprite_list before_list = self._name_mapping[before] index = self._sprite_lists.index(before_list) @@ -288,7 +288,7 @@ def add_sprite_list_after( sprite_list = SpriteList(use_spatial_hash=use_spatial_hash) if name in self._name_mapping.keys(): self.remove_sprite_list_by_name(name) - warn("A Spritelist with the name: "+name+", is already in the scene, will override Spritelist") + warn(f"A Spritelist with the name: '{name}', is already in the scene, will override Spritelist") self._name_mapping[name] = sprite_list after_list = self._name_mapping[after] index = self._sprite_lists.index(after_list) + 1 diff --git a/arcade/shape_list.py b/arcade/shape_list.py index 3e4543d9e..fcbbd977b 100644 --- a/arcade/shape_list.py +++ b/arcade/shape_list.py @@ -119,7 +119,7 @@ def draw(self): if self.geometry is None: self._init_geometry() - self.geometry.render(self.program, mode=self.mode) # pyright: ignore [reportOptionalMemberAccess] + self.geometry.render(self.program, mode=self.mode) # pyright: ignore [reportOptionalMemberAccess] def create_line( diff --git a/arcade/sound.py b/arcade/sound.py index ff199f91c..b915048f5 100644 --- a/arcade/sound.py +++ b/arcade/sound.py @@ -99,7 +99,7 @@ def _on_player_eos(): media.Source._players.remove(player) # There is a closure on player. To get the refcount to 0, # we need to delete this function. - player.on_player_eos = None # type: ignore # pending https://github.com/pyglet/pyglet/issues/845 + player.on_player_eos = None # type: ignore # pending https://github.com/pyglet/pyglet/issues/845 player.on_player_eos = _on_player_eos return player @@ -116,12 +116,12 @@ def stop(self, player: media.Player) -> None: def get_length(self) -> float: """Get length of audio in seconds""" # We validate that duration is known when loading the source - return self.source.duration # type: ignore + return self.source.duration # type: ignore def is_complete(self, player: media.Player) -> bool: """Return true if the sound is done playing.""" # We validate that duration is known when loading the source - return player.time >= self.source.duration # type: ignore + return player.time >= self.source.duration # type: ignore def is_playing(self, player: media.Player) -> bool: """ @@ -140,7 +140,7 @@ def get_volume(self, player: media.Player) -> float: :param player: Player returned from :func:`play_sound`. :returns: A float, 0 for volume off, 1 for full volume. """ - return player.volume # type: ignore # pending https://github.com/pyglet/pyglet/issues/847 + return player.volume # type: ignore # pending https://github.com/pyglet/pyglet/issues/847 def set_volume(self, volume, player: media.Player) -> None: """ diff --git a/arcade/sprite_list/collision.py b/arcade/sprite_list/collision.py index 77f8ff577..0c906acda 100644 --- a/arcade/sprite_list/collision.py +++ b/arcade/sprite_list/collision.py @@ -92,7 +92,7 @@ def _check_for_collision(sprite1: BasicSprite, sprite2: BasicSprite) -> bool: :returns: True if sprites overlap. """ - #NOTE: for speed becuase attribute look ups are slow. + # NOTE: for speed because attribute look ups are slow. sprite1_position = sprite1._position sprite1_width = sprite1._width sprite1_height = sprite1._height diff --git a/arcade/sprite_list/sprite_list.py b/arcade/sprite_list/sprite_list.py index 68618401f..5cc832ada 100644 --- a/arcade/sprite_list/sprite_list.py +++ b/arcade/sprite_list/sprite_list.py @@ -193,7 +193,7 @@ def _init_deferred(self) -> None: self.ctx = get_window().ctx self.program = self.ctx.sprite_list_program_cull if not self._atlas: - self._atlas = self.ctx.default_atlas + self._atlas = self.ctx.default_atlas # Buffers for each sprite attribute (read by shader) with initial capacity self._sprite_pos_buf = self.ctx.buffer(reserve=self._buf_capacity * 12) # 3 x 32 bit floats @@ -885,7 +885,7 @@ def preload_textures(self, texture_list: Iterable["Texture"]) -> None: for texture in texture_list: # Ugly spacing is a fast workaround for None type checking issues - self._atlas.add( # type: ignore + self._atlas.add( # type: ignore texture) def write_sprite_buffers_to_gpu(self) -> None: @@ -1004,12 +1004,12 @@ def draw( self.ctx.blend_func = self.ctx.BLEND_DEFAULT # Workarounds for Optional[TextureAtlas] + slow . lookup speed - atlas: TextureAtlas = self.atlas # type: ignore + atlas: TextureAtlas = self.atlas # type: ignore atlas_texture: Texture2D = atlas.texture # Set custom filter or reset to default if filter: - if hasattr(filter, '__len__', ): # assume it's a collection + if hasattr(filter, '__len__', ): # assume it's a collection if len(cast(Sized, filter)) != 2: raise ValueError("Can't use sequence of length != 2") atlas_texture.filter = tuple(filter) # type: ignore @@ -1090,11 +1090,11 @@ def _grow_sprite_buffers(self) -> None: if self._initialized: # Proper initialization implies these buffers are allocated - self._sprite_pos_buf.orphan(double=True) # type: ignore - self._sprite_size_buf.orphan(double=True) # type: ignore - self._sprite_angle_buf.orphan(double=True) # type: ignore - self._sprite_color_buf.orphan(double=True) # type: ignore - self._sprite_texture_buf.orphan(double=True) # type: ignore + self._sprite_pos_buf.orphan(double=True) # type: ignore + self._sprite_size_buf.orphan(double=True) # type: ignore + self._sprite_angle_buf.orphan(double=True) # type: ignore + self._sprite_color_buf.orphan(double=True) # type: ignore + self._sprite_texture_buf.orphan(double=True) # type: ignore self._sprite_pos_changed = True self._sprite_size_changed = True @@ -1164,7 +1164,7 @@ def _update_all(self, sprite: SpriteType) -> None: return # Ugly syntax makes type checking pass without perf hit from cast - tex_slot: int = self._atlas.add( # type: ignore + tex_slot: int = self._atlas.add( # type: ignore sprite._texture)[0] slot = self.sprite_slot[sprite] @@ -1183,7 +1183,7 @@ def _update_texture(self, sprite: SpriteType) -> None: return atlas = self._atlas # Ugly spacing makes type checking work with specificity - tex_slot: int = atlas.add( # type: ignore + tex_slot: int = atlas.add( # type: ignore sprite._texture)[0] slot = self.sprite_slot[sprite] diff --git a/arcade/text.py b/arcade/text.py index e63e4de85..ee166e769 100644 --- a/arcade/text.py +++ b/arcade/text.py @@ -219,7 +219,7 @@ def __init__( bold=bold, italic=italic, multiline=multiline, - rotation=rotation, # type: ignore # pending https://github.com/pyglet/pyglet/issues/843 + rotation=rotation, # type: ignore # pending https://github.com/pyglet/pyglet/issues/843 batch=batch, group=group ) diff --git a/arcade/texture/manager.py b/arcade/texture/manager.py index f7e4f78b2..65a91397b 100644 --- a/arcade/texture/manager.py +++ b/arcade/texture/manager.py @@ -11,6 +11,7 @@ ) from . import SpriteSheet + class TextureManager: """ This class is used to manage textures. It is used to keep track of diff --git a/arcade/tilemap/tilemap.py b/arcade/tilemap/tilemap.py index 221c927ce..ae72f0d82 100644 --- a/arcade/tilemap/tilemap.py +++ b/arcade/tilemap/tilemap.py @@ -52,6 +52,7 @@ prop_to_float = cast(Callable[[pytiled_parser.Property], float], float) + def _get_image_info_from_tileset(tile: pytiled_parser.Tile) -> Tuple[int, int, int, int]: image_x = 0 image_y = 0 @@ -104,13 +105,13 @@ def _get_image_source( def _may_be_flip(tile: pytiled_parser.Tile, texture: Texture) -> Texture: - if tile.flipped_diagonally: - texture = texture.flip_diagonally() - if tile.flipped_horizontally: - texture = texture.flip_horizontally() - if tile.flipped_vertically: - texture = texture.flip_vertically() - return texture + if tile.flipped_diagonally: + texture = texture.flip_diagonally() + if tile.flipped_horizontally: + texture = texture.flip_horizontally() + if tile.flipped_vertically: + texture = texture.flip_vertically() + return texture class TileMap: