Skip to content

Commit

Permalink
chore: update pre-commit hooks (#347)
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.0.277 → v0.0.278](astral-sh/ruff-pre-commit@v0.0.277...v0.0.278)

* style: pre-commit fixes

* Please Black

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eduardo Rodrigues <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and eduardo-rodrigues authored Jul 19, 2023
1 parent 8eaec8f commit fbaf7f2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.277"
rev: "v0.0.278"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
10 changes: 4 additions & 6 deletions src/decaylanguage/dec/dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,7 @@ def __repr__(self) -> str:
return "<{self.__class__.__name__}: decfile(s)={decfile}, n_decays={n_decays}>".format(
self=self, decfile=self._dec_file_names, n_decays=self.number_of_decays
)
return "<{self.__class__.__name__}: decfile(s)={decfile}>".format(
self=self, decfile=self._dec_file_names
)
return f"<{self.__class__.__name__}: decfile(s)={self._dec_file_names}>"

def __str__(self) -> str:
return repr(self)
Expand Down Expand Up @@ -1525,9 +1523,9 @@ def str_or_float(arg: str) -> str | float:

try:
return {
"{}:{}".format(
tree.children[0].value, tree.children[1].value
): str_or_float(tree.children[2].value)
f"{tree.children[0].value}:{tree.children[1].value}": str_or_float(
tree.children[2].value
)
for tree in parsed_file.find_data("pythia_def")
}
except Exception as err:
Expand Down
4 changes: 1 addition & 3 deletions src/decaylanguage/decay/decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ def charge_conjugate(
)

def __repr__(self) -> str:
return "<{self.__class__.__name__}: {daughters}>".format(
self=self, daughters=self.to_list()
)
return f"<{self.__class__.__name__}: {self.to_list()}>"

def __str__(self) -> str:
return repr(self)
Expand Down
10 changes: 2 additions & 8 deletions src/decaylanguage/decay/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ def html_table_label(
bgcolor: str = "#9abad6",
) -> str:
if add_tags:
label = (
'<<TABLE BORDER="0" CELLSPACING="0" BGCOLOR="{bgcolor}">'.format(
bgcolor=bgcolor
)
)
label = f'<<TABLE BORDER="0" CELLSPACING="0" BGCOLOR="{bgcolor}">'
else:
label = '<<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="{bgcolor}"><TR>'.format(
bgcolor=bgcolor
Expand All @@ -123,9 +119,7 @@ def html_table_label(
tag=i, name=safe_html_name(n)
)
else:
label += '<TD BORDER="0" CELLPADDING="2">{name}</TD>'.format(
name=safe_html_name(n)
)
label += f'<TD BORDER="0" CELLPADDING="2">{safe_html_name(n)}</TD>'
label += "{tr}</TABLE>>".format(tr="" if add_tags else "</TR>")
return label

Expand Down
30 changes: 6 additions & 24 deletions src/decaylanguage/modeling/goofit.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ def make_intro(cls, all_states):

for particle in final_particles:
name = particle.programmatic_name.upper()
header += (
" constexpr fptype {name:8} {{ {particle.mass:<14.8g} }};\n".format(
name=name, particle=particle
)
)
header += f" constexpr fptype {name:8} {{ {particle.mass:<14.8g} }};\n"

header += "\n"

Expand Down Expand Up @@ -184,9 +180,7 @@ def spinfactors(self):

raise LineFailure(
self,
"Spinfactors not currently included!: {spindet}".format(
spindet=self.spindetails()
),
f"Spinfactors not currently included!: {self.spindetails()}",
)

# if self.decay_structure == DecayStructure.FF_12_34 :
Expand Down Expand Up @@ -224,11 +218,7 @@ def make_pars(cls):
)
)
else:
headerlist.append(
' Variable {pname} {{"{name}", {par.value} }};'.format(
pname=pname, name=name, par=par
)
)
headerlist.append(f' Variable {pname} {{"{name}", {par.value} }};')

def strip_pararray(pars, begin, convert=lambda x: x):
mysplines = pars.index[pars.index.str.contains(begin, regex=False)]
Expand Down Expand Up @@ -467,9 +457,7 @@ def make_intro(cls, all_states):

for particle in final_particles:
name = particle.programmatic_name.upper()
header += "{name:8} = {particle.mass:<14.8g}\n".format(
name=name, particle=particle
)
header += f"{name:8} = {particle.mass:<14.8g}\n"

header += "\n"

Expand Down Expand Up @@ -559,9 +547,7 @@ def spinfactors(self):

raise LineFailure(
self,
"Spinfactors not currently included!: {spindet}".format(
spindet=self.spindetails()
),
f"Spinfactors not currently included!: {self.spindetails()}",
)

# if self.decay_structure == DecayStructure.FF_12_34 :
Expand Down Expand Up @@ -599,11 +585,7 @@ def make_pars(cls):
)
)
else:
headerlist.append(
'{pname} = Variable("{name}", {par.value})'.format(
pname=pname, name=name, par=par
)
)
headerlist.append(f'{pname} = Variable("{name}", {par.value})')

def strip_pararray(pars, begin, convert=lambda x: x):
mysplines = pars.index[pars.index.str.contains(begin, regex=False)]
Expand Down

0 comments on commit fbaf7f2

Please sign in to comment.