mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump xmltodict from 0.13.0 to 0.14.2 (#2418)
* Bump xmltodict from 0.13.0 to 0.14.2 Bumps [xmltodict](https://github.com/martinblech/xmltodict) from 0.13.0 to 0.14.2. - [Changelog](https://github.com/martinblech/xmltodict/blob/master/CHANGELOG.md) - [Commits](https://github.com/martinblech/xmltodict/compare/v0.13.0...v0.14.2) --- updated-dependencies: - dependency-name: xmltodict dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update xmltodict==0.14.2 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
86abd130b0
commit
af752e0acc
2 changed files with 23 additions and 45 deletions
|
@ -1,18 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"Makes working with XML feel like you are working with JSON"
|
"Makes working with XML feel like you are working with JSON"
|
||||||
|
|
||||||
try:
|
|
||||||
from defusedexpat import pyexpat as expat
|
|
||||||
except ImportError:
|
|
||||||
from xml.parsers import expat
|
from xml.parsers import expat
|
||||||
from xml.sax.saxutils import XMLGenerator
|
from xml.sax.saxutils import XMLGenerator
|
||||||
from xml.sax.xmlreader import AttributesImpl
|
from xml.sax.xmlreader import AttributesImpl
|
||||||
try: # pragma no cover
|
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError: # pragma no cover
|
|
||||||
try:
|
|
||||||
from StringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
_dict = dict
|
_dict = dict
|
||||||
|
@ -22,17 +13,8 @@ if tuple(map(int, platform.python_version_tuple()[:2])) < (3, 7):
|
||||||
|
|
||||||
from inspect import isgenerator
|
from inspect import isgenerator
|
||||||
|
|
||||||
try: # pragma no cover
|
|
||||||
_basestring = basestring
|
|
||||||
except NameError: # pragma no cover
|
|
||||||
_basestring = str
|
|
||||||
try: # pragma no cover
|
|
||||||
_unicode = unicode
|
|
||||||
except NameError: # pragma no cover
|
|
||||||
_unicode = str
|
|
||||||
|
|
||||||
__author__ = 'Martin Blech'
|
__author__ = 'Martin Blech'
|
||||||
__version__ = '0.13.0'
|
__version__ = "0.14.2"
|
||||||
__license__ = 'MIT'
|
__license__ = 'MIT'
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +22,7 @@ class ParsingInterrupted(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _DictSAXHandler(object):
|
class _DictSAXHandler:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
item_depth=0,
|
item_depth=0,
|
||||||
item_callback=lambda *args: True,
|
item_callback=lambda *args: True,
|
||||||
|
@ -107,7 +89,7 @@ class _DictSAXHandler(object):
|
||||||
attrs['xmlns'] = self.namespace_declarations
|
attrs['xmlns'] = self.namespace_declarations
|
||||||
self.namespace_declarations = self.dict_constructor()
|
self.namespace_declarations = self.dict_constructor()
|
||||||
self.path.append((name, attrs or None))
|
self.path.append((name, attrs or None))
|
||||||
if len(self.path) > self.item_depth:
|
if len(self.path) >= self.item_depth:
|
||||||
self.stack.append((self.item, self.data))
|
self.stack.append((self.item, self.data))
|
||||||
if self.xml_attribs:
|
if self.xml_attribs:
|
||||||
attr_entries = []
|
attr_entries = []
|
||||||
|
@ -135,7 +117,7 @@ class _DictSAXHandler(object):
|
||||||
|
|
||||||
should_continue = self.item_callback(self.path, item)
|
should_continue = self.item_callback(self.path, item)
|
||||||
if not should_continue:
|
if not should_continue:
|
||||||
raise ParsingInterrupted()
|
raise ParsingInterrupted
|
||||||
if self.stack:
|
if self.stack:
|
||||||
data = (None if not self.data
|
data = (None if not self.data
|
||||||
else self.cdata_separator.join(self.data))
|
else self.cdata_separator.join(self.data))
|
||||||
|
@ -335,9 +317,8 @@ def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
|
||||||
"""
|
"""
|
||||||
handler = _DictSAXHandler(namespace_separator=namespace_separator,
|
handler = _DictSAXHandler(namespace_separator=namespace_separator,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
if isinstance(xml_input, _unicode):
|
if isinstance(xml_input, str):
|
||||||
if not encoding:
|
encoding = encoding or 'utf-8'
|
||||||
encoding = 'utf-8'
|
|
||||||
xml_input = xml_input.encode(encoding)
|
xml_input = xml_input.encode(encoding)
|
||||||
if not process_namespaces:
|
if not process_namespaces:
|
||||||
namespace_separator = None
|
namespace_separator = None
|
||||||
|
@ -412,9 +393,7 @@ def _emit(key, value, content_handler,
|
||||||
if result is None:
|
if result is None:
|
||||||
return
|
return
|
||||||
key, value = result
|
key, value = result
|
||||||
if (not hasattr(value, '__iter__')
|
if not hasattr(value, '__iter__') or isinstance(value, (str, dict)):
|
||||||
or isinstance(value, _basestring)
|
|
||||||
or isinstance(value, dict)):
|
|
||||||
value = [value]
|
value = [value]
|
||||||
for index, v in enumerate(value):
|
for index, v in enumerate(value):
|
||||||
if full_document and depth == 0 and index > 0:
|
if full_document and depth == 0 and index > 0:
|
||||||
|
@ -422,16 +401,13 @@ def _emit(key, value, content_handler,
|
||||||
if v is None:
|
if v is None:
|
||||||
v = _dict()
|
v = _dict()
|
||||||
elif isinstance(v, bool):
|
elif isinstance(v, bool):
|
||||||
if v:
|
v = 'true' if v else 'false'
|
||||||
v = _unicode('true')
|
elif not isinstance(v, (dict, str)):
|
||||||
else:
|
if expand_iter and hasattr(v, '__iter__'):
|
||||||
v = _unicode('false')
|
|
||||||
elif not isinstance(v, dict):
|
|
||||||
if expand_iter and hasattr(v, '__iter__') and not isinstance(v, _basestring):
|
|
||||||
v = _dict(((expand_iter, v),))
|
v = _dict(((expand_iter, v),))
|
||||||
else:
|
else:
|
||||||
v = _unicode(v)
|
v = str(v)
|
||||||
if isinstance(v, _basestring):
|
if isinstance(v, str):
|
||||||
v = _dict(((cdata_key, v),))
|
v = _dict(((cdata_key, v),))
|
||||||
cdata = None
|
cdata = None
|
||||||
attrs = _dict()
|
attrs = _dict()
|
||||||
|
@ -445,14 +421,16 @@ def _emit(key, value, content_handler,
|
||||||
attr_prefix)
|
attr_prefix)
|
||||||
if ik == '@xmlns' and isinstance(iv, dict):
|
if ik == '@xmlns' and isinstance(iv, dict):
|
||||||
for k, v in iv.items():
|
for k, v in iv.items():
|
||||||
attr = 'xmlns{}'.format(':{}'.format(k) if k else '')
|
attr = 'xmlns{}'.format(f':{k}' if k else '')
|
||||||
attrs[attr] = _unicode(v)
|
attrs[attr] = str(v)
|
||||||
continue
|
continue
|
||||||
if not isinstance(iv, _unicode):
|
if not isinstance(iv, str):
|
||||||
iv = _unicode(iv)
|
iv = str(iv)
|
||||||
attrs[ik[len(attr_prefix):]] = iv
|
attrs[ik[len(attr_prefix):]] = iv
|
||||||
continue
|
continue
|
||||||
children.append((ik, iv))
|
children.append((ik, iv))
|
||||||
|
if isinstance(indent, int):
|
||||||
|
indent = ' ' * indent
|
||||||
if pretty:
|
if pretty:
|
||||||
content_handler.ignorableWhitespace(depth * indent)
|
content_handler.ignorableWhitespace(depth * indent)
|
||||||
content_handler.startElement(key, AttributesImpl(attrs))
|
content_handler.startElement(key, AttributesImpl(attrs))
|
||||||
|
|
|
@ -46,7 +46,7 @@ tzlocal==5.0.1
|
||||||
urllib3<2
|
urllib3<2
|
||||||
webencodings==0.5.1
|
webencodings==0.5.1
|
||||||
websocket-client==1.8.0
|
websocket-client==1.8.0
|
||||||
xmltodict==0.13.0
|
xmltodict==0.14.2
|
||||||
zipp==3.19.2
|
zipp==3.19.2
|
||||||
|
|
||||||
# configobj==5.1.0
|
# configobj==5.1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue