Skip to content

Commit

Permalink
Merge branch 'master' into apfelsilikon
Browse files Browse the repository at this point in the history
  • Loading branch information
theCapypara authored Feb 3, 2024
2 parents 9e1bf98 + 698e923 commit eb4ffea
Show file tree
Hide file tree
Showing 48 changed files with 272 additions and 253 deletions.
2 changes: 1 addition & 1 deletion requirements-mac-windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pypresence==4.3.0
pygal==3.0.1
CairoSVG==2.7.1
gbulb==0.6.4
psutil==5.9.5
psutil==5.9.8
sentry-sdk==1.35.0
cairocffi>=1.6.1
packaging
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pypresence==4.3.0
pygal==3.0.1
CairoSVG==2.7.1
gbulb==0.6.4
psutil==5.9.5
psutil==5.9.8
sentry-sdk==1.35.0
packaging
wheel
Expand Down
1 change: 1 addition & 0 deletions skytemple/_i18n.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module that contains GTK stock strings, just for source detection for i18n strings."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/error_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for handling errors."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
9 changes: 6 additions & 3 deletions skytemple/core/events/impl/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Discord presence module.
If the extra dependencies are not installed, importing this module will raise an ImportError.
"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down Expand Up @@ -351,9 +352,11 @@ def _update_current_presence(self):
elif self.current_presence == "debugger":
self._update_presence(
state=self.debugger_script_name,
details="In the debugger"
if self.debugger_script_name is None
else "Editing script",
details=(
"In the debugger"
if self.debugger_script_name is None
else "Editing script"
),
start=self.start,
large_text=self.rom_name,
small_image="bug",
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/img_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for dealing with images"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
6 changes: 3 additions & 3 deletions skytemple/core/list_icon_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def _reload_icon(self, parameters, idx, store, load_fn, target_name, was_loading
def _reload_icons_in_tree(self):
try:
for model, idx, params in self._registered_for_reload:
model[get_list_store_iter_by_idx(model, idx)][
self.column_id
] = self._get_icon(*params)
model[get_list_store_iter_by_idx(model, idx)][self.column_id] = (
self._get_icon(*params)
)
self._loading = False
self._refresh_timer = None
except (AttributeError, TypeError):
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Logging configuration."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/mapbg_util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for drawing editors for/on maps."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/module_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
:deprecated: The controller-based approach of presenting and controlling views has been
replaced. See docs for `AbstractController`.
"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/modules.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module that manages and loads modules"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
13 changes: 5 additions & 8 deletions skytemple/core/profiling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module that contains profiling contexts. They are based on Sentry's transactions and spans.
"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down Expand Up @@ -29,8 +30,7 @@


class TaggableContext(AbstractContextManager, Protocol):
def set_tag(self, key: str, value: Any):
...
def set_tag(self, key: str, value: Any): ...


def record_transaction(
Expand All @@ -52,20 +52,17 @@ def reset_impls_cache():
class _ProfilingImplementation(ABC):
@classmethod
@abstractmethod
def new(cls) -> _ProfilingImplementation | None:
...
def new(cls) -> _ProfilingImplementation | None: ...

@abstractmethod
def make_transaction(
self, name: str, tags: dict[str, Any] | None
) -> TaggableContext | None:
...
) -> TaggableContext | None: ...

@abstractmethod
def make_span(
self, op: str, description: str, tags: dict[str, Any] | None
) -> TaggableContext | None:
...
) -> TaggableContext | None: ...


class _LogImpl(_ProfilingImplementation):
Expand Down
60 changes: 22 additions & 38 deletions skytemple/core/rom_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manages the state and files of the currently open ROM"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down Expand Up @@ -304,72 +305,57 @@ def get_modules(self, include_rom_module=True) -> Iterator[AbstractModule]:
from skytemple.module.spritecollab.module import SpritecollabModule

@overload
def get_module(self, name: Literal["rom"]) -> "RomModule":
...
def get_module(self, name: Literal["rom"]) -> "RomModule": ...

@overload
def get_module(self, name: Literal["bgp"]) -> "BgpModule":
...
def get_module(self, name: Literal["bgp"]) -> "BgpModule": ...

@overload
def get_module(self, name: Literal["tiled_img"]) -> "TiledImgModule":
...
def get_module(self, name: Literal["tiled_img"]) -> "TiledImgModule": ...

@overload
def get_module(self, name: Literal["map_bg"]) -> "MapBgModule":
...
def get_module(self, name: Literal["map_bg"]) -> "MapBgModule": ...

@overload
def get_module(self, name: Literal["script"]) -> "ScriptModule":
...
def get_module(self, name: Literal["script"]) -> "ScriptModule": ...

@overload
def get_module(self, name: Literal["gfxcrunch"]) -> "GfxcrunchModule":
...
def get_module(self, name: Literal["gfxcrunch"]) -> "GfxcrunchModule": ...

@overload
def get_module(self, name: Literal["sprite"]) -> "SpriteModule":
...
def get_module(self, name: Literal["sprite"]) -> "SpriteModule": ...

@overload
def get_module(self, name: Literal["monster"]) -> "MonsterModule":
...
def get_module(self, name: Literal["monster"]) -> "MonsterModule": ...

@overload
def get_module(self, name: Literal["portrait"]) -> "PortraitModule":
...
def get_module(self, name: Literal["portrait"]) -> "PortraitModule": ...

@overload
def get_module(self, name: Literal["patch"]) -> "PatchModule":
...
def get_module(self, name: Literal["patch"]) -> "PatchModule": ...

@overload
def get_module(self, name: Literal["lists"]) -> "ListsModule":
...
def get_module(self, name: Literal["lists"]) -> "ListsModule": ...

@overload
def get_module(self, name: Literal["moves_items"]) -> "MovesItemsModule":
...
def get_module(self, name: Literal["moves_items"]) -> "MovesItemsModule": ...

@overload
def get_module(self, name: Literal["misc_graphics"]) -> "MiscGraphicsModule":
...
def get_module(self, name: Literal["misc_graphics"]) -> "MiscGraphicsModule": ...

@overload
def get_module(self, name: Literal["dungeon"]) -> "DungeonModule":
...
def get_module(self, name: Literal["dungeon"]) -> "DungeonModule": ...

@overload
def get_module(self, name: Literal["dungeon_graphics"]) -> "DungeonGraphicsModule":
...
def get_module(
self, name: Literal["dungeon_graphics"]
) -> "DungeonGraphicsModule": ...

@overload
def get_module(self, name: Literal["strings"]) -> "StringsModule":
...
def get_module(self, name: Literal["strings"]) -> "StringsModule": ...

@overload
def get_module(self, name: Literal["spritecollab"]) -> "SpritecollabModule":
...
def get_module(self, name: Literal["spritecollab"]) -> "SpritecollabModule": ...

def get_module(self, name: str) -> AbstractModule:
return self._loaded_modules[name]
Expand Down Expand Up @@ -401,8 +387,7 @@ def open_file_in_rom(
file_handler_class: type[DataHandler[T]],
threadsafe: Literal[False] = False,
**kwargs,
) -> T:
...
) -> T: ...

@overload
def open_file_in_rom(
Expand All @@ -411,8 +396,7 @@ def open_file_in_rom(
file_handler_class: type[DataHandler[T]],
threadsafe: Literal[True],
**kwargs,
) -> ModelContext[T]:
...
) -> ModelContext[T]: ...

def open_file_in_rom(
self,
Expand Down
27 changes: 15 additions & 12 deletions skytemple/core/sentry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module that manages capturing debugging information and sending it to sentry.io."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down Expand Up @@ -280,9 +281,9 @@ def debugger_emulator_state(manager: DebuggerManager):
{
"id": x.id,
"hanger": x.hanger,
"direction": x.direction.ssa_id
if x.direction is not None
else None,
"direction": (
x.direction.ssa_id if x.direction is not None else None
),
"kind": x.kind.name,
"sector": x.sector,
}
Expand All @@ -296,9 +297,9 @@ def debugger_emulator_state(manager: DebuggerManager):
{
"id": x.id,
"hanger": x.hanger,
"direction": x.direction.ssa_id
if x.direction is not None
else None,
"direction": (
x.direction.ssa_id if x.direction is not None else None
),
"kind": x.kind.unique_name,
"sector": x.sector,
}
Expand All @@ -312,9 +313,9 @@ def debugger_emulator_state(manager: DebuggerManager):
{
"id": x.id,
"hanger": x.hanger,
"direction": x.direction.ssa_id
if x.direction is not None
else None,
"direction": (
x.direction.ssa_id if x.direction is not None else None
),
"kind": x.kind,
"sector": x.sector,
}
Expand All @@ -335,9 +336,11 @@ def debugger_emulator_state(manager: DebuggerManager):
return {
"running": ges.running,
"ground_state": ground_state,
"game_vars": {k.name: v for k, v in vars._variable_cache.items()}
if hasattr(vars, "_variable_cache") and vars._variable_cache is not None
else None,
"game_vars": (
{k.name: v for k, v in vars._variable_cache.items()}
if hasattr(vars, "_variable_cache") and vars._variable_cache is not None
else None
),
}


Expand Down
1 change: 1 addition & 0 deletions skytemple/core/sentry_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Sentry extensions for user feedback. Can be removed and replaced by if
https://github.com/getsentry/sentry-python/pull/2442 is merged and released.
"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/sprite_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sprite renderer module. Allows rendering Sprites, and loads them asynchronously."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/ssb_debugger/manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manages the integration of SkyTemple Script Debugger (skytemple-ssb-debugger)."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/ssb_debugger/ssb_loaded_file_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""skytemple-files data handler that wraps skytemple-files Ssb models in skytemple-ssb-debugger's LoadedSsbFile"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
7 changes: 3 additions & 4 deletions skytemple/core/ui_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""UI utilities."""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down Expand Up @@ -191,13 +192,11 @@ def wrapper(*args, **kwargs):
@overload
def catch_overflow(
typ: type[u8] | type[u16] | type[u32] | type[i8] | type[i16] | type[i32],
):
...
): ...


@overload
def catch_overflow(range_start: int, range_end: int):
...
def catch_overflow(range_start: int, range_end: int): ...


def catch_overflow(typ_or_range_start, range_end=None):
Expand Down
1 change: 1 addition & 0 deletions skytemple/core/view_loader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to load a module view and controller"""

# Copyright 2020-2023 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
Expand Down
Loading

0 comments on commit eb4ffea

Please sign in to comment.