From 5650b30e55d823692193a3452b1e806f40e9696a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 20:31:39 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/hades/progress_bar.py | 6 ++---- src/hades/views/player.py | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/hades/progress_bar.py b/src/hades/progress_bar.py index 39819a37..c3c520df 100644 --- a/src/hades/progress_bar.py +++ b/src/hades/progress_bar.py @@ -10,13 +10,11 @@ from arcade import color from arcade.gui import UIAnchorLayout, UIBoxLayout, UISpace -# Custom -from hades_extensions.ecs.components import Stat - if TYPE_CHECKING: from arcade.types.color import RGBA255 from hades.sprite import HadesSprite + from hades_extensions.ecs.components import Stat __all__ = ( "PROGRESS_BAR_DISTANCE", @@ -107,7 +105,7 @@ def __init__(self: ProgressBarGroup, sprite: HadesSprite) -> None: sprite.constructor.progress_bars[component_type][0], ProgressBar( cast( - Stat, + "Stat", sprite.registry.get_component( sprite.game_object_id, component_type, diff --git a/src/hades/views/player.py b/src/hades/views/player.py index 00d00445..41e7ba00 100644 --- a/src/hades/views/player.py +++ b/src/hades/views/player.py @@ -234,7 +234,7 @@ def use(self: InventoryItemButton) -> None: if not self.sprite_object: error = "No sprite object set for this item." raise ValueError(error) - view = cast(PlayerView, get_window().current_view) + view = cast("PlayerView", get_window().current_view) view.registry.get_system(InventorySystem).use_item( view.game_object_id, self.sprite_object.game_object_id, @@ -287,7 +287,7 @@ def update_description(self: UpgradesItemButton) -> None: return # Get the required components - view = cast(PlayerView, get_window().current_view) + view = cast("PlayerView", get_window().current_view) component = view.registry.get_component( view.game_object_id, self.target_component, @@ -333,7 +333,7 @@ def use(self: UpgradesItemButton) -> None: if not self.target_component or not self.target_functions: error = "No target component or functions set for this item." raise ValueError(error) - view = cast(PlayerView, get_window().current_view) + view = cast("PlayerView", get_window().current_view) view.registry.get_system(UpgradeSystem).upgrade_component( view.game_object_id, self.target_component, @@ -454,9 +454,9 @@ def item_clicked(event: UIOnClickEvent) -> None: """ # Get the item that was clicked and either show its stats or use it # depending on what button was clicked - item = cast(ItemButton, event.source.parent.parent) + item = cast("ItemButton", event.source.parent.parent) if isinstance(event.source, UITextureButton): - cast(PlayerView, get_window().current_view).stats_layout.set_info( + cast("PlayerView", get_window().current_view).stats_layout.set_info( *item.get_info(), ) else: @@ -523,10 +523,10 @@ def set_info( description: The description of the stats layout. texture: The texture to display in the stats layout. """ - title_obj = cast(UILabel, self.children[0]) + title_obj = cast("UILabel", self.children[0]) title_obj.text = title title_obj.fit_content() - description_obj = cast(UILabel, self.children[4]) + description_obj = cast("UILabel", self.children[4]) description_obj.text = description description_obj.fit_content() self.children[2].with_background(texture=texture)