Skip to content

Commit

Permalink
even simpler _expand_yield_statements
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Jan 11, 2022
1 parent 44855fe commit c3d3727
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/galaxy/util/xml_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,11 @@ def _expand_yield_statements(macro_def, expand_el):
<sub_of_expand_2/>
</xml>
"""
yield_els = [yield_el for macro_def_el in macro_def for yield_el in macro_def_el.findall('.//yield')]
yield_els = [yield_el for yield_el in macro_def.findall('.//yield')]
expand_el_children = list(expand_el)
for yield_el in yield_els:
_xml_replace(yield_el, expand_el_children)

# Replace yields at the top level of a macro, seems hacky approach
for i, macro_def_el in enumerate(macro_def):
if macro_def_el.tag == "yield":
for target in expand_el_children:
i += 1
macro_def.insert(i, deepcopy(target))
macro_def.remove(macro_def_el)


def _load_macros(macros_el, xml_base_dir):
macros = []
Expand Down

0 comments on commit c3d3727

Please sign in to comment.