Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #39

Merged
merged 4 commits into from
Dec 15, 2024
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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions chanfig/flat_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chanfig/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Loading