Skip to content

Commit

Permalink
bump ruff pre-commit hook to v0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Nov 9, 2023
1 parent 6740ffa commit 2092a36
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .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/charliermarsh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.5
hooks:
- id: ruff
args: [--fix]
Expand Down
1 change: 1 addition & 0 deletions src/atomate2/common/jobs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""DFT code agnostic jobs."""

from .utils import structure_to_conventional, structure_to_primitive
1 change: 1 addition & 0 deletions src/atomate2/common/schemas/elastic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Schemas for elastic tensor fitting and related properties."""

from copy import deepcopy
from typing import Optional

Expand Down
31 changes: 16 additions & 15 deletions src/atomate2/cp2k/schemas/calc_types/_generate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to define various calculation types as Enums for CP2K."""

from itertools import product
from pathlib import Path

Expand All @@ -18,8 +19,8 @@
_RUN_TYPES = []
for functional_class in _RUN_TYPE_DATA:
for rt in _RUN_TYPE_DATA[functional_class]:
for vdw in ["", "-RVV10", "-LMKLL", "-DRSLL", "-D3", "-D2", "-D3(BJ)"]:
for u in ["", "+U"]:
for vdw in ("", "-RVV10", "-LMKLL", "-DRSLL", "-D3", "-D2", "-D3(BJ)"):
for u in ("", "+U"):
_RUN_TYPES.append(f"{rt}{vdw}{u}") # noqa: PERF401


Expand Down Expand Up @@ -52,11 +53,11 @@ class {enum_name}(ValueEnum):
)


def get_calc_type_key(rt) -> str:
"""Conveniece function for readability."""
s = "_".join(rt.split())
s = s.replace("+", "_").replace("-", "_").replace("(", "_").replace(")", "")
return f"{s}"
def get_calc_type_key(rt: str) -> str:
"""Get the calc_type key from the run_type. Convenience function for readability."""
out = "_".join(rt.split())
out = out.replace("+", "_").replace("-", "_").replace("(", "_").replace(")", "")
return f"{out}"


calc_type_enum = get_enum_source(
Expand All @@ -69,8 +70,8 @@ def get_calc_type_key(rt) -> str:
)


with open(Path(__file__).parent / "enums.py", "w") as f:
f.write(
with open(Path(__file__).parent / "enums.py", "w") as file:
file.write(
"""\"\"\"
Autogenerated Enums for CP2K RunType, TaskType, and CalcType
Do not edit this by hand. Edit generate.py or run_types.yaml instead
Expand All @@ -79,9 +80,9 @@ def get_calc_type_key(rt) -> str:
"""
)
f.write(run_type_enum)
f.write("\n\n")
f.write(task_type_enum)
f.write("\n\n")
f.write(calc_type_enum)
f.write("\n")
file.write(run_type_enum)
file.write("\n\n")
file.write(task_type_enum)
file.write("\n\n")
file.write(calc_type_enum)
file.write("\n")
1 change: 1 addition & 0 deletions src/atomate2/cp2k/schemas/calc_types/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to define various calculation types as Enums for CP2K."""

from collections.abc import Iterable
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions src/atomate2/forcefields/flows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Flows for forcefields."""

from .relax import CHGNetVaspRelaxMaker, M3GNetVaspRelaxMaker
1 change: 1 addition & 0 deletions src/atomate2/forcefields/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
and the following copyright applies:
Copyright (c) 2022, Materials Virtual Lab.
"""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions src/atomate2/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Settings for atomate2."""

from __future__ import annotations

import warnings
Expand Down

0 comments on commit 2092a36

Please sign in to comment.