Skip to content

Commit f74d44f

Browse files
authored
Merge pull request #925 from nsoranzo/fix_deprecated
Fix deprecated ``getchildren()``
2 parents a604435 + 4c22dd2 commit f74d44f

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

planemo/shed/diff.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ def _shed_diff(file_a, file_b, f=sys.stdout):
5151
def _strip_shed_attributes(xml_element):
5252
if xml_element.tag == "repository":
5353
_remove_attribs(xml_element)
54-
children = xml_element.getchildren()
55-
if len(children) > 0:
56-
for child in children:
57-
_strip_shed_attributes(child)
54+
for child in xml_element:
55+
_strip_shed_attributes(child)
5856

5957

6058
def _remove_attribs(xml_element):

planemo/xml/diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def reporter(x):
3737

3838

3939
def _compare_children(x1, x2, reporter):
40-
cl1 = x1.getchildren()
41-
cl2 = x2.getchildren()
40+
cl1 = list(x1)
41+
cl2 = list(x2)
4242
if len(cl1) != len(cl2):
4343
reporter('children length differs, %i != %i\n'
4444
% (len(cl1), len(cl2)))

tests/shed_app.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,8 @@ def _modify_attributes(xml_element):
173173
xml_element.attrib["toolshed"] = "localhost:9012"
174174
xml_element.attrib["changeset_revision"] = "12345"
175175

176-
children = xml_element.getchildren()
177-
if len(children) > 0:
178-
for child in children:
179-
_modify_attributes(child)
176+
for child in xml_element:
177+
_modify_attributes(child)
180178

181179

182180
def _shutdown_server():

0 commit comments

Comments
 (0)