Skip to content

Commit

Permalink
Merge pull request #925 from nsoranzo/fix_deprecated
Browse files Browse the repository at this point in the history
Fix deprecated ``getchildren()``
  • Loading branch information
nsoranzo committed Apr 24, 2019
2 parents a604435 + 4c22dd2 commit f74d44f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions planemo/shed/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ def _shed_diff(file_a, file_b, f=sys.stdout):
def _strip_shed_attributes(xml_element):
if xml_element.tag == "repository":
_remove_attribs(xml_element)
children = xml_element.getchildren()
if len(children) > 0:
for child in children:
_strip_shed_attributes(child)
for child in xml_element:
_strip_shed_attributes(child)


def _remove_attribs(xml_element):
Expand Down
4 changes: 2 additions & 2 deletions planemo/xml/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def reporter(x):


def _compare_children(x1, x2, reporter):
cl1 = x1.getchildren()
cl2 = x2.getchildren()
cl1 = list(x1)
cl2 = list(x2)
if len(cl1) != len(cl2):
reporter('children length differs, %i != %i\n'
% (len(cl1), len(cl2)))
Expand Down
6 changes: 2 additions & 4 deletions tests/shed_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ def _modify_attributes(xml_element):
xml_element.attrib["toolshed"] = "localhost:9012"
xml_element.attrib["changeset_revision"] = "12345"

children = xml_element.getchildren()
if len(children) > 0:
for child in children:
_modify_attributes(child)
for child in xml_element:
_modify_attributes(child)


def _shutdown_server():
Expand Down

0 comments on commit f74d44f

Please sign in to comment.