Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 12, 2024
1 parent 73935c0 commit 10c8edd
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
8 changes: 5 additions & 3 deletions gotran/codegeneration/codecomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,11 @@ def _body_from_cse(self, **results):
result_expr_map[result_expr].append(
(
result_names[orig_result_expr],
orig_result_expr.indices
if isinstance(orig_result_expr, IndexedExpression)
else ind,
(
orig_result_expr.indices
if isinstance(orig_result_expr, IndexedExpression)
else ind
),
),
)

Expand Down
20 changes: 12 additions & 8 deletions gotran/codegeneration/codegenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,12 @@ def function_code(self, comp, indent=0, include_signature=True):
body_lines.append(
"return {0}".format(
", ".join(
result_name
if len(comp.shapes[result_name]) >= 1
and comp.shapes[result_name][0] > 1
else result_name + "[0]"
(
result_name
if len(comp.shapes[result_name]) >= 1
and comp.shapes[result_name][0] > 1
else result_name + "[0]"
)
for result_name in comp.results
),
),
Expand Down Expand Up @@ -4220,10 +4222,12 @@ def function_code(self, comp, indent=0, include_signature=True):
body_lines.append(
"return {0}".format(
", ".join(
result_name
if len(comp.shapes[result_name]) >= 1
and comp.shapes[result_name][0] > 1
else result_name + "[0]"
(
result_name
if len(comp.shapes[result_name]) >= 1
and comp.shapes[result_name][0] > 1
else result_name + "[0]"
)
for result_name in comp.results
),
),
Expand Down
8 changes: 5 additions & 3 deletions gotran/input/cellml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,9 +1736,11 @@ def unders_score_replace(comp):
"{0} = {1}{2}".format(
eq.name,
"".join(eq.expr),
" # {0}".format(comp.variable_info[eq.name]["unit"])
if comp.variable_info[eq.name]["unit"] != "1"
else "",
(
" # {0}".format(comp.variable_info[eq.name]["unit"])
if comp.variable_info[eq.name]["unit"] != "1"
else ""
),
)
for eq in comp.equations
)
Expand Down
6 changes: 3 additions & 3 deletions gotran/model/ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,9 @@ def mass_matrix(self):
self._mass_matrix = sp.Matrix(
N,
N,
lambda i, j: 1
if i == j and isinstance(state_exprs[i], StateDerivative)
else 0,
lambda i, j: (
1 if i == j and isinstance(state_exprs[i], StateDerivative) else 0
),
)

return self._mass_matrix
Expand Down
3 changes: 1 addition & 2 deletions sandbox/gpu/testeverything.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ def testThreadsPerBlock(


def testNumNodes(
num_nodes=[1024 * 2**n for n in range(3, 8)]
+ [1000 * 2**n for n in range(3, 8)],
num_nodes=[1024 * 2**n for n in range(3, 8)] + [1000 * 2**n for n in range(3, 8)],
dt=0.1,
tstop=300.0,
solver="rush_larsen",
Expand Down
1 change: 1 addition & 0 deletions tests/codegeneration/test_codegeneration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""test for odecomponent module"""

# Imports for evaluation of generated code
import importlib
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_ode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""test for odecomponent module"""

# import unittest
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/model/test_odeobjects.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""test for odeobjects module"""

import pytest
from modelparameters.sympy import Symbol
from modelparameters.sympytools import symbols_from_expr
Expand Down
1 change: 1 addition & 0 deletions utils/test_scripts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Run test for all scripts
"""

import os
import time

Expand Down

0 comments on commit 10c8edd

Please sign in to comment.