Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 2fdec26

Browse files
committed
Removed defusedxml as a hard requirement
1 parent eba1ee3 commit 2fdec26

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

.circleci/unittest/linux/scripts/environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ dependencies:
1818
- sphinx
1919
- sphinx-rtd-theme
2020
- tqdm
21-
- defusedxml
2221
- https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0
2322
- https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0

.circleci/unittest/windows/scripts/environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ dependencies:
2020
- tqdm
2121
- certifi
2222
- future
23-
- defusedxml
2423
- https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-3.0.0/de_core_news_sm-3.0.0.tar.gz#egg=de_core_news_sm==3.0.0
2524
- https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz#egg=en_core_web_sm==3.0.0

torchtext/data/datasets_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
unicode_csv_reader,
1212
)
1313
import codecs
14-
import defusedxml.ElementTree as ET
14+
try:
15+
import defusedxml.ElementTree as ET
16+
except ImportError:
17+
import xml.etree.ElementTree as ET
1518
"""
1619
These functions and classes are meant solely for use in torchtext.datasets and not
1720
for public consumption yet.

torchtext/legacy/datasets/translation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
2-
import defusedxml.ElementTree as ET
2+
try:
3+
import defusedxml.ElementTree as ET
4+
except ImportError:
5+
import xml.etree.ElementTree as ET
36
import glob
47
import io
58
import codecs

0 commit comments

Comments
 (0)