diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index ca6727c..8f6da92 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -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 @@ -58,7 +58,6 @@ jobs: fail-fast: false matrix: python: - - {version: '3.9'} - {version: '3.10'} - {version: '3.11'} - {version: '3.12'} diff --git a/pyproject.toml b/pyproject.toml index b368408..5d80fa2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ diff --git a/src/mars_patcher/common_types.py b/src/mars_patcher/common_types.py index 6be881b..823298b 100644 --- a/src/mars_patcher/common_types.py +++ b/src/mars_patcher/common_types.py @@ -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 diff --git a/src/mars_patcher/patcher.py b/src/mars_patcher/patcher.py index 66ccb28..6a9cfe8 100644 --- a/src/mars_patcher/patcher.py +++ b/src/mars_patcher/patcher.py @@ -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 @@ -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: diff --git a/src/mars_patcher/rom.py b/src/mars_patcher/rom.py index f20ef60..f08d309 100644 --- a/src/mars_patcher/rom.py +++ b/src/mars_patcher/rom.py @@ -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 @@ -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()) @@ -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)