Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.10"

- name: Install core Python packages
run: python -m pip install --upgrade pip setuptools build
Expand Down Expand Up @@ -58,7 +58,6 @@ jobs:
fail-fast: false
matrix:
python:
- {version: '3.9'}
- {version: '3.10'}
- {version: '3.11'}
- {version: '3.12'}
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ authors = [
description = "An open source randomizer patcher for Metroid Fusion."
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.9"
"Programming Language :: Python :: 3.10"

]
dependencies = [
Expand Down
4 changes: 1 addition & 3 deletions src/mars_patcher/common_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import Annotated

from typing_extensions import TypeAlias
from typing import Annotated, TypeAlias

from mars_patcher.auto_generated_types import Areaid, Typeu8

Expand Down
8 changes: 4 additions & 4 deletions src/mars_patcher/patcher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import typing
from collections.abc import Callable
from os import PathLike
from typing import Callable, Union

from jsonschema import validate

Expand Down Expand Up @@ -46,12 +46,12 @@ def validate_patch_data(patch_data: dict) -> MarsSchema:
with open(get_data_path("schema.json")) as f:
schema = json.load(f)
validate(patch_data, schema)
return typing.cast(MarsSchema, patch_data)
return typing.cast("MarsSchema", patch_data)


def patch(
input_path: Union[str, PathLike[str]],
output_path: Union[str, PathLike[str]],
input_path: str | PathLike[str],
output_path: str | PathLike[str],
patch_data: MarsSchema,
status_update: Callable[[str, float], None],
) -> None:
Expand Down
7 changes: 3 additions & 4 deletions src/mars_patcher/rom.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from enum import Enum
from os import PathLike
from typing import Union

from mars_patcher.constants.reserved_space import ReservedConstants

BytesLike = Union[bytes, bytearray]
BytesLike = bytes | bytearray

SIZE_8MB = 0x800000
ROM_OFFSET = 0x8000000
Expand Down Expand Up @@ -82,7 +81,7 @@ class Rom:
},
}

def __init__(self, path: Union[str, PathLike[str]]):
def __init__(self, path: str | PathLike[str]):
# Read file
with open(path, "rb") as f:
self.data = bytearray(f.read())
Expand Down Expand Up @@ -238,7 +237,7 @@ def reserve_free_space(self, size: int) -> int:
raise RuntimeError("Ran out of reserved free space")
return addr

def save(self, path: Union[str, PathLike[str]]) -> None:
def save(self, path: str | PathLike[str]) -> None:
"""Saves the currently loaded data to a specified path."""
with open(path, "wb") as f:
f.write(self.data)