From 0faa479f94159eccdb254306e0eaa8bbce74fdec Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 23 Apr 2019 12:51:09 +0100 Subject: [PATCH] Fix deprecated ``getchildren()`` See https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren --- lib/galaxy/tools/parser/xml.py | 2 +- scripts/extract_toolbox_sections.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tools/parser/xml.py b/lib/galaxy/tools/parser/xml.py index c142c97745d..380b47308be 100644 --- a/lib/galaxy/tools/parser/xml.py +++ b/lib/galaxy/tools/parser/xml.py @@ -329,7 +329,7 @@ class XmlToolSource(ToolSource): output_collection.outputs[output_name] = data output_collections[name] = output_collection - for out_child in out_elem.getchildren(): + for out_child in out_elem: if out_child.tag == "data": _parse(out_child) elif out_child.tag == "collection": diff --git a/scripts/extract_toolbox_sections.py b/scripts/extract_toolbox_sections.py index cc0a49bd28d..20e3e5a2675 100644 --- a/scripts/extract_toolbox_sections.py +++ b/scripts/extract_toolbox_sections.py @@ -14,18 +14,18 @@ def main(): # index range 1-1000, current sections/tools divided between 250-750 sectionindex = 250 - sectionfactor = int(500 / len(root.getchildren())) + sectionfactor = int(500 / len(root)) - for rootchild in root.getchildren(): + for rootchild in root: currentsectionlabel = "" if (rootchild.tag == "section"): sectionname = rootchild.attrib['name'] # per section tool index range 1-1000, current labels/tools # divided between 20 and 750 toolindex = 250 - toolfactor = int(500 / len(rootchild.getchildren())) + toolfactor = int(500 / len(rootchild)) currentlabel = "" - for sectionchild in rootchild.getchildren(): + for sectionchild in rootchild: if (sectionchild.tag == "tool"): addToToolDict(sectionchild, sectionname, sectionindex, toolindex, currentlabel) toolindex += toolfactor