diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 814b0f6f..0d4113f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/PSF/black - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black args: [--safe, --quiet] @@ -20,16 +20,16 @@ repos: - flake8-comprehensions - flake8-simplify - repo: https://github.com/asottile/pyupgrade - rev: v3.17.0 + rev: v3.19.0 hooks: - id: pyupgrade args: [--keep-runtime-typing] - repo: https://github.com/tox-dev/pyproject-fmt - rev: 2.2.1 + rev: v2.5.0 hooks: - id: pyproject-fmt - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.13.0 hooks: - id: mypy files: chanfig @@ -46,7 +46,7 @@ repos: - id: prettier files: chanfig - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-ast diff --git a/chanfig/flat_dict.py b/chanfig/flat_dict.py index 023fdc4a..7e48399d 100644 --- a/chanfig/flat_dict.py +++ b/chanfig/flat_dict.py @@ -110,7 +110,7 @@ def to_dict(obj: Any, flatten: bool = False) -> Mapping | Sequence | Set: if isinstance(obj, Variable): return obj.value if is_dataclass(obj): - return asdict(obj) # type: ignore[call-overload] + return asdict(obj) # type: ignore[arg-type] if hasattr(obj, "to_dict"): return obj.to_dict() return obj @@ -717,7 +717,10 @@ def interpolate( # pylint: disable=R0912 self[key] = self.substitute(self[key], interpolators, value) if unsafe_eval and isinstance(self[key], str): with suppress(SyntaxError): - self[key] = eval(self[key]) # pylint: disable=W0123 + if isinstance(self[key], Variable): + self[key].set(eval(self[key].value)) + else: + self[key] = eval(self[key]) # pylint: disable=W0123 return self @staticmethod diff --git a/chanfig/parser.py b/chanfig/parser.py index d458c0ac..8b223541 100644 --- a/chanfig/parser.py +++ b/chanfig/parser.py @@ -297,7 +297,7 @@ def add_config_argument(self, key, value: Any | None = None, dtype: type | None if isinstance(value, Variable): dtype = value._type or value.dtype # pylint: disable=W0212 elif isinstance(value, Field): - dtype = value.type + dtype = value.type # type: ignore[assignment] elif value is not None: dtype = type(value) if _should_collect_from_parameters(dtype): diff --git a/pyproject.toml b/pyproject.toml index fbba6987..80e477c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering :: Artificial Intelligence", ] dynamic = [