Skip to content

Commit

Permalink
Update precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
utf authored and BryantLi-BLI committed Jul 29, 2024
1 parent 0fa6abb commit a3808b6
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
exclude: ^(.github/|tests/test_data/abinit/)
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.10
rev: v0.5.2
hooks:
- id: ruff
args: [--fix]
Expand All @@ -17,7 +17,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies: [black]
Expand All @@ -30,7 +30,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
files: ^src/
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ ignore = [
"PTH", # prefer Pathlib to os.path
"RUF013", # implicit-optional
"S324", # use of insecure hash function
"S603", # use of insecure subprocess
"S507", # paramiko auto trust
"TD", # TODOs
"TRY003", # long message outside exception class
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/abinit/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run_abinit(
command.append(INPUT_FILE_NAME)

with open(LOG_FILE_NAME, "w") as stdout, open(STDERR_FILE_NAME, "w") as stderr:
process = subprocess.Popen(command, stdout=stdout, stderr=stderr) # noqa: S603
process = subprocess.Popen(command, stdout=stdout, stderr=stderr)

if wall_time is not None:
while True:
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/aims/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run_aims(
aims_cmd = expandvars(aims_cmd)

logger.info(f"Running command: {aims_cmd}")
return_code = subprocess.call(["/bin/bash", "-c", aims_cmd], env=os.environ) # noqa: S603
return_code = subprocess.call(["/bin/bash", "-c", aims_cmd], env=os.environ)
logger.info(f"{aims_cmd} finished running with return code: {return_code}")


Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/amset/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def run_amset() -> None:
# Run AMSET using the command line as calling from python can cause issues
# with multiprocessing
with open("std_out.log", "w") as f_std, open("std_err.log", "w") as f_err:
subprocess.call(["amset", "run"], stdout=f_std, stderr=f_err) # noqa: S603, S607
subprocess.call(["amset", "run"], stdout=f_std, stderr=f_err) # noqa: S607


def check_converged(
Expand Down
4 changes: 2 additions & 2 deletions src/atomate2/cli/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,13 +602,13 @@ def save_abinit_maker(maker: Maker) -> None:
author_mail = None
if git:
name = subprocess.run(
"git config user.name".split(), # noqa: S603
"git config user.name".split(),
capture_output=True,
encoding="utf-8",
check=True,
)
mail = subprocess.run(
"git config user.email".split(), # noqa: S603
"git config user.email".split(),
capture_output=True,
encoding="utf-8",
check=True,
Expand Down
4 changes: 2 additions & 2 deletions src/atomate2/vasp/builders/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def process_item(self, tasks: list[dict]) -> list[ElasticDocument]:
grouped = _group_deformations(tasks, self.structure_match_tol)

elastic_docs = []
for tasks in grouped:
for group in grouped:
elastic_doc = _get_elastic_document(
tasks, self.symprec, self.fitting_method
group, self.symprec, self.fitting_method
)
elastic_docs.append(elastic_doc)

Expand Down
2 changes: 1 addition & 1 deletion tests/forcefields/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_ext_load(force_field: str):
}[force_field]
calc_from_decode = ase_calculator(decode_dict)
calc_from_preset = ase_calculator(str(MLFF(force_field)))
assert type(calc_from_decode) == type(calc_from_preset)
assert type(calc_from_decode) is type(calc_from_preset)
assert calc_from_decode.name == calc_from_preset.name
assert calc_from_decode.parameters == calc_from_preset.parameters == {}

Expand Down

0 comments on commit a3808b6

Please sign in to comment.