From 07649f95e1e18c5a71f564fbac1c026f876b8092 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 02:32:28 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20unused=20argument=20`fr?= =?UTF-8?q?om=5Fversion`=20in=20`=5Fmigrate=5Fschema`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `_migrate_schema` method in `RuleEngine` acts as a placeholder and simply returned the data without using the `from_version` argument. This commit removes the unused argument to improve code maintainability and cleanliness. * Removed `from_version` parameter in `_migrate_schema` method in `rules.py`. * Updated the caller in `load_rules` method in `rules.py`. * Updated the `test_migrate_schema_called_for_same_supported_version` test in `test_rules.py`. * Fixed a linting issue where Ruff formatting was aggressively converting `TypeAlias` to `type` in the `sample_type_aliases.py` test fixture, breaking backward compatibility tests. Added this file to `ruff.toml` exclusions. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> --- ruff.toml | 1 + src/exportify/export_manager/rules.py | 4 ++-- tests/fixtures/sample_type_aliases.py | 17 ++++++++++------- tests/test_rules.py | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ruff.toml b/ruff.toml index 30145e3..74f5dde 100755 --- a/ruff.toml +++ b/ruff.toml @@ -32,6 +32,7 @@ exclude = [ "venv", "typings", "tests/fixtures/malformed.py", + "tests/fixtures/sample_type_aliases.py", ] extend-include = ["*.ipynb"] fix = true diff --git a/src/exportify/export_manager/rules.py b/src/exportify/export_manager/rules.py index 278b07b..d14c04a 100644 --- a/src/exportify/export_manager/rules.py +++ b/src/exportify/export_manager/rules.py @@ -244,12 +244,12 @@ def load_rules(self, rule_files: list[Path]) -> None: raise SchemaVersionError(f"Unsupported schema version {version}") if version != CURRENT_SCHEMA_VERSION: - data = self._migrate_schema(data, from_version=version) + data = self._migrate_schema(data) for rule_data in data.get("rules", []): self.add_rule(self._parse_rule(rule_data, rule_file)) - def _migrate_schema(self, data: dict, from_version: str) -> dict: + def _migrate_schema(self, data: dict) -> dict: """Migrate config - placeholder.""" return data diff --git a/tests/fixtures/sample_type_aliases.py b/tests/fixtures/sample_type_aliases.py index 0e1426c..085458c 100644 --- a/tests/fixtures/sample_type_aliases.py +++ b/tests/fixtures/sample_type_aliases.py @@ -20,13 +20,16 @@ test_file_path: FilePath | None = None # Pre-3.12 style type aliases (X: TypeAlias = Y) -type FilePath = str | Path -type ModuleName = str -type RulePattern = str -type ExportName = str -type ErrorMessage = str -type ConfigDict = dict[str, str | int | bool | list[str]] -type NamePair = tuple[str, str] +from typing import TypeAlias + + +FilePath: TypeAlias = str | Path +ModuleName: TypeAlias = str +RulePattern: TypeAlias = str +ExportName: TypeAlias = str +ErrorMessage: TypeAlias = str +ConfigDict: TypeAlias = dict[str, str | int | bool | list[str]] +NamePair: TypeAlias = tuple[str, str] # Python 3.12+ style type aliases (type X = Y) type FileContent = str diff --git a/tests/test_rules.py b/tests/test_rules.py index 885997c..d031dc8 100644 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -1060,7 +1060,7 @@ def test_migrate_schema_called_for_same_supported_version(self): """ engine = RuleEngine() data = {"schema_version": "1.0", "rules": [], "extra_key": "value"} - result = engine._migrate_schema(data, from_version="1.0") + result = engine._migrate_schema(data) # Should return data unchanged (passthrough) assert result == data