update (tests not passing in python2, need to investigate)

security-update
Andrew Port 2021-09-22 21:17:35 -07:00
parent e71d2d4282
commit 05408cfa26
2 changed files with 6 additions and 6 deletions

View File

@ -37,8 +37,8 @@ A Big Problem:
from __future__ import division, absolute_import, print_function
import os
import collections
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import Element, SubElement, register_namespace
from defusedxml.cElementTree import parse, tostring
from xml.etree.cElementTree import Element, SubElement, register_namespace
from defusedxml.minidom import parseString
import warnings
from tempfile import gettempdir
@ -244,10 +244,10 @@ class Document:
self.original_filepath = os.path.join(os.getcwd(), filepath)
if filepath is None:
self.tree = etree.ElementTree(Element('svg'))
self.tree = ElementTree(Element('svg'))
else:
# parse svg to ElementTree object
self.tree = etree.parse(filepath)
self.tree = parse(filepath)
self.root = self.tree.getroot()
@ -416,7 +416,7 @@ class Document:
SVG_NAMESPACE['svg']), group_attribs)
def __repr__(self):
return etree.tostring(self.tree.getroot()).decode()
return tostring(self.tree.getroot()).decode()
def pretty(self, **kwargs):
return parseString(repr(self)).toprettyxml(**kwargs)

View File

@ -5,7 +5,7 @@
# External dependencies
from __future__ import division, absolute_import, print_function
import os
from xml.etree.ElementTree import Element, ElementTree, SubElement
from xml.etree.cElementTree import Element, ElementTree, SubElement
from defusedxml.cElementTree import iterparse
# Internal dependencies