Skip to content

Commit

Permalink
more ruff fixes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
htz1992213 committed Feb 5, 2024
1 parent a6cc3fd commit 4ab775d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions mdgo/coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ def concat_coord_array(
and the corresponding values are the selection language.
run_start: Start frame of analysis.
run_end: End frame of analysis.
kwargs: Keyword arguments in the func.
Returns:
A diction containing the coordination number sequence of each specified neighbor species
Expand Down
2 changes: 1 addition & 1 deletion mdgo/msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def parse_msd_type(msd_type: DIM) -> list[int]:
dim = keys[msd_type_str]
except KeyError:
raise ValueError(
f"invalid msd_type: {msd_type_str} specified, please specify one of xyz, " "xy, xz, yz, x, y, z"
f"invalid msd_type: {msd_type_str} specified, please specify one of xyz, xy, xz, yz, x, y, z"
)
return dim

Expand Down
9 changes: 4 additions & 5 deletions mdgo/residence_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def calc_neigh_corr(
Args:
nvt_run: An MDAnalysis ``Universe``.
distance_dict:
select_dict:
time_step:
distance_dict: A dict of coordination cutoff distance of the neighbor species.
select_dict: A dictionary of atom species selection.
time_step: Timestep between each frame, in ps.
run_start: Start frame of analysis.
run_end: End frame of analysis.
center_atom: The center atom to calculate the ACF for. Default to "cation".
Expand Down Expand Up @@ -158,8 +158,7 @@ def calc_neigh_corr(
run_end,
)
acfs = calc_acf(adjacency_matrix)
for acf in acfs:
acf_all.append(acf)
acf_all.extend(list(acfs))
acf_avg[kw] = np.mean(acf_all, axis=0)
return times, acf_avg

Expand Down
19 changes: 11 additions & 8 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""
Pyinvoke tasks.py file for automating releases and admin stuff.
To cut a new mdgo release, use `invoke update-changelog` followed by `invoke release`.
Author: Tingzheng Hou
"""
from __future__ import annotations
Expand Down Expand Up @@ -179,8 +182,8 @@ def update_changelog(ctx, version, sim=False):
output = subprocess.check_output(["git", "log", "--pretty=format:%s", "v%s..HEAD" % CURRENT_VER])
lines = []
misc = []
for l in output.decode("utf-8").strip().split("\n"):
m = re.match(r"Merge pull request \#(\d+) from (.*)", l)
for line in output.decode("utf-8").strip().split("\n"):
m = re.match(r"Merge pull request \#(\d+) from (.*)", line)
if m:
pr_number = m.group(1)
contrib, pr_name = m.group(2).split("/", 1)
Expand All @@ -191,22 +194,22 @@ def update_changelog(ctx, version, sim=False):
ll = ll.strip()
if ll in ["", "## Summary"]:
continue
elif ll.startswith(("## Checklist", "## TODO")):
if ll.startswith(("## Checklist", "## TODO")):
break
lines.append(f" {ll}")
misc.append(l)
misc.append(line)
with open("CHANGES.rst") as f:
contents = f.read()
l = "=========="
toks = contents.split(l)
line = "=========="
toks = contents.split(line)
head = "\n\nv%s\n" % version + "-" * (len(version) + 1) + "\n"
toks.insert(-1, head + "\n".join(lines))
if not sim:
with open("CHANGES.rst", "w") as f:
f.write(toks[0] + l + "".join(toks[1:]))
f.write(toks[0] + line + "".join(toks[1:]))
ctx.run("open CHANGES.rst")
else:
print(toks[0] + l + "".join(toks[1:]))
print(toks[0] + line + "".join(toks[1:]))
print("The following commit messages were not included...")
print("\n".join(misc))

Expand Down

0 comments on commit 4ab775d

Please sign in to comment.