def _build_input_tree(self, inputs: XmlElement, parent: InputNode) -> None: """Given the XML element containing the inputs of the tool, this method recursively builds an expanded input tree. Args: inputs (XmlElement): The XML element corresponding to the inputs. parent (InputNode): The node that will hold all the inputs. """ parent.params = inputs.get_children_with_name(PARAM) conditionals = inputs.get_children_with_name(CONDITIONAL) for conditional in conditionals: self._build_conditional_input_tree(conditional, parent) repeats = inputs.get_children_with_name(REPEAT) for repeat in repeats: repeat_node = self._build_repeat_input_tree(repeat) if repeat_node: parent.repeats.append(repeat_node) sections = inputs.get_children_with_name(SECTION) for section in sections: section_node = self._build_section_input_tree(section) if section_node: parent.sections.append(section_node)
def _get_options_from_param(self, param: XmlElement) -> List[str]: """Gets the list of children elements of type <option> from the given 'param' XML element. Args: param (XmlElement): The <param> XML element. Returns: List[str]: The list of <option> in this 'param' or an empty list. """ option_elements = param.get_children_with_name(OPTION) options = [o.get_attribute(VALUE) for o in option_elements] return list(filter(None, options))