Skip to content

Commit

Permalink
Merge pull request #159 from finsberg/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
finsberg authored Jan 17, 2025
2 parents 66cde08 + ceadc33 commit 738995d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.8.6'
rev: 'v0.9.1'
hooks:
# Run the linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion src/gotranx/cli/gotran2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_code(
codegen.imports(),
f"int NUM_STATES = {len(ode.states)};",
f"int NUM_PARAMS = {len(ode.parameters)};",
f"int NUM_MONITORED = { len(ode.state_derivatives) + len(ode.intermediates)};",
f"int NUM_MONITORED = {len(ode.state_derivatives) + len(ode.intermediates)};",
codegen.parameter_index(),
codegen.state_index(),
codegen.monitor_index(),
Expand Down
5 changes: 1 addition & 4 deletions src/gotranx/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ class StateNotFoundInComponent(GotranxError):
component_name: str

def __str__(self) -> str:
return (
f"State with name {self.state_name!r} "
f"not found in component {self.component_name!r}"
)
return f"State with name {self.state_name!r} not found in component {self.component_name!r}"


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/gotranx/sympytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def Conditional(cond, true_value, false_value):

if not isinstance(cond, (Relational, Boolean)):
raise TypeError(
"Cond %s is of type %s, but must be a Relational" " or Boolean." % (cond, type(cond)),
"Cond %s is of type %s, but must be a Relational or Boolean." % (cond, type(cond)),
)

return sympy.functions.Piecewise(
Expand Down Expand Up @@ -124,7 +124,7 @@ def ContinuousConditional(cond, true_value, false_value, sigma=1.0):
# FIXME: in latest sympy making comparison difficult
if "<" not in cond.rel_op and ">" not in cond.rel_op:
TypeError(
"Expected a lesser or greater than relational for " "a continuous conditional .",
"Expected a lesser or greater than relational for a continuous conditional .",
)

# Create Heaviside
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ode_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_component_with_multiple_component_names(

def test_component_intermediates(parser, trans):
tree = parser.parse(
("parameters(x=1, y=2)\n" "states(a=2, b=3)\n" "da_dt=0\n" "c=a+b\n" "db_dt=c - a"),
("parameters(x=1, y=2)\nstates(a=2, b=3)\nda_dt=0\nc=a+b\ndb_dt=c - a"),
)
result = trans.transform(tree)
comp = result.components[0]
Expand Down

0 comments on commit 738995d

Please sign in to comment.