Skip to content

Commit

Permalink
fix: Use ElementTree instead of deprecated cElementTree. (#427)
Browse files Browse the repository at this point in the history
* Use ElementTree instead of deprecated cElementTree.

* Add @tirkarthi to AUTHORS; update changelog

---------

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
  • Loading branch information
sloria and tirkarthi authored Feb 15, 2024
1 parent 411eadd commit c70f9d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ Contributors (chronological)
- Ram Rachum `@cool-RR <https://github.com/cool-RR>`_
- Romain Casati `@casatir <https://github.com/casatir>`_
- Evgeny Kemerov `@sudoguy <https://github.com/sudoguy>`_
- Karthikeyan Singaravelan `@tirkarthi <https://github.com/tirkarthi>`_
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Changelog
0.18.0 (unreleased)
-------------------

Bug fixes:

- Remove usage of deprecated cElementTree (:issue:`339`).
Thanks :user:`tirkarthi` for reporting and for the PR.
- Address ``SyntaxWarning`` on Python 3.12 (:pr:`418`).
Thanks :user:`smontanaro` for the PR.

Removals:

- ``TextBlob.translate()`` and ``TextBlob.detect_language``, and ``textblob.translate``
Expand Down
4 changes: 2 additions & 2 deletions src/textblob/_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import string
import types
from itertools import chain
from xml.etree import cElementTree
from xml.etree import ElementTree

basestring = (str, bytes)

Expand Down Expand Up @@ -909,7 +909,7 @@ def load(self, path=None):
if not os.path.exists(path):
return
words, synsets, labels = {}, {}, {}
xml = cElementTree.parse(path)
xml = ElementTree.parse(path)
xml = xml.getroot()
for w in xml.findall("word"):
if self._confidence is None or self._confidence <= float(
Expand Down

0 comments on commit c70f9d3

Please sign in to comment.