Skip to content

Commit 10739fa

Browse files
dweindlFFroehlich
andauthored
pre-commit updates (#2813)
* pre-commit updates Update pre-commit hooks and re-run. * Update python/sdist/amici/numpy.py --------- Co-authored-by: Fabian Fröhlich <[email protected]>
1 parent 83e1887 commit 10739fa

30 files changed

+87
-99
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: trailing-whitespace
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
1414
# Ruff version.
15-
rev: v0.8.6
15+
rev: v0.12.0
1616
hooks:
1717
# Run the linter.
1818
- id: ruff
@@ -28,7 +28,7 @@ repos:
2828
- python/sdist/pyproject.toml
2929

3030
- repo: https://github.com/asottile/pyupgrade
31-
rev: v3.19.1
31+
rev: v3.20.0
3232
hooks:
3333
- id: pyupgrade
3434
args: ["--py310-plus"]

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def install_doxygen():
349349
[
350350
"INPUT = ../matlab",
351351
"EXTENSION_MAPPING = .m=C++",
352-
"FILTER_PATTERNS = " f"*.m={mtocpp_filter}",
352+
f"FILTER_PATTERNS = *.m={mtocpp_filter}",
353353
"EXCLUDE += ../matlab/examples",
354354
"EXCLUDE += ../matlab/mtoc",
355355
"EXCLUDE += ../matlab/SBMLimporter",
@@ -509,7 +509,7 @@ def process_docstring(app, what, name, obj, options, lines):
509509
cname = name.split(".")[2]
510510
lines.append(
511511
f"Swig-Generated class that implements smart pointers to "
512-
f'{cname.replace("Ptr", "")} as objects.'
512+
f"{cname.replace('Ptr', '')} as objects."
513513
)
514514
return
515515

doc/examples/example_errors.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@
985985
"source": [
986986
"# Increase relative steady state tolerance\n",
987987
"for log10_relaxation_factor in range(1, 10):\n",
988-
" print(f\"Relaxing tolerances by factor {10 ** log10_relaxation_factor}\")\n",
988+
" print(f\"Relaxing tolerances by factor {10**log10_relaxation_factor}\")\n",
989989
" amici_solver = amici_model.getSolver()\n",
990990
" amici_solver.setRelativeToleranceSteadyState(\n",
991991
" amici_solver.getRelativeToleranceSteadyState()\n",

doc/examples/example_large_models/example_performance_optimization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
")\n",
128128
"plt.show()\n",
129129
"\n",
130-
"print(f\"speedup: {873.54/697.85:.2f}x\")"
130+
"print(f\"speedup: {873.54 / 697.85:.2f}x\")"
131131
]
132132
},
133133
{

doc/recreate_reference_list.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ def get_sub_bibliography(year, by_year, bibfile):
4242

4343
entries = ",".join(["@" + x for x in by_year[year]])
4444
stdin_input = (
45-
"---\n"
46-
f"bibliography: {bibfile}\n"
47-
f'nocite: "{entries}"\n...\n'
48-
f"# {year}"
45+
f'---\nbibliography: {bibfile}\nnocite: "{entries}"\n...\n# {year}'
4946
)
5047

5148
out = subprocess.run(

python/sdist/amici/_codegen/cxx_functions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ def var_in_signature(self, varname: str, ode: bool = True) -> bool:
291291
assume_pow_positivity=True,
292292
),
293293
"x0": _FunctionInfo(
294-
"realtype *x0, const realtype t, const realtype *p, "
295-
"const realtype *k"
294+
"realtype *x0, const realtype t, const realtype *p, const realtype *k"
296295
),
297296
"x0_fixedParameters": _FunctionInfo(
298297
"realtype *x0_fixedParameters, const realtype t, "

python/sdist/amici/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def build_model_extension(
4949
# length of intermediate build files, that may easily become
5050
# problematic on Windows, due to its ridiculous 255-character path
5151
# length limit.
52-
f'--build-temp={package_dir / "build"}',
52+
f"--build-temp={package_dir / 'build'}",
5353
]
5454
)
5555

python/sdist/amici/cxxcodeprinter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def _get_sym_lines_array(
130130
C++ code as list of lines
131131
"""
132132
return [
133-
" " * indent_level + f"{variable}[{index}] = "
134-
f"{self.doprint(math)};"
133+
" " * indent_level + f"{variable}[{index}] = {self.doprint(math)};"
135134
for index, math in enumerate(equations)
136135
if math not in [0, 0.0]
137136
]
@@ -366,7 +365,7 @@ def csc_matrix(
366365

367366
symbol_row_vals.append(row)
368367
idx += 1
369-
symbol_name = f"d{rownames[row].name}" f"_d{colnames[col].name}"
368+
symbol_name = f"d{rownames[row].name}_d{colnames[col].name}"
370369
if identifier:
371370
symbol_name += f"_{identifier}"
372371
symbol_list.append(symbol_name)

python/sdist/amici/de_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def _generate_function_index(
648648

649649
lines.extend(
650650
[
651-
"}" "",
651+
"}",
652652
f"}} // namespace model_{self.model_name}",
653653
"} // namespace amici\n",
654654
]

python/sdist/amici/de_model.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,7 @@ def add_conservation_law(
634634
)[0]
635635
except StopIteration:
636636
raise ValueError(
637-
f"Specified state {state} was not found in the "
638-
f"model states."
637+
f"Specified state {state} was not found in the model states."
639638
)
640639

641640
state_id = self._differential_states[ix].get_id()
@@ -1236,7 +1235,7 @@ def _generate_symbol(self, name: str) -> None:
12361235
length = len(self.eq(name))
12371236
self._syms[name] = sp.Matrix(
12381237
[
1239-
sp.Symbol(f'{name}{0 if name == "stau" else i}', real=True)
1238+
sp.Symbol(f"{name}{0 if name == 'stau' else i}", real=True)
12401239
for i in range(length)
12411240
]
12421241
)

0 commit comments

Comments
 (0)