diff --git a/biosimulators_utils/_version.py b/biosimulators_utils/_version.py index b8d5baed..416dc749 100644 --- a/biosimulators_utils/_version.py +++ b/biosimulators_utils/_version.py @@ -1 +1 @@ -__version__ = '0.1.180' +__version__ = '0.1.181' diff --git a/biosimulators_utils/sedml/math.py b/biosimulators_utils/sedml/math.py index 6ac81ef2..615fd88f 100644 --- a/biosimulators_utils/sedml/math.py +++ b/biosimulators_utils/sedml/math.py @@ -179,10 +179,12 @@ def compile_math(math): .replace('^', '**') ) - math_node = evalidate.evalidate(math, - addnodes=VALID_MATH_EXPRESSION_NODES, - funcs=MATHEMATICAL_FUNCTIONS.keys()) - compiled_math = compile(math_node, '', 'eval') + model = evalidate.base_eval_model.clone() + model.nodes.extend(VALID_MATH_EXPRESSION_NODES) + model.allowed_functions.extend(MATHEMATICAL_FUNCTIONS.keys()) + + math_node = evalidate.Expr(math, model=model) + compiled_math = compile(math_node.node, '', 'eval') return compiled_math diff --git a/biosimulators_utils/sedml/validation.py b/biosimulators_utils/sedml/validation.py index 2bbc919b..29f4522f 100644 --- a/biosimulators_utils/sedml/validation.py +++ b/biosimulators_utils/sedml/validation.py @@ -1771,8 +1771,8 @@ def validate_calculation(calculation): try: compiled_math = compile_math(calculation.math) - except TypeError: - errors.append(['The mathematical expression must be a `string`, not a `{}`.'.format(calculation.math.__class__)]) + except TypeError as exception: + errors.append(['The mathematical expression must be a `string`, not a `{}`:'.format(calculation.math.__class__), [[str(exception)]]]) return (errors, warnings) except (SyntaxError, CompilationException) as exception: errors.append(['The syntax of the mathematical expression `{}` is invalid.'.format(calculation.math), [[str(exception)]]]) diff --git a/requirements.txt b/requirements.txt index d96612b0..d666f239 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ appdirs biopython cement -evalidate +evalidate >= 2.0.0 h5py kisao >= 2.32 lxml