Skip to content

Commit

Permalink
chore: update pre-commit hooks (#484)
Browse files Browse the repository at this point in the history
* chore: update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1)

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 14, 2025
1 parent 0815614 commit 92b4940
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.6"
rev: "v0.9.1"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
6 changes: 3 additions & 3 deletions src/decaylanguage/dec/dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,9 @@ def model(self, treelist: list[Tree]) -> Tree:
Doesn't do anything if no model_label is found.
"""
if isinstance(treelist[0], Tree):
assert (
treelist[0].data == "model_label"
), f"Instead of a subtree of type 'model_label' one of type {treelist[0].data} has been passed."
assert treelist[0].data == "model_label", (
f"Instead of a subtree of type 'model_label' one of type {treelist[0].data} has been passed."
)
return Tree("model", self._replacement(treelist[0].children[0]))

return Tree("model", treelist)
Expand Down
20 changes: 9 additions & 11 deletions src/decaylanguage/modeling/goofit.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ def make_linefactor(self, final_states):

for structure in self.list_structure(final_states):
if self.decay_structure == DecayStructure.FF_12_34:
mass1 = f"M_{structure[0]+1}{structure[1]+1}"
mass2 = f"M_{structure[2]+1}{structure[3]+1}"
mass1 = f"M_{structure[0] + 1}{structure[1] + 1}"
mass2 = f"M_{structure[2] + 1}{structure[3] + 1}"
else:
mass1 = f"M_{structure[0]+1}{structure[1]+1}_{structure[2]+1}"
mass2 = f"M_{structure[0]+1}{structure[1]+1}"
mass1 = f"M_{structure[0] + 1}{structure[1] + 1}_{structure[2] + 1}"
mass2 = f"M_{structure[0] + 1}{structure[1] + 1}"
masses = [mass1, mass2]
for i_mass, sub in enumerate(self.vertexes):
factor.append(
Expand Down Expand Up @@ -419,9 +419,7 @@ def make_intro(cls, all_states):
header += "\nDK3P_DI = DecayInfo4()\n"

header += (
"\nline_factor_list = []"
"\nspin_factor_list = []"
"\namplitudes_list = []\n"
"\nline_factor_list = []\nspin_factor_list = []\namplitudes_list = []\n"
)

final_particles = set(all_states)
Expand Down Expand Up @@ -673,11 +671,11 @@ def make_linefactor(self, final_states):
factor = []
for structure in self.list_structure(final_states):
if self.decay_structure == DecayStructure.FF_12_34:
mass1 = f"M_{structure[0]+1}{structure[1]+1}"
mass2 = f"M_{structure[2]+1}{structure[3]+1}"
mass1 = f"M_{structure[0] + 1}{structure[1] + 1}"
mass2 = f"M_{structure[2] + 1}{structure[3] + 1}"
else:
mass1 = f"M_{structure[0]+1}{structure[1]+1}_{structure[2]+1}"
mass2 = f"M_{structure[0]+1}{structure[1]+1}"
mass1 = f"M_{structure[0] + 1}{structure[1] + 1}_{structure[2] + 1}"
mass2 = f"M_{structure[0] + 1}{structure[1] + 1}"
masses = [mass1, mass2]
for i_mass, sub in enumerate(self.vertexes):
factor.append(
Expand Down
6 changes: 3 additions & 3 deletions src/decaylanguage/utils/particleutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def _from_group_dict_list(mat: dict[str, Any]) -> list[Particle]:
if mat["family"]:
if "_" in mat["family"]:
mat["family"] = mat["family"].strip("_")
name += f'({mat["family"]})'
name += f"({mat['family']})"
if mat["state"]:
name += f'({mat["state"]})'
name += f"({mat['state']})"

if mat.get("prime"):
name += "'"
Expand All @@ -148,7 +148,7 @@ def _from_group_dict_list(mat: dict[str, Any]) -> list[Particle]:
if mat["state"] is not None:
kw["J"] = float(mat["state"])

maxname = name + f'({mat["mass"]})' if mat["mass"] else name
maxname = name + f"({mat['mass']})" if mat["mass"] else name
if "charge" in mat and mat["charge"] is not None:
kw["three_charge"] = Charge_mapping[mat["charge"]]

Expand Down

0 comments on commit 92b4940

Please sign in to comment.