diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa612a4..15ae0cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,6 @@ jobs: - "3.14" - "3.13" - "3.12" - - "3.11" steps: - name: Setup python for test ${{ matrix.py }} uses: actions/setup-python@v7 diff --git a/.gitignore b/.gitignore index 2d263f2..5a38523 100644 --- a/.gitignore +++ b/.gitignore @@ -83,7 +83,7 @@ profile_default/ ipython_config.py # pyenv -.python-version +#.python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..fdcfcfd --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 7b881d8..ecf93ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,6 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", @@ -27,7 +26,7 @@ maintainers = [ {name="Hans Spaans", email="hspaans@gmail.com"}, ] -requires-python = ">= 3.11,<3.15" +requires-python = ">= 3.12,<3.15" dependencies = [ ] @@ -62,6 +61,7 @@ lint = [ "flake8-rst-docstrings", "flake8-isort", "pymarkdownlnt", + "pyupgrade", "rstcheck", "yamllint", ] @@ -111,7 +111,7 @@ skips = ["B101", "B601", "S101"] [tool.tox] requires = ["tox>=4.52.1,<5.0.0"] -env_list = ["lint", "fix", "3.14", "3.13", "3.12", "3.11", "cov", "type", "pkg_meta"] +env_list = ["lint", "fix", "3.14", "3.13", "3.12", "cov", "type", "pkg_meta"] skip_missing_interpreters = true [tool.tox.env_run_base] @@ -155,3 +155,15 @@ commands = [ ["pymarkdownlnt", "scan", "."], ["python", "-c", 'print(r"{env_python}")'], ] + +[tool.tox.env.fix] +description = "running pyupgrade at {envdir}" +package = "editable" +dependency_groups = ["lint", "test"] +allowlist_externals = ["git", "sh"] +commands = [ + # Finds all tracked .py files and updates them to Python 3.12+ syntax + ["sh", "-c", "git ls-files '*.py' | xargs pyupgrade --py312-plus"], + # Fails the build if pyupgrade modified any files (perfect for CI) + ["git", "diff", "--exit-code"] +] diff --git a/src/m6502/processor.py b/src/m6502/processor.py index 6018b44..321bf36 100644 --- a/src/m6502/processor.py +++ b/src/m6502/processor.py @@ -777,7 +777,7 @@ def _ins_lda_inx(self) -> None: The instruction costs 2 bytes and 6 cycles to complete. """ self.reg_a = self._read_byte( - self._read_word(((self._fetch_byte() + self.reg_x) & 0xFF)) + self._read_word((self._fetch_byte() + self.reg_x) & 0xFF) ) self._evaluate_flags_nz(self.reg_a) self.cycles += 1 # TODO: Why is the extra cycle required? @@ -1261,9 +1261,7 @@ def _ins_sta_inx(self) -> None: The instruction costs 2 bytes and 6 cycles to complete. """ self._write_byte( - self._read_byte( - self._read_word(((self._fetch_byte() + self.reg_x) & 0xFF)) - ), + self._read_byte(self._read_word((self._fetch_byte() + self.reg_x) & 0xFF)), self.reg_a, )