jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/588166 )
Change subject: [cleanup] use xml.etree.ElementTree instead of cElementTree ......................................................................
[cleanup] use xml.etree.ElementTree instead of cElementTree
xml.etree.cElementTree is deprecated since Python 3.3 and has been removed in Python 3.9
- update wikistats.py - update xmlreader.py - updat README.rst
Bug: T250039 Change-Id: I5e8484cbccbbedcc14d77dcba671ef35a9c2e1c0 --- M pywikibot/README.rst M pywikibot/data/wikistats.py M pywikibot/xmlreader.py 3 files changed, 6 insertions(+), 7 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/README.rst b/pywikibot/README.rst index 6e46698..4513f58 100644 --- a/pywikibot/README.rst +++ b/pywikibot/README.rst @@ -24,7 +24,6 @@ are not installed by default on some Linux distributions:
* python-xml (required to parse XML via SaX2) - * python-celementtree (recommended if you use XML dumps) * python-tkinter (optional, used by some experimental GUI stuff)
diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py index 2f2d06f..931fcd9 100644 --- a/pywikibot/data/wikistats.py +++ b/pywikibot/data/wikistats.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Objects representing WikiStats API.""" # -# (C) Pywikibot team, 2014-2019 +# (C) Pywikibot team, 2014-2020 # # Distributed under the terms of the MIT license. from __future__ import absolute_import, division, unicode_literals @@ -169,12 +169,12 @@ if table in self._data.setdefault('xml', {}): return self._data['xml'][table]
- from xml.etree import cElementTree + from xml.etree import ElementTree
data = self.raw_cached(table, 'xml')
f = BytesIO(data) - tree = cElementTree.parse(f) + tree = ElementTree.parse(f)
data = []
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py index 67154c8..b46315b 100644 --- a/pywikibot/xmlreader.py +++ b/pywikibot/xmlreader.py @@ -9,7 +9,7 @@ XmlEntry objects which can be used by other bots. """ # -# (C) Pywikibot team, 2005-2018 +# (C) Pywikibot team, 2005-2020 # # Distributed under the terms of the MIT license. # @@ -18,7 +18,7 @@ import re import threading
-from xml.etree.cElementTree import iterparse +from xml.etree.ElementTree import iterparse
import xml.sax
@@ -116,7 +116,7 @@ self._parse = self._parse_only_latest
def parse(self): - """Generator using cElementTree iterparse function.""" + """Generator using ElementTree iterparse function.""" with open_archive(self.filename) as source: # iterparse's event must be a str but they are unicode with # unicode_literals in Python 2