[gobject-introspection] Drop deprecated xml.etree.ElementTree.Element.getchildren() calls
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Drop deprecated xml.etree.ElementTree.Element.getchildren() calls
- Date: Mon, 6 Jan 2020 13:23:25 +0000 (UTC)
commit 1f9284228092b2a7200e8a78bc0ea6702231c6db
Author: Miro HronĨok <miro hroncok cz>
Date: Mon Jan 6 14:05:03 2020 +0100
Drop deprecated xml.etree.ElementTree.Element.getchildren() calls
The XML elements are implicitly iterable in all Python versions including
at least 2.7 and 3.2+.
The .getchildren() method is deprecated since 2.7 and 3.2, removed in 3.9.
Fixes https://gitlab.gnome.org/GNOME/gobject-introspection/issues/325
giscanner/girparser.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 7687c35c..0a6c687b 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -75,17 +75,17 @@ class GIRParser(object):
def _find_first_child(self, node, name_or_names):
if isinstance(name_or_names, str):
- for child in node.getchildren():
+ for child in node:
if child.tag == name_or_names:
return child
else:
- for child in node.getchildren():
+ for child in node:
if child.tag in name_or_names:
return child
return None
def _find_children(self, node, name):
- return [child for child in node.getchildren() if child.tag == name]
+ return [child for child in node if child.tag == name]
def _get_current_file(self):
if not self._filename_stack:
@@ -103,7 +103,7 @@ class GIRParser(object):
raise SystemExit("%s: Incompatible version %s (supported: %s)" %
(self._get_current_file(), version, COMPATIBLE_GIR_VERSION))
- for node in root.getchildren():
+ for node in root:
if node.tag == _corens('include'):
self._parse_include(node)
elif node.tag == _corens('package'):
@@ -145,7 +145,7 @@ class GIRParser(object):
parser_methods[_corens('function-macro')] = self._parse_function_macro
parser_methods[_corens('function')] = self._parse_function
- for node in ns.getchildren():
+ for node in ns:
method = parser_methods.get(node.tag)
if method is not None:
method(node)
@@ -413,7 +413,7 @@ class GIRParser(object):
def _parse_fields(self, node, obj):
res = []
names = (_corens('field'), _corens('record'), _corens('union'), _corens('callback'))
- for child in node.getchildren():
+ for child in node:
if child.tag in names:
fieldobj = self._parse_field(child, obj)
res.append(fieldobj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]