Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update pre-commit hooks #484

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading