Skip to content

Commit 605a0af

Browse files
committed
Use ElementTree instead of deprecated cElementTree.
1 parent f3affab commit 605a0af

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

textblob/_text.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
import types
1212
import os
1313
import re
14-
from xml.etree import cElementTree
1514

16-
from .compat import text_type, basestring, imap, unicode, binary_type, PY2
15+
from .compat import text_type, basestring, imap, unicode, binary_type, PY2, ET
1716

1817
try:
1918
MODULE = os.path.dirname(os.path.abspath(__file__))
@@ -740,7 +739,7 @@ def load(self, path=None):
740739
if not os.path.exists(path):
741740
return
742741
words, synsets, labels = {}, {}, {}
743-
xml = cElementTree.parse(path)
742+
xml = ET.parse(path)
744743
xml = xml.getroot()
745744
for w in xml.findall("word"):
746745
if self._confidence is None \

textblob/compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
imap = imap
1717
izip = izip
1818
import unicodecsv as csv
19+
import xml.etree.cElementTree as ET
1920

2021
def implements_to_string(cls):
2122
"""Class decorator that renames __str__ to __unicode__ and
@@ -36,6 +37,7 @@ def implements_to_string(cls):
3637
imap = map
3738
izip = zip
3839
import csv
40+
import xml.etree.ElementTree as ET
3941

4042
implements_to_string = lambda x: x
4143

0 commit comments

Comments
 (0)