Skip to content

Commit 729e202

Browse files
authored
Avoid sympification in is-None checks (#2945)
* Avoid sympification in is-None checks Don't sympify if we just need to test some expression to be (not) None. Saves some time for expensive-to-sympify expressions like big piecewise constructs for splines. * pytest-rerunfailures!=16.0
1 parent 1b88ab4 commit 729e202

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

python/sdist/amici/sbml_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ def is_assignment_rule_target(self, element: libsbml.SBase) -> bool:
30663066
boolean indicating truth of function name
30673067
"""
30683068
a = self.sbml.getAssignmentRuleByVariable(element.getId())
3069-
return a is not None and self._sympify(a) is not None
3069+
return a is not None and a.getMath() is not None
30703070

30713071
def is_rate_rule_target(self, element: libsbml.SBase) -> bool:
30723072
"""
@@ -3080,7 +3080,7 @@ def is_rate_rule_target(self, element: libsbml.SBase) -> bool:
30803080
boolean indicating truth of function name
30813081
"""
30823082
a = self.sbml.getRateRuleByVariable(element.getId())
3083-
return a is not None and self._sympify(a) is not None
3083+
return a is not None and a.getMath() is not None
30843084

30853085
def _transform_dxdt_to_concentration(
30863086
self, species_id: sp.Symbol, dxdt: sp.Expr

python/sdist/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ test = [
6565
"h5py",
6666
"pytest",
6767
"pytest-cov",
68-
"pytest-rerunfailures",
68+
# v16.0: https://github.com/pytest-dev/pytest-rerunfailures/issues/302
69+
"pytest-rerunfailures!=16.0",
6970
"coverage",
7071
"shyaml",
7172
"antimony>=2.13",

0 commit comments

Comments
 (0)