From 36388fba44bef425c0fde986ea873474ff9edac9 Mon Sep 17 00:00:00 2001 From: Jonathan Karr Date: Fri, 12 Feb 2021 18:00:09 -0500 Subject: [PATCH] fixing error message, simplifying --- biosimulators_utils/sedml/utils.py | 2 +- biosimulators_utils/sedml/validation.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/biosimulators_utils/sedml/utils.py b/biosimulators_utils/sedml/utils.py index 07902b0f..421c8916 100644 --- a/biosimulators_utils/sedml/utils.py +++ b/biosimulators_utils/sedml/utils.py @@ -415,7 +415,7 @@ def apply_changes_to_xml_model(model, model_etree, sed_doc, working_dir, new_value = calc_compute_model_change_new_value(change, variable_values=iter_variable_values, range_values=range_values) if new_value == int(new_value): new_value = str(int(new_value)) - else: + else: new_value = str(new_value) # get object to change diff --git a/biosimulators_utils/sedml/validation.py b/biosimulators_utils/sedml/validation.py index 26c0fafc..c093f2f3 100644 --- a/biosimulators_utils/sedml/validation.py +++ b/biosimulators_utils/sedml/validation.py @@ -214,7 +214,7 @@ def validate_doc(doc, validate_semantics=True): functional_range_graph = networkx.DiGraph() for task in doc.tasks: if isinstance(task, RepeatedTask): - for i_range, range in enumerate(task.ranges): + for range in task.ranges: if isinstance(range, FunctionalRange): if not range.range: msg = ('Functional ranges must reference another range. ' @@ -240,7 +240,8 @@ def validate_doc(doc, validate_semantics=True): raise ValueError('Variables of functional ranges should define a symbol or target, not both') if not range.math: - raise ValueError('Functional ranges must have math. Functional range `{}` does not have math.') + msg = 'Functional ranges must have math. Functional range `{}` does not have math.'.format(range.id) + raise ValueError(msg) functional_range_graph.add_node(range.id) functional_range_graph.add_edge(range.id, range.range.id) @@ -261,7 +262,7 @@ def validate_doc(doc, validate_semantics=True): raise ValueError('Repeated tasks must have main ranges. Repeated task `{}` does not have a main range.'.format(task.id)) main_range_len = get_range_len(task.range) - for i_range, range in enumerate(task.ranges): + for range in task.ranges: range_len = get_range_len(range) if range_len < main_range_len: msg = (