Skip to content

Commit

Permalink
fix deprecated code in shed_tool_conf_xml_cleaner.py (#659)
Browse files Browse the repository at this point in the history
* add readme.txt to described python environment

* fix deprecated code in shed_tool_conf_xml_cleaner.py

* fix import order with flake8
  • Loading branch information
drosofff authored Jan 25, 2024
1 parent 355389e commit 4979d43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions scripts/helper_scripts/shed_tool_conf_xml_cleaner/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(.venv) chris@artbio:~/shed_tool_conf_xml_cleaner$ which python && python --version && pip list

/home/chris/shed_tool_conf_xml_cleaner/.venv/bin/python

Python 3.8.10

Package Version
------------- -------
pip 20.0.2
pkg-resources 0.0.0
setuptools 44.0.0
wheel 0.34.2
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# -i shed_tool_conf.xml
# -o shed_tool_conf.xml

from xml.dom import minidom
import xml.etree.ElementTree as ET
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
from xml.dom import minidom


def merge_xml_sections(input_file, output_file):
Expand All @@ -15,7 +15,7 @@ def merge_xml_sections(input_file, output_file):
tool_counter = 0
tree = ET.parse(input_file)
root = tree.getroot()
children = root.getchildren()
children = list(root)
section_list = []
for child in children:
initial_section_number += 1
Expand All @@ -42,7 +42,7 @@ def merge_xml_sections(input_file, output_file):
tool = ET.SubElement(child, "tool",
file=item.attrib['file'],
guid=item.attrib['guid'])
for subitem in item.getchildren():
for subitem in list(item):
buffer = ET.SubElement(tool, subitem.tag)
buffer.text = subitem.text
newtree = ET.ElementTree(toolbox)
Expand Down

0 comments on commit 4979d43

Please sign in to comment.