Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 13, 2024
1 parent d1dee11 commit cf01067
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions dpdata/amber/mask.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Amber mask."""

try:
import parmed
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions dpdata/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command line interface for dpdata."""

import argparse
from typing import Optional

Expand Down
4 changes: 1 addition & 3 deletions dpdata/cp2k/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ def get_xyz_block_generator(self):
lines.append(self.xyz_file_object.readline())
if not lines[-1]:
raise RuntimeError(
"this xyz file may lack of lines, should be {};lines:{}".format(
atom_num + 2, lines
)
f"this xyz file may lack of lines, should be {atom_num + 2};lines:{lines}"
)
yield lines

Expand Down
1 change: 1 addition & 0 deletions dpdata/deepmd/hdf5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils for deepmd/hdf5 format."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions dpdata/driver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Driver plugin system."""

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Callable, List, Union

Expand Down
1 change: 1 addition & 0 deletions dpdata/format.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the format plugin system."""

import os
from abc import ABC

Expand Down
4 changes: 1 addition & 3 deletions dpdata/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,7 @@ def __repr__(self):
return self.__str__()

def __str__(self):
return "MultiSystems ({} systems containing {} frames)".format(
len(self.systems), self.get_nframes()
)
return f"MultiSystems ({len(self.systems)} systems containing {self.get_nframes()} frames)"

def __add__(self, others):
"""Magic method "+" operation."""
Expand Down
9 changes: 1 addition & 8 deletions dpdata/vasp/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ def formulate_config(eles, types, posi, cell, ener, forc, strs_):
ret += f"#Z {cell[2][0]:13.8f} {cell[2][1]:13.8f} {cell[2][2]:13.8f}\n"
ret += "#W 1.0\n"
ret += "#E %.10f\n" % (ener / natoms)
ret += "#S {:.9e} {:.9e} {:.9e} {:.9e} {:.9e} {:.9e}\n".format(
strs[0][0],
strs[1][1],
strs[2][2],
strs[0][1],
strs[1][2],
strs[0][2],
)
ret += f"#S {strs[0][0]:.9e} {strs[1][1]:.9e} {strs[2][2]:.9e} {strs[0][1]:.9e} {strs[1][2]:.9e} {strs[0][2]:.9e}\n"

Check warning on line 71 in dpdata/vasp/xml.py

View check run for this annotation

Codecov / codecov/patch

dpdata/vasp/xml.py#L71

Added line #L71 was not covered by tests
ret += "#F\n"
for ii in range(natoms):
sp = np.matmul(cell.T, posi[ii])
Expand Down
4 changes: 1 addition & 3 deletions dpdata/xyz/quip_gap_xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def get_block_generator(self):
lines.append(self.file_object.readline())
if not lines[-1]:
raise RuntimeError(
"this xyz file may lack of lines, should be {};lines:{}".format(
atom_num + 2, lines
)
f"this xyz file may lack of lines, should be {atom_num + 2};lines:{lines}"
)
yield lines

Expand Down

0 comments on commit cf01067

Please sign in to comment.