Current File : /home/mmdealscpanel/yummmdeals.com/etree.zip
PK��ZW�Z�DD__init__.pynu�[���# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $
# elementtree package

# --------------------------------------------------------------------
# The ElementTree toolkit is
#
# Copyright (c) 1999-2008 by Fredrik Lundh
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and
# its associated documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice appears in
# all copies, and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of
# Secret Labs AB or the author not be used in advertising or publicity
# pertaining to distribution of the software without specific, written
# prior permission.
#
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# --------------------------------------------------------------------

# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.
PK��Z�):��ElementTree.pynu�[���"""Lightweight XML support for Python.

 XML is an inherently hierarchical data format, and the most natural way to
 represent it is with a tree.  This module has two classes for this purpose:

    1. ElementTree represents the whole XML document as a tree and

    2. Element represents a single node in this tree.

 Interactions with the whole document (reading and writing to/from files) are
 usually done on the ElementTree level.  Interactions with a single XML element
 and its sub-elements are done on the Element level.

 Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:

    'tag' - a string containing the element's name.

    'attributes' - a Python dictionary storing the element's attributes.

    'text' - a string containing the element's text content.

    'tail' - an optional string containing text after the element's end tag.

    And a number of child elements stored in a Python sequence.

 To create an element instance, use the Element constructor,
 or the SubElement factory function.

 You can also use the ElementTree class to wrap an element structure
 and convert it to and from XML.

"""

#---------------------------------------------------------------------
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.
#
# ElementTree
# Copyright (c) 1999-2008 by Fredrik Lundh.  All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware.com
# --------------------------------------------------------------------
# The ElementTree toolkit is
#
# Copyright (c) 1999-2008 by Fredrik Lundh
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and
# its associated documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice appears in
# all copies, and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of
# Secret Labs AB or the author not be used in advertising or publicity
# pertaining to distribution of the software without specific, written
# prior permission.
#
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# --------------------------------------------------------------------

__all__ = [
    # public symbols
    "Comment",
    "dump",
    "Element", "ElementTree",
    "fromstring", "fromstringlist",
    "iselement", "iterparse",
    "parse", "ParseError",
    "PI", "ProcessingInstruction",
    "QName",
    "SubElement",
    "tostring", "tostringlist",
    "TreeBuilder",
    "VERSION",
    "XML", "XMLID",
    "XMLParser", "XMLPullParser",
    "register_namespace",
    "canonicalize", "C14NWriterTarget",
    ]

VERSION = "1.3.0"

import sys
import re
import warnings
import io
import collections
import collections.abc
import contextlib

from . import ElementPath


class ParseError(SyntaxError):
    """An error when parsing an XML document.

    In addition to its exception value, a ParseError contains
    two extra attributes:
        'code'     - the specific exception code
        'position' - the line and column of the error

    """
    pass

# --------------------------------------------------------------------


def iselement(element):
    """Return True if *element* appears to be an Element."""
    return hasattr(element, 'tag')


class Element:
    """An XML element.

    This class is the reference implementation of the Element interface.

    An element's length is its number of subelements.  That means if you
    want to check if an element is truly empty, you should check BOTH
    its length AND its text attribute.

    The element tag, attribute names, and attribute values can be either
    bytes or strings.

    *tag* is the element name.  *attrib* is an optional dictionary containing
    element attributes. *extra* are additional element attributes given as
    keyword arguments.

    Example form:
        <tag attrib>text<child/>...</tag>tail

    """

    tag = None
    """The element's name."""

    attrib = None
    """Dictionary of the element's attributes."""

    text = None
    """
    Text before first subelement. This is either a string or the value None.
    Note that if there is no text, this attribute may be either
    None or the empty string, depending on the parser.

    """

    tail = None
    """
    Text after this element's end tag, but before the next sibling element's
    start tag.  This is either a string or the value None.  Note that if there
    was no text, this attribute may be either None or an empty string,
    depending on the parser.

    """

    def __init__(self, tag, attrib={}, **extra):
        if not isinstance(attrib, dict):
            raise TypeError("attrib must be dict, not %s" % (
                attrib.__class__.__name__,))
        self.tag = tag
        self.attrib = {**attrib, **extra}
        self._children = []

    def __repr__(self):
        return "<%s %r at %#x>" % (self.__class__.__name__, self.tag, id(self))

    def makeelement(self, tag, attrib):
        """Create a new element with the same type.

        *tag* is a string containing the element name.
        *attrib* is a dictionary containing the element attributes.

        Do not call this method, use the SubElement factory function instead.

        """
        return self.__class__(tag, attrib)

    def copy(self):
        """Return copy of current element.

        This creates a shallow copy. Subelements will be shared with the
        original tree.

        """
        elem = self.makeelement(self.tag, self.attrib)
        elem.text = self.text
        elem.tail = self.tail
        elem[:] = self
        return elem

    def __len__(self):
        return len(self._children)

    def __bool__(self):
        warnings.warn(
            "The behavior of this method will change in future versions.  "
            "Use specific 'len(elem)' or 'elem is not None' test instead.",
            FutureWarning, stacklevel=2
            )
        return len(self._children) != 0 # emulate old behaviour, for now

    def __getitem__(self, index):
        return self._children[index]

    def __setitem__(self, index, element):
        if isinstance(index, slice):
            for elt in element:
                self._assert_is_element(elt)
        else:
            self._assert_is_element(element)
        self._children[index] = element

    def __delitem__(self, index):
        del self._children[index]

    def append(self, subelement):
        """Add *subelement* to the end of this element.

        The new element will appear in document order after the last existing
        subelement (or directly after the text, if it's the first subelement),
        but before the end tag for this element.

        """
        self._assert_is_element(subelement)
        self._children.append(subelement)

    def extend(self, elements):
        """Append subelements from a sequence.

        *elements* is a sequence with zero or more elements.

        """
        for element in elements:
            self._assert_is_element(element)
            self._children.append(element)

    def insert(self, index, subelement):
        """Insert *subelement* at position *index*."""
        self._assert_is_element(subelement)
        self._children.insert(index, subelement)

    def _assert_is_element(self, e):
        # Need to refer to the actual Python implementation, not the
        # shadowing C implementation.
        if not isinstance(e, _Element_Py):
            raise TypeError('expected an Element, not %s' % type(e).__name__)

    def remove(self, subelement):
        """Remove matching subelement.

        Unlike the find methods, this method compares elements based on
        identity, NOT ON tag value or contents.  To remove subelements by
        other means, the easiest way is to use a list comprehension to
        select what elements to keep, and then use slice assignment to update
        the parent element.

        ValueError is raised if a matching element could not be found.

        """
        # assert iselement(element)
        self._children.remove(subelement)

    def getchildren(self):
        """(Deprecated) Return all subelements.

        Elements are returned in document order.

        """
        warnings.warn(
            "This method will be removed in future versions.  "
            "Use 'list(elem)' or iteration over elem instead.",
            DeprecationWarning, stacklevel=2
            )
        return self._children

    def find(self, path, namespaces=None):
        """Find first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        """
        return ElementPath.find(self, path, namespaces)

    def findtext(self, path, default=None, namespaces=None):
        """Find text for first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *default* is the value to return if the element was not found,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return text content of first matching element, or default value if
        none was found.  Note that if an element is found having no text
        content, the empty string is returned.

        """
        return ElementPath.findtext(self, path, default, namespaces)

    def findall(self, path, namespaces=None):
        """Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Returns list containing all matching elements in document order.

        """
        return ElementPath.findall(self, path, namespaces)

    def iterfind(self, path, namespaces=None):
        """Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        """
        return ElementPath.iterfind(self, path, namespaces)

    def clear(self):
        """Reset element.

        This function removes all subelements, clears all attributes, and sets
        the text and tail attributes to None.

        """
        self.attrib.clear()
        self._children = []
        self.text = self.tail = None

    def get(self, key, default=None):
        """Get element attribute.

        Equivalent to attrib.get, but some implementations may handle this a
        bit more efficiently.  *key* is what attribute to look for, and
        *default* is what to return if the attribute was not found.

        Returns a string containing the attribute value, or the default if
        attribute was not found.

        """
        return self.attrib.get(key, default)

    def set(self, key, value):
        """Set element attribute.

        Equivalent to attrib[key] = value, but some implementations may handle
        this a bit more efficiently.  *key* is what attribute to set, and
        *value* is the attribute value to set it to.

        """
        self.attrib[key] = value

    def keys(self):
        """Get list of attribute names.

        Names are returned in an arbitrary order, just like an ordinary
        Python dict.  Equivalent to attrib.keys()

        """
        return self.attrib.keys()

    def items(self):
        """Get element attributes as a sequence.

        The attributes are returned in arbitrary order.  Equivalent to
        attrib.items().

        Return a list of (name, value) tuples.

        """
        return self.attrib.items()

    def iter(self, tag=None):
        """Create tree iterator.

        The iterator loops over the element and all subelements in document
        order, returning all elements with a matching tag.

        If the tree structure is modified during iteration, new or removed
        elements may or may not be included.  To get a stable set, use the
        list() function on the iterator, and loop over the resulting list.

        *tag* is what tags to look for (default is to return all elements)

        Return an iterator containing all the matching elements.

        """
        if tag == "*":
            tag = None
        if tag is None or self.tag == tag:
            yield self
        for e in self._children:
            yield from e.iter(tag)

    # compatibility
    def getiterator(self, tag=None):
        warnings.warn(
            "This method will be removed in future versions.  "
            "Use 'elem.iter()' or 'list(elem.iter())' instead.",
            DeprecationWarning, stacklevel=2
        )
        return list(self.iter(tag))

    def itertext(self):
        """Create text iterator.

        The iterator loops over the element and all subelements in document
        order, returning all inner text.

        """
        tag = self.tag
        if not isinstance(tag, str) and tag is not None:
            return
        t = self.text
        if t:
            yield t
        for e in self:
            yield from e.itertext()
            t = e.tail
            if t:
                yield t


def SubElement(parent, tag, attrib={}, **extra):
    """Subelement factory which creates an element instance, and appends it
    to an existing parent.

    The element tag, attribute names, and attribute values can be either
    bytes or Unicode strings.

    *parent* is the parent element, *tag* is the subelements name, *attrib* is
    an optional directory containing element attributes, *extra* are
    additional attributes given as keyword arguments.

    """
    attrib = {**attrib, **extra}
    element = parent.makeelement(tag, attrib)
    parent.append(element)
    return element


def Comment(text=None):
    """Comment element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *text* is a string containing the comment string.

    """
    element = Element(Comment)
    element.text = text
    return element


def ProcessingInstruction(target, text=None):
    """Processing Instruction element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *target* is a string containing the processing instruction, *text* is a
    string containing the processing instruction contents, if any.

    """
    element = Element(ProcessingInstruction)
    element.text = target
    if text:
        element.text = element.text + " " + text
    return element

PI = ProcessingInstruction


class QName:
    """Qualified name wrapper.

    This class can be used to wrap a QName attribute value in order to get
    proper namespace handing on output.

    *text_or_uri* is a string containing the QName value either in the form
    {uri}local, or if the tag argument is given, the URI part of a QName.

    *tag* is an optional argument which if given, will make the first
    argument (text_or_uri) be interpreted as a URI, and this argument (tag)
    be interpreted as a local name.

    """
    def __init__(self, text_or_uri, tag=None):
        if tag:
            text_or_uri = "{%s}%s" % (text_or_uri, tag)
        self.text = text_or_uri
    def __str__(self):
        return self.text
    def __repr__(self):
        return '<%s %r>' % (self.__class__.__name__, self.text)
    def __hash__(self):
        return hash(self.text)
    def __le__(self, other):
        if isinstance(other, QName):
            return self.text <= other.text
        return self.text <= other
    def __lt__(self, other):
        if isinstance(other, QName):
            return self.text < other.text
        return self.text < other
    def __ge__(self, other):
        if isinstance(other, QName):
            return self.text >= other.text
        return self.text >= other
    def __gt__(self, other):
        if isinstance(other, QName):
            return self.text > other.text
        return self.text > other
    def __eq__(self, other):
        if isinstance(other, QName):
            return self.text == other.text
        return self.text == other

# --------------------------------------------------------------------


class ElementTree:
    """An XML element hierarchy.

    This class also provides support for serialization to and from
    standard XML.

    *element* is an optional root element node,
    *file* is an optional file handle or file name of an XML file whose
    contents will be used to initialize the tree with.

    """
    def __init__(self, element=None, file=None):
        # assert element is None or iselement(element)
        self._root = element # first node
        if file:
            self.parse(file)

    def getroot(self):
        """Return root element of this tree."""
        return self._root

    def _setroot(self, element):
        """Replace root element of this tree.

        This will discard the current contents of the tree and replace it
        with the given element.  Use with care!

        """
        # assert iselement(element)
        self._root = element

    def parse(self, source, parser=None):
        """Load external XML document into element tree.

        *source* is a file name or file object, *parser* is an optional parser
        instance that defaults to XMLParser.

        ParseError is raised if the parser fails to parse the document.

        Returns the root element of the given source document.

        """
        close_source = False
        if not hasattr(source, "read"):
            source = open(source, "rb")
            close_source = True
        try:
            if parser is None:
                # If no parser was specified, create a default XMLParser
                parser = XMLParser()
                if hasattr(parser, '_parse_whole'):
                    # The default XMLParser, when it comes from an accelerator,
                    # can define an internal _parse_whole API for efficiency.
                    # It can be used to parse the whole source without feeding
                    # it with chunks.
                    self._root = parser._parse_whole(source)
                    return self._root
            while True:
                data = source.read(65536)
                if not data:
                    break
                parser.feed(data)
            self._root = parser.close()
            return self._root
        finally:
            if close_source:
                source.close()

    def iter(self, tag=None):
        """Create and return tree iterator for the root element.

        The iterator loops over all elements in this tree, in document order.

        *tag* is a string with the tag name to iterate over
        (default is to return all elements).

        """
        # assert self._root is not None
        return self._root.iter(tag)

    # compatibility
    def getiterator(self, tag=None):
        warnings.warn(
            "This method will be removed in future versions.  "
            "Use 'tree.iter()' or 'list(tree.iter())' instead.",
            DeprecationWarning, stacklevel=2
        )
        return list(self.iter(tag))

    def find(self, path, namespaces=None):
        """Find first matching element by tag name or path.

        Same as getroot().find(path), which is Element.find()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        """
        # assert self._root is not None
        if path[:1] == "/":
            path = "." + path
            warnings.warn(
                "This search is broken in 1.3 and earlier, and will be "
                "fixed in a future version.  If you rely on the current "
                "behaviour, change it to %r" % path,
                FutureWarning, stacklevel=2
                )
        return self._root.find(path, namespaces)

    def findtext(self, path, default=None, namespaces=None):
        """Find first matching element by tag name or path.

        Same as getroot().findtext(path),  which is Element.findtext()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        """
        # assert self._root is not None
        if path[:1] == "/":
            path = "." + path
            warnings.warn(
                "This search is broken in 1.3 and earlier, and will be "
                "fixed in a future version.  If you rely on the current "
                "behaviour, change it to %r" % path,
                FutureWarning, stacklevel=2
                )
        return self._root.findtext(path, default, namespaces)

    def findall(self, path, namespaces=None):
        """Find all matching subelements by tag name or path.

        Same as getroot().findall(path), which is Element.findall().

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return list containing all matching elements in document order.

        """
        # assert self._root is not None
        if path[:1] == "/":
            path = "." + path
            warnings.warn(
                "This search is broken in 1.3 and earlier, and will be "
                "fixed in a future version.  If you rely on the current "
                "behaviour, change it to %r" % path,
                FutureWarning, stacklevel=2
                )
        return self._root.findall(path, namespaces)

    def iterfind(self, path, namespaces=None):
        """Find all matching subelements by tag name or path.

        Same as getroot().iterfind(path), which is element.iterfind()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        """
        # assert self._root is not None
        if path[:1] == "/":
            path = "." + path
            warnings.warn(
                "This search is broken in 1.3 and earlier, and will be "
                "fixed in a future version.  If you rely on the current "
                "behaviour, change it to %r" % path,
                FutureWarning, stacklevel=2
                )
        return self._root.iterfind(path, namespaces)

    def write(self, file_or_filename,
              encoding=None,
              xml_declaration=None,
              default_namespace=None,
              method=None, *,
              short_empty_elements=True):
        """Write element tree to a file as XML.

        Arguments:
          *file_or_filename* -- file name or a file object opened for writing

          *encoding* -- the output encoding (default: US-ASCII)

          *xml_declaration* -- bool indicating if an XML declaration should be
                               added to the output. If None, an XML declaration
                               is added if encoding IS NOT either of:
                               US-ASCII, UTF-8, or Unicode

          *default_namespace* -- sets the default XML namespace (for "xmlns")

          *method* -- either "xml" (default), "html, "text", or "c14n"

          *short_empty_elements* -- controls the formatting of elements
                                    that contain no content. If True (default)
                                    they are emitted as a single self-closed
                                    tag, otherwise they are emitted as a pair
                                    of start/end tags

        """
        if not method:
            method = "xml"
        elif method not in _serialize:
            raise ValueError("unknown method %r" % method)
        if not encoding:
            if method == "c14n":
                encoding = "utf-8"
            else:
                encoding = "us-ascii"
        enc_lower = encoding.lower()
        with _get_writer(file_or_filename, enc_lower) as write:
            if method == "xml" and (xml_declaration or
                    (xml_declaration is None and
                     enc_lower not in ("utf-8", "us-ascii", "unicode"))):
                declared_encoding = encoding
                if enc_lower == "unicode":
                    # Retrieve the default encoding for the xml declaration
                    import locale
                    declared_encoding = locale.getpreferredencoding()
                write("<?xml version='1.0' encoding='%s'?>\n" % (
                    declared_encoding,))
            if method == "text":
                _serialize_text(write, self._root)
            else:
                qnames, namespaces = _namespaces(self._root, default_namespace)
                serialize = _serialize[method]
                serialize(write, self._root, qnames, namespaces,
                          short_empty_elements=short_empty_elements)

    def write_c14n(self, file):
        # lxml.etree compatibility.  use output method instead
        return self.write(file, method="c14n")

# --------------------------------------------------------------------
# serialization support

@contextlib.contextmanager
def _get_writer(file_or_filename, encoding):
    # returns text write method and release all resources after using
    try:
        write = file_or_filename.write
    except AttributeError:
        # file_or_filename is a file name
        if encoding == "unicode":
            file = open(file_or_filename, "w")
        else:
            file = open(file_or_filename, "w", encoding=encoding,
                        errors="xmlcharrefreplace")
        with file:
            yield file.write
    else:
        # file_or_filename is a file-like object
        # encoding determines if it is a text or binary writer
        if encoding == "unicode":
            # use a text writer as is
            yield write
        else:
            # wrap a binary writer with TextIOWrapper
            with contextlib.ExitStack() as stack:
                if isinstance(file_or_filename, io.BufferedIOBase):
                    file = file_or_filename
                elif isinstance(file_or_filename, io.RawIOBase):
                    file = io.BufferedWriter(file_or_filename)
                    # Keep the original file open when the BufferedWriter is
                    # destroyed
                    stack.callback(file.detach)
                else:
                    # This is to handle passed objects that aren't in the
                    # IOBase hierarchy, but just have a write method
                    file = io.BufferedIOBase()
                    file.writable = lambda: True
                    file.write = write
                    try:
                        # TextIOWrapper uses this methods to determine
                        # if BOM (for UTF-16, etc) should be added
                        file.seekable = file_or_filename.seekable
                        file.tell = file_or_filename.tell
                    except AttributeError:
                        pass
                file = io.TextIOWrapper(file,
                                        encoding=encoding,
                                        errors="xmlcharrefreplace",
                                        newline="\n")
                # Keep the original file open when the TextIOWrapper is
                # destroyed
                stack.callback(file.detach)
                yield file.write

def _namespaces(elem, default_namespace=None):
    # identify namespaces used in this tree

    # maps qnames to *encoded* prefix:local names
    qnames = {None: None}

    # maps uri:s to prefixes
    namespaces = {}
    if default_namespace:
        namespaces[default_namespace] = ""

    def add_qname(qname):
        # calculate serialized qname representation
        try:
            if qname[:1] == "{":
                uri, tag = qname[1:].rsplit("}", 1)
                prefix = namespaces.get(uri)
                if prefix is None:
                    prefix = _namespace_map.get(uri)
                    if prefix is None:
                        prefix = "ns%d" % len(namespaces)
                    if prefix != "xml":
                        namespaces[uri] = prefix
                if prefix:
                    qnames[qname] = "%s:%s" % (prefix, tag)
                else:
                    qnames[qname] = tag # default element
            else:
                if default_namespace:
                    # FIXME: can this be handled in XML 1.0?
                    raise ValueError(
                        "cannot use non-qualified names with "
                        "default_namespace option"
                        )
                qnames[qname] = qname
        except TypeError:
            _raise_serialization_error(qname)

    # populate qname and namespaces table
    for elem in elem.iter():
        tag = elem.tag
        if isinstance(tag, QName):
            if tag.text not in qnames:
                add_qname(tag.text)
        elif isinstance(tag, str):
            if tag not in qnames:
                add_qname(tag)
        elif tag is not None and tag is not Comment and tag is not PI:
            _raise_serialization_error(tag)
        for key, value in elem.items():
            if isinstance(key, QName):
                key = key.text
            if key not in qnames:
                add_qname(key)
            if isinstance(value, QName) and value.text not in qnames:
                add_qname(value.text)
        text = elem.text
        if isinstance(text, QName) and text.text not in qnames:
            add_qname(text.text)
    return qnames, namespaces

def _serialize_xml(write, elem, qnames, namespaces,
                   short_empty_elements, **kwargs):
    tag = elem.tag
    text = elem.text
    if tag is Comment:
        write("<!--%s-->" % text)
    elif tag is ProcessingInstruction:
        write("<?%s?>" % text)
    else:
        tag = qnames[tag]
        if tag is None:
            if text:
                write(_escape_cdata(text))
            for e in elem:
                _serialize_xml(write, e, qnames, None,
                               short_empty_elements=short_empty_elements)
        else:
            write("<" + tag)
            items = list(elem.items())
            if items or namespaces:
                if namespaces:
                    for v, k in sorted(namespaces.items(),
                                       key=lambda x: x[1]):  # sort on prefix
                        if k:
                            k = ":" + k
                        write(" xmlns%s=\"%s\"" % (
                            k,
                            _escape_attrib(v)
                            ))
                for k, v in items:
                    if isinstance(k, QName):
                        k = k.text
                    if isinstance(v, QName):
                        v = qnames[v.text]
                    else:
                        v = _escape_attrib(v)
                    write(" %s=\"%s\"" % (qnames[k], v))
            if text or len(elem) or not short_empty_elements:
                write(">")
                if text:
                    write(_escape_cdata(text))
                for e in elem:
                    _serialize_xml(write, e, qnames, None,
                                   short_empty_elements=short_empty_elements)
                write("</" + tag + ">")
            else:
                write(" />")
    if elem.tail:
        write(_escape_cdata(elem.tail))

HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
              "img", "input", "isindex", "link", "meta", "param")

try:
    HTML_EMPTY = set(HTML_EMPTY)
except NameError:
    pass

def _serialize_html(write, elem, qnames, namespaces, **kwargs):
    tag = elem.tag
    text = elem.text
    if tag is Comment:
        write("<!--%s-->" % _escape_cdata(text))
    elif tag is ProcessingInstruction:
        write("<?%s?>" % _escape_cdata(text))
    else:
        tag = qnames[tag]
        if tag is None:
            if text:
                write(_escape_cdata(text))
            for e in elem:
                _serialize_html(write, e, qnames, None)
        else:
            write("<" + tag)
            items = list(elem.items())
            if items or namespaces:
                if namespaces:
                    for v, k in sorted(namespaces.items(),
                                       key=lambda x: x[1]):  # sort on prefix
                        if k:
                            k = ":" + k
                        write(" xmlns%s=\"%s\"" % (
                            k,
                            _escape_attrib(v)
                            ))
                for k, v in items:
                    if isinstance(k, QName):
                        k = k.text
                    if isinstance(v, QName):
                        v = qnames[v.text]
                    else:
                        v = _escape_attrib_html(v)
                    # FIXME: handle boolean attributes
                    write(" %s=\"%s\"" % (qnames[k], v))
            write(">")
            ltag = tag.lower()
            if text:
                if ltag == "script" or ltag == "style":
                    write(text)
                else:
                    write(_escape_cdata(text))
            for e in elem:
                _serialize_html(write, e, qnames, None)
            if ltag not in HTML_EMPTY:
                write("</" + tag + ">")
    if elem.tail:
        write(_escape_cdata(elem.tail))

def _serialize_text(write, elem):
    for part in elem.itertext():
        write(part)
    if elem.tail:
        write(elem.tail)

_serialize = {
    "xml": _serialize_xml,
    "html": _serialize_html,
    "text": _serialize_text,
# this optional method is imported at the end of the module
#   "c14n": _serialize_c14n,
}


def register_namespace(prefix, uri):
    """Register a namespace prefix.

    The registry is global, and any existing mapping for either the
    given prefix or the namespace URI will be removed.

    *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
    attributes in this namespace will be serialized with prefix if possible.

    ValueError is raised if prefix is reserved or is invalid.

    """
    if re.match(r"ns\d+$", prefix):
        raise ValueError("Prefix format reserved for internal use")
    for k, v in list(_namespace_map.items()):
        if k == uri or v == prefix:
            del _namespace_map[k]
    _namespace_map[uri] = prefix

_namespace_map = {
    # "well-known" namespace prefixes
    "http://www.w3.org/XML/1998/namespace": "xml",
    "http://www.w3.org/1999/xhtml": "html",
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
    "http://schemas.xmlsoap.org/wsdl/": "wsdl",
    # xml schema
    "http://www.w3.org/2001/XMLSchema": "xs",
    "http://www.w3.org/2001/XMLSchema-instance": "xsi",
    # dublin core
    "http://purl.org/dc/elements/1.1/": "dc",
}
# For tests and troubleshooting
register_namespace._namespace_map = _namespace_map

def _raise_serialization_error(text):
    raise TypeError(
        "cannot serialize %r (type %s)" % (text, type(text).__name__)
        )

def _escape_cdata(text):
    # escape character data
    try:
        # it's worth avoiding do-nothing calls for strings that are
        # shorter than 500 characters, or so.  assume that's, by far,
        # the most common case in most applications.
        if "&" in text:
            text = text.replace("&", "&amp;")
        if "<" in text:
            text = text.replace("<", "&lt;")
        if ">" in text:
            text = text.replace(">", "&gt;")
        return text
    except (TypeError, AttributeError):
        _raise_serialization_error(text)

def _escape_attrib(text):
    # escape attribute value
    try:
        if "&" in text:
            text = text.replace("&", "&amp;")
        if "<" in text:
            text = text.replace("<", "&lt;")
        if ">" in text:
            text = text.replace(">", "&gt;")
        if "\"" in text:
            text = text.replace("\"", "&quot;")
        # The following business with carriage returns is to satisfy
        # Section 2.11 of the XML specification, stating that
        # CR or CR LN should be replaced with just LN
        # http://www.w3.org/TR/REC-xml/#sec-line-ends
        if "\r\n" in text:
            text = text.replace("\r\n", "\n")
        if "\r" in text:
            text = text.replace("\r", "\n")
        #The following four lines are issue 17582
        if "\n" in text:
            text = text.replace("\n", "&#10;")
        if "\t" in text:
            text = text.replace("\t", "&#09;")
        return text
    except (TypeError, AttributeError):
        _raise_serialization_error(text)

def _escape_attrib_html(text):
    # escape attribute value
    try:
        if "&" in text:
            text = text.replace("&", "&amp;")
        if ">" in text:
            text = text.replace(">", "&gt;")
        if "\"" in text:
            text = text.replace("\"", "&quot;")
        return text
    except (TypeError, AttributeError):
        _raise_serialization_error(text)

# --------------------------------------------------------------------

def tostring(element, encoding=None, method=None, *,
             xml_declaration=None, default_namespace=None,
             short_empty_elements=True):
    """Generate string representation of XML element.

    All subelements are included.  If encoding is "unicode", a string
    is returned. Otherwise a bytestring is returned.

    *element* is an Element instance, *encoding* is an optional output
    encoding defaulting to US-ASCII, *method* is an optional output which can
    be one of "xml" (default), "html", "text" or "c14n", *default_namespace*
    sets the default XML namespace (for "xmlns").

    Returns an (optionally) encoded string containing the XML data.

    """
    stream = io.StringIO() if encoding == 'unicode' else io.BytesIO()
    ElementTree(element).write(stream, encoding,
                               xml_declaration=xml_declaration,
                               default_namespace=default_namespace,
                               method=method,
                               short_empty_elements=short_empty_elements)
    return stream.getvalue()

class _ListDataStream(io.BufferedIOBase):
    """An auxiliary stream accumulating into a list reference."""
    def __init__(self, lst):
        self.lst = lst

    def writable(self):
        return True

    def seekable(self):
        return True

    def write(self, b):
        self.lst.append(b)

    def tell(self):
        return len(self.lst)

def tostringlist(element, encoding=None, method=None, *,
                 xml_declaration=None, default_namespace=None,
                 short_empty_elements=True):
    lst = []
    stream = _ListDataStream(lst)
    ElementTree(element).write(stream, encoding,
                               xml_declaration=xml_declaration,
                               default_namespace=default_namespace,
                               method=method,
                               short_empty_elements=short_empty_elements)
    return lst


def dump(elem):
    """Write element tree or element structure to sys.stdout.

    This function should be used for debugging only.

    *elem* is either an ElementTree, or a single Element.  The exact output
    format is implementation dependent.  In this version, it's written as an
    ordinary XML file.

    """
    # debugging
    if not isinstance(elem, ElementTree):
        elem = ElementTree(elem)
    elem.write(sys.stdout, encoding="unicode")
    tail = elem.getroot().tail
    if not tail or tail[-1] != "\n":
        sys.stdout.write("\n")

# --------------------------------------------------------------------
# parsing


def parse(source, parser=None):
    """Parse XML document into element tree.

    *source* is a filename or file object containing XML data,
    *parser* is an optional parser instance defaulting to XMLParser.

    Return an ElementTree instance.

    """
    tree = ElementTree()
    tree.parse(source, parser)
    return tree


def iterparse(source, events=None, parser=None):
    """Incrementally parse XML document into ElementTree.

    This class also reports what's going on to the user based on the
    *events* it is initialized with.  The supported events are the strings
    "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
    detailed namespace information).  If *events* is omitted, only
    "end" events are reported.

    *source* is a filename or file object containing XML data, *events* is
    a list of events to report back, *parser* is an optional parser instance.

    Returns an iterator providing (event, elem) pairs.

    """
    # Use the internal, undocumented _parser argument for now; When the
    # parser argument of iterparse is removed, this can be killed.
    pullparser = XMLPullParser(events=events, _parser=parser)
    def iterator():
        try:
            while True:
                yield from pullparser.read_events()
                # load event buffer
                data = source.read(16 * 1024)
                if not data:
                    break
                pullparser.feed(data)
            root = pullparser._close_and_return_root()
            yield from pullparser.read_events()
            it.root = root
        finally:
            if close_source:
                source.close()

    class IterParseIterator(collections.abc.Iterator):
        __next__ = iterator().__next__
    it = IterParseIterator()
    it.root = None
    del iterator, IterParseIterator

    close_source = False
    if not hasattr(source, "read"):
        source = open(source, "rb")
        close_source = True

    return it


class XMLPullParser:

    def __init__(self, events=None, *, _parser=None):
        # The _parser argument is for internal use only and must not be relied
        # upon in user code. It will be removed in a future release.
        # See http://bugs.python.org/issue17741 for more details.

        self._events_queue = collections.deque()
        self._parser = _parser or XMLParser(target=TreeBuilder())
        # wire up the parser for event reporting
        if events is None:
            events = ("end",)
        self._parser._setevents(self._events_queue, events)

    def feed(self, data):
        """Feed encoded data to parser."""
        if self._parser is None:
            raise ValueError("feed() called after end of stream")
        if data:
            try:
                self._parser.feed(data)
            except SyntaxError as exc:
                self._events_queue.append(exc)

    def _close_and_return_root(self):
        # iterparse needs this to set its root attribute properly :(
        root = self._parser.close()
        self._parser = None
        return root

    def close(self):
        """Finish feeding data to parser.

        Unlike XMLParser, does not return the root element. Use
        read_events() to consume elements from XMLPullParser.
        """
        self._close_and_return_root()

    def read_events(self):
        """Return an iterator over currently available (event, elem) pairs.

        Events are consumed from the internal event queue as they are
        retrieved from the iterator.
        """
        events = self._events_queue
        while events:
            event = events.popleft()
            if isinstance(event, Exception):
                raise event
            else:
                yield event


def XML(text, parser=None):
    """Parse XML document from string constant.

    This function can be used to embed "XML Literals" in Python code.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    """
    if not parser:
        parser = XMLParser(target=TreeBuilder())
    parser.feed(text)
    return parser.close()


def XMLID(text, parser=None):
    """Parse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    """
    if not parser:
        parser = XMLParser(target=TreeBuilder())
    parser.feed(text)
    tree = parser.close()
    ids = {}
    for elem in tree.iter():
        id = elem.get("id")
        if id:
            ids[id] = elem
    return tree, ids

# Parse XML document from string constant.  Alias for XML().
fromstring = XML

def fromstringlist(sequence, parser=None):
    """Parse XML document from sequence of string fragments.

    *sequence* is a list of other sequence, *parser* is an optional parser
    instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    """
    if not parser:
        parser = XMLParser(target=TreeBuilder())
    for text in sequence:
        parser.feed(text)
    return parser.close()

# --------------------------------------------------------------------


class TreeBuilder:
    """Generic element structure builder.

    This builder converts a sequence of start, data, and end method
    calls to a well-formed element structure.

    You can use this class to build an element structure using a custom XML
    parser, or a parser for some other XML-like format.

    *element_factory* is an optional element factory which is called
    to create new Element instances, as necessary.

    *comment_factory* is a factory to create comments to be used instead of
    the standard factory.  If *insert_comments* is false (the default),
    comments will not be inserted into the tree.

    *pi_factory* is a factory to create processing instructions to be used
    instead of the standard factory.  If *insert_pis* is false (the default),
    processing instructions will not be inserted into the tree.
    """
    def __init__(self, element_factory=None, *,
                 comment_factory=None, pi_factory=None,
                 insert_comments=False, insert_pis=False):
        self._data = [] # data collector
        self._elem = [] # element stack
        self._last = None # last element
        self._root = None # root element
        self._tail = None # true if we're after an end tag
        if comment_factory is None:
            comment_factory = Comment
        self._comment_factory = comment_factory
        self.insert_comments = insert_comments
        if pi_factory is None:
            pi_factory = ProcessingInstruction
        self._pi_factory = pi_factory
        self.insert_pis = insert_pis
        if element_factory is None:
            element_factory = Element
        self._factory = element_factory

    def close(self):
        """Flush builder buffers and return toplevel document Element."""
        assert len(self._elem) == 0, "missing end tags"
        assert self._root is not None, "missing toplevel element"
        return self._root

    def _flush(self):
        if self._data:
            if self._last is not None:
                text = "".join(self._data)
                if self._tail:
                    assert self._last.tail is None, "internal error (tail)"
                    self._last.tail = text
                else:
                    assert self._last.text is None, "internal error (text)"
                    self._last.text = text
            self._data = []

    def data(self, data):
        """Add text to current element."""
        self._data.append(data)

    def start(self, tag, attrs):
        """Open new element and return it.

        *tag* is the element name, *attrs* is a dict containing element
        attributes.

        """
        self._flush()
        self._last = elem = self._factory(tag, attrs)
        if self._elem:
            self._elem[-1].append(elem)
        elif self._root is None:
            self._root = elem
        self._elem.append(elem)
        self._tail = 0
        return elem

    def end(self, tag):
        """Close and return current Element.

        *tag* is the element name.

        """
        self._flush()
        self._last = self._elem.pop()
        assert self._last.tag == tag,\
               "end tag mismatch (expected %s, got %s)" % (
                   self._last.tag, tag)
        self._tail = 1
        return self._last

    def comment(self, text):
        """Create a comment using the comment_factory.

        *text* is the text of the comment.
        """
        return self._handle_single(
            self._comment_factory, self.insert_comments, text)

    def pi(self, target, text=None):
        """Create a processing instruction using the pi_factory.

        *target* is the target name of the processing instruction.
        *text* is the data of the processing instruction, or ''.
        """
        return self._handle_single(
            self._pi_factory, self.insert_pis, target, text)

    def _handle_single(self, factory, insert, *args):
        elem = factory(*args)
        if insert:
            self._flush()
            self._last = elem
            if self._elem:
                self._elem[-1].append(elem)
            self._tail = 1
        return elem


# also see ElementTree and TreeBuilder
class XMLParser:
    """Element structure builder for XML source data based on the expat parser.

    *target* is an optional target object which defaults to an instance of the
    standard TreeBuilder class, *encoding* is an optional encoding string
    which if given, overrides the encoding specified in the XML file:
    http://www.iana.org/assignments/character-sets

    """

    def __init__(self, *, target=None, encoding=None):
        try:
            from xml.parsers import expat
        except ImportError:
            try:
                import pyexpat as expat
            except ImportError:
                raise ImportError(
                    "No module named expat; use SimpleXMLTreeBuilder instead"
                    )
        parser = expat.ParserCreate(encoding, "}")
        if target is None:
            target = TreeBuilder()
        # underscored names are provided for compatibility only
        self.parser = self._parser = parser
        self.target = self._target = target
        self._error = expat.error
        self._names = {} # name memo cache
        # main callbacks
        parser.DefaultHandlerExpand = self._default
        if hasattr(target, 'start'):
            parser.StartElementHandler = self._start
        if hasattr(target, 'end'):
            parser.EndElementHandler = self._end
        if hasattr(target, 'start_ns'):
            parser.StartNamespaceDeclHandler = self._start_ns
        if hasattr(target, 'end_ns'):
            parser.EndNamespaceDeclHandler = self._end_ns
        if hasattr(target, 'data'):
            parser.CharacterDataHandler = target.data
        # miscellaneous callbacks
        if hasattr(target, 'comment'):
            parser.CommentHandler = target.comment
        if hasattr(target, 'pi'):
            parser.ProcessingInstructionHandler = target.pi
        # Configure pyexpat: buffering, new-style attribute handling.
        parser.buffer_text = 1
        parser.ordered_attributes = 1
        parser.specified_attributes = 1
        self._doctype = None
        self.entity = {}
        try:
            self.version = "Expat %d.%d.%d" % expat.version_info
        except AttributeError:
            pass # unknown

    def _setevents(self, events_queue, events_to_report):
        # Internal API for XMLPullParser
        # events_to_report: a list of events to report during parsing (same as
        # the *events* of XMLPullParser's constructor.
        # events_queue: a list of actual parsing events that will be populated
        # by the underlying parser.
        #
        parser = self._parser
        append = events_queue.append
        for event_name in events_to_report:
            if event_name == "start":
                parser.ordered_attributes = 1
                parser.specified_attributes = 1
                def handler(tag, attrib_in, event=event_name, append=append,
                            start=self._start):
                    append((event, start(tag, attrib_in)))
                parser.StartElementHandler = handler
            elif event_name == "end":
                def handler(tag, event=event_name, append=append,
                            end=self._end):
                    append((event, end(tag)))
                parser.EndElementHandler = handler
            elif event_name == "start-ns":
                # TreeBuilder does not implement .start_ns()
                if hasattr(self.target, "start_ns"):
                    def handler(prefix, uri, event=event_name, append=append,
                                start_ns=self._start_ns):
                        append((event, start_ns(prefix, uri)))
                else:
                    def handler(prefix, uri, event=event_name, append=append):
                        append((event, (prefix or '', uri or '')))
                parser.StartNamespaceDeclHandler = handler
            elif event_name == "end-ns":
                # TreeBuilder does not implement .end_ns()
                if hasattr(self.target, "end_ns"):
                    def handler(prefix, event=event_name, append=append,
                                end_ns=self._end_ns):
                        append((event, end_ns(prefix)))
                else:
                    def handler(prefix, event=event_name, append=append):
                        append((event, None))
                parser.EndNamespaceDeclHandler = handler
            elif event_name == 'comment':
                def handler(text, event=event_name, append=append, self=self):
                    append((event, self.target.comment(text)))
                parser.CommentHandler = handler
            elif event_name == 'pi':
                def handler(pi_target, data, event=event_name, append=append,
                            self=self):
                    append((event, self.target.pi(pi_target, data)))
                parser.ProcessingInstructionHandler = handler
            else:
                raise ValueError("unknown event %r" % event_name)

    def _raiseerror(self, value):
        err = ParseError(value)
        err.code = value.code
        err.position = value.lineno, value.offset
        raise err

    def _fixname(self, key):
        # expand qname, and convert name string to ascii, if possible
        try:
            name = self._names[key]
        except KeyError:
            name = key
            if "}" in name:
                name = "{" + name
            self._names[key] = name
        return name

    def _start_ns(self, prefix, uri):
        return self.target.start_ns(prefix or '', uri or '')

    def _end_ns(self, prefix):
        return self.target.end_ns(prefix or '')

    def _start(self, tag, attr_list):
        # Handler for expat's StartElementHandler. Since ordered_attributes
        # is set, the attributes are reported as a list of alternating
        # attribute name,value.
        fixname = self._fixname
        tag = fixname(tag)
        attrib = {}
        if attr_list:
            for i in range(0, len(attr_list), 2):
                attrib[fixname(attr_list[i])] = attr_list[i+1]
        return self.target.start(tag, attrib)

    def _end(self, tag):
        return self.target.end(self._fixname(tag))

    def _default(self, text):
        prefix = text[:1]
        if prefix == "&":
            # deal with undefined entities
            try:
                data_handler = self.target.data
            except AttributeError:
                return
            try:
                data_handler(self.entity[text[1:-1]])
            except KeyError:
                from xml.parsers import expat
                err = expat.error(
                    "undefined entity %s: line %d, column %d" %
                    (text, self.parser.ErrorLineNumber,
                    self.parser.ErrorColumnNumber)
                    )
                err.code = 11 # XML_ERROR_UNDEFINED_ENTITY
                err.lineno = self.parser.ErrorLineNumber
                err.offset = self.parser.ErrorColumnNumber
                raise err
        elif prefix == "<" and text[:9] == "<!DOCTYPE":
            self._doctype = [] # inside a doctype declaration
        elif self._doctype is not None:
            # parse doctype contents
            if prefix == ">":
                self._doctype = None
                return
            text = text.strip()
            if not text:
                return
            self._doctype.append(text)
            n = len(self._doctype)
            if n > 2:
                type = self._doctype[1]
                if type == "PUBLIC" and n == 4:
                    name, type, pubid, system = self._doctype
                    if pubid:
                        pubid = pubid[1:-1]
                elif type == "SYSTEM" and n == 3:
                    name, type, system = self._doctype
                    pubid = None
                else:
                    return
                if hasattr(self.target, "doctype"):
                    self.target.doctype(name, pubid, system[1:-1])
                elif hasattr(self, "doctype"):
                    warnings.warn(
                        "The doctype() method of XMLParser is ignored.  "
                        "Define doctype() method on the TreeBuilder target.",
                        RuntimeWarning)

                self._doctype = None

    def feed(self, data):
        """Feed encoded data to parser."""
        try:
            self.parser.Parse(data, 0)
        except self._error as v:
            self._raiseerror(v)

    def close(self):
        """Finish feeding data to parser and return element structure."""
        try:
            self.parser.Parse("", 1) # end of data
        except self._error as v:
            self._raiseerror(v)
        try:
            close_handler = self.target.close
        except AttributeError:
            pass
        else:
            return close_handler()
        finally:
            # get rid of circular references
            del self.parser, self._parser
            del self.target, self._target


# --------------------------------------------------------------------
# C14N 2.0

def canonicalize(xml_data=None, *, out=None, from_file=None, **options):
    """Convert XML to its C14N 2.0 serialised form.

    If *out* is provided, it must be a file or file-like object that receives
    the serialised canonical XML output (text, not bytes) through its ``.write()``
    method.  To write to a file, open it in text mode with encoding "utf-8".
    If *out* is not provided, this function returns the output as text string.

    Either *xml_data* (an XML string) or *from_file* (a file path or
    file-like object) must be provided as input.

    The configuration options are the same as for the ``C14NWriterTarget``.
    """
    if xml_data is None and from_file is None:
        raise ValueError("Either 'xml_data' or 'from_file' must be provided as input")
    sio = None
    if out is None:
        sio = out = io.StringIO()

    parser = XMLParser(target=C14NWriterTarget(out.write, **options))

    if xml_data is not None:
        parser.feed(xml_data)
        parser.close()
    elif from_file is not None:
        parse(from_file, parser=parser)

    return sio.getvalue() if sio is not None else None


_looks_like_prefix_name = re.compile(r'^\w+:\w+$', re.UNICODE).match


class C14NWriterTarget:
    """
    Canonicalization writer target for the XMLParser.

    Serialises parse events to XML C14N 2.0.

    The *write* function is used for writing out the resulting data stream
    as text (not bytes).  To write to a file, open it in text mode with encoding
    "utf-8" and pass its ``.write`` method.

    Configuration options:

    - *with_comments*: set to true to include comments
    - *strip_text*: set to true to strip whitespace before and after text content
    - *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
    - *qname_aware_tags*: a set of qname aware tag names in which prefixes
                          should be replaced in text content
    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes
                           should be replaced in text content
    - *exclude_attrs*: a set of attribute names that should not be serialised
    - *exclude_tags*: a set of tag names that should not be serialised
    """
    def __init__(self, write, *,
                 with_comments=False, strip_text=False, rewrite_prefixes=False,
                 qname_aware_tags=None, qname_aware_attrs=None,
                 exclude_attrs=None, exclude_tags=None):
        self._write = write
        self._data = []
        self._with_comments = with_comments
        self._strip_text = strip_text
        self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None
        self._exclude_tags = set(exclude_tags) if exclude_tags else None

        self._rewrite_prefixes = rewrite_prefixes
        if qname_aware_tags:
            self._qname_aware_tags = set(qname_aware_tags)
        else:
            self._qname_aware_tags = None
        if qname_aware_attrs:
            self._find_qname_aware_attrs = set(qname_aware_attrs).intersection
        else:
            self._find_qname_aware_attrs = None

        # Stack with globally and newly declared namespaces as (uri, prefix) pairs.
        self._declared_ns_stack = [[
            ("http://www.w3.org/XML/1998/namespace", "xml"),
        ]]
        # Stack with user declared namespace prefixes as (uri, prefix) pairs.
        self._ns_stack = []
        if not rewrite_prefixes:
            self._ns_stack.append(list(_namespace_map.items()))
        self._ns_stack.append([])
        self._prefix_map = {}
        self._preserve_space = [False]
        self._pending_start = None
        self._root_seen = False
        self._root_done = False
        self._ignored_depth = 0

    def _iter_namespaces(self, ns_stack, _reversed=reversed):
        for namespaces in _reversed(ns_stack):
            if namespaces:  # almost no element declares new namespaces
                yield from namespaces

    def _resolve_prefix_name(self, prefixed_name):
        prefix, name = prefixed_name.split(':', 1)
        for uri, p in self._iter_namespaces(self._ns_stack):
            if p == prefix:
                return f'{{{uri}}}{name}'
        raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope')

    def _qname(self, qname, uri=None):
        if uri is None:
            uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname)
        else:
            tag = qname

        prefixes_seen = set()
        for u, prefix in self._iter_namespaces(self._declared_ns_stack):
            if u == uri and prefix not in prefixes_seen:
                return f'{prefix}:{tag}' if prefix else tag, tag, uri
            prefixes_seen.add(prefix)

        # Not declared yet => add new declaration.
        if self._rewrite_prefixes:
            if uri in self._prefix_map:
                prefix = self._prefix_map[uri]
            else:
                prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}'
            self._declared_ns_stack[-1].append((uri, prefix))
            return f'{prefix}:{tag}', tag, uri

        if not uri and '' not in prefixes_seen:
            # No default namespace declared => no prefix needed.
            return tag, tag, uri

        for u, prefix in self._iter_namespaces(self._ns_stack):
            if u == uri:
                self._declared_ns_stack[-1].append((uri, prefix))
                return f'{prefix}:{tag}' if prefix else tag, tag, uri

        if not uri:
            # As soon as a default namespace is defined,
            # anything that has no namespace (and thus, no prefix) goes there.
            return tag, tag, uri

        raise ValueError(f'Namespace "{uri}" is not declared in scope')

    def data(self, data):
        if not self._ignored_depth:
            self._data.append(data)

    def _flush(self, _join_text=''.join):
        data = _join_text(self._data)
        del self._data[:]
        if self._strip_text and not self._preserve_space[-1]:
            data = data.strip()
        if self._pending_start is not None:
            args, self._pending_start = self._pending_start, None
            qname_text = data if data and _looks_like_prefix_name(data) else None
            self._start(*args, qname_text)
            if qname_text is not None:
                return
        if data and self._root_seen:
            self._write(_escape_cdata_c14n(data))

    def start_ns(self, prefix, uri):
        if self._ignored_depth:
            return
        # we may have to resolve qnames in text content
        if self._data:
            self._flush()
        self._ns_stack[-1].append((uri, prefix))

    def start(self, tag, attrs):
        if self._exclude_tags is not None and (
                self._ignored_depth or tag in self._exclude_tags):
            self._ignored_depth += 1
            return
        if self._data:
            self._flush()

        new_namespaces = []
        self._declared_ns_stack.append(new_namespaces)

        if self._qname_aware_tags is not None and tag in self._qname_aware_tags:
            # Need to parse text first to see if it requires a prefix declaration.
            self._pending_start = (tag, attrs, new_namespaces)
            return
        self._start(tag, attrs, new_namespaces)

    def _start(self, tag, attrs, new_namespaces, qname_text=None):
        if self._exclude_attrs is not None and attrs:
            attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs}

        qnames = {tag, *attrs}
        resolved_names = {}

        # Resolve prefixes in attribute and tag text.
        if qname_text is not None:
            qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text)
            qnames.add(qname)
        if self._find_qname_aware_attrs is not None and attrs:
            qattrs = self._find_qname_aware_attrs(attrs)
            if qattrs:
                for attr_name in qattrs:
                    value = attrs[attr_name]
                    if _looks_like_prefix_name(value):
                        qname = resolved_names[value] = self._resolve_prefix_name(value)
                        qnames.add(qname)
            else:
                qattrs = None
        else:
            qattrs = None

        # Assign prefixes in lexicographical order of used URIs.
        parse_qname = self._qname
        parsed_qnames = {n: parse_qname(n) for n in sorted(
            qnames, key=lambda n: n.split('}', 1))}

        # Write namespace declarations in prefix order ...
        if new_namespaces:
            attr_list = [
                ('xmlns:' + prefix if prefix else 'xmlns', uri)
                for uri, prefix in new_namespaces
            ]
            attr_list.sort()
        else:
            # almost always empty
            attr_list = []

        # ... followed by attributes in URI+name order
        if attrs:
            for k, v in sorted(attrs.items()):
                if qattrs is not None and k in qattrs and v in resolved_names:
                    v = parsed_qnames[resolved_names[v]][0]
                attr_qname, attr_name, uri = parsed_qnames[k]
                # No prefix for attributes in default ('') namespace.
                attr_list.append((attr_qname if uri else attr_name, v))

        # Honour xml:space attributes.
        space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space')
        self._preserve_space.append(
            space_behaviour == 'preserve' if space_behaviour
            else self._preserve_space[-1])

        # Write the tag.
        write = self._write
        write('<' + parsed_qnames[tag][0])
        if attr_list:
            write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list]))
        write('>')

        # Write the resolved qname text content.
        if qname_text is not None:
            write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0]))

        self._root_seen = True
        self._ns_stack.append([])

    def end(self, tag):
        if self._ignored_depth:
            self._ignored_depth -= 1
            return
        if self._data:
            self._flush()
        self._write(f'</{self._qname(tag)[0]}>')
        self._preserve_space.pop()
        self._root_done = len(self._preserve_space) == 1
        self._declared_ns_stack.pop()
        self._ns_stack.pop()

    def comment(self, text):
        if not self._with_comments:
            return
        if self._ignored_depth:
            return
        if self._root_done:
            self._write('\n')
        elif self._root_seen and self._data:
            self._flush()
        self._write(f'<!--{_escape_cdata_c14n(text)}-->')
        if not self._root_seen:
            self._write('\n')

    def pi(self, target, data):
        if self._ignored_depth:
            return
        if self._root_done:
            self._write('\n')
        elif self._root_seen and self._data:
            self._flush()
        self._write(
            f'<?{target} {_escape_cdata_c14n(data)}?>' if data else f'<?{target}?>')
        if not self._root_seen:
            self._write('\n')


def _escape_cdata_c14n(text):
    # escape character data
    try:
        # it's worth avoiding do-nothing calls for strings that are
        # shorter than 500 character, or so.  assume that's, by far,
        # the most common case in most applications.
        if '&' in text:
            text = text.replace('&', '&amp;')
        if '<' in text:
            text = text.replace('<', '&lt;')
        if '>' in text:
            text = text.replace('>', '&gt;')
        if '\r' in text:
            text = text.replace('\r', '&#xD;')
        return text
    except (TypeError, AttributeError):
        _raise_serialization_error(text)


def _escape_attrib_c14n(text):
    # escape attribute value
    try:
        if '&' in text:
            text = text.replace('&', '&amp;')
        if '<' in text:
            text = text.replace('<', '&lt;')
        if '"' in text:
            text = text.replace('"', '&quot;')
        if '\t' in text:
            text = text.replace('\t', '&#x9;')
        if '\n' in text:
            text = text.replace('\n', '&#xA;')
        if '\r' in text:
            text = text.replace('\r', '&#xD;')
        return text
    except (TypeError, AttributeError):
        _raise_serialization_error(text)


# --------------------------------------------------------------------

# Import the C accelerators
try:
    # Element is going to be shadowed by the C implementation. We need to keep
    # the Python version of it accessible for some "creative" by external code
    # (see tests)
    _Element_Py = Element

    # Element, SubElement, ParseError, TreeBuilder, XMLParser, _set_factories
    from _elementtree import *
    from _elementtree import _set_factories
except ImportError:
    pass
else:
    _set_factories(Comment, ProcessingInstruction)
PK��Zn=mE��,__pycache__/ElementTree.cpython-38.opt-1.pycnu�[���U

e5d��@s�dZddddddddd	d
ddd
ddddddddddddgZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZGdd
�d
e�Z
d d�ZGd!d�d�Zifd"d�Zd]d#d�Zd^d$d�ZeZGd%d
�d
�ZGd&d�d�Ze	jd'd(��Zd_d)d*�Zd+d,�Zd-Zzee�ZWnek
�r.YnXd.d/�Zd0d1�Zeeed2�Zd3d�Z d4d5d6d7d8d9d:d;�Z!e!e _!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%d`dddDdE�dFd�Z&GdGdH�dHej'�Z(dadddDdE�dId�Z)dJd�Z*dbdKd	�Z+dcdLd�Z,GdMd�d�Z-dddNd�Z.dedOd�Z/e.Z0dfdPd�Z1GdQd�d�Z2GdRd�d�Z3dgdddS�dTd�Z4e�5dUej6�j7Z8GdVd�d�Z9dWdX�Z:dYdZ�Z;zeZ<dd[l=Tdd\l=m>Z>Wne?k
�r�YnXe>ee�dS)haLightweight XML support for Python.

 XML is an inherently hierarchical data format, and the most natural way to
 represent it is with a tree.  This module has two classes for this purpose:

    1. ElementTree represents the whole XML document as a tree and

    2. Element represents a single node in this tree.

 Interactions with the whole document (reading and writing to/from files) are
 usually done on the ElementTree level.  Interactions with a single XML element
 and its sub-elements are done on the Element level.

 Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:

    'tag' - a string containing the element's name.

    'attributes' - a Python dictionary storing the element's attributes.

    'text' - a string containing the element's text content.

    'tail' - an optional string containing text after the element's end tag.

    And a number of child elements stored in a Python sequence.

 To create an element instance, use the Element constructor,
 or the SubElement factory function.

 You can also use the ElementTree class to wrap an element structure
 and convert it to and from XML.

�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespace�canonicalize�C14NWriterTargetz1.3.0�N�)�ElementPathc@seZdZdZdS)r
z�An error when parsing an XML document.

    In addition to its exception value, a ParseError contains
    two extra attributes:
        'code'     - the specific exception code
        'position' - the line and column of the error

    N)�__name__�
__module__�__qualname__�__doc__�r!r!�-/usr/lib64/python3.8/xml/etree/ElementTree.pyr
jscCs
t|d�S)z2Return True if *element* appears to be an Element.�tag)�hasattr)�elementr!r!r"rxsc@s
eZdZdZdZdZdZdZifdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd9d!d"�Zd:d#d$�Zd;d%d&�Zd<d'd(�Zd)d*�Zd=d+d,�Zd-d.�Zd/d0�Zd1d2�Zd>d3d4�Z d?d5d6�Z!d7d8�Z"dS)@rahAn XML element.

    This class is the reference implementation of the Element interface.

    An element's length is its number of subelements.  That means if you
    want to check if an element is truly empty, you should check BOTH
    its length AND its text attribute.

    The element tag, attribute names, and attribute values can be either
    bytes or strings.

    *tag* is the element name.  *attrib* is an optional dictionary containing
    element attributes. *extra* are additional element attributes given as
    keyword arguments.

    Example form:
        <tag attrib>text<child/>...</tag>tail

    NcKs6t|t�std|jjf��||_||�|_g|_dS)Nzattrib must be dict, not %s)�
isinstance�dict�	TypeError�	__class__rr#�attrib�	_children)�selfr#r*�extrar!r!r"�__init__�s
�
zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r)rr#�id�r,r!r!r"�__repr__�szElement.__repr__cCs|�||�S)z�Create a new element with the same type.

        *tag* is a string containing the element name.
        *attrib* is a dictionary containing the element attributes.

        Do not call this method, use the SubElement factory function instead.

        )r))r,r#r*r!r!r"�makeelement�s	zElement.makeelementcCs0|�|j|j�}|j|_|j|_||dd�<|S)z�Return copy of current element.

        This creates a shallow copy. Subelements will be shared with the
        original tree.

        N)r2r#r*�text�tail)r,�elemr!r!r"�copy�s
zElement.copycCs
t|j�S�N)�lenr+r0r!r!r"�__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.���
stacklevelr)�warnings�warn�
FutureWarningr8r+r0r!r!r"�__bool__�s�zElement.__bool__cCs
|j|Sr7�r+�r,�indexr!r!r"�__getitem__�szElement.__getitem__cCs8t|t�r |D]}|�|�qn
|�|�||j|<dSr7)r&�slice�_assert_is_elementr+)r,rCr%Zeltr!r!r"�__setitem__�s


zElement.__setitem__cCs|j|=dSr7rArBr!r!r"�__delitem__�szElement.__delitem__cCs|�|�|j�|�dS)aAdd *subelement* to the end of this element.

        The new element will appear in document order after the last existing
        subelement (or directly after the text, if it's the first subelement),
        but before the end tag for this element.

        N�rFr+�append�r,�
subelementr!r!r"rJ�s
zElement.appendcCs$|D]}|�|�|j�|�qdS)zkAppend subelements from a sequence.

        *elements* is a sequence with zero or more elements.

        NrI)r,�elementsr%r!r!r"�extend�s
zElement.extendcCs|�|�|j�||�dS)z(Insert *subelement* at position *index*.N)rFr+�insert)r,rCrLr!r!r"rO�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r&�_Element_Pyr(�typer)r,�er!r!r"rF�s
zElement._assert_is_elementcCs|j�|�dS)a�Remove matching subelement.

        Unlike the find methods, this method compares elements based on
        identity, NOT ON tag value or contents.  To remove subelements by
        other means, the easiest way is to use a list comprehension to
        select what elements to keep, and then use slice assignment to update
        the parent element.

        ValueError is raised if a matching element could not be found.

        N)r+�removerKr!r!r"rSs
zElement.removecCstjdtdd�|jS)z`(Deprecated) Return all subelements.

        Elements are returned in document order.

        zaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r:r;)r=r>�DeprecationWarningr+r0r!r!r"�getchildrens�zElement.getchildrencCst�|||�S)aFind first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        )r�find�r,�path�
namespacesr!r!r"rV!s	zElement.findcCst�||||�S)a�Find text for first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *default* is the value to return if the element was not found,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return text content of first matching element, or default value if
        none was found.  Note that if an element is found having no text
        content, the empty string is returned.

        )r�findtext�r,rX�defaultrYr!r!r"rZ,szElement.findtextcCst�|||�S)aFind all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Returns list containing all matching elements in document order.

        )r�findallrWr!r!r"r]:s	zElement.findallcCst�|||�S)a Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        )r�iterfindrWr!r!r"r^Es	zElement.iterfindcCs |j��g|_d|_|_dS)z�Reset element.

        This function removes all subelements, clears all attributes, and sets
        the text and tail attributes to None.

        N)r*�clearr+r3r4r0r!r!r"r_Ps
z
Element.clearcCs|j�||�S)agGet element attribute.

        Equivalent to attrib.get, but some implementations may handle this a
        bit more efficiently.  *key* is what attribute to look for, and
        *default* is what to return if the attribute was not found.

        Returns a string containing the attribute value, or the default if
        attribute was not found.

        )r*�get)r,�keyr\r!r!r"r`[szElement.getcCs||j|<dS)z�Set element attribute.

        Equivalent to attrib[key] = value, but some implementations may handle
        this a bit more efficiently.  *key* is what attribute to set, and
        *value* is the attribute value to set it to.

        N)r*)r,ra�valuer!r!r"�sethszElement.setcCs
|j��S)z�Get list of attribute names.

        Names are returned in an arbitrary order, just like an ordinary
        Python dict.  Equivalent to attrib.keys()

        )r*�keysr0r!r!r"rdrszElement.keyscCs
|j��S)z�Get element attributes as a sequence.

        The attributes are returned in arbitrary order.  Equivalent to
        attrib.items().

        Return a list of (name, value) tuples.

        )r*�itemsr0r!r!r"re{s	z
Element.itemsccsD|dkrd}|dks|j|kr$|V|jD]}|�|�EdHq*dS)aCreate tree iterator.

        The iterator loops over the element and all subelements in document
        order, returning all elements with a matching tag.

        If the tree structure is modified during iteration, new or removed
        elements may or may not be included.  To get a stable set, use the
        list() function on the iterator, and loop over the resulting list.

        *tag* is what tags to look for (default is to return all elements)

        Return an iterator containing all the matching elements.

        �*N)r#r+�iter)r,r#rRr!r!r"rg�s
zElement.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r:r;�r=r>rT�listrg�r,r#r!r!r"�getiterator�s�zElement.getiteratorccsX|j}t|t�s|dk	rdS|j}|r,|V|D]"}|��EdH|j}|r0|Vq0dS)z�Create text iterator.

        The iterator loops over the element and all subelements in document
        order, returning all inner text.

        N)r#r&�strr3�itertextr4)r,r#�trRr!r!r"rm�szElement.itertext)N)NN)N)N)N)N)N)#rrrr r#r*r3r4r.r1r2r6r9r@rDrGrHrJrNrOrFrSrUrVrZr]r^r_r`rcrdrergrkrmr!r!r!r"r}s@	








	

cKs"||�}|�||�}|�|�|S)a�Subelement factory which creates an element instance, and appends it
    to an existing parent.

    The element tag, attribute names, and attribute values can be either
    bytes or Unicode strings.

    *parent* is the parent element, *tag* is the subelements name, *attrib* is
    an optional directory containing element attributes, *extra* are
    additional attributes given as keyword arguments.

    )r2rJ)�parentr#r*r-r%r!r!r"r�s
cCstt�}||_|S)z�Comment element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *text* is a string containing the comment string.

    )rrr3)r3r%r!r!r"r�s	cCs&tt�}||_|r"|jd||_|S)a*Processing Instruction element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *target* is a string containing the processing instruction, *text* is a
    string containing the processing instruction contents, if any.

    � )rrr3)�targetr3r%r!r!r"r�s

c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)r
a�Qualified name wrapper.

    This class can be used to wrap a QName attribute value in order to get
    proper namespace handing on output.

    *text_or_uri* is a string containing the QName value either in the form
    {uri}local, or if the tag argument is given, the URI part of a QName.

    *tag* is an optional argument which if given, will make the first
    argument (text_or_uri) be interpreted as a URI, and this argument (tag)
    be interpreted as a local name.

    NcCs|rd||f}||_dS)Nz{%s}%s�r3)r,Ztext_or_urir#r!r!r"r.�szQName.__init__cCs|jSr7rrr0r!r!r"�__str__�sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r)rr3r0r!r!r"r1szQName.__repr__cCs
t|j�Sr7)�hashr3r0r!r!r"�__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kSr7�r&r
r3�r,�otherr!r!r"�__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__lt__s
zQName.__lt__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__eq__s
zQName.__eq__)N)
rrrr r.rsr1ruryrzr{r|r}r!r!r!r"r
�s
c@s�eZdZdZddd�Zdd�Zdd�Zdd	d
�Zddd�Zd d
d�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�Z
d%dd�dd�Zdd�ZdS)&ra%An XML element hierarchy.

    This class also provides support for serialization to and from
    standard XML.

    *element* is an optional root element node,
    *file* is an optional file handle or file name of an XML file whose
    contents will be used to initialize the tree with.

    NcCs||_|r|�|�dSr7)�_rootr	)r,r%�filer!r!r"r.'szElementTree.__init__cCs|jS)z!Return root element of this tree.�r~r0r!r!r"�getroot-szElementTree.getrootcCs
||_dS)z�Replace root element of this tree.

        This will discard the current contents of the tree and replace it
        with the given element.  Use with care!

        Nr�)r,r%r!r!r"�_setroot1szElementTree._setrootcCs�d}t|d�st|d�}d}z^|dkrLt�}t|d�rL|�|�|_|jW�2S|�d�}|s\qh|�|�qL|��|_|jW�S|r�|��XdS)a=Load external XML document into element tree.

        *source* is a file name or file object, *parser* is an optional parser
        instance that defaults to XMLParser.

        ParseError is raised if the parser fails to parse the document.

        Returns the root element of the given source document.

        F�read�rbTN�_parse_wholei)r$�open�closerr�r~r��feed)r,�source�parser�close_source�datar!r!r"r	;s$






zElementTree.parsecCs|j�|�S)z�Create and return tree iterator for the root element.

        The iterator loops over all elements in this tree, in document order.

        *tag* is a string with the tag name to iterate over
        (default is to return all elements).

        )r~rgrjr!r!r"rg`s
zElementTree.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r:r;rhrjr!r!r"rkms�zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)a\Find first matching element by tag name or path.

        Same as getroot().find(path), which is Element.find()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nr�/�.��This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr:r;)r=r>r?r~rVrWr!r!r"rVus��zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|j�|||�S)aeFind first matching element by tag name or path.

        Same as getroot().findtext(path),  which is Element.findtext()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nrr�r�r�r:r;)r=r>r?r~rZr[r!r!r"rZ�s��zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)aaFind all matching subelements by tag name or path.

        Same as getroot().findall(path), which is Element.findall().

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return list containing all matching elements in document order.

        Nrr�r�r�r:r;)r=r>r?r~r]rWr!r!r"r]�s��zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)agFind all matching subelements by tag name or path.

        Same as getroot().iterfind(path), which is element.iterfind()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        Nrr�r�r�r:r;)r=r>r?r~r^rWr!r!r"r^�s��zElementTree.iterfindT��short_empty_elementsc	Cs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|��}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�d	dl}
|
��}	|d
|	f�|dkr�t||j�n,t|j|�\}}t|}
|
||j|||d�W5QRXdS)
a�Write element tree to a file as XML.

        Arguments:
          *file_or_filename* -- file name or a file object opened for writing

          *encoding* -- the output encoding (default: US-ASCII)

          *xml_declaration* -- bool indicating if an XML declaration should be
                               added to the output. If None, an XML declaration
                               is added if encoding IS NOT either of:
                               US-ASCII, UTF-8, or Unicode

          *default_namespace* -- sets the default XML namespace (for "xmlns")

          *method* -- either "xml" (default), "html, "text", or "c14n"

          *short_empty_elements* -- controls the formatting of elements
                                    that contain no content. If True (default)
                                    they are emitted as a single self-closed
                                    tag, otherwise they are emitted as a pair
                                    of start/end tags

        �xmlzunknown method %r�c14n�utf-8�us-asciiN)r�r��unicoder�rz$<?xml version='1.0' encoding='%s'?>
r3r�)	�
_serialize�
ValueError�lower�_get_writer�localeZgetpreferredencoding�_serialize_textr~�_namespaces)r,�file_or_filename�encoding�xml_declaration�default_namespace�methodr�Z	enc_lower�writeZdeclared_encodingr��qnamesrYZ	serializer!r!r"r��s:����zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,rr!r!r"�
write_c14nszElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr r.r�r�r	rgrkrVrZr]r^r�r�r!r!r!r"rs&



%





��:ccs"z
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVW5QRXYn�X|dkrl|Vn�t����}t|tj�r�|}nft|tj�r�t�	|�}|�
|j�nBt��}dd�|_||_z|j
|_
|j|_Wntk
r�YnXtj||ddd�}|�
|j�|jVW5QRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS�NTr!r!r!r!r"�<lambda>0�z_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorr��
contextlib�	ExitStackr&�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�r�stackr!r!r"r�sB
�


�r�csddi�i��rd��<���fdd�}|��D]�}|j}t|t�rZ|j�kr�||j�n<t|t�rv|�kr�||�n |dk	r�|tk	r�|tk	r�t|�|�	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�|j}t|t�r0|j�kr0||j�q0��fS)N�cs�z�|dd�dkr�|dd��dd�\}}��|�}|dkrjt�|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitr`�_namespace_mapr8r�r(�_raise_serialization_error)�qname�urir#�prefix�r�rYr�r!r"�	add_qnameMs(


�z_namespaces.<locals>.add_qname)
rgr#r&r
r3rlrrr�re)r5r�r�r#rarbr3r!r�r"r�Bs4




r�cKs�|j}|j}|tkr$|d|��nv|tkr<|d|��n^||}|dkr||r\|t|��|D]}t|||d|d�q`�n|d|�t|���}	|	s�|�r2|r�t|��dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�|	D]L\}}
t
|t�r�|j}t
|
t��r||
j}
nt	|
�}
|d
|||
f�q�|�sHt|��sH|�s�|d�|�rb|t|��|D]}t|||d|d��qf|d|d�n|d
�|j
�r�|t|j
��dS)N�	<!--%s-->�<?%s?>r��<cSs|dS�Nrr!��xr!r!r"r��r�z _serialize_xml.<locals>.<lambda>�ra�:�
 xmlns%s="%s"� %s="%s"�>�</z />)r#r3rr�
_escape_cdata�_serialize_xmlrire�sorted�_escape_attribr&r
r8r4)r�r5r�rYr��kwargsr#r3rRre�v�kr!r!r"r�s\
�
��


�
r�)
Zarea�baseZbasefont�br�col�frameZhrZimg�inputZisindex�link�metaZparamcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���nh||}|dkr�|rd|t|��|D]}t|||d�qh�n,|d|�t|���}|s�|�r8|r�t|��dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�|D]N\}
}	t
|
t��r|
j}
t
|	t��r||	j}	nt|	�}	|d	||
|	f�q�|d
�|�
�}|�rx|dk�sb|dk�rl||�n|t|��|D]}t|||d��q||tk�r�|d
|d
�|j�r�|t|j��dS)Nr�r�r�cSs|dSr�r!r�r!r!r"r��r�z!_serialize_html.<locals>.<lambda>r�r�r�r�r�ZscriptZstyler�)r#r3rr�r�_serialize_htmlrirer�r�r&r
�_escape_attrib_htmlr��
HTML_EMPTYr4)r�r5r�rYr�r#r3rRrer�r�Zltagr!r!r"r��sX
��


r�cCs*|��D]}||�q|jr&||j�dSr7)rmr4)r�r5�partr!r!r"r��s
r�)r��htmlr3cCsLt�d|�rtd��tt���D]\}}||ks8||kr t|=q |t|<dS)atRegister a namespace prefix.

    The registry is global, and any existing mapping for either the
    given prefix or the namespace URI will be removed.

    *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
    attributes in this namespace will be serialized with prefix if possible.

    ValueError is raised if prefix is reserved or is invalid.

    zns\d+$z'Prefix format reserved for internal useN)�re�matchr�rir�re)r�r�r�r�r!r!r"r�sr�r�ZrdfZwsdlZxsZxsiZdc)�$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r(rQrrrr!r!r"r�s�r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)N�&�&amp;r��&lt;r��&gt;��replacer(r�r�rrr!r!r"r�!sr�c	Cs�z�d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd
�}d
|kr�|�d
d�}d
|kr�|�d
d�}|WSttfk
r�t|�YnXdS)Nr�r�r�r�r�r��"�&quot;z
r��
z&#10;�	z&#09;r�rrr!r!r"r�1s(r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)Nr�r�r�r�r�r�r�rrr!r!r"r�Msr�T)r�r�r�cCs:|dkrt��nt��}t|�j||||||d�|��S)a
Generate string representation of XML element.

    All subelements are included.  If encoding is "unicode", a string
    is returned. Otherwise a bytestring is returned.

    *element* is an Element instance, *encoding* is an optional output
    encoding defaulting to US-ASCII, *method* is an optional output which can
    be one of "xml" (default), "html", "text" or "c14n", *default_namespace*
    sets the default XML namespace (for "xmlns").

    Returns an (optionally) encoded string containing the XML data.

    r��r�r�r�r�)r��StringIO�BytesIOrr��getvalue)r%r�r�r�r�r��streamr!r!r"r\s�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs
||_dSr7)�lst)r,r�r!r!r"r.vsz_ListDataStream.__init__cCsdSr�r!r0r!r!r"r�ysz_ListDataStream.writablecCsdSr�r!r0r!r!r"r�|sz_ListDataStream.seekablecCs|j�|�dSr7)r�rJ)r,�br!r!r"r�sz_ListDataStream.writecCs
t|j�Sr7)r8r�r0r!r!r"r��sz_ListDataStream.tellN)	rrrr r.r�r�r�r�r!r!r!r"r�tsr�cCs*g}t|�}t|�j||||||d�|S)Nr�)r�rr�)r%r�r�r�r�r�r�r�r!r!r"r�s�cCsLt|t�st|�}|jtjdd�|��j}|r<|ddkrHtj�d�dS)a#Write element tree or element structure to sys.stdout.

    This function should be used for debugging only.

    *elem* is either an ElementTree, or a single Element.  The exact output
    format is implementation dependent.  In this version, it's written as an
    ordinary XML file.

    r�)r����r�N)r&rr��sys�stdoutr�r4)r5r4r!r!r"r�s

cCst�}|�||�|S)z�Parse XML document into element tree.

    *source* is a filename or file object containing XML data,
    *parser* is an optional parser instance defaulting to XMLParser.

    Return an ElementTree instance.

    )rr	)r�r��treer!r!r"r	�s	csft||d������fdd��G�fdd�dtjj�}|��d�_�~d�t�d�sbt�d	��d
��S)aJIncrementally parse XML document into ElementTree.

    This class also reports what's going on to the user based on the
    *events* it is initialized with.  The supported events are the strings
    "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
    detailed namespace information).  If *events* is omitted, only
    "end" events are reported.

    *source* is a filename or file object containing XML data, *events* is
    a list of events to report back, *parser* is an optional parser instance.

    Returns an iterator providing (event, elem) pairs.

    )�events�_parserc3s^zJ���EdH��d�}|s q,��|�q���}���EdH|�_W5�rX���XdS)Ni@)r��read_eventsr�r��_close_and_return_root�root)r�r)r��it�
pullparserr�r!r"�iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r!)rr!r"�IterParseIterator�srNFr�r�T)r�collections�abc�Iteratorrr$r�)r�r�r�rr!)r�rrrr�r"r�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)rcCs<t��|_|ptt�d�|_|dkr(d}|j�|j|�dS)N�rq)�end)r	�deque�
_events_queuerrr�
_setevents)r,r�rr!r!r"r.�s

zXMLPullParser.__init__c
CsZ|jdkrtd��|rVz|j�|�Wn.tk
rT}z|j�|�W5d}~XYnXdS)�Feed encoded data to parser.Nz!feed() called after end of stream)rr�r��SyntaxErrorrrJ)r,r��excr!r!r"r��s
zXMLPullParser.feedcCs|j��}d|_|Sr7)rr�)r,rr!r!r"r�s
z$XMLPullParser._close_and_return_rootcCs|��dS)z�Finish feeding data to parser.

        Unlike XMLParser, does not return the root element. Use
        read_events() to consume elements from XMLPullParser.
        N)rr0r!r!r"r�szXMLPullParser.closeccs.|j}|r*|��}t|t�r"|�q|VqdS)z�Return an iterator over currently available (event, elem) pairs.

        Events are consumed from the internal event queue as they are
        retrieved from the iterator.
        N)r�popleftr&�	Exception)r,r��eventr!r!r"rs
zXMLPullParser.read_events)N)rrrr.r�rr�rr!r!r!r"r�s

cCs"|stt�d�}|�|�|��S)aParse XML document from string constant.

    This function can be used to embed "XML Literals" in Python code.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    r�rrr�r�)r3r�r!r!r"rs
cCsR|stt�d�}|�|�|��}i}|��D]}|�d�}|r.|||<q.||fS)aParse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    rr/)rrr�r�rgr`)r3r�r�Zidsr5r/r!r!r"r,s



cCs,|stt�d�}|D]}|�|�q|��S)z�Parse XML document from sequence of string fragments.

    *sequence* is a list of other sequence, *parser* is an optional parser
    instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    rr)Zsequencer�r3r!r!r"rDs
	c@sheZdZdZdddddd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
ddd�Zdd�ZdS)ra8Generic element structure builder.

    This builder converts a sequence of start, data, and end method
    calls to a well-formed element structure.

    You can use this class to build an element structure using a custom XML
    parser, or a parser for some other XML-like format.

    *element_factory* is an optional element factory which is called
    to create new Element instances, as necessary.

    *comment_factory* is a factory to create comments to be used instead of
    the standard factory.  If *insert_comments* is false (the default),
    comments will not be inserted into the tree.

    *pi_factory* is a factory to create processing instructions to be used
    instead of the standard factory.  If *insert_pis* is false (the default),
    processing instructions will not be inserted into the tree.
    NF)�comment_factory�
pi_factory�insert_comments�
insert_piscCsdg|_g|_d|_d|_d|_|dkr*t}||_||_|dkrBt}||_	||_
|dkrZt}||_dSr7)
�_data�_elem�_lastr~�_tailr�_comment_factoryrr�_pi_factoryrr�_factory)r,Zelement_factoryrrrrr!r!r"r.js zTreeBuilder.__init__cCs|jS)z;Flush builder buffers and return toplevel document Element.r�r0r!r!r"r�~szTreeBuilder.closecCs>|jr:|jdk	r4d�|j�}|jr,||j_n||j_g|_dS�Nr�)rr�joinrr4r3�r,r3r!r!r"�_flush�s

zTreeBuilder._flushcCs|j�|�dS)zAdd text to current element.N)rrJ�r,r�r!r!r"r��szTreeBuilder.datacCsX|��|�||�|_}|jr2|jd�|�n|jdkrB||_|j�|�d|_|S)z�Open new element and return it.

        *tag* is the element name, *attrs* is a dict containing element
        attributes.

        r�Nr)r&r"rrrJr~r)r,r#�attrsr5r!r!r"�start�s
zTreeBuilder.startcCs |��|j��|_d|_|jS)zOClose and return current Element.

        *tag* is the element name.

        r)r&r�poprrrjr!r!r"r
�szTreeBuilder.endcCs|�|j|j|�S)z`Create a comment using the comment_factory.

        *text* is the text of the comment.
        )�_handle_singler rr%r!r!r"�comment�s
�zTreeBuilder.commentcCs|�|j|j||�S)z�Create a processing instruction using the pi_factory.

        *target* is the target name of the processing instruction.
        *text* is the data of the processing instruction, or ''.
        )r+r!r)r,rqr3r!r!r"�pi�s�zTreeBuilder.picGs:||�}|r6|��||_|jr0|jd�|�d|_|S)Nr�r)r&rrrJr)r,�factoryrO�argsr5r!r!r"r+�szTreeBuilder._handle_single)N)N)
rrrr r.r�r&r�r)r
r,r-r+r!r!r!r"rVs�
	c@speZdZdZddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)raaElement structure builder for XML source data based on the expat parser.

    *target* is an optional target object which defaults to an instance of the
    standard TreeBuilder class, *encoding* is an optional encoding string
    which if given, overrides the encoding specified in the XML file:
    http://www.iana.org/assignments/character-sets

    N)rqr�cCsdzddlm}Wn>tk
rNzddl}Wntk
rHtd��YnXYnX|�|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_t|d
��r|j|_t|d��r|j|_d|_d|_d|_ d|_!i|_"zd
|j#|_$Wnt%k
�r^YnXdS)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r)r
�start_ns�end_nsr�r,r-rzExpat %d.%d.%d)&�xml.parsersr1�ImportErrorZpyexpatZParserCreaterr�rrq�_target�error�_error�_names�_defaultZDefaultHandlerExpandr$�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr�ZCharacterDataHandlerr,�CommentHandlerr-�ProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r,rqr�r1r�r!r!r"r.�sP�




zXMLParser.__init__cCs8|j}|j}|D�] }|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�t|j	d�r�|||j
fd	d�}n||fd
d�}||_q|dkr�t|j	d�r�|||jfd
d�}n||fdd�}||_
q|dk�r|||fdd�}||_q|dk�r&|||fdd�}||_qtd|��qdS)Nr)rcSs|||||�f�dSr7r!)r#Z	attrib_inrrJr)r!r!r"�handlersz%XMLParser._setevents.<locals>.handlerr
cSs||||�f�dSr7r!)r#rrJr
r!r!r"rKszstart-nsr2cSs|||||�f�dSr7r!)r�r�rrJr2r!r!r"rK!scSs|||p
d|pdff�dSr#r!)r�r�rrJr!r!r"rK%szend-nsr3cSs||||�f�dSr7r!)r�rrJr3r!r!r"rK+scSs||df�dSr7r!)r�rrJr!r!r"rK/sr,cSs|||j�|�f�dSr7)rqr,)r3rrJr,r!r!r"rK3sr-cSs|||j�||�f�dSr7)rqr-)Z	pi_targetr�rrJr,r!r!r"rK7szunknown event %r)rrJrErFr;r<r=r>r$rqr?r@rArBrCrDr�)r,Zevents_queueZevents_to_reportr�rJZ
event_namerKr!r!r"rsL
�
�
��

�
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dSr7)r
�code�lineno�offsetZposition)r,rb�errr!r!r"�_raiseerror>szXMLParser._raiseerrorcCsFz|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r9�KeyError)r,ra�namer!r!r"�_fixnameDszXMLParser._fixnamecCs|j�|pd|pd�Sr#)rqr2�r,r�r�r!r!r"r?OszXMLParser._start_nscCs|j�|pd�Sr#)rqr3)r,r�r!r!r"rARszXMLParser._end_nscCsR|j}||�}i}|rDtdt|�d�D]}||d||||�<q&|j�||�S)Nrr:r)rS�ranger8rqr))r,r#�	attr_listZfixnamer*�ir!r!r"r;UszXMLParser._startcCs|j�|�|��Sr7)rqr
rSrjr!r!r"r=aszXMLParser._endc	Cs�|dd�}|dkr�z|jj}Wntk
r6YdSXz||j|dd��WnZtk
r�ddlm}|�d||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�n"|dkr�|dd	�d
kr�g|_�n|jdk	�r�|dkr�d|_dS|��}|�sdS|j�|�t|j�}|dk�r�|jd}|d
k�rd|dk�rd|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|j�||	|
dd��nt|d��r�t�dt�d|_dS)Nrr�r�rr0z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r:ZPUBLIC�ZSYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)rqr�r�rHrQr4r1r7r�ZErrorLineNumberZErrorColumnNumberrLrMrNrG�striprJr8r$r\r=r>�RuntimeWarning)r,r3r�Zdata_handlerr1rO�nrQrRZpubid�systemr!r!r"r:dsd���





�zXMLParser._defaultc
CsFz|j�|d�Wn.|jk
r@}z|�|�W5d}~XYnXdS)rrN)r��Parser8rP)r,r�r�r!r!r"r��szXMLParser.feedc
Cs�z|j�dd�Wn.|jk
r@}z|�|�W5d}~XYnXz0z|jj}Wntk
rdYnX|�W�SW5|`|`|`|`XdS)z;Finish feeding data to parser and return element structure.r�rN)	r�rar8rPrrqr6r�r�)r,r�Z
close_handlerr!r!r"r��szXMLParser.close)rrrr r.rrPrSr?rAr;r=r:r�r�r!r!r!r"r�s	.66)�out�	from_filecKs�|dkr|dkrtd��d}|dkr0t��}}tt|jf|�d�}|dk	r`|�|�|��n|dk	rtt||d�|dk	r�|�	�SdS)a3Convert XML to its C14N 2.0 serialised form.

    If *out* is provided, it must be a file or file-like object that receives
    the serialised canonical XML output (text, not bytes) through its ``.write()``
    method.  To write to a file, open it in text mode with encoding "utf-8".
    If *out* is not provided, this function returns the output as text string.

    Either *xml_data* (an XML string) or *from_file* (a file path or
    file-like object) must be provided as input.

    The configuration options are the same as for the ``C14NWriterTarget``.
    Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r�)
r�r�r�rrr�r�r�r	r�)Zxml_datarbrcZoptionsZsior�r!r!r"r�s


z	^\w+:\w+$c@s�eZdZdZdddddddd�dd�Zefdd�Zd	d
�Zddd�Zd
d�Z	dj
fdd�Zdd�Zdd�Z
ddd�Zdd�Zdd�Zdd�ZdS) ra�
    Canonicalization writer target for the XMLParser.

    Serialises parse events to XML C14N 2.0.

    The *write* function is used for writing out the resulting data stream
    as text (not bytes).  To write to a file, open it in text mode with encoding
    "utf-8" and pass its ``.write`` method.

    Configuration options:

    - *with_comments*: set to true to include comments
    - *strip_text*: set to true to strip whitespace before and after text content
    - *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
    - *qname_aware_tags*: a set of qname aware tag names in which prefixes
                          should be replaced in text content
    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes
                           should be replaced in text content
    - *exclude_attrs*: a set of attribute names that should not be serialised
    - *exclude_tags*: a set of tag names that should not be serialised
    FN)�
with_comments�
strip_text�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�
exclude_attrs�exclude_tagsc	Cs�||_g|_||_||_|r$t|�nd|_|r6t|�nd|_||_|rRt|�|_nd|_|rjt|�j	|_
nd|_
dgg|_g|_|s�|j�
tt����|j�
g�i|_dg|_d|_d|_d|_d|_dS)N)r�r�Fr)�_writer�_with_comments�_strip_textrc�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackrJrir�re�_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r,r�rdrerfrgrhrirjr!r!r"r.�s2�zC14NWriterTarget.__init__ccs ||�D]}|r|EdHqdSr7r!)r,Zns_stackZ	_reversedrYr!r!r"�_iter_namespacessz!C14NWriterTarget._iter_namespacescCs\|�dd�\}}|�|j�D]$\}}||krd|�d|��Sqtd|�d|�d���dS)Nr�rr�r�zPrefix z of QName "�" is not declared in scope)�splitr|rur�)r,Z
prefixed_namer�rRr��pr!r!r"�_resolve_prefix_names
z%C14NWriterTarget._resolve_prefix_namecCs�|dkr:|dd�dkr,|dd��dd�nd|f\}}n|}t�}|�|j�D]B\}}||kr�||kr�|rz|�d|��n|||fS|�|�qP|jr�||jkr�|j|}ndt|j���}|j|<|jd�||f�|�d|��||fS|�sd|k�r|||fS|�|j	�D]J\}}||k�r|jd�||f�|�rR|�d|��n|||fS�q|�st|||fSt
d|�d	���dS)
Nrr�r�r�r�r_r�zNamespace "r})r�rcr|rt�addrprvr8rJrur�)r,r�r�r#Z
prefixes_seen�ur�r!r!r"�_qnames.2 


&
zC14NWriterTarget._qnamecCs|js|j�|�dSr7)r{rrJr'r!r!r"r�CszC14NWriterTarget.datar�cCs�||j�}|jdd�=|jr.|jds.|��}|jdk	rv|jd}|_|rVt|�rV|nd}|j||f��|dk	rvdS|r�|jr�|�t	|��dS�Nr�)
rrmrwr]rx�_looks_like_prefix_namer;ryrk�_escape_cdata_c14n)r,Z
_join_textr�r/�
qname_textr!r!r"r&Gs


zC14NWriterTarget._flushcCs0|jr
dS|jr|��|jd�||f�dSr�)r{rr&rurJrTr!r!r"r2Us
zC14NWriterTarget.start_nscCs�|jdk	r,|js||jkr,|jd7_dS|jr:|��g}|j�|�|jdk	rn||jkrn|||f|_dS|�|||�dSr�)	ror{rr&rtrJrqrxr;)r,r#r(�new_namespacesr!r!r"r)]s
��zC14NWriterTarget.startcs�jdk	r$|r$�fdd�|��D�}|h|�}i}|dk	rV��|�}||<|�|��jdk	r�|r���|�}|r�|D]0}	||	}
t|
�rv��|
�}||
<|�|�qvq�d}nd}�j��fdd�t|dd�d�D�}|r�dd�|D�}|��ng}|�rjt|���D]^\}
}|dk	�r@|
|k�r@||k�r@|||d	}||
\}}	}|�	|�r\|n|	|f��q
|�
d
�}�j�	|�r�|dkn�jd��j}|d
||d	�|�r�|d�
dd�|D���|d�|dk	�r�|t|||d	��d�_�j�	g�dS)Ncs i|]\}}|�jkr||�qSr!)rn��.0r�r�r0r!r"�
<dictcomp>ps
z+C14NWriterTarget._start.<locals>.<dictcomp>csi|]}|�|��qSr!r!)r�r_)�parse_qnamer!r"r��scSs|�dd�S)Nr�r)r~)r_r!r!r"r��r�z)C14NWriterTarget._start.<locals>.<lambda>r�cSs$g|]\}}|rd|nd|f�qS)zxmlns:Zxmlnsr!)r�r�r�r!r!r"�
<listcomp>�s�z+C14NWriterTarget._start.<locals>.<listcomp>rz+{http://www.w3.org/XML/1998/namespace}spaceZpreserver�r�r�cSs&g|]\}}d|�dt|��d��qS)rpz="r�)�_escape_attrib_c14nr�r!r!r"r��sr�T)rnrer�r�rsr�r�r��sortrJr`rwrkr$r�ryru)r,r#r(r�r�r�Zresolved_namesr�ZqattrsZ	attr_namerbZ
parsed_qnamesrVr�r�Z
attr_qnamer�Zspace_behaviourr�r!)r�r,r"r;ns`


�
�

�
zC14NWriterTarget._startcCst|jr|jd8_dS|jr&|��|�d|�|�d�d��|j��t|j�dk|_|j	��|j
��dS)Nrr�rr�)r{rr&rkr�rwr*r8rzrtrurjr!r!r"r
�s

zC14NWriterTarget.endcCsd|js
dS|jrdS|jr&|�d�n|jr:|jr:|��|�dt|��d��|js`|�d�dS)Nr�z<!--z-->)rlr{rzrkryrr&r�r%r!r!r"r,�szC14NWriterTarget.commentcCsp|jr
dS|jr|�d�n|jr0|jr0|��|�|rNd|�dt|��d�n
d|�d��|jsl|�d�dS)Nr�z<?rpz?>)r{rzrkryrr&r�)r,rqr�r!r!r"r-�s$�zC14NWriterTarget.pi)N)N)rrrr r.�reversedr|r�r�r�r$r&r2r)r;r
r,r-r!r!r!r"r�s(�%
%
E
c	Cs|zVd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}|WSttfk
rvt|�YnXdS)	Nr�r�r�r�r�r�r��&#xD;r�rrr!r!r"r��sr�c	Cs�z~d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd�}|WSttfk
r�t|�YnXdS)
Nr�r�r�r�r�r�r�z&#x9;r�z&#xA;r�r�r�rrr!r!r"r��s r�)rf)�_set_factories)N)N)N)NN)NN)N)NN)N)N)N)N)@r �__all__rr�r�r=r�r	Zcollections.abcr�r�rrr
rrrrrrr
r�contextmanagerr�r�r�r�rc�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrr�compile�UNICODEr�r�rr�r�rPZ_elementtreer�r5r!r!r!r"�<module>s�J�>

0s
3
=22�	�
��


05


zgPK��Z4��1�1�,__pycache__/ElementTree.cpython-38.opt-2.pycnu�[���U

e5d��@s�dddddddddd	d
ddd
dddddddddddgZdZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
Gdd	�d	e�Zdd�Z
Gd d�d�Zifd!d
�Zd\d"d�Zd]d#d�ZeZGd$d�d�ZGd%d�d�Zejd&d'��Zd^d(d)�Zd*d+�Zd,Zzee�ZWnek
�r*YnXd-d.�Zd/d0�Zeeed1�Zd2d�Zd3d4d5d6d7d8d9d:�Z e e_ d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$d_dddCdD�dEd�Z%GdFdG�dGej&�Z'd`dddCdD�dHd�Z(dId�Z)dadJd�Z*dbdKd�Z+GdLd�d�Z,dcdMd�Z-dddNd�Z.e-Z/dedOd�Z0GdPd�d�Z1GdQd�d�Z2dfdddR�dSd�Z3e�4dTej5�j6Z7GdUd�d�Z8dVdW�Z9dXdY�Z:zeZ;ddZl<Tdd[l<m=Z=Wne>k
�r�YnXe=ee�dS)g�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespace�canonicalize�C14NWriterTargetz1.3.0�N�)�ElementPathc@seZdZdS)r
N)�__name__�
__module__�__qualname__�r r �-/usr/lib64/python3.8/xml/etree/ElementTree.pyr
js	cCs
t|d�S)N�tag)�hasattr)�elementr r r!rxsc@seZdZdZdZdZdZifdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd8d d!�Zd9d"d#�Zd:d$d%�Zd;d&d'�Zd(d)�Zd<d*d+�Zd,d-�Zd.d/�Zd0d1�Zd=d2d3�Zd>d4d5�Z d6d7�Z!dS)?rNcKs6t|t�std|jjf��||_||�|_g|_dS)Nzattrib must be dict, not %s)�
isinstance�dict�	TypeError�	__class__rr"�attrib�	_children)�selfr"r)�extrar r r!�__init__�s
�
zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r(rr"�id�r+r r r!�__repr__�szElement.__repr__cCs|�||�S�N)r()r+r"r)r r r!�makeelement�s	zElement.makeelementcCs0|�|j|j�}|j|_|j|_||dd�<|Sr1)r2r"r)�text�tail)r+�elemr r r!�copy�s
zElement.copycCs
t|j�Sr1)�lenr*r/r r r!�__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.���
stacklevelr)�warnings�warn�
FutureWarningr7r*r/r r r!�__bool__�s�zElement.__bool__cCs
|j|Sr1�r*�r+�indexr r r!�__getitem__�szElement.__getitem__cCs8t|t�r |D]}|�|�qn
|�|�||j|<dSr1)r%�slice�_assert_is_elementr*)r+rBr$Zeltr r r!�__setitem__�s


zElement.__setitem__cCs|j|=dSr1r@rAr r r!�__delitem__�szElement.__delitem__cCs|�|�|j�|�dSr1�rEr*�append�r+�
subelementr r r!rI�s
zElement.appendcCs$|D]}|�|�|j�|�qdSr1rH)r+�elementsr$r r r!�extend�s
zElement.extendcCs|�|�|j�||�dSr1)rEr*�insert)r+rBrKr r r!rN�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r%�_Element_Pyr'�typer)r+�er r r!rE�s
zElement._assert_is_elementcCs|j�|�dSr1)r*�removerJr r r!rRs
zElement.removecCstjdtdd�|jS)NzaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r9r:)r<r=�DeprecationWarningr*r/r r r!�getchildrens�zElement.getchildrencCst�|||�Sr1)r�find�r+�path�
namespacesr r r!rU!s	zElement.findcCst�||||�Sr1)r�findtext�r+rW�defaultrXr r r!rY,szElement.findtextcCst�|||�Sr1)r�findallrVr r r!r\:s	zElement.findallcCst�|||�Sr1)r�iterfindrVr r r!r]Es	zElement.iterfindcCs |j��g|_d|_|_dSr1)r)�clearr*r3r4r/r r r!r^Ps
z
Element.clearcCs|j�||�Sr1)r)�get)r+�keyr[r r r!r_[szElement.getcCs||j|<dSr1)r))r+r`�valuer r r!�sethszElement.setcCs
|j��Sr1)r)�keysr/r r r!rcrszElement.keyscCs
|j��Sr1)r)�itemsr/r r r!rd{s	z
Element.itemsccsD|dkrd}|dks|j|kr$|V|jD]}|�|�EdHq*dS)N�*)r"r*�iter)r+r"rQr r r!rf�s
zElement.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r9r:�r<r=rS�listrf�r+r"r r r!�getiterator�s�zElement.getiteratorccsX|j}t|t�s|dk	rdS|j}|r,|V|D]"}|��EdH|j}|r0|Vq0dSr1)r"r%�strr3�itertextr4)r+r"�trQr r r!rl�szElement.itertext)N)NN)N)N)N)N)N)"rrrr"r)r3r4r-r0r2r6r8r?rCrFrGrIrMrNrErRrTrUrYr\r]r^r_rbrcrdrfrjrlr r r r!r}s>	








	

cKs"||�}|�||�}|�|�|Sr1)r2rI)�parentr"r)r,r$r r r!r�s
cCstt�}||_|Sr1)rrr3)r3r$r r r!r�s	cCs&tt�}||_|r"|jd||_|S)N� )rrr3)�targetr3r$r r r!r�s

c@sVeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r
NcCs|rd||f}||_dS)Nz{%s}%s�r3)r+Ztext_or_urir"r r r!r-�szQName.__init__cCs|jSr1rqr/r r r!�__str__�sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r(rr3r/r r r!r0szQName.__repr__cCs
t|j�Sr1)�hashr3r/r r r!�__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kSr1�r%r
r3�r+�otherr r r!�__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kSr1rurvr r r!�__lt__s
zQName.__lt__cCs t|t�r|j|jkS|j|kSr1rurvr r r!�__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kSr1rurvr r r!�__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kSr1rurvr r r!�__eq__s
zQName.__eq__)N)rrrr-rrr0rtrxryrzr{r|r r r r!r
�s
c@s�eZdZddd�Zdd�Zdd�Zddd	�Zdd
d�Zddd
�Zd dd�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�dd�Z
dd�ZdS)%rNcCs||_|r|�|�dSr1)�_rootr	)r+r$�filer r r!r-'szElementTree.__init__cCs|jSr1�r}r/r r r!�getroot-szElementTree.getrootcCs
||_dSr1r)r+r$r r r!�_setroot1szElementTree._setrootcCs�d}t|d�st|d�}d}z^|dkrLt�}t|d�rL|�|�|_|jW�2S|�d�}|s\qh|�|�qL|��|_|jW�S|r�|��XdS)NF�read�rbT�_parse_wholei)r#�open�closerr�r}r��feed)r+�source�parser�close_source�datar r r!r	;s$






zElementTree.parsecCs|j�|�Sr1)r}rfrir r r!rf`s
zElementTree.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r9r:rgrir r r!rjms�zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|j�||�S�Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr9r:)r<r=r>r}rUrVr r r!rUus��zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|j�|||�Sr�)r<r=r>r}rYrZr r r!rY�s��zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|j�||�Sr�)r<r=r>r}r\rVr r r!r\�s��zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|j�||�Sr�)r<r=r>r}r]rVr r r!r]�s��zElementTree.iterfindT��short_empty_elementsc	Cs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|��}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�ddl}
|
��}	|d	|	f�|d
kr�t||j�n,t|j|�\}}t|}
|
||j|||d�W5QRXdS)N�xmlzunknown method %r�c14n�utf-8�us-ascii)r�r��unicoder�rz$<?xml version='1.0' encoding='%s'?>
r3r�)	�
_serialize�
ValueError�lower�_get_writer�localeZgetpreferredencoding�_serialize_textr}�_namespaces)r+�file_or_filename�encoding�xml_declaration�default_namespace�methodr�Z	enc_lower�writeZdeclared_encodingr��qnamesrXZ	serializer r r!r��s:����zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r+r~r r r!�
write_c14nszElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr-r�r�r	rfrjrUrYr\r]r�r�r r r r!rs$


%





��:ccs"z
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVW5QRXYn�X|dkrl|Vn�t����}t|tj�r�|}nft|tj�r�t�	|�}|�
|j�nBt��}dd�|_||_z|j
|_
|j|_Wntk
r�YnXtj||ddd�}|�
|j�|jVW5QRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS�NTr r r r r!�<lambda>0�z_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorr��
contextlib�	ExitStackr%�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�r~�stackr r r!r�sB
�


�r�csddi�i��rd��<���fdd�}|��D]�}|j}t|t�rZ|j�kr�||j�n<t|t�rv|�kr�||�n |dk	r�|tk	r�|tk	r�t|�|�	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�|j}t|t�r0|j�kr0||j�q0��fS)N�cs�z�|dd�dkr�|dd��dd�\}}��|�}|dkrjt�|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitr_�_namespace_mapr7r�r'�_raise_serialization_error)�qname�urir"�prefix�r�rXr�r r!�	add_qnameMs(


�z_namespaces.<locals>.add_qname)
rfr"r%r
r3rkrrr�rd)r5r�r�r"r`rar3r r�r!r�Bs4




r�cKs�|j}|j}|tkr$|d|��nv|tkr<|d|��n^||}|dkr||r\|t|��|D]}t|||d|d�q`�n|d|�t|���}	|	s�|�r2|r�t|��dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�|	D]L\}}
t
|t�r�|j}t
|
t��r||
j}
nt	|
�}
|d
|||
f�q�|�sHt|��sH|�s�|d�|�rb|t|��|D]}t|||d|d��qf|d|d�n|d
�|j
�r�|t|j
��dS)N�	<!--%s-->�<?%s?>r��<cSs|dS�Nrr ��xr r r!r��r�z _serialize_xml.<locals>.<lambda>�r`�:�
 xmlns%s="%s"� %s="%s"�>�</z />)r"r3rr�
_escape_cdata�_serialize_xmlrhrd�sorted�_escape_attribr%r
r7r4)r�r5r�rXr��kwargsr"r3rQrd�v�kr r r!r�s\
�
��


�
r�)
Zarea�baseZbasefont�br�col�frameZhrZimg�inputZisindex�link�metaZparamcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���nh||}|dkr�|rd|t|��|D]}t|||d�qh�n,|d|�t|���}|s�|�r8|r�t|��dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�|D]N\}
}	t
|
t��r|
j}
t
|	t��r||	j}	nt|	�}	|d	||
|	f�q�|d
�|�
�}|�rx|dk�sb|dk�rl||�n|t|��|D]}t|||d��q||tk�r�|d
|d
�|j�r�|t|j��dS)Nr�r�r�cSs|dSr�r r�r r r!r��r�z!_serialize_html.<locals>.<lambda>r�r�r�r�r�ZscriptZstyler�)r"r3rr�r�_serialize_htmlrhrdr�r�r%r
�_escape_attrib_htmlr��
HTML_EMPTYr4)r�r5r�rXr�r"r3rQrdr�r�Zltagr r r!r��sX
��


r�cCs*|��D]}||�q|jr&||j�dSr1)rlr4)r�r5�partr r r!r��s
r�)r��htmlr3cCsLt�d|�rtd��tt���D]\}}||ks8||kr t|=q |t|<dS)Nzns\d+$z'Prefix format reserved for internal use)�re�matchr�rhr�rd)r�r�r�r�r r r!r�sr�r�ZrdfZwsdlZxsZxsiZdc)�$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r'rPrrqr r r!r�s�r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)N�&�&amp;r��&lt;r��&gt;��replacer'r�r�rqr r r!r�!sr�c	Cs�z�d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd
�}d
|kr�|�d
d�}d
|kr�|�d
d�}|WSttfk
r�t|�YnXdS)Nr�r�r�r�r�r��"�&quot;z
r��
z&#10;�	z&#09;r�rqr r r!r�1s(r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)Nr�r�r�r�r�r�r�rqr r r!r�Msr�T)r�r�r�cCs:|dkrt��nt��}t|�j||||||d�|��S)Nr��r�r�r�r�)r��StringIO�BytesIOrr��getvalue)r$r�r�r�r�r��streamr r r!r\s�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ListDataStreamcCs
||_dSr1)�lst)r+r�r r r!r-vsz_ListDataStream.__init__cCsdSr�r r/r r r!r�ysz_ListDataStream.writablecCsdSr�r r/r r r!r�|sz_ListDataStream.seekablecCs|j�|�dSr1)r�rI)r+�br r r!r�sz_ListDataStream.writecCs
t|j�Sr1)r7r�r/r r r!r��sz_ListDataStream.tellN)rrrr-r�r�r�r�r r r r!r�ts
r�cCs*g}t|�}t|�j||||||d�|S)Nr�)r�rr�)r$r�r�r�r�r�r�r�r r r!r�s�cCsLt|t�st|�}|jtjdd�|��j}|r<|ddkrHtj�d�dS)Nr�)r����r�)r%rr��sys�stdoutr�r4)r5r4r r r!r�s

cCst�}|�||�|Sr1)rr	)r�r��treer r r!r	�s	csft||d������fdd��G�fdd�dtjj�}|��d�_�~d�t�d�sbt�d��d	��S)
N)�events�_parserc3s^zJ���EdH��d�}|s q,��|�q���}���EdH|�_W5�rX���XdS)Ni@)r��read_eventsr�r��_close_and_return_root�root)r�r)r��it�
pullparserr�r r!�iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r )rr r!�IterParseIterator�srFr�r�T)r�collections�abc�Iteratorrr#r�)r�r�r�rr )r�rrrr�r!r�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)r�cCs<t��|_|ptt�d�|_|dkr(d}|j�|j|�dS)N�rp)�end)r�deque�
_events_queuerrr��
_setevents)r+r�r�r r r!r-�s

zXMLPullParser.__init__c
CsZ|jdkrtd��|rVz|j�|�Wn.tk
rT}z|j�|�W5d}~XYnXdS)Nz!feed() called after end of stream)r�r�r��SyntaxErrorrrI)r+r��excr r r!r��s
zXMLPullParser.feedcCs|j��}d|_|Sr1)r�r�)r+rr r r!r�s
z$XMLPullParser._close_and_return_rootcCs|��dSr1)rr/r r r!r�szXMLPullParser.closeccs.|j}|r*|��}t|t�r"|�q|VqdSr1)r�popleftr%�	Exception)r+r��eventr r r!rs
zXMLPullParser.read_events)N)rrrr-r�rr�rr r r r!r�s

cCs"|stt�d�}|�|�|��S�Nr�rrr�r�)r3r�r r r!rs
cCsR|stt�d�}|�|�|��}i}|��D]}|�d�}|r.|||<q.||fS)Nrr.)rrr�r�rfr_)r3r�r�Zidsr5r.r r r!r,s



cCs,|stt�d�}|D]}|�|�q|��Srr)Zsequencer�r3r r r!rDs
	c@sdeZdZdddddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	ddd�Z
dd�ZdS)rNF)�comment_factory�
pi_factory�insert_comments�
insert_piscCsdg|_g|_d|_d|_d|_|dkr*t}||_||_|dkrBt}||_	||_
|dkrZt}||_dSr1)
�_data�_elem�_lastr}�_tailr�_comment_factoryrr�_pi_factoryrr�_factory)r+Zelement_factoryrrrrr r r!r-js zTreeBuilder.__init__cCs|jSr1rr/r r r!r�~szTreeBuilder.closecCs>|jr:|jdk	r4d�|j�}|jr,||j_n||j_g|_dS�Nr�)rr�joinrr4r3�r+r3r r r!�_flush�s

zTreeBuilder._flushcCs|j�|�dSr1)rrI�r+r�r r r!r��szTreeBuilder.datacCsX|��|�||�|_}|jr2|jd�|�n|jdkrB||_|j�|�d|_|S)Nr�r)r%r!rrrIr}r)r+r"�attrsr5r r r!�start�s
zTreeBuilder.startcCs |��|j��|_d|_|jSr�)r%r�poprrrir r r!r�szTreeBuilder.endcCs|�|j|j|�Sr1)�_handle_singlerrr$r r r!�comment�s
�zTreeBuilder.commentcCs|�|j|j||�Sr1)r*r r)r+rpr3r r r!�pi�s�zTreeBuilder.picGs:||�}|r6|��||_|jr0|jd�|�d|_|S)Nr�r)r%rrrIr)r+�factoryrN�argsr5r r r!r*�szTreeBuilder._handle_single)N)N)rrrr-r�r%r�r(rr+r,r*r r r r!rVs�
	c@sleZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)rN)rpr�cCsdzddlm}Wn>tk
rNzddl}Wntk
rHtd��YnXYnX|�|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_t|d
��r|j|_t|d��r|j|_d|_d|_d|_ d|_!i|_"zd
|j#|_$Wnt%k
�r^YnXdS)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r(r�start_ns�end_nsr�r+r,rzExpat %d.%d.%d)&�xml.parsersr0�ImportErrorZpyexpatZParserCreaterr�r�rp�_target�error�_error�_names�_defaultZDefaultHandlerExpandr#�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr�ZCharacterDataHandlerr+�CommentHandlerr,�ProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r+rpr�r0r�r r r!r-�sP�




zXMLParser.__init__cCs8|j}|j}|D�] }|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�t|j	d�r�|||j
fd	d�}n||fd
d�}||_q|dkr�t|j	d�r�|||jfd
d�}n||fdd�}||_
q|dk�r|||fdd�}||_q|dk�r&|||fdd�}||_qtd|��qdS)Nr(rcSs|||||�f�dSr1r )r"Z	attrib_inrrIr(r r r!�handlersz%XMLParser._setevents.<locals>.handlerrcSs||||�f�dSr1r )r"rrIrr r r!rJszstart-nsr1cSs|||||�f�dSr1r )r�r�rrIr1r r r!rJ!scSs|||p
d|pdff�dSr"r )r�r�rrIr r r!rJ%szend-nsr2cSs||||�f�dSr1r )r�rrIr2r r r!rJ+scSs||df�dSr1r )r�rrIr r r!rJ/sr+cSs|||j�|�f�dSr1)rpr+)r3rrIr+r r r!rJ3sr,cSs|||j�||�f�dSr1)rpr,)Z	pi_targetr�rrIr+r r r!rJ7szunknown event %r)r�rIrDrEr:r;r<r=r#rpr>r?r@rArBrCr�)r+Zevents_queueZevents_to_reportr�rIZ
event_namerJr r r!rsL
�
�
��

�
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dSr1)r
�code�lineno�offsetZposition)r+ra�errr r r!�_raiseerror>szXMLParser._raiseerrorcCsFz|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r8�KeyError)r+r`�namer r r!�_fixnameDszXMLParser._fixnamecCs|j�|pd|pd�Sr")rpr1�r+r�r�r r r!r>OszXMLParser._start_nscCs|j�|pd�Sr")rpr2)r+r�r r r!r@RszXMLParser._end_nscCsR|j}||�}i}|rDtdt|�d�D]}||d||||�<q&|j�||�S)Nrr9r)rR�ranger7rpr()r+r"�	attr_listZfixnamer)�ir r r!r:UszXMLParser._startcCs|j�|�|��Sr1)rprrRrir r r!r<aszXMLParser._endc	Cs�|dd�}|dkr�z|jj}Wntk
r6YdSXz||j|dd��WnZtk
r�ddlm}|�d||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�n"|dkr�|dd	�d
kr�g|_�n|jdk	�r�|dkr�d|_dS|��}|�sdS|j�|�t|j�}|dk�r�|jd}|d
k�rd|dk�rd|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|j�||	|
dd��nt|d��r�t�dt�d|_dS)Nrr�r�rr/z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r9ZPUBLIC�ZSYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)rpr�r�rGrPr3r0r6r�ZErrorLineNumberZErrorColumnNumberrKrLrMrF�striprIr7r#r[r<r=�RuntimeWarning)r+r3r�Zdata_handlerr0rN�nrPrQZpubid�systemr r r!r9dsd���





�zXMLParser._defaultc
CsFz|j�|d�Wn.|jk
r@}z|�|�W5d}~XYnXdS)Nr)r��Parser7rO)r+r�r�r r r!r��szXMLParser.feedc
Cs�z|j�dd�Wn.|jk
r@}z|�|�W5d}~XYnXz0z|jj}Wntk
rdYnX|�W�SW5|`|`|`|`XdS)Nr�r)	r�r`r7rOr�rpr5r�r�)r+r�Z
close_handlerr r r!r��szXMLParser.close)rrrr-rrOrRr>r@r:r<r9r�r�r r r r!r�s
.66)�out�	from_filecKs�|dkr|dkrtd��d}|dkr0t��}}tt|jf|�d�}|dk	r`|�|�|��n|dk	rtt||d�|dk	r�|�	�SdS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r�)
r�r�r�rrr�r�r�r	r�)Zxml_datararbZoptionsZsior�r r r!r�s


z	^\w+:\w+$c@s�eZdZdddddddd�dd�Zefdd�Zdd	�Zdd
d�Zdd
�Zdj	fdd�Z
dd�Zdd�Zddd�Z
dd�Zdd�Zdd�ZdS)rFN)�
with_comments�
strip_text�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�
exclude_attrs�exclude_tagsc	Cs�||_g|_||_||_|r$t|�nd|_|r6t|�nd|_||_|rRt|�|_nd|_|rjt|�j	|_
nd|_
dgg|_g|_|s�|j�
tt����|j�
g�i|_dg|_d|_d|_d|_d|_dS)N)r�r�Fr)�_writer�_with_comments�_strip_textrb�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackrIrhr�rd�_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r+r�rcrdrerfrgrhrir r r!r-�s2�zC14NWriterTarget.__init__ccs ||�D]}|r|EdHqdSr1r )r+Zns_stackZ	_reversedrXr r r!�_iter_namespacessz!C14NWriterTarget._iter_namespacescCs\|�dd�\}}|�|j�D]$\}}||krd|�d|��Sqtd|�d|�d���dS)Nr�rr�r�zPrefix z of QName "�" is not declared in scope)�splitr{rtr�)r+Z
prefixed_namer�rQr��pr r r!�_resolve_prefix_names
z%C14NWriterTarget._resolve_prefix_namecCs�|dkr:|dd�dkr,|dd��dd�nd|f\}}n|}t�}|�|j�D]B\}}||kr�||kr�|rz|�d|��n|||fS|�|�qP|jr�||jkr�|j|}ndt|j���}|j|<|jd�||f�|�d|��||fS|�sd|k�r|||fS|�|j	�D]J\}}||k�r|jd�||f�|�rR|�d|��n|||fS�q|�st|||fSt
d|�d	���dS)
Nrr�r�r�r�r^r�zNamespace "r|)r�rbr{rs�addrorur7rIrtr�)r+r�r�r"Z
prefixes_seen�ur�r r r!�_qnames.2 


&
zC14NWriterTarget._qnamecCs|js|j�|�dSr1)rzrrIr&r r r!r�CszC14NWriterTarget.datar�cCs�||j�}|jdd�=|jr.|jds.|��}|jdk	rv|jd}|_|rVt|�rV|nd}|j||f��|dk	rvdS|r�|jr�|�t	|��dS�Nr�)
rrlrvr\rw�_looks_like_prefix_namer:rxrj�_escape_cdata_c14n)r+Z
_join_textr�r.�
qname_textr r r!r%Gs


zC14NWriterTarget._flushcCs0|jr
dS|jr|��|jd�||f�dSr�)rzrr%rtrIrSr r r!r1Us
zC14NWriterTarget.start_nscCs�|jdk	r,|js||jkr,|jd7_dS|jr:|��g}|j�|�|jdk	rn||jkrn|||f|_dS|�|||�dSr�)	rnrzrr%rsrIrprwr:)r+r"r'�new_namespacesr r r!r(]s
��zC14NWriterTarget.startcs�jdk	r$|r$�fdd�|��D�}|h|�}i}|dk	rV��|�}||<|�|��jdk	r�|r���|�}|r�|D]0}	||	}
t|
�rv��|
�}||
<|�|�qvq�d}nd}�j��fdd�t|dd�d�D�}|r�dd�|D�}|��ng}|�rjt|���D]^\}
}|dk	�r@|
|k�r@||k�r@|||d	}||
\}}	}|�	|�r\|n|	|f��q
|�
d
�}�j�	|�r�|dkn�jd��j}|d
||d	�|�r�|d�
dd�|D���|d�|dk	�r�|t|||d	��d�_�j�	g�dS)Ncs i|]\}}|�jkr||�qSr )rm��.0r�r�r/r r!�
<dictcomp>ps
z+C14NWriterTarget._start.<locals>.<dictcomp>csi|]}|�|��qSr r )r�r^)�parse_qnamer r!r��scSs|�dd�S)Nr�r)r})r^r r r!r��r�z)C14NWriterTarget._start.<locals>.<lambda>r�cSs$g|]\}}|rd|nd|f�qS)zxmlns:Zxmlnsr )r�r�r�r r r!�
<listcomp>�s�z+C14NWriterTarget._start.<locals>.<listcomp>rz+{http://www.w3.org/XML/1998/namespace}spaceZpreserver�r�r�cSs&g|]\}}d|�dt|��d��qS)roz="r�)�_escape_attrib_c14nr�r r r!r��sr�T)rmrdrr�rrr�r�r��sortrIr_rvrjr#r�rxrt)r+r"r'r�r�r�Zresolved_namesr�ZqattrsZ	attr_nameraZ
parsed_qnamesrUr�r�Z
attr_qnamer�Zspace_behaviourr�r )r�r+r!r:ns`


�
�

�
zC14NWriterTarget._startcCst|jr|jd8_dS|jr&|��|�d|�|�d�d��|j��t|j�dk|_|j	��|j
��dS)Nrr�rr�)rzrr%rjr�rvr)r7ryrsrtrir r r!r�s

zC14NWriterTarget.endcCsd|js
dS|jrdS|jr&|�d�n|jr:|jr:|��|�dt|��d��|js`|�d�dS)Nr�z<!--z-->)rkrzryrjrxrr%r�r$r r r!r+�szC14NWriterTarget.commentcCsp|jr
dS|jr|�d�n|jr0|jr0|��|�|rNd|�dt|��d�n
d|�d��|jsl|�d�dS)Nr�z<?roz?>)rzryrjrxrr%r�)r+rpr�r r r!r,�s$�zC14NWriterTarget.pi)N)N)rrrr-�reversedr{rr�r�r#r%r1r(r:rr+r,r r r r!r�s&�%
%
E
c	Cs|zVd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}|WSttfk
rvt|�YnXdS)	Nr�r�r�r�r�r�r��&#xD;r�rqr r r!r��sr�c	Cs�z~d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd�}|WSttfk
r�t|�YnXdS)
Nr�r�r�r�r�r�r�z&#x9;r�z&#xA;r�r�r�rqr r r!r��s r�)re)�_set_factories)N)N)N)NN)NN)N)NN)N)N)N)N)?�__all__rr�r�r<r�rZcollections.abcr�r�rrr
rrrrrrr
r�contextmanagerr�r�r�r�rb�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrr�compile�UNICODEr�r�rr�r�rOZ_elementtreer�r4r r r r!�<module>Ks��>

0s
3
=22�	�
��


05


zgPK��Z�r�� � &__pycache__/ElementPath.cpython-38.pycnu�[���U

e5d>3�@s�ddlZe�d�Zd"dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zeee	ee
ed�Z
iZGdd�d�Zd#dd�Zd$dd�Zd%dd�Zd&d d!�ZdS)'�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c		cs�|r|�d�nd}d}t�|�D]�}|\}}|r�|ddkr�d|kr�|�dd�\}}z"|s^t�|d|||ffVWq�tk
r�td|�d�Yq�Xn"|r�|s�|d||ffVn|Vd}q |V|d	k}q dS)
N�Fr�{�:�z{%s}%sz!prefix %r not found in prefix map�@)�get�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)	�pattern�
namespacesZdefault_namespaceZparsing_attribute�tokenZttype�tag�prefixZuri�r�-/usr/lib64/python3.8/xml/etree/ElementPath.py�xpath_tokenizerIs&rcCs>|j}|dkr:i|_}|j��D]}|D]}|||<q*q"|S�N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapas
rcCs |dd�dkp|dd�dkS)N��{*}����}*r�rrrr�_is_wildcard_tagksr"cs�tt���dkr"��fdd�}n��dkr:��fdd�}n��dd�dkr��dd��tt��d���dd�������fd	d�}nL�d
d�dkrƈdd��tdt��������fd
d�}ntd�����|S)Nz{*}*c3s |D]}�|j��r|VqdSrr!�r�result�elem��_isinstance�_strrr�selectusz_prepare_tag.<locals>.selectz{}*c3s0|D]&}|j}�|��r|ddkr|VqdS)Nrrr!�rr$r%Zel_tagr&rrr){srr�c3s8|D].}|j}|�ks,�|��r|��kr|VqdSrr!r*)r'r(�no_ns�suffixrrrr)�srr ���c3s0|D]&}|j}�|��r|��kr|VqdSrr!r*)r'r(�ns�ns_onlyrrr)�szinternal parser error, got )�
isinstance�str�slice�len�RuntimeError)rr)r)r'r(r,r/r0r-rr�_prepare_tagos 
r6csR|d�t��r&t����fdd�}n(�dd�dkrB�dd���fdd�}|S)Nrcsdd�}�|||��S)Ncss|D]}|EdHqdSrr)r$r%rrr�select_child�sz3prepare_child.<locals>.select.<locals>.select_childr�rr$r7��
select_tagrrr)�szprepare_child.<locals>.selectr+�{}c3s(|D]}|D]}|j�kr|VqqdSrr!�rr$r%rr!rrr)�s
)r"r6��nextrr)r�r:rr�
prepare_child�sr@cCsdd�}|S)Ncss|D]}|EdHqdSrrr#rrrr)�szprepare_star.<locals>.selectrr=rrr�prepare_star�srAcCsdd�}|S)Ncss|EdHdSrr)rr$rrrr)�szprepare_self.<locals>.selectrr=rrr�prepare_self�srBcs�z
|�}Wntk
r YdSX|ddkr4d�n|dsF|d�ntd��t��rlt����fdd�}n(�dd�dkr��dd���fd	d�}|S)
Nr�*rzinvalid descendantcsdd�}�|||��S)Ncss*|D] }|��D]}||k	r|VqqdSr�r)r$r%rrrrr7�sz8prepare_descendant.<locals>.select.<locals>.select_childrr8r9rrr)�sz"prepare_descendant.<locals>.selectr+r;c3s,|D]"}|���D]}||k	r|VqqdSrrDr<r!rrr)�s)�
StopIterationrr"r6r=rr?r�prepare_descendant�s 

rFcCsdd�}|S)Ncss@t|�}i}|D]*}||kr||}||krd||<|VqdSr)r)rr$rZ
result_mapr%�parentrrrr)�szprepare_parent.<locals>.selectrr=rrr�prepare_parent�s
rHcsLg}g}z
|�}Wntk
r(YdSX|ddkr8q�|dkrBq|drr|ddd�dkrrd|ddd�f}|�|dp�d�|�|d�qd	�|�}|d
kr�|d��fdd�}|S|d
kr�|d�|d���fdd�}|S|dk�rt�d|d��s|d��fdd�}|S|dk�sB|dk�rxt�d|d��sx|d�|d���rh��fdd�}n�fdd�}|S|dk�s�|dk�s�|dk�r@|dk�r�t|d�d��dk�r0td��nl|ddk�r�td��|dk�r,zt|d�d�Wntk
�rtd��YnX�dk�r0td��nd��fdd�}|Std��dS) Nr�])rrrz'"�'r.�-rz@-c3s"|D]}|���dk	r|VqdSr�rr#)�keyrrr)�sz!prepare_predicate.<locals>.selectz@-='c3s"|D]}|����kr|VqdSrrLr#)rM�valuerrr)sz\-?\d+$c3s"|D]}|���dk	r|VqdSr)�findr#r!rrr)sz.='z-='c3s:|D]0}|���D] }d�|����kr|VqqqdS�Nr)r	�join�itertextr<)rrNrrr)s
c3s&|D]}d�|����kr|VqdSrP)rQrRr#)rNrrr)sz-()z-()-zXPath position >= 1 expectedZlastzunsupported functionr+zunsupported expressionrz)XPath offset from last() must be negativec
3s^t|�}|D]L}z.||}t|�|j��}|�|kr<|VWqttfk
rVYqXqdSr)r�listr	r�
IndexErrorr)rr$rr%rGZelems)�indexrrr)5s
zinvalid predicate)rE�appendrQ�re�match�intr�
ValueError)r>rZ	signatureZ	predicater)r)rUrMrrNr�prepare_predicate�sj

&





r[)rrC�.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dSr)r)�selfrrrr�__init__Psz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr`rrrrr^Nsr^c
Csj|dd�dkr|d}|f}|r6|tt|����7}zt|}W�n�tk
�r@tt�dkrjt��|dd�dkr�td��tt	||��j
}z
|�}Wntk
r�YYdSXg}z|�t
|d||��Wntk
r�td�d�YnXz|�}|ddk�r|�}Wq�tk
�r0Y�q4Yq�Xq�|t|<YnX|g}t|�}|D]}	|	||�}�qT|S)	Nr.�/rC�drz#cannot use absolute path on elementrzinvalid path)�tuple�sorted�items�_cacherr4�clearrrr�__next__rErV�opsr^)
r%�pathrZ	cache_keyZselectorr>rr$rr)rrr�iterfindXsD


rncCstt|||�d�Sr)r>rn�r%rmrrrrrO�srOcCstt|||��Sr)rSrnrorrrr	�sr	cCs:ztt|||��}|jpdWStk
r4|YSXdSrP)r>rn�textrE)r%rm�defaultrrrr�findtext�s
rr)N)N)N)N)NN)rW�compilerrrr"r6r@rArBrFrHr[rlrir^rnrOr	rrrrrr�<module>;s4�

)
b�	

,

PK��Z��H�H�&__pycache__/ElementTree.cpython-38.pycnu�[���U

e5d��@s�dZddddddddd	d
ddd
ddddddddddddgZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZGdd
�d
e�Z
d d�ZGd!d�d�Zifd"d�Zd]d#d�Zd^d$d�ZeZGd%d
�d
�ZGd&d�d�Ze	jd'd(��Zd_d)d*�Zd+d,�Zd-Zzee�ZWnek
�r.YnXd.d/�Zd0d1�Zeeed2�Zd3d�Z d4d5d6d7d8d9d:d;�Z!e!e _!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%d`dddDdE�dFd�Z&GdGdH�dHej'�Z(dadddDdE�dId�Z)dJd�Z*dbdKd	�Z+dcdLd�Z,GdMd�d�Z-dddNd�Z.dedOd�Z/e.Z0dfdPd�Z1GdQd�d�Z2GdRd�d�Z3dgdddS�dTd�Z4e�5dUej6�j7Z8GdVd�d�Z9dWdX�Z:dYdZ�Z;zeZ<dd[l=Tdd\l=m>Z>Wne?k
�r�YnXe>ee�dS)haLightweight XML support for Python.

 XML is an inherently hierarchical data format, and the most natural way to
 represent it is with a tree.  This module has two classes for this purpose:

    1. ElementTree represents the whole XML document as a tree and

    2. Element represents a single node in this tree.

 Interactions with the whole document (reading and writing to/from files) are
 usually done on the ElementTree level.  Interactions with a single XML element
 and its sub-elements are done on the Element level.

 Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:

    'tag' - a string containing the element's name.

    'attributes' - a Python dictionary storing the element's attributes.

    'text' - a string containing the element's text content.

    'tail' - an optional string containing text after the element's end tag.

    And a number of child elements stored in a Python sequence.

 To create an element instance, use the Element constructor,
 or the SubElement factory function.

 You can also use the ElementTree class to wrap an element structure
 and convert it to and from XML.

�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespace�canonicalize�C14NWriterTargetz1.3.0�N�)�ElementPathc@seZdZdZdS)r
z�An error when parsing an XML document.

    In addition to its exception value, a ParseError contains
    two extra attributes:
        'code'     - the specific exception code
        'position' - the line and column of the error

    N)�__name__�
__module__�__qualname__�__doc__�r!r!�-/usr/lib64/python3.8/xml/etree/ElementTree.pyr
jscCs
t|d�S)z2Return True if *element* appears to be an Element.�tag)�hasattr)�elementr!r!r"rxsc@s
eZdZdZdZdZdZdZifdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd9d!d"�Zd:d#d$�Zd;d%d&�Zd<d'd(�Zd)d*�Zd=d+d,�Zd-d.�Zd/d0�Zd1d2�Zd>d3d4�Z d?d5d6�Z!d7d8�Z"dS)@rahAn XML element.

    This class is the reference implementation of the Element interface.

    An element's length is its number of subelements.  That means if you
    want to check if an element is truly empty, you should check BOTH
    its length AND its text attribute.

    The element tag, attribute names, and attribute values can be either
    bytes or strings.

    *tag* is the element name.  *attrib* is an optional dictionary containing
    element attributes. *extra* are additional element attributes given as
    keyword arguments.

    Example form:
        <tag attrib>text<child/>...</tag>tail

    NcKs6t|t�std|jjf��||_||�|_g|_dS)Nzattrib must be dict, not %s)�
isinstance�dict�	TypeError�	__class__rr#�attrib�	_children)�selfr#r*�extrar!r!r"�__init__�s
�
zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r)rr#�id�r,r!r!r"�__repr__�szElement.__repr__cCs|�||�S)z�Create a new element with the same type.

        *tag* is a string containing the element name.
        *attrib* is a dictionary containing the element attributes.

        Do not call this method, use the SubElement factory function instead.

        )r))r,r#r*r!r!r"�makeelement�s	zElement.makeelementcCs0|�|j|j�}|j|_|j|_||dd�<|S)z�Return copy of current element.

        This creates a shallow copy. Subelements will be shared with the
        original tree.

        N)r2r#r*�text�tail)r,�elemr!r!r"�copy�s
zElement.copycCs
t|j�S�N)�lenr+r0r!r!r"�__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.���
stacklevelr)�warnings�warn�
FutureWarningr8r+r0r!r!r"�__bool__�s�zElement.__bool__cCs
|j|Sr7�r+�r,�indexr!r!r"�__getitem__�szElement.__getitem__cCs8t|t�r |D]}|�|�qn
|�|�||j|<dSr7)r&�slice�_assert_is_elementr+)r,rCr%Zeltr!r!r"�__setitem__�s


zElement.__setitem__cCs|j|=dSr7rArBr!r!r"�__delitem__�szElement.__delitem__cCs|�|�|j�|�dS)aAdd *subelement* to the end of this element.

        The new element will appear in document order after the last existing
        subelement (or directly after the text, if it's the first subelement),
        but before the end tag for this element.

        N�rFr+�append�r,�
subelementr!r!r"rJ�s
zElement.appendcCs$|D]}|�|�|j�|�qdS)zkAppend subelements from a sequence.

        *elements* is a sequence with zero or more elements.

        NrI)r,�elementsr%r!r!r"�extend�s
zElement.extendcCs|�|�|j�||�dS)z(Insert *subelement* at position *index*.N)rFr+�insert)r,rCrLr!r!r"rO�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r&�_Element_Pyr(�typer)r,�er!r!r"rF�s
zElement._assert_is_elementcCs|j�|�dS)a�Remove matching subelement.

        Unlike the find methods, this method compares elements based on
        identity, NOT ON tag value or contents.  To remove subelements by
        other means, the easiest way is to use a list comprehension to
        select what elements to keep, and then use slice assignment to update
        the parent element.

        ValueError is raised if a matching element could not be found.

        N)r+�removerKr!r!r"rSs
zElement.removecCstjdtdd�|jS)z`(Deprecated) Return all subelements.

        Elements are returned in document order.

        zaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r:r;)r=r>�DeprecationWarningr+r0r!r!r"�getchildrens�zElement.getchildrencCst�|||�S)aFind first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        )r�find�r,�path�
namespacesr!r!r"rV!s	zElement.findcCst�||||�S)a�Find text for first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *default* is the value to return if the element was not found,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return text content of first matching element, or default value if
        none was found.  Note that if an element is found having no text
        content, the empty string is returned.

        )r�findtext�r,rX�defaultrYr!r!r"rZ,szElement.findtextcCst�|||�S)aFind all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Returns list containing all matching elements in document order.

        )r�findallrWr!r!r"r]:s	zElement.findallcCst�|||�S)a Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        )r�iterfindrWr!r!r"r^Es	zElement.iterfindcCs |j��g|_d|_|_dS)z�Reset element.

        This function removes all subelements, clears all attributes, and sets
        the text and tail attributes to None.

        N)r*�clearr+r3r4r0r!r!r"r_Ps
z
Element.clearcCs|j�||�S)agGet element attribute.

        Equivalent to attrib.get, but some implementations may handle this a
        bit more efficiently.  *key* is what attribute to look for, and
        *default* is what to return if the attribute was not found.

        Returns a string containing the attribute value, or the default if
        attribute was not found.

        )r*�get)r,�keyr\r!r!r"r`[szElement.getcCs||j|<dS)z�Set element attribute.

        Equivalent to attrib[key] = value, but some implementations may handle
        this a bit more efficiently.  *key* is what attribute to set, and
        *value* is the attribute value to set it to.

        N)r*)r,ra�valuer!r!r"�sethszElement.setcCs
|j��S)z�Get list of attribute names.

        Names are returned in an arbitrary order, just like an ordinary
        Python dict.  Equivalent to attrib.keys()

        )r*�keysr0r!r!r"rdrszElement.keyscCs
|j��S)z�Get element attributes as a sequence.

        The attributes are returned in arbitrary order.  Equivalent to
        attrib.items().

        Return a list of (name, value) tuples.

        )r*�itemsr0r!r!r"re{s	z
Element.itemsccsD|dkrd}|dks|j|kr$|V|jD]}|�|�EdHq*dS)aCreate tree iterator.

        The iterator loops over the element and all subelements in document
        order, returning all elements with a matching tag.

        If the tree structure is modified during iteration, new or removed
        elements may or may not be included.  To get a stable set, use the
        list() function on the iterator, and loop over the resulting list.

        *tag* is what tags to look for (default is to return all elements)

        Return an iterator containing all the matching elements.

        �*N)r#r+�iter)r,r#rRr!r!r"rg�s
zElement.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r:r;�r=r>rT�listrg�r,r#r!r!r"�getiterator�s�zElement.getiteratorccsX|j}t|t�s|dk	rdS|j}|r,|V|D]"}|��EdH|j}|r0|Vq0dS)z�Create text iterator.

        The iterator loops over the element and all subelements in document
        order, returning all inner text.

        N)r#r&�strr3�itertextr4)r,r#�trRr!r!r"rm�szElement.itertext)N)NN)N)N)N)N)N)#rrrr r#r*r3r4r.r1r2r6r9r@rDrGrHrJrNrOrFrSrUrVrZr]r^r_r`rcrdrergrkrmr!r!r!r"r}s@	








	

cKs"||�}|�||�}|�|�|S)a�Subelement factory which creates an element instance, and appends it
    to an existing parent.

    The element tag, attribute names, and attribute values can be either
    bytes or Unicode strings.

    *parent* is the parent element, *tag* is the subelements name, *attrib* is
    an optional directory containing element attributes, *extra* are
    additional attributes given as keyword arguments.

    )r2rJ)�parentr#r*r-r%r!r!r"r�s
cCstt�}||_|S)z�Comment element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *text* is a string containing the comment string.

    )rrr3)r3r%r!r!r"r�s	cCs&tt�}||_|r"|jd||_|S)a*Processing Instruction element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *target* is a string containing the processing instruction, *text* is a
    string containing the processing instruction contents, if any.

    � )rrr3)�targetr3r%r!r!r"r�s

c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)r
a�Qualified name wrapper.

    This class can be used to wrap a QName attribute value in order to get
    proper namespace handing on output.

    *text_or_uri* is a string containing the QName value either in the form
    {uri}local, or if the tag argument is given, the URI part of a QName.

    *tag* is an optional argument which if given, will make the first
    argument (text_or_uri) be interpreted as a URI, and this argument (tag)
    be interpreted as a local name.

    NcCs|rd||f}||_dS)Nz{%s}%s�r3)r,Ztext_or_urir#r!r!r"r.�szQName.__init__cCs|jSr7rrr0r!r!r"�__str__�sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r)rr3r0r!r!r"r1szQName.__repr__cCs
t|j�Sr7)�hashr3r0r!r!r"�__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kSr7�r&r
r3�r,�otherr!r!r"�__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__lt__s
zQName.__lt__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kSr7rvrwr!r!r"�__eq__s
zQName.__eq__)N)
rrrr r.rsr1ruryrzr{r|r}r!r!r!r"r
�s
c@s�eZdZdZddd�Zdd�Zdd�Zdd	d
�Zddd�Zd d
d�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�Z
d%dd�dd�Zdd�ZdS)&ra%An XML element hierarchy.

    This class also provides support for serialization to and from
    standard XML.

    *element* is an optional root element node,
    *file* is an optional file handle or file name of an XML file whose
    contents will be used to initialize the tree with.

    NcCs||_|r|�|�dSr7)�_rootr	)r,r%�filer!r!r"r.'szElementTree.__init__cCs|jS)z!Return root element of this tree.�r~r0r!r!r"�getroot-szElementTree.getrootcCs
||_dS)z�Replace root element of this tree.

        This will discard the current contents of the tree and replace it
        with the given element.  Use with care!

        Nr�)r,r%r!r!r"�_setroot1szElementTree._setrootcCs�d}t|d�st|d�}d}z^|dkrLt�}t|d�rL|�|�|_|jW�2S|�d�}|s\qh|�|�qL|��|_|jW�S|r�|��XdS)a=Load external XML document into element tree.

        *source* is a file name or file object, *parser* is an optional parser
        instance that defaults to XMLParser.

        ParseError is raised if the parser fails to parse the document.

        Returns the root element of the given source document.

        F�read�rbTN�_parse_wholei)r$�open�closerr�r~r��feed)r,�source�parser�close_source�datar!r!r"r	;s$






zElementTree.parsecCs|j�|�S)z�Create and return tree iterator for the root element.

        The iterator loops over all elements in this tree, in document order.

        *tag* is a string with the tag name to iterate over
        (default is to return all elements).

        )r~rgrjr!r!r"rg`s
zElementTree.itercCstjdtdd�t|�|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r:r;rhrjr!r!r"rkms�zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)a\Find first matching element by tag name or path.

        Same as getroot().find(path), which is Element.find()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nr�/�.��This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr:r;)r=r>r?r~rVrWr!r!r"rVus��zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|j�|||�S)aeFind first matching element by tag name or path.

        Same as getroot().findtext(path),  which is Element.findtext()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nrr�r�r�r:r;)r=r>r?r~rZr[r!r!r"rZ�s��zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)aaFind all matching subelements by tag name or path.

        Same as getroot().findall(path), which is Element.findall().

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return list containing all matching elements in document order.

        Nrr�r�r�r:r;)r=r>r?r~r]rWr!r!r"r]�s��zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|j�||�S)agFind all matching subelements by tag name or path.

        Same as getroot().iterfind(path), which is element.iterfind()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        Nrr�r�r�r:r;)r=r>r?r~r^rWr!r!r"r^�s��zElementTree.iterfindT��short_empty_elementsc	Cs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|��}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�d	dl}
|
��}	|d
|	f�|dkr�t||j�n,t|j|�\}}t|}
|
||j|||d�W5QRXdS)
a�Write element tree to a file as XML.

        Arguments:
          *file_or_filename* -- file name or a file object opened for writing

          *encoding* -- the output encoding (default: US-ASCII)

          *xml_declaration* -- bool indicating if an XML declaration should be
                               added to the output. If None, an XML declaration
                               is added if encoding IS NOT either of:
                               US-ASCII, UTF-8, or Unicode

          *default_namespace* -- sets the default XML namespace (for "xmlns")

          *method* -- either "xml" (default), "html, "text", or "c14n"

          *short_empty_elements* -- controls the formatting of elements
                                    that contain no content. If True (default)
                                    they are emitted as a single self-closed
                                    tag, otherwise they are emitted as a pair
                                    of start/end tags

        �xmlzunknown method %r�c14n�utf-8�us-asciiN)r�r��unicoder�rz$<?xml version='1.0' encoding='%s'?>
r3r�)	�
_serialize�
ValueError�lower�_get_writer�localeZgetpreferredencoding�_serialize_textr~�_namespaces)r,�file_or_filename�encoding�xml_declaration�default_namespace�methodr�Z	enc_lower�writeZdeclared_encodingr��qnamesrYZ	serializer!r!r"r��s:����zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,rr!r!r"�
write_c14nszElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr r.r�r�r	rgrkrVrZr]r^r�r�r!r!r!r"rs&



%





��:ccs"z
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVW5QRXYn�X|dkrl|Vn�t����}t|tj�r�|}nft|tj�r�t�	|�}|�
|j�nBt��}dd�|_||_z|j
|_
|j|_Wntk
r�YnXtj||ddd�}|�
|j�|jVW5QRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS�NTr!r!r!r!r"�<lambda>0�z_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorr��
contextlib�	ExitStackr&�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�r�stackr!r!r"r�sB
�


�r�csddi�i��rd��<���fdd�}|��D]�}|j}t|t�rZ|j�kr�||j�n<t|t�rv|�kr�||�n |dk	r�|tk	r�|tk	r�t|�|�	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�|j}t|t�r0|j�kr0||j�q0��fS)N�cs�z�|dd�dkr�|dd��dd�\}}��|�}|dkrjt�|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitr`�_namespace_mapr8r�r(�_raise_serialization_error)�qname�urir#�prefix�r�rYr�r!r"�	add_qnameMs(


�z_namespaces.<locals>.add_qname)
rgr#r&r
r3rlrrr�re)r5r�r�r#rarbr3r!r�r"r�Bs4




r�cKs�|j}|j}|tkr$|d|��nv|tkr<|d|��n^||}|dkr||r\|t|��|D]}t|||d|d�q`�n|d|�t|���}	|	s�|�r2|r�t|��dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�|	D]L\}}
t
|t�r�|j}t
|
t��r||
j}
nt	|
�}
|d
|||
f�q�|�sHt|��sH|�s�|d�|�rb|t|��|D]}t|||d|d��qf|d|d�n|d
�|j
�r�|t|j
��dS)N�	<!--%s-->�<?%s?>r��<cSs|dS�Nrr!��xr!r!r"r��r�z _serialize_xml.<locals>.<lambda>�ra�:�
 xmlns%s="%s"� %s="%s"�>�</z />)r#r3rr�
_escape_cdata�_serialize_xmlrire�sorted�_escape_attribr&r
r8r4)r�r5r�rYr��kwargsr#r3rRre�v�kr!r!r"r�s\
�
��


�
r�)
Zarea�baseZbasefont�br�col�frameZhrZimg�inputZisindex�link�metaZparamcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���nh||}|dkr�|rd|t|��|D]}t|||d�qh�n,|d|�t|���}|s�|�r8|r�t|��dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�|D]N\}
}	t
|
t��r|
j}
t
|	t��r||	j}	nt|	�}	|d	||
|	f�q�|d
�|�
�}|�rx|dk�sb|dk�rl||�n|t|��|D]}t|||d��q||tk�r�|d
|d
�|j�r�|t|j��dS)Nr�r�r�cSs|dSr�r!r�r!r!r"r��r�z!_serialize_html.<locals>.<lambda>r�r�r�r�r�ZscriptZstyler�)r#r3rr�r�_serialize_htmlrirer�r�r&r
�_escape_attrib_htmlr��
HTML_EMPTYr4)r�r5r�rYr�r#r3rRrer�r�Zltagr!r!r"r��sX
��


r�cCs*|��D]}||�q|jr&||j�dSr7)rmr4)r�r5�partr!r!r"r��s
r�)r��htmlr3cCsLt�d|�rtd��tt���D]\}}||ks8||kr t|=q |t|<dS)atRegister a namespace prefix.

    The registry is global, and any existing mapping for either the
    given prefix or the namespace URI will be removed.

    *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
    attributes in this namespace will be serialized with prefix if possible.

    ValueError is raised if prefix is reserved or is invalid.

    zns\d+$z'Prefix format reserved for internal useN)�re�matchr�rir�re)r�r�r�r�r!r!r"r�sr�r�ZrdfZwsdlZxsZxsiZdc)�$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r(rQrrrr!r!r"r�s�r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)N�&�&amp;r��&lt;r��&gt;��replacer(r�r�rrr!r!r"r�!sr�c	Cs�z�d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd
�}d
|kr�|�d
d�}d
|kr�|�d
d�}|WSttfk
r�t|�YnXdS)Nr�r�r�r�r�r��"�&quot;z
r��
z&#10;�	z&#09;r�rrr!r!r"r�1s(r�c	CshzBd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}|WSttfk
rbt|�YnXdS)Nr�r�r�r�r�r�r�rrr!r!r"r�Msr�T)r�r�r�cCs:|dkrt��nt��}t|�j||||||d�|��S)a
Generate string representation of XML element.

    All subelements are included.  If encoding is "unicode", a string
    is returned. Otherwise a bytestring is returned.

    *element* is an Element instance, *encoding* is an optional output
    encoding defaulting to US-ASCII, *method* is an optional output which can
    be one of "xml" (default), "html", "text" or "c14n", *default_namespace*
    sets the default XML namespace (for "xmlns").

    Returns an (optionally) encoded string containing the XML data.

    r��r�r�r�r�)r��StringIO�BytesIOrr��getvalue)r%r�r�r�r�r��streamr!r!r"r\s�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs
||_dSr7)�lst)r,r�r!r!r"r.vsz_ListDataStream.__init__cCsdSr�r!r0r!r!r"r�ysz_ListDataStream.writablecCsdSr�r!r0r!r!r"r�|sz_ListDataStream.seekablecCs|j�|�dSr7)r�rJ)r,�br!r!r"r�sz_ListDataStream.writecCs
t|j�Sr7)r8r�r0r!r!r"r��sz_ListDataStream.tellN)	rrrr r.r�r�r�r�r!r!r!r"r�tsr�cCs*g}t|�}t|�j||||||d�|S)Nr�)r�rr�)r%r�r�r�r�r�r�r�r!r!r"r�s�cCsLt|t�st|�}|jtjdd�|��j}|r<|ddkrHtj�d�dS)a#Write element tree or element structure to sys.stdout.

    This function should be used for debugging only.

    *elem* is either an ElementTree, or a single Element.  The exact output
    format is implementation dependent.  In this version, it's written as an
    ordinary XML file.

    r�)r����r�N)r&rr��sys�stdoutr�r4)r5r4r!r!r"r�s

cCst�}|�||�|S)z�Parse XML document into element tree.

    *source* is a filename or file object containing XML data,
    *parser* is an optional parser instance defaulting to XMLParser.

    Return an ElementTree instance.

    )rr	)r�r��treer!r!r"r	�s	csft||d������fdd��G�fdd�dtjj�}|��d�_�~d�t�d�sbt�d	��d
��S)aJIncrementally parse XML document into ElementTree.

    This class also reports what's going on to the user based on the
    *events* it is initialized with.  The supported events are the strings
    "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
    detailed namespace information).  If *events* is omitted, only
    "end" events are reported.

    *source* is a filename or file object containing XML data, *events* is
    a list of events to report back, *parser* is an optional parser instance.

    Returns an iterator providing (event, elem) pairs.

    )�events�_parserc3s^zJ���EdH��d�}|s q,��|�q���}���EdH|�_W5�rX���XdS)Ni@)r��read_eventsr�r��_close_and_return_root�root)r�r)r��it�
pullparserr�r!r"�iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r!)rr!r"�IterParseIterator�srNFr�r�T)r�collections�abc�Iteratorrr$r�)r�r�r�rr!)r�rrrr�r"r�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)rcCs<t��|_|ptt�d�|_|dkr(d}|j�|j|�dS)N�rq)�end)r	�deque�
_events_queuerrr�
_setevents)r,r�rr!r!r"r.�s

zXMLPullParser.__init__c
CsZ|jdkrtd��|rVz|j�|�Wn.tk
rT}z|j�|�W5d}~XYnXdS)�Feed encoded data to parser.Nz!feed() called after end of stream)rr�r��SyntaxErrorrrJ)r,r��excr!r!r"r��s
zXMLPullParser.feedcCs|j��}d|_|Sr7)rr�)r,rr!r!r"r�s
z$XMLPullParser._close_and_return_rootcCs|��dS)z�Finish feeding data to parser.

        Unlike XMLParser, does not return the root element. Use
        read_events() to consume elements from XMLPullParser.
        N)rr0r!r!r"r�szXMLPullParser.closeccs.|j}|r*|��}t|t�r"|�q|VqdS)z�Return an iterator over currently available (event, elem) pairs.

        Events are consumed from the internal event queue as they are
        retrieved from the iterator.
        N)r�popleftr&�	Exception)r,r��eventr!r!r"rs
zXMLPullParser.read_events)N)rrrr.r�rr�rr!r!r!r"r�s

cCs"|stt�d�}|�|�|��S)aParse XML document from string constant.

    This function can be used to embed "XML Literals" in Python code.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    r�rrr�r�)r3r�r!r!r"rs
cCsR|stt�d�}|�|�|��}i}|��D]}|�d�}|r.|||<q.||fS)aParse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    rr/)rrr�r�rgr`)r3r�r�Zidsr5r/r!r!r"r,s



cCs,|stt�d�}|D]}|�|�q|��S)z�Parse XML document from sequence of string fragments.

    *sequence* is a list of other sequence, *parser* is an optional parser
    instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    rr)Zsequencer�r3r!r!r"rDs
	c@sheZdZdZdddddd�dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
ddd�Zdd�ZdS)ra8Generic element structure builder.

    This builder converts a sequence of start, data, and end method
    calls to a well-formed element structure.

    You can use this class to build an element structure using a custom XML
    parser, or a parser for some other XML-like format.

    *element_factory* is an optional element factory which is called
    to create new Element instances, as necessary.

    *comment_factory* is a factory to create comments to be used instead of
    the standard factory.  If *insert_comments* is false (the default),
    comments will not be inserted into the tree.

    *pi_factory* is a factory to create processing instructions to be used
    instead of the standard factory.  If *insert_pis* is false (the default),
    processing instructions will not be inserted into the tree.
    NF)�comment_factory�
pi_factory�insert_comments�
insert_piscCsdg|_g|_d|_d|_d|_|dkr*t}||_||_|dkrBt}||_	||_
|dkrZt}||_dSr7)
�_data�_elem�_lastr~�_tailr�_comment_factoryrr�_pi_factoryrr�_factory)r,Zelement_factoryrrrrr!r!r"r.js zTreeBuilder.__init__cCs.t|j�dkstd��|jdk	s(td��|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagsNzmissing toplevel element)r8r�AssertionErrorr~r0r!r!r"r�~szTreeBuilder.closecCsf|jrb|jdk	r\d�|j�}|jr@|jjdks6td��||j_n|jjdksTtd��||j_g|_dS)Nr�zinternal error (tail)zinternal error (text))rr�joinrr4r#r3�r,r3r!r!r"�_flush�s

zTreeBuilder._flushcCs|j�|�dS)zAdd text to current element.N)rrJ�r,r�r!r!r"r��szTreeBuilder.datacCsX|��|�||�|_}|jr2|jd�|�n|jdkrB||_|j�|�d|_|S)z�Open new element and return it.

        *tag* is the element name, *attrs* is a dict containing element
        attributes.

        r�Nr)r&r"rrrJr~r)r,r#�attrsr5r!r!r"�start�s
zTreeBuilder.startcCs@|��|j��|_|jj|ks4td|jj|f��d|_|jS)zOClose and return current Element.

        *tag* is the element name.

        z&end tag mismatch (expected %s, got %s)r)r&r�poprr#r#rrjr!r!r"r
�s��zTreeBuilder.endcCs|�|j|j|�S)z`Create a comment using the comment_factory.

        *text* is the text of the comment.
        )�_handle_singler rr%r!r!r"�comment�s
�zTreeBuilder.commentcCs|�|j|j||�S)z�Create a processing instruction using the pi_factory.

        *target* is the target name of the processing instruction.
        *text* is the data of the processing instruction, or ''.
        )r+r!r)r,rqr3r!r!r"�pi�s�zTreeBuilder.picGs:||�}|r6|��||_|jr0|jd�|�d|_|S)Nr�r)r&rrrJr)r,�factoryrO�argsr5r!r!r"r+�szTreeBuilder._handle_single)N)N)
rrrr r.r�r&r�r)r
r,r-r+r!r!r!r"rVs�
	c@speZdZdZddd�dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)raaElement structure builder for XML source data based on the expat parser.

    *target* is an optional target object which defaults to an instance of the
    standard TreeBuilder class, *encoding* is an optional encoding string
    which if given, overrides the encoding specified in the XML file:
    http://www.iana.org/assignments/character-sets

    N)rqr�cCsdzddlm}Wn>tk
rNzddl}Wntk
rHtd��YnXYnX|�|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_t|d
��r|j|_t|d��r|j|_d|_d|_d|_ d|_!i|_"zd
|j#|_$Wnt%k
�r^YnXdS)Nr��expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r)r
�start_ns�end_nsr�r,r-rzExpat %d.%d.%d)&�xml.parsersr1�ImportErrorZpyexpatZParserCreaterr�rrq�_target�error�_error�_names�_defaultZDefaultHandlerExpandr$�_start�StartElementHandler�_end�EndElementHandler�	_start_ns�StartNamespaceDeclHandler�_end_ns�EndNamespaceDeclHandlerr�ZCharacterDataHandlerr,�CommentHandlerr-�ProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r,rqr�r1r�r!r!r"r.�sP�




zXMLParser.__init__cCs8|j}|j}|D�] }|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�t|j	d�r�|||j
fd	d�}n||fd
d�}||_q|dkr�t|j	d�r�|||jfd
d�}n||fdd�}||_
q|dk�r|||fdd�}||_q|dk�r&|||fdd�}||_qtd|��qdS)Nr)rcSs|||||�f�dSr7r!)r#Z	attrib_inrrJr)r!r!r"�handlersz%XMLParser._setevents.<locals>.handlerr
cSs||||�f�dSr7r!)r#rrJr
r!r!r"rKszstart-nsr2cSs|||||�f�dSr7r!)r�r�rrJr2r!r!r"rK!scSs|||p
d|pdff�dS�Nr�r!)r�r�rrJr!r!r"rK%szend-nsr3cSs||||�f�dSr7r!)r�rrJr3r!r!r"rK+scSs||df�dSr7r!)r�rrJr!r!r"rK/sr,cSs|||j�|�f�dSr7)rqr,)r3rrJr,r!r!r"rK3sr-cSs|||j�||�f�dSr7)rqr-)Z	pi_targetr�rrJr,r!r!r"rK7szunknown event %r)rrJrErFr;r<r=r>r$rqr?r@rArBrCrDr�)r,Zevents_queueZevents_to_reportr�rJZ
event_namerKr!r!r"rsL
�
�
��

�
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dSr7)r
�code�lineno�offsetZposition)r,rb�errr!r!r"�_raiseerror>szXMLParser._raiseerrorcCsFz|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r9�KeyError)r,ra�namer!r!r"�_fixnameDszXMLParser._fixnamecCs|j�|pd|pd�SrL)rqr2�r,r�r�r!r!r"r?OszXMLParser._start_nscCs|j�|pd�SrL)rqr3)r,r�r!r!r"rARszXMLParser._end_nscCsR|j}||�}i}|rDtdt|�d�D]}||d||||�<q&|j�||�S)Nrr:r)rT�ranger8rqr))r,r#�	attr_listZfixnamer*�ir!r!r"r;UszXMLParser._startcCs|j�|�|��Sr7)rqr
rTrjr!r!r"r=aszXMLParser._endc	Cs�|dd�}|dkr�z|jj}Wntk
r6YdSXz||j|dd��WnZtk
r�ddlm}|�d||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�n"|dkr�|dd	�d
kr�g|_�n|jdk	�r�|dkr�d|_dS|��}|�sdS|j�|�t|j�}|dk�r�|jd}|d
k�rd|dk�rd|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|j�||	|
dd��nt|d��r�t�dt�d|_dS)Nrr�r�rr0z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r:ZPUBLIC�ZSYSTEM��doctypezaThe doctype() method of XMLParser is ignored.  Define doctype() method on the TreeBuilder target.)rqr�r�rHrRr4r1r7r�ZErrorLineNumberZErrorColumnNumberrMrNrOrG�striprJr8r$r]r=r>�RuntimeWarning)r,r3r�Zdata_handlerr1rP�nrQrSZpubid�systemr!r!r"r:dsd���





�zXMLParser._defaultc
CsFz|j�|d�Wn.|jk
r@}z|�|�W5d}~XYnXdS)rrN)r��Parser8rQ)r,r�r�r!r!r"r��szXMLParser.feedc
Cs�z|j�dd�Wn.|jk
r@}z|�|�W5d}~XYnXz0z|jj}Wntk
rdYnX|�W�SW5|`|`|`|`XdS)z;Finish feeding data to parser and return element structure.r�rN)	r�rbr8rQrrqr6r�r�)r,r�Z
close_handlerr!r!r"r��szXMLParser.close)rrrr r.rrQrTr?rAr;r=r:r�r�r!r!r!r"r�s	.66)�out�	from_filecKs�|dkr|dkrtd��d}|dkr0t��}}tt|jf|�d�}|dk	r`|�|�|��n|dk	rtt||d�|dk	r�|�	�SdS)a3Convert XML to its C14N 2.0 serialised form.

    If *out* is provided, it must be a file or file-like object that receives
    the serialised canonical XML output (text, not bytes) through its ``.write()``
    method.  To write to a file, open it in text mode with encoding "utf-8".
    If *out* is not provided, this function returns the output as text string.

    Either *xml_data* (an XML string) or *from_file* (a file path or
    file-like object) must be provided as input.

    The configuration options are the same as for the ``C14NWriterTarget``.
    Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r�)
r�r�r�rrr�r�r�r	r�)Zxml_datarcrdZoptionsZsior�r!r!r"r�s


z	^\w+:\w+$c@s�eZdZdZdddddddd�dd�Zefdd�Zd	d
�Zddd�Zd
d�Z	dj
fdd�Zdd�Zdd�Z
ddd�Zdd�Zdd�Zdd�ZdS) ra�
    Canonicalization writer target for the XMLParser.

    Serialises parse events to XML C14N 2.0.

    The *write* function is used for writing out the resulting data stream
    as text (not bytes).  To write to a file, open it in text mode with encoding
    "utf-8" and pass its ``.write`` method.

    Configuration options:

    - *with_comments*: set to true to include comments
    - *strip_text*: set to true to strip whitespace before and after text content
    - *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}"
    - *qname_aware_tags*: a set of qname aware tag names in which prefixes
                          should be replaced in text content
    - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes
                           should be replaced in text content
    - *exclude_attrs*: a set of attribute names that should not be serialised
    - *exclude_tags*: a set of tag names that should not be serialised
    FN)�
with_comments�
strip_text�rewrite_prefixes�qname_aware_tags�qname_aware_attrs�
exclude_attrs�exclude_tagsc	Cs�||_g|_||_||_|r$t|�nd|_|r6t|�nd|_||_|rRt|�|_nd|_|rjt|�j	|_
nd|_
dgg|_g|_|s�|j�
tt����|j�
g�i|_dg|_d|_d|_d|_d|_dS)N)r�r�Fr)�_writer�_with_comments�_strip_textrc�_exclude_attrs�
_exclude_tags�_rewrite_prefixes�_qname_aware_tags�intersection�_find_qname_aware_attrs�_declared_ns_stack�	_ns_stackrJrir�re�_prefix_map�_preserve_space�_pending_start�
_root_seen�
_root_done�_ignored_depth)	r,r�rerfrgrhrirjrkr!r!r"r.�s2�zC14NWriterTarget.__init__ccs ||�D]}|r|EdHqdSr7r!)r,Zns_stackZ	_reversedrYr!r!r"�_iter_namespacessz!C14NWriterTarget._iter_namespacescCs\|�dd�\}}|�|j�D]$\}}||krd|�d|��Sqtd|�d|�d���dS)Nr�rr�r�zPrefix z of QName "�" is not declared in scope)�splitr}rvr�)r,Z
prefixed_namer�rSr��pr!r!r"�_resolve_prefix_names
z%C14NWriterTarget._resolve_prefix_namecCs�|dkr:|dd�dkr,|dd��dd�nd|f\}}n|}t�}|�|j�D]B\}}||kr�||kr�|rz|�d|��n|||fS|�|�qP|jr�||jkr�|j|}ndt|j���}|j|<|jd�||f�|�d|��||fS|�sd|k�r|||fS|�|j	�D]J\}}||k�r|jd�||f�|�rR|�d|��n|||fS�q|�st|||fSt
d|�d	���dS)
Nrr�r�r�r�r`r�zNamespace "r~)r�rcr}ru�addrqrwr8rJrvr�)r,r�r�r#Z
prefixes_seen�ur�r!r!r"�_qnames.2 


&
zC14NWriterTarget._qnamecCs|js|j�|�dSr7)r|rrJr'r!r!r"r�CszC14NWriterTarget.datar�cCs�||j�}|jdd�=|jr.|jds.|��}|jdk	rv|jd}|_|rVt|�rV|nd}|j||f��|dk	rvdS|r�|jr�|�t	|��dS�Nr�)
rrnrxr^ry�_looks_like_prefix_namer;rzrl�_escape_cdata_c14n)r,Z
_join_textr�r/�
qname_textr!r!r"r&Gs


zC14NWriterTarget._flushcCs0|jr
dS|jr|��|jd�||f�dSr�)r|rr&rvrJrUr!r!r"r2Us
zC14NWriterTarget.start_nscCs�|jdk	r,|js||jkr,|jd7_dS|jr:|��g}|j�|�|jdk	rn||jkrn|||f|_dS|�|||�dSr�)	rpr|rr&rurJrrryr;)r,r#r(�new_namespacesr!r!r"r)]s
��zC14NWriterTarget.startcs�jdk	r$|r$�fdd�|��D�}|h|�}i}|dk	rV��|�}||<|�|��jdk	r�|r���|�}|r�|D]0}	||	}
t|
�rv��|
�}||
<|�|�qvq�d}nd}�j��fdd�t|dd�d�D�}|r�dd�|D�}|��ng}|�rjt|���D]^\}
}|dk	�r@|
|k�r@||k�r@|||d	}||
\}}	}|�	|�r\|n|	|f��q
|�
d
�}�j�	|�r�|dkn�jd��j}|d
||d	�|�r�|d�
dd�|D���|d�|dk	�r�|t|||d	��d�_�j�	g�dS)Ncs i|]\}}|�jkr||�qSr!)ro��.0r�r�r0r!r"�
<dictcomp>ps
z+C14NWriterTarget._start.<locals>.<dictcomp>csi|]}|�|��qSr!r!)r�r`)�parse_qnamer!r"r��scSs|�dd�S)Nr�r)r)r`r!r!r"r��r�z)C14NWriterTarget._start.<locals>.<lambda>r�cSs$g|]\}}|rd|nd|f�qS)zxmlns:Zxmlnsr!)r�r�r�r!r!r"�
<listcomp>�s�z+C14NWriterTarget._start.<locals>.<listcomp>rz+{http://www.w3.org/XML/1998/namespace}spaceZpreserver�r�r�cSs&g|]\}}d|�dt|��d��qS)rpz="r�)�_escape_attrib_c14nr�r!r!r"r��sr�T)rorer�r�rtr�r�r��sortrJr`rxrlr$r�rzrv)r,r#r(r�r�r�Zresolved_namesr�ZqattrsZ	attr_namerbZ
parsed_qnamesrWr�r�Z
attr_qnamer�Zspace_behaviourr�r!)r�r,r"r;ns`


�
�

�
zC14NWriterTarget._startcCst|jr|jd8_dS|jr&|��|�d|�|�d�d��|j��t|j�dk|_|j	��|j
��dS)Nrr�rr�)r|rr&rlr�rxr*r8r{rurvrjr!r!r"r
�s

zC14NWriterTarget.endcCsd|js
dS|jrdS|jr&|�d�n|jr:|jr:|��|�dt|��d��|js`|�d�dS)Nr�z<!--z-->)rmr|r{rlrzrr&r�r%r!r!r"r,�szC14NWriterTarget.commentcCsp|jr
dS|jr|�d�n|jr0|jr0|��|�|rNd|�dt|��d�n
d|�d��|jsl|�d�dS)Nr�z<?rpz?>)r|r{rlrzrr&r�)r,rqr�r!r!r"r-�s$�zC14NWriterTarget.pi)N)N)rrrr r.�reversedr}r�r�r�r$r&r2r)r;r
r,r-r!r!r!r"r�s(�%
%
E
c	Cs|zVd|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}|WSttfk
rvt|�YnXdS)	Nr�r�r�r�r�r�r��&#xD;r�rrr!r!r"r��sr�c	Cs�z~d|kr|�dd�}d|kr*|�dd�}d|kr>|�dd�}d|krR|�dd�}d	|krf|�d	d
�}d|krz|�dd�}|WSttfk
r�t|�YnXdS)
Nr�r�r�r�r�r�r�z&#x9;r�z&#xA;r�r�r�rrr!r!r"r��s r�)rf)�_set_factories)N)N)N)NN)NN)N)NN)N)N)N)N)@r �__all__rr�r�r=r�r	Zcollections.abcr�r�rrr
rrrrrrr
r�contextmanagerr�r�r�r�rc�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrr�compile�UNICODEr�r�rr�r�rPZ_elementtreer�r5r!r!r!r"�<module>s�J�>

0s
3
=22�	�
��


05


zgPK��Z�b�2��-__pycache__/cElementTree.cpython-38.opt-1.pycnu�[���U

e5dR�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.8/xml/etree/cElementTree.py�<module>�PK��Z��J--/__pycache__/ElementInclude.cpython-38.opt-2.pycnu�[���U

e5d�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.8/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}t�|���}W5QRXn*|s6d}t|d|d��}|��}W5QRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsh|dkrt}d}|t|�k�rd||}|jtk�r4|�d�}|�dd�}|dkr�|||�}|dkrrtd||f��t�|�}|jr�|jp�d|j|_|||<n�|dk�r&||||�d��}|dkr�td||f��|r�||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rPtd|j��n
t
||�|d	}qdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsN


�



���
)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK��Z��J--/__pycache__/ElementInclude.cpython-38.opt-1.pycnu�[���U

e5d�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.8/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}t�|���}W5QRXn*|s6d}t|d|d��}|��}W5QRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsh|dkrt}d}|t|�k�rd||}|jtk�r4|�d�}|�dd�}|dkr�|||�}|dkrrtd||f��t�|�}|jr�|jp�d|j|_|||<n�|dk�r&||||�d��}|dkr�td||f��|r�||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rPtd|j��n
t
||�|d	}qdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsN


�



���
)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK��Z�%�'��)__pycache__/__init__.cpython-38.opt-1.pycnu�[���U

e5dD�@sdS)N�rrr�*/usr/lib64/python3.8/xml/etree/__init__.py�<module>�PK��Z�%�'��)__pycache__/__init__.cpython-38.opt-2.pycnu�[���U

e5dD�@sdS)N�rrr�*/usr/lib64/python3.8/xml/etree/__init__.py�<module>�PK��Z�r�� � ,__pycache__/ElementPath.cpython-38.opt-1.pycnu�[���U

e5d>3�@s�ddlZe�d�Zd"dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zeee	ee
ed�Z
iZGdd�d�Zd#dd�Zd$dd�Zd%dd�Zd&d d!�ZdS)'�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c		cs�|r|�d�nd}d}t�|�D]�}|\}}|r�|ddkr�d|kr�|�dd�\}}z"|s^t�|d|||ffVWq�tk
r�td|�d�Yq�Xn"|r�|s�|d||ffVn|Vd}q |V|d	k}q dS)
N�Fr�{�:�z{%s}%sz!prefix %r not found in prefix map�@)�get�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)	�pattern�
namespacesZdefault_namespaceZparsing_attribute�tokenZttype�tag�prefixZuri�r�-/usr/lib64/python3.8/xml/etree/ElementPath.py�xpath_tokenizerIs&rcCs>|j}|dkr:i|_}|j��D]}|D]}|||<q*q"|S�N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapas
rcCs |dd�dkp|dd�dkS)N��{*}����}*r�rrrr�_is_wildcard_tagksr"cs�tt���dkr"��fdd�}n��dkr:��fdd�}n��dd�dkr��dd��tt��d���dd�������fd	d�}nL�d
d�dkrƈdd��tdt��������fd
d�}ntd�����|S)Nz{*}*c3s |D]}�|j��r|VqdSrr!�r�result�elem��_isinstance�_strrr�selectusz_prepare_tag.<locals>.selectz{}*c3s0|D]&}|j}�|��r|ddkr|VqdS)Nrrr!�rr$r%Zel_tagr&rrr){srr�c3s8|D].}|j}|�ks,�|��r|��kr|VqdSrr!r*)r'r(�no_ns�suffixrrrr)�srr ���c3s0|D]&}|j}�|��r|��kr|VqdSrr!r*)r'r(�ns�ns_onlyrrr)�szinternal parser error, got )�
isinstance�str�slice�len�RuntimeError)rr)r)r'r(r,r/r0r-rr�_prepare_tagos 
r6csR|d�t��r&t����fdd�}n(�dd�dkrB�dd���fdd�}|S)Nrcsdd�}�|||��S)Ncss|D]}|EdHqdSrr)r$r%rrr�select_child�sz3prepare_child.<locals>.select.<locals>.select_childr�rr$r7��
select_tagrrr)�szprepare_child.<locals>.selectr+�{}c3s(|D]}|D]}|j�kr|VqqdSrr!�rr$r%rr!rrr)�s
)r"r6��nextrr)r�r:rr�
prepare_child�sr@cCsdd�}|S)Ncss|D]}|EdHqdSrrr#rrrr)�szprepare_star.<locals>.selectrr=rrr�prepare_star�srAcCsdd�}|S)Ncss|EdHdSrr)rr$rrrr)�szprepare_self.<locals>.selectrr=rrr�prepare_self�srBcs�z
|�}Wntk
r YdSX|ddkr4d�n|dsF|d�ntd��t��rlt����fdd�}n(�dd�dkr��dd���fd	d�}|S)
Nr�*rzinvalid descendantcsdd�}�|||��S)Ncss*|D] }|��D]}||k	r|VqqdSr�r)r$r%rrrrr7�sz8prepare_descendant.<locals>.select.<locals>.select_childrr8r9rrr)�sz"prepare_descendant.<locals>.selectr+r;c3s,|D]"}|���D]}||k	r|VqqdSrrDr<r!rrr)�s)�
StopIterationrr"r6r=rr?r�prepare_descendant�s 

rFcCsdd�}|S)Ncss@t|�}i}|D]*}||kr||}||krd||<|VqdSr)r)rr$rZ
result_mapr%�parentrrrr)�szprepare_parent.<locals>.selectrr=rrr�prepare_parent�s
rHcsLg}g}z
|�}Wntk
r(YdSX|ddkr8q�|dkrBq|drr|ddd�dkrrd|ddd�f}|�|dp�d�|�|d�qd	�|�}|d
kr�|d��fdd�}|S|d
kr�|d�|d���fdd�}|S|dk�rt�d|d��s|d��fdd�}|S|dk�sB|dk�rxt�d|d��sx|d�|d���rh��fdd�}n�fdd�}|S|dk�s�|dk�s�|dk�r@|dk�r�t|d�d��dk�r0td��nl|ddk�r�td��|dk�r,zt|d�d�Wntk
�rtd��YnX�dk�r0td��nd��fdd�}|Std��dS) Nr�])rrrz'"�'r.�-rz@-c3s"|D]}|���dk	r|VqdSr�rr#)�keyrrr)�sz!prepare_predicate.<locals>.selectz@-='c3s"|D]}|����kr|VqdSrrLr#)rM�valuerrr)sz\-?\d+$c3s"|D]}|���dk	r|VqdSr)�findr#r!rrr)sz.='z-='c3s:|D]0}|���D] }d�|����kr|VqqqdS�Nr)r	�join�itertextr<)rrNrrr)s
c3s&|D]}d�|����kr|VqdSrP)rQrRr#)rNrrr)sz-()z-()-zXPath position >= 1 expectedZlastzunsupported functionr+zunsupported expressionrz)XPath offset from last() must be negativec
3s^t|�}|D]L}z.||}t|�|j��}|�|kr<|VWqttfk
rVYqXqdSr)r�listr	r�
IndexErrorr)rr$rr%rGZelems)�indexrrr)5s
zinvalid predicate)rE�appendrQ�re�match�intr�
ValueError)r>rZ	signatureZ	predicater)r)rUrMrrNr�prepare_predicate�sj

&





r[)rrC�.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dSr)r)�selfrrrr�__init__Psz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr`rrrrr^Nsr^c
Csj|dd�dkr|d}|f}|r6|tt|����7}zt|}W�n�tk
�r@tt�dkrjt��|dd�dkr�td��tt	||��j
}z
|�}Wntk
r�YYdSXg}z|�t
|d||��Wntk
r�td�d�YnXz|�}|ddk�r|�}Wq�tk
�r0Y�q4Yq�Xq�|t|<YnX|g}t|�}|D]}	|	||�}�qT|S)	Nr.�/rC�drz#cannot use absolute path on elementrzinvalid path)�tuple�sorted�items�_cacherr4�clearrrr�__next__rErV�opsr^)
r%�pathrZ	cache_keyZselectorr>rr$rr)rrr�iterfindXsD


rncCstt|||�d�Sr)r>rn�r%rmrrrrrO�srOcCstt|||��Sr)rSrnrorrrr	�sr	cCs:ztt|||��}|jpdWStk
r4|YSXdSrP)r>rn�textrE)r%rm�defaultrrrr�findtext�s
rr)N)N)N)N)NN)rW�compilerrrr"r6r@rArBrFrHr[rlrir^rnrOr	rrrrrr�<module>;s4�

)
b�	

,

PK��Z�b�2��'__pycache__/cElementTree.cpython-38.pycnu�[���U

e5dR�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.8/xml/etree/cElementTree.py�<module>�PK��Z�r�� � ,__pycache__/ElementPath.cpython-38.opt-2.pycnu�[���U

e5d>3�@s�ddlZe�d�Zd"dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zeee	ee
ed�Z
iZGdd�d�Zd#dd�Zd$dd�Zd%dd�Zd&d d!�ZdS)'�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c		cs�|r|�d�nd}d}t�|�D]�}|\}}|r�|ddkr�d|kr�|�dd�\}}z"|s^t�|d|||ffVWq�tk
r�td|�d�Yq�Xn"|r�|s�|d||ffVn|Vd}q |V|d	k}q dS)
N�Fr�{�:�z{%s}%sz!prefix %r not found in prefix map�@)�get�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)	�pattern�
namespacesZdefault_namespaceZparsing_attribute�tokenZttype�tag�prefixZuri�r�-/usr/lib64/python3.8/xml/etree/ElementPath.py�xpath_tokenizerIs&rcCs>|j}|dkr:i|_}|j��D]}|D]}|||<q*q"|S�N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapas
rcCs |dd�dkp|dd�dkS)N��{*}����}*r�rrrr�_is_wildcard_tagksr"cs�tt���dkr"��fdd�}n��dkr:��fdd�}n��dd�dkr��dd��tt��d���dd�������fd	d�}nL�d
d�dkrƈdd��tdt��������fd
d�}ntd�����|S)Nz{*}*c3s |D]}�|j��r|VqdSrr!�r�result�elem��_isinstance�_strrr�selectusz_prepare_tag.<locals>.selectz{}*c3s0|D]&}|j}�|��r|ddkr|VqdS)Nrrr!�rr$r%Zel_tagr&rrr){srr�c3s8|D].}|j}|�ks,�|��r|��kr|VqdSrr!r*)r'r(�no_ns�suffixrrrr)�srr ���c3s0|D]&}|j}�|��r|��kr|VqdSrr!r*)r'r(�ns�ns_onlyrrr)�szinternal parser error, got )�
isinstance�str�slice�len�RuntimeError)rr)r)r'r(r,r/r0r-rr�_prepare_tagos 
r6csR|d�t��r&t����fdd�}n(�dd�dkrB�dd���fdd�}|S)Nrcsdd�}�|||��S)Ncss|D]}|EdHqdSrr)r$r%rrr�select_child�sz3prepare_child.<locals>.select.<locals>.select_childr�rr$r7��
select_tagrrr)�szprepare_child.<locals>.selectr+�{}c3s(|D]}|D]}|j�kr|VqqdSrr!�rr$r%rr!rrr)�s
)r"r6��nextrr)r�r:rr�
prepare_child�sr@cCsdd�}|S)Ncss|D]}|EdHqdSrrr#rrrr)�szprepare_star.<locals>.selectrr=rrr�prepare_star�srAcCsdd�}|S)Ncss|EdHdSrr)rr$rrrr)�szprepare_self.<locals>.selectrr=rrr�prepare_self�srBcs�z
|�}Wntk
r YdSX|ddkr4d�n|dsF|d�ntd��t��rlt����fdd�}n(�dd�dkr��dd���fd	d�}|S)
Nr�*rzinvalid descendantcsdd�}�|||��S)Ncss*|D] }|��D]}||k	r|VqqdSr�r)r$r%rrrrr7�sz8prepare_descendant.<locals>.select.<locals>.select_childrr8r9rrr)�sz"prepare_descendant.<locals>.selectr+r;c3s,|D]"}|���D]}||k	r|VqqdSrrDr<r!rrr)�s)�
StopIterationrr"r6r=rr?r�prepare_descendant�s 

rFcCsdd�}|S)Ncss@t|�}i}|D]*}||kr||}||krd||<|VqdSr)r)rr$rZ
result_mapr%�parentrrrr)�szprepare_parent.<locals>.selectrr=rrr�prepare_parent�s
rHcsLg}g}z
|�}Wntk
r(YdSX|ddkr8q�|dkrBq|drr|ddd�dkrrd|ddd�f}|�|dp�d�|�|d�qd	�|�}|d
kr�|d��fdd�}|S|d
kr�|d�|d���fdd�}|S|dk�rt�d|d��s|d��fdd�}|S|dk�sB|dk�rxt�d|d��sx|d�|d���rh��fdd�}n�fdd�}|S|dk�s�|dk�s�|dk�r@|dk�r�t|d�d��dk�r0td��nl|ddk�r�td��|dk�r,zt|d�d�Wntk
�rtd��YnX�dk�r0td��nd��fdd�}|Std��dS) Nr�])rrrz'"�'r.�-rz@-c3s"|D]}|���dk	r|VqdSr�rr#)�keyrrr)�sz!prepare_predicate.<locals>.selectz@-='c3s"|D]}|����kr|VqdSrrLr#)rM�valuerrr)sz\-?\d+$c3s"|D]}|���dk	r|VqdSr)�findr#r!rrr)sz.='z-='c3s:|D]0}|���D] }d�|����kr|VqqqdS�Nr)r	�join�itertextr<)rrNrrr)s
c3s&|D]}d�|����kr|VqdSrP)rQrRr#)rNrrr)sz-()z-()-zXPath position >= 1 expectedZlastzunsupported functionr+zunsupported expressionrz)XPath offset from last() must be negativec
3s^t|�}|D]L}z.||}t|�|j��}|�|kr<|VWqttfk
rVYqXqdSr)r�listr	r�
IndexErrorr)rr$rr%rGZelems)�indexrrr)5s
zinvalid predicate)rE�appendrQ�re�match�intr�
ValueError)r>rZ	signatureZ	predicater)r)rUrMrrNr�prepare_predicate�sj

&





r[)rrC�.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dSr)r)�selfrrrr�__init__Psz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr`rrrrr^Nsr^c
Csj|dd�dkr|d}|f}|r6|tt|����7}zt|}W�n�tk
�r@tt�dkrjt��|dd�dkr�td��tt	||��j
}z
|�}Wntk
r�YYdSXg}z|�t
|d||��Wntk
r�td�d�YnXz|�}|ddk�r|�}Wq�tk
�r0Y�q4Yq�Xq�|t|<YnX|g}t|�}|D]}	|	||�}�qT|S)	Nr.�/rC�drz#cannot use absolute path on elementrzinvalid path)�tuple�sorted�items�_cacherr4�clearrrr�__next__rErV�opsr^)
r%�pathrZ	cache_keyZselectorr>rr$rr)rrr�iterfindXsD


rncCstt|||�d�Sr)r>rn�r%rmrrrrrO�srOcCstt|||��Sr)rSrnrorrrr	�sr	cCs:ztt|||��}|jpdWStk
r4|YSXdSrP)r>rn�textrE)r%rm�defaultrrrr�findtext�s
rr)N)N)N)N)NN)rW�compilerrrr"r6r@rArBrFrHr[rlrir^rnrOr	rrrrrr�<module>;s4�

)
b�	

,

PK��Z�b�2��-__pycache__/cElementTree.cpython-38.opt-2.pycnu�[���U

e5dR�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.8/xml/etree/cElementTree.py�<module>�PK��Z��J--)__pycache__/ElementInclude.cpython-38.pycnu�[���U

e5d�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.8/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}t�|���}W5QRXn*|s6d}t|d|d��}|��}W5QRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsh|dkrt}d}|t|�k�rd||}|jtk�r4|�d�}|�dd�}|dkr�|||�}|dkrrtd||f��t�|�}|jr�|jp�d|j|_|||<n�|dk�r&||||�d��}|dkr�td||f��|r�||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rPtd|j��n
t
||�|d	}qdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsN


�



���
)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK��Z�%�'��#__pycache__/__init__.cpython-38.pycnu�[���U

e5dD�@sdS)N�rrr�*/usr/lib64/python3.8/xml/etree/__init__.py�<module>�PK��Z����RRcElementTree.pynu�[���# Deprecated alias for xml.etree.ElementTree

from xml.etree.ElementTree import *
PK��Z��<>3>3ElementPath.pynu�[���#
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl   created
# 2003-05-28 fl   added support for // etc
# 2003-08-27 fl   fixed parsing of periods in element names
# 2007-09-10 fl   new selection engine
# 2007-09-12 fl   fixed parent selector
# 2007-09-13 fl   added iterfind; changed findall to return a list
# 2007-11-30 fl   added namespaces support
# 2009-10-30 fl   added child element value filter
#
# Copyright (c) 2003-2009 by Fredrik Lundh.  All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware.com
#
# --------------------------------------------------------------------
# The ElementTree toolkit is
#
# Copyright (c) 1999-2009 by Fredrik Lundh
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and
# its associated documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice appears in
# all copies, and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of
# Secret Labs AB or the author not be used in advertising or publicity
# pertaining to distribution of the software without specific, written
# prior permission.
#
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# --------------------------------------------------------------------

# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.

##
# Implementation module for XPath support.  There's usually no reason
# to import this module directly; the <b>ElementTree</b> does this for
# you, if needed.
##

import re

xpath_tokenizer_re = re.compile(
    r"("
    r"'[^']*'|\"[^\"]*\"|"
    r"::|"
    r"//?|"
    r"\.\.|"
    r"\(\)|"
    r"[/.*:\[\]\(\)@=])|"
    r"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
    r"\s+"
    )

def xpath_tokenizer(pattern, namespaces=None):
    default_namespace = namespaces.get('') if namespaces else None
    parsing_attribute = False
    for token in xpath_tokenizer_re.findall(pattern):
        ttype, tag = token
        if tag and tag[0] != "{":
            if ":" in tag:
                prefix, uri = tag.split(":", 1)
                try:
                    if not namespaces:
                        raise KeyError
                    yield ttype, "{%s}%s" % (namespaces[prefix], uri)
                except KeyError:
                    raise SyntaxError("prefix %r not found in prefix map" % prefix) from None
            elif default_namespace and not parsing_attribute:
                yield ttype, "{%s}%s" % (default_namespace, tag)
            else:
                yield token
            parsing_attribute = False
        else:
            yield token
            parsing_attribute = ttype == '@'


def get_parent_map(context):
    parent_map = context.parent_map
    if parent_map is None:
        context.parent_map = parent_map = {}
        for p in context.root.iter():
            for e in p:
                parent_map[e] = p
    return parent_map


def _is_wildcard_tag(tag):
    return tag[:3] == '{*}' or tag[-2:] == '}*'


def _prepare_tag(tag):
    _isinstance, _str = isinstance, str
    if tag == '{*}*':
        # Same as '*', but no comments or processing instructions.
        # It can be a surprise that '*' includes those, but there is no
        # justification for '{*}*' doing the same.
        def select(context, result):
            for elem in result:
                if _isinstance(elem.tag, _str):
                    yield elem
    elif tag == '{}*':
        # Any tag that is not in a namespace.
        def select(context, result):
            for elem in result:
                el_tag = elem.tag
                if _isinstance(el_tag, _str) and el_tag[0] != '{':
                    yield elem
    elif tag[:3] == '{*}':
        # The tag in any (or no) namespace.
        suffix = tag[2:]  # '}name'
        no_ns = slice(-len(suffix), None)
        tag = tag[3:]
        def select(context, result):
            for elem in result:
                el_tag = elem.tag
                if el_tag == tag or _isinstance(el_tag, _str) and el_tag[no_ns] == suffix:
                    yield elem
    elif tag[-2:] == '}*':
        # Any tag in the given namespace.
        ns = tag[:-1]
        ns_only = slice(None, len(ns))
        def select(context, result):
            for elem in result:
                el_tag = elem.tag
                if _isinstance(el_tag, _str) and el_tag[ns_only] == ns:
                    yield elem
    else:
        raise RuntimeError(f"internal parser error, got {tag}")
    return select


def prepare_child(next, token):
    tag = token[1]
    if _is_wildcard_tag(tag):
        select_tag = _prepare_tag(tag)
        def select(context, result):
            def select_child(result):
                for elem in result:
                    yield from elem
            return select_tag(context, select_child(result))
    else:
        if tag[:2] == '{}':
            tag = tag[2:]  # '{}tag' == 'tag'
        def select(context, result):
            for elem in result:
                for e in elem:
                    if e.tag == tag:
                        yield e
    return select

def prepare_star(next, token):
    def select(context, result):
        for elem in result:
            yield from elem
    return select

def prepare_self(next, token):
    def select(context, result):
        yield from result
    return select

def prepare_descendant(next, token):
    try:
        token = next()
    except StopIteration:
        return
    if token[0] == "*":
        tag = "*"
    elif not token[0]:
        tag = token[1]
    else:
        raise SyntaxError("invalid descendant")

    if _is_wildcard_tag(tag):
        select_tag = _prepare_tag(tag)
        def select(context, result):
            def select_child(result):
                for elem in result:
                    for e in elem.iter():
                        if e is not elem:
                            yield e
            return select_tag(context, select_child(result))
    else:
        if tag[:2] == '{}':
            tag = tag[2:]  # '{}tag' == 'tag'
        def select(context, result):
            for elem in result:
                for e in elem.iter(tag):
                    if e is not elem:
                        yield e
    return select

def prepare_parent(next, token):
    def select(context, result):
        # FIXME: raise error if .. is applied at toplevel?
        parent_map = get_parent_map(context)
        result_map = {}
        for elem in result:
            if elem in parent_map:
                parent = parent_map[elem]
                if parent not in result_map:
                    result_map[parent] = None
                    yield parent
    return select

def prepare_predicate(next, token):
    # FIXME: replace with real parser!!! refs:
    # http://effbot.org/zone/simple-iterator-parser.htm
    # http://javascript.crockford.com/tdop/tdop.html
    signature = []
    predicate = []
    while 1:
        try:
            token = next()
        except StopIteration:
            return
        if token[0] == "]":
            break
        if token == ('', ''):
            # ignore whitespace
            continue
        if token[0] and token[0][:1] in "'\"":
            token = "'", token[0][1:-1]
        signature.append(token[0] or "-")
        predicate.append(token[1])
    signature = "".join(signature)
    # use signature to determine predicate type
    if signature == "@-":
        # [@attribute] predicate
        key = predicate[1]
        def select(context, result):
            for elem in result:
                if elem.get(key) is not None:
                    yield elem
        return select
    if signature == "@-='":
        # [@attribute='value']
        key = predicate[1]
        value = predicate[-1]
        def select(context, result):
            for elem in result:
                if elem.get(key) == value:
                    yield elem
        return select
    if signature == "-" and not re.match(r"\-?\d+$", predicate[0]):
        # [tag]
        tag = predicate[0]
        def select(context, result):
            for elem in result:
                if elem.find(tag) is not None:
                    yield elem
        return select
    if signature == ".='" or (signature == "-='" and not re.match(r"\-?\d+$", predicate[0])):
        # [.='value'] or [tag='value']
        tag = predicate[0]
        value = predicate[-1]
        if tag:
            def select(context, result):
                for elem in result:
                    for e in elem.findall(tag):
                        if "".join(e.itertext()) == value:
                            yield elem
                            break
        else:
            def select(context, result):
                for elem in result:
                    if "".join(elem.itertext()) == value:
                        yield elem
        return select
    if signature == "-" or signature == "-()" or signature == "-()-":
        # [index] or [last()] or [last()-index]
        if signature == "-":
            # [index]
            index = int(predicate[0]) - 1
            if index < 0:
                raise SyntaxError("XPath position >= 1 expected")
        else:
            if predicate[0] != "last":
                raise SyntaxError("unsupported function")
            if signature == "-()-":
                try:
                    index = int(predicate[2]) - 1
                except ValueError:
                    raise SyntaxError("unsupported expression")
                if index > -2:
                    raise SyntaxError("XPath offset from last() must be negative")
            else:
                index = -1
        def select(context, result):
            parent_map = get_parent_map(context)
            for elem in result:
                try:
                    parent = parent_map[elem]
                    # FIXME: what if the selector is "*" ?
                    elems = list(parent.findall(elem.tag))
                    if elems[index] is elem:
                        yield elem
                except (IndexError, KeyError):
                    pass
        return select
    raise SyntaxError("invalid predicate")

ops = {
    "": prepare_child,
    "*": prepare_star,
    ".": prepare_self,
    "..": prepare_parent,
    "//": prepare_descendant,
    "[": prepare_predicate,
    }

_cache = {}

class _SelectorContext:
    parent_map = None
    def __init__(self, root):
        self.root = root

# --------------------------------------------------------------------

##
# Generate all matching objects.

def iterfind(elem, path, namespaces=None):
    # compile selector pattern
    if path[-1:] == "/":
        path = path + "*" # implicit all (FIXME: keep this?)

    cache_key = (path,)
    if namespaces:
        cache_key += tuple(sorted(namespaces.items()))

    try:
        selector = _cache[cache_key]
    except KeyError:
        if len(_cache) > 100:
            _cache.clear()
        if path[:1] == "/":
            raise SyntaxError("cannot use absolute path on element")
        next = iter(xpath_tokenizer(path, namespaces)).__next__
        try:
            token = next()
        except StopIteration:
            return
        selector = []
        while 1:
            try:
                selector.append(ops[token[0]](next, token))
            except StopIteration:
                raise SyntaxError("invalid path") from None
            try:
                token = next()
                if token[0] == "/":
                    token = next()
            except StopIteration:
                break
        _cache[cache_key] = selector
    # execute selector pattern
    result = [elem]
    context = _SelectorContext(elem)
    for select in selector:
        result = select(context, result)
    return result

##
# Find first matching object.

def find(elem, path, namespaces=None):
    return next(iterfind(elem, path, namespaces), None)

##
# Find all matching objects.

def findall(elem, path, namespaces=None):
    return list(iterfind(elem, path, namespaces))

##
# Find text for first matching object.

def findtext(elem, path, default=None, namespaces=None):
    try:
        elem = next(iterfind(elem, path, namespaces))
        return elem.text or ""
    except StopIteration:
        return default
PK��Z�V�ElementInclude.pynu�[���#
# ElementTree
# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xinclude support for element trees
#
# history:
# 2003-08-15 fl   created
# 2003-11-14 fl   fixed default loader
#
# Copyright (c) 2003-2004 by Fredrik Lundh.  All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware.com
#
# --------------------------------------------------------------------
# The ElementTree toolkit is
#
# Copyright (c) 1999-2008 by Fredrik Lundh
#
# By obtaining, using, and/or copying this software and/or its
# associated documentation, you agree that you have read, understood,
# and will comply with the following terms and conditions:
#
# Permission to use, copy, modify, and distribute this software and
# its associated documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice appears in
# all copies, and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of
# Secret Labs AB or the author not be used in advertising or publicity
# pertaining to distribution of the software without specific, written
# prior permission.
#
# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
# ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# --------------------------------------------------------------------

# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.

##
# Limited XInclude support for the ElementTree package.
##

import copy
from . import ElementTree

XINCLUDE = "{http://www.w3.org/2001/XInclude}"

XINCLUDE_INCLUDE = XINCLUDE + "include"
XINCLUDE_FALLBACK = XINCLUDE + "fallback"

##
# Fatal include error.

class FatalIncludeError(SyntaxError):
    pass

##
# Default loader.  This loader reads an included resource from disk.
#
# @param href Resource reference.
# @param parse Parse mode.  Either "xml" or "text".
# @param encoding Optional text encoding (UTF-8 by default for "text").
# @return The expanded resource.  If the parse mode is "xml", this
#    is an ElementTree instance.  If the parse mode is "text", this
#    is a Unicode string.  If the loader fails, it can return None
#    or raise an OSError exception.
# @throws OSError If the loader fails to load the resource.

def default_loader(href, parse, encoding=None):
    if parse == "xml":
        with open(href, 'rb') as file:
            data = ElementTree.parse(file).getroot()
    else:
        if not encoding:
            encoding = 'UTF-8'
        with open(href, 'r', encoding=encoding) as file:
            data = file.read()
    return data

##
# Expand XInclude directives.
#
# @param elem Root element.
# @param loader Optional resource loader.  If omitted, it defaults
#     to {@link default_loader}.  If given, it should be a callable
#     that implements the same interface as <b>default_loader</b>.
# @throws FatalIncludeError If the function fails to include a given
#     resource, or if the tree contains malformed XInclude elements.
# @throws OSError If the function fails to load a given resource.

def include(elem, loader=None):
    if loader is None:
        loader = default_loader
    # look for xinclude elements
    i = 0
    while i < len(elem):
        e = elem[i]
        if e.tag == XINCLUDE_INCLUDE:
            # process xinclude directive
            href = e.get("href")
            parse = e.get("parse", "xml")
            if parse == "xml":
                node = loader(href, parse)
                if node is None:
                    raise FatalIncludeError(
                        "cannot load %r as %r" % (href, parse)
                        )
                node = copy.copy(node)
                if e.tail:
                    node.tail = (node.tail or "") + e.tail
                elem[i] = node
            elif parse == "text":
                text = loader(href, parse, e.get("encoding"))
                if text is None:
                    raise FatalIncludeError(
                        "cannot load %r as %r" % (href, parse)
                        )
                if i:
                    node = elem[i-1]
                    node.tail = (node.tail or "") + text + (e.tail or "")
                else:
                    elem.text = (elem.text or "") + text + (e.tail or "")
                del elem[i]
                continue
            else:
                raise FatalIncludeError(
                    "unknown parse type in xi:include tag (%r)" % parse
                )
        elif e.tag == XINCLUDE_FALLBACK:
            raise FatalIncludeError(
                "xi:fallback tag must be child of xi:include (%r)" % e.tag
                )
        else:
            include(e, loader)
        i = i + 1
PK�e�Z��xr)__pycache__/ElementInclude.cpython-36.pycnu�[���3


 \�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}tj|�j�}WdQRXn*|s6d}t|d|d��}|j�}WdQRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsp|dkrt}d}�xX|t|�k�rj||}|jtk�r:|jd�}|jdd�}|dkr�|||�}|dkrvtd||f��tj|�}|jr�|jp�d|j|_|||<n�|dk�r,||||jd��}|dkr�td||f��|�r||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rVtd|j��n
t
||�|d	}qWdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsF





)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK�e�Z�Ib}��&__pycache__/ElementPath.cpython-36.pycnu�[���3


 \�&�@s�ddlZejd�Zddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
eeee	ee
d�ZiZGdd�d�Z
ddd�Zd dd�Zd!dd�Zd"dd�ZdS)#�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�y6|jdd�\}}|sJt�|dd|||ffVWq�tk
r�td|��Yq�Xq|VqWdS)N�r�{�:z{%s}%sz!prefix %r not found in prefix map)�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)�pattern�
namespaces�token�tag�prefixZuri�r�-/usr/lib64/python3.6/xml/etree/ElementPath.py�xpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jj�D]}x|D]}|||<q.Wq$W|S)N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapWs

rcs|d��fdd�}|S)Nrc3s0x*|D]"}x|D]}|j�kr|VqWqWdS)N)r
)r�result�elemr)r
rr�selectbs


zprepare_child.<locals>.selectr)�nextrrr)r
r�
prepare_child`srcCsdd�}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs
zprepare_star.<locals>.selectr)rrrrrr�prepare_starisrcCsdd�}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self.<locals>.selectr)rrrrrr�prepare_selfosrcs\y
|�}Wntk
rdSX|ddkr2d�n|dsD|d�ntd���fdd�}|S)Nr�*rzinvalid descendantc3s4x.|D]&}x |j��D]}||k	r|VqWqWdS)N)r)rrrr)r
rrrs
z"prepare_descendant.<locals>.select)�
StopIterationr	)rrrr)r
r�prepare_descendantts

r"cCsdd�}|S)NcssDt|�}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ
result_mapr�parentrrrr�s
zprepare_parent.<locals>.selectr)rrrrrr�prepare_parent�s
r$cs*g}g}x�y
|�}Wntk
r(dSX|ddkr8P|drh|ddd�dkrhd|ddd�f}|j|dpvd�|j|d�q
Wdj|�}|dkr�|d��fd	d
�}|S|dkr�|d�|d���fdd
�}|S|dk�rtjd
|d��r|d��fdd
�}|S|dk�rVtjd
|d��rV|d�|d���fdd
�}|S|dk�st|dk�st|dk�r|dk�r�t|d�d��dk�rtd��nl|ddk�r�td��|dk�r
yt|d�d�Wntk
�r�td��YnX�dk�rtd��nd��fdd
�}|Std��dS) Nr�]rz'"�'�-�z@-c3s&x |D]}|j��dk	r|VqWdS)N)�get)rrr)�keyrrr�s
z!prepare_predicate.<locals>.selectz@-='c3s&x |D]}|j���kr|VqWdS)N)r))rrr)r*�valuerrr�s
z\-?\d+$c3s&x |D]}|j��dk	r|VqWdS)N)�find)rrr)r
rrr�s
z-='c3s@x:|D]2}x,|j��D]}dj|j���kr|VPqWqWdS)Nr()r�joinZitertext)rrrr)r
r+rrr�s

z-()z-()-zXPath position >= 1 expectedZlastzunsupported function�zunsupported expressionz)XPath offset from last() must be negativec
3sbt|�}xT|D]L}y.||}t|j|j��}|�|kr>|VWqttfk
rXYqXqWdS)N)r�listrr
�
IndexErrorr)rrrrr#Zelems)�indexrrr�s

zinvalid predicate���r2r2���r2)r!�appendr-�re�match�intr	�
ValueError)rrZ	signatureZ	predicaterr)r1r*r
r+r�prepare_predicate�sd







r9)r(r �.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dS)N)r)�selfrrrr�__init__�sz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr>rrrrr<�sr<c
!Csh||dkrdntt|j���f}|dd�dkr8|d}yt|}Wn�tk
�r:tt�dkrjtj�|dd�dkr�td��tt	||��j
}y
|�}Wntk
r�dSXg}xvy|jt
|d||��Wntk
r�td��YnXy|�}|ddk�r|�}Wq�tk
�r(PYq�Xq�W|t|<YnX|g}t|�}x|D]}	|	||�}�qPW|S)	Nr�/r �dz#cannot use absolute path on elementrzinvalid pathr2)�tuple�sorted�items�_cacher�len�clearr	rr�__next__r!r4�opsr<)
r�pathrZ	cache_keyZselectorrrrrrrrr�iterfindsD


rMcCstt|||�d�S)N)rrM)rrLrrrrr,)sr,cCstt|||��S)N)r/rM)rrLrrrrr/srcCs4ytt|||��}|jpdStk
r.|SXdS)Nr()rrM�textr!)rrL�defaultrrrr�findtext5s

rP)N)N)N)N)NN)r5�compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr�<module>;s,
		
Y

)

PK�e�Z�A�3}})__pycache__/__init__.cpython-36.opt-2.pycnu�[���3


 \D�@sdS)N�rrr�*/usr/lib64/python3.6/xml/etree/__init__.py�<module>sPK�e�ZtH������,__pycache__/ElementTree.cpython-36.opt-1.pycnu�[���3


 \���@sHdZddddddddd	d
ddd
ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl	m
Z
Gdd
�d
e�Zdd�Z
Gdd�d�Zifd d�Zd^d!d�Zd_d"d�ZeZGd#d
�d
�ZGd$d�d�Zejd%d&��Zd`d'd(�Zd)d*�ZdaZyee�ZWnek
�r"YnXd8d9�Zd:d;�Zeeed<�Zd=d�Zd>d?d@dAdBdCdDdE�Z e e_ dFdG�Z!dHdI�Z"dJdK�Z#dLdM�Z$dbdNdO�dPd�Z%GdQdR�dRej&�Z'dcdNdO�dSd�Z(dTd�Z)dddUd	�Z*dedVd�Z+GdWd�d�Z,dfdXd�Z-dgdYd�Z.e-Z/dhdZd�Z0Gd[d�d�Z1Gd\d�d�Z2yeZ3dd]l4TWne5k
�rBYnXdS)iaLightweight XML support for Python.

 XML is an inherently hierarchical data format, and the most natural way to
 represent it is with a tree.  This module has two classes for this purpose:

    1. ElementTree represents the whole XML document as a tree and

    2. Element represents a single node in this tree.

 Interactions with the whole document (reading and writing to/from files) are
 usually done on the ElementTree level.  Interactions with a single XML element
 and its sub-elements are done on the Element level.

 Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:

    'tag' - a string containing the element's name.

    'attributes' - a Python dictionary storing the element's attributes.

    'text' - a string containing the element's text content.

    'tail' - an optional string containing text after the element's end tag.

    And a number of child elements stored in a Python sequence.

 To create an element instance, use the Element constructor,
 or the SubElement factory function.

 You can also use the ElementTree class to wrap an element structure
 and convert it to and from XML.

�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespacez1.3.0�N�)�ElementPathc@seZdZdZdS)r
z�An error when parsing an XML document.

    In addition to its exception value, a ParseError contains
    two extra attributes:
        'code'     - the specific exception code
        'position' - the line and column of the error

    N)�__name__�
__module__�__qualname__�__doc__�rr�-/usr/lib64/python3.6/xml/etree/ElementTree.pyr
hscCs
t|d�S)z2Return True if *element* appears to be an Element.�tag)�hasattr)�elementrrr rvsc@s
eZdZdZdZdZdZdZifdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd9d!d"�Zd:d#d$�Zd;d%d&�Zd<d'd(�Zd)d*�Zd=d+d,�Zd-d.�Zd/d0�Zd1d2�Zd>d3d4�Z d?d5d6�Z!d7d8�Z"dS)@rahAn XML element.

    This class is the reference implementation of the Element interface.

    An element's length is its number of subelements.  That means if you
    want to check if an element is truly empty, you should check BOTH
    its length AND its text attribute.

    The element tag, attribute names, and attribute values can be either
    bytes or strings.

    *tag* is the element name.  *attrib* is an optional dictionary containing
    element attributes. *extra* are additional element attributes given as
    keyword arguments.

    Example form:
        <tag attrib>text<child/>...</tag>tail

    NcKsDt|t�std|jjf��|j�}|j|�||_||_g|_	dS)Nzattrib must be dict, not %s)
�
isinstance�dict�	TypeError�	__class__r�copy�updater!�attrib�	_children)�selfr!r*�extrarrr �__init__�s

zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r'rr!�id)r,rrr �__repr__�szElement.__repr__cCs|j||�S)z�Create a new element with the same type.

        *tag* is a string containing the element name.
        *attrib* is a dictionary containing the element attributes.

        Do not call this method, use the SubElement factory function instead.

        )r')r,r!r*rrr �makeelement�s	zElement.makeelementcCs0|j|j|j�}|j|_|j|_||dd�<|S)z�Return copy of current element.

        This creates a shallow copy. Subelements will be shared with the
        original tree.

        N)r1r!r*�text�tail)r,�elemrrr r(�s
zElement.copycCs
t|j�S)N)�lenr+)r,rrr �__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.�)�
stacklevelr)�warnings�warn�
FutureWarningr5r+)r,rrr �__bool__�s
zElement.__bool__cCs
|j|S)N)r+)r,�indexrrr �__getitem__�szElement.__getitem__cCs||j|<dS)N)r+)r,r=r#rrr �__setitem__�szElement.__setitem__cCs|j|=dS)N)r+)r,r=rrr �__delitem__�szElement.__delitem__cCs|j|�|jj|�dS)aAdd *subelement* to the end of this element.

        The new element will appear in document order after the last existing
        subelement (or directly after the text, if it's the first subelement),
        but before the end tag for this element.

        N)�_assert_is_elementr+�append)r,�
subelementrrr rB�s
zElement.appendcCs(x|D]}|j|�qW|jj|�dS)zkAppend subelements from a sequence.

        *elements* is a sequence with zero or more elements.

        N)rAr+�extend)r,�elementsr#rrr rD�s
zElement.extendcCs|j|�|jj||�dS)z(Insert *subelement* at position *index*.N)rAr+�insert)r,r=rCrrr rF�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r$�_Element_Pyr&�typer)r,�errr rA�s
zElement._assert_is_elementcCs|jj|�dS)a�Remove matching subelement.

        Unlike the find methods, this method compares elements based on
        identity, NOT ON tag value or contents.  To remove subelements by
        other means, the easiest way is to use a list comprehension to
        select what elements to keep, and then use slice assignment to update
        the parent element.

        ValueError is raised if a matching element could not be found.

        N)r+�remove)r,rCrrr rJs
zElement.removecCstjdtdd�|jS)z`(Deprecated) Return all subelements.

        Elements are returned in document order.

        zaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r7)r8)r9r:�DeprecationWarningr+)r,rrr �getchildrens
zElement.getchildrencCstj|||�S)aFind first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        )r�find)r,�path�
namespacesrrr rM!s	zElement.findcCstj||||�S)a�Find text for first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *default* is the value to return if the element was not found,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return text content of first matching element, or default value if
        none was found.  Note that if an element is found having no text
        content, the empty string is returned.

        )r�findtext)r,rN�defaultrOrrr rP,szElement.findtextcCstj|||�S)aFind all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Returns list containing all matching elements in document order.

        )r�findall)r,rNrOrrr rR:s	zElement.findallcCstj|||�S)a Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        )r�iterfind)r,rNrOrrr rSEs	zElement.iterfindcCs |jj�g|_d|_|_dS)z�Reset element.

        This function removes all subelements, clears all attributes, and sets
        the text and tail attributes to None.

        N)r*�clearr+r2r3)r,rrr rTPs
z
Element.clearcCs|jj||�S)agGet element attribute.

        Equivalent to attrib.get, but some implementations may handle this a
        bit more efficiently.  *key* is what attribute to look for, and
        *default* is what to return if the attribute was not found.

        Returns a string containing the attribute value, or the default if
        attribute was not found.

        )r*�get)r,�keyrQrrr rU[szElement.getcCs||j|<dS)z�Set element attribute.

        Equivalent to attrib[key] = value, but some implementations may handle
        this a bit more efficiently.  *key* is what attribute to set, and
        *value* is the attribute value to set it to.

        N)r*)r,rV�valuerrr �sethszElement.setcCs
|jj�S)z�Get list of attribute names.

        Names are returned in an arbitrary order, just like an ordinary
        Python dict.  Equivalent to attrib.keys()

        )r*�keys)r,rrr rYrszElement.keyscCs
|jj�S)z�Get element attributes as a sequence.

        The attributes are returned in arbitrary order.  Equivalent to
        attrib.items().

        Return a list of (name, value) tuples.

        )r*�items)r,rrr rZ{s	z
Element.itemsccsH|dkrd}|dks|j|kr$|Vx|jD]}|j|�EdHq,WdS)aCreate tree iterator.

        The iterator loops over the element and all subelements in document
        order, returning all elements with a matching tag.

        If the tree structure is modified during iteration, new or removed
        elements may or may not be included.  To get a stable set, use the
        list() function on the iterator, and loop over the resulting list.

        *tag* is what tags to look for (default is to return all elements)

        Return an iterator containing all the matching elements.

        �*N)r!r+�iter)r,r!rIrrr r\�szElement.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:�PendingDeprecationWarning�listr\)r,r!rrr �getiterator�s
zElement.getiteratorccs^|j}t|t�r|dk	rdS|j}|r.|Vx*|D]"}|j�EdH|j}|r4|Vq4WdS)z�Create text iterator.

        The iterator loops over the element and all subelements in document
        order, returning all inner text.

        N)r!r$�strr2�itertextr3)r,r!�trIrrr ra�s
zElement.itertext)N)NN)N)N)N)N)N)#rrrrr!r*r2r3r.r0r1r(r6r<r>r?r@rBrDrFrArJrLrMrPrRrSrTrUrXrYrZr\r_rarrrr r{s@	









	

	cKs,|j�}|j|�|j||�}|j|�|S)a�Subelement factory which creates an element instance, and appends it
    to an existing parent.

    The element tag, attribute names, and attribute values can be either
    bytes or Unicode strings.

    *parent* is the parent element, *tag* is the subelements name, *attrib* is
    an optional directory containing element attributes, *extra* are
    additional attributes given as keyword arguments.

    )r(r)r1rB)�parentr!r*r-r#rrr r�s


cCstt�}||_|S)z�Comment element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *text* is a string containing the comment string.

    )rrr2)r2r#rrr r�s	cCs&tt�}||_|r"|jd||_|S)a*Processing Instruction element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *target* is a string containing the processing instruction, *text* is a
    string containing the processing instruction contents, if any.

    � )rrr2)�targetr2r#rrr r�s

c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)r
a�Qualified name wrapper.

    This class can be used to wrap a QName attribute value in order to get
    proper namespace handing on output.

    *text_or_uri* is a string containing the QName value either in the form
    {uri}local, or if the tag argument is given, the URI part of a QName.

    *tag* is an optional argument which if given, will make the first
    argument (text_or_uri) be interpreted as a URI, and this argument (tag)
    be interpreted as a local name.

    NcCs|rd||f}||_dS)Nz{%s}%s)r2)r,Ztext_or_urir!rrr r.�szQName.__init__cCs|jS)N)r2)r,rrr �__str__sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r'rr2)r,rrr r0szQName.__repr__cCs
t|j�S)N)�hashr2)r,rrr �__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,�otherrrr �__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__lt__
s
zQName.__lt__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__eq__s
zQName.__eq__)N)
rrrrr.rfr0rhrjrkrlrmrnrrrr r
�s

c@s�eZdZdZddd�Zdd�Zdd�Zdd	d
�Zddd�Zd d
d�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�Z
d%dd�dd�Zdd�ZdS)&ra%An XML element hierarchy.

    This class also provides support for serialization to and from
    standard XML.

    *element* is an optional root element node,
    *file* is an optional file handle or file name of an XML file whose
    contents will be used to initialize the tree with.

    NcCs||_|r|j|�dS)N)�_rootr	)r,r#�filerrr r.)szElementTree.__init__cCs|jS)z!Return root element of this tree.)ro)r,rrr �getroot/szElementTree.getrootcCs
||_dS)z�Replace root element of this tree.

        This will discard the current contents of the tree and replace it
        with the given element.  Use with care!

        N)ro)r,r#rrr �_setroot3szElementTree._setrootc
Cs�d}t|d�st|d�}d}zZ|dkrHt�}t|d�rH|j|�|_|jSx|jd�}|sZP|j|�qJW|j�|_|jS|r�|j�XdS)a=Load external XML document into element tree.

        *source* is a file name or file object, *parser* is an optional parser
        instance that defaults to XMLParser.

        ParseError is raised if the parser fails to parse the document.

        Returns the root element of the given source document.

        F�read�rbTN�_parse_wholei)r"�openrrurors�feed�close)r,�source�parser�close_source�datarrr r	=s&




zElementTree.parsecCs|jj|�S)z�Create and return tree iterator for the root element.

        The iterator loops over all elements in this tree, in document order.

        *tag* is a string with the tag name to iterate over
        (default is to return all elements).

        )ror\)r,r!rrr r\bs
zElementTree.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r7)r8)r9r:r]r^r\)r,r!rrr r_os
zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)a\Find first matching element by tag name or path.

        Same as getroot().find(path), which is Element.find()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorM)r,rNrOrrr rMxs
zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|jj|||�S)aeFind first matching element by tag name or path.

        Same as getroot().findtext(path),  which is Element.findtext()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorP)r,rNrQrOrrr rP�s
zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)aaFind all matching subelements by tag name or path.

        Same as getroot().findall(path), which is Element.findall().

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return list containing all matching elements in document order.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorR)r,rNrOrrr rR�s
zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)agFind all matching subelements by tag name or path.

        Same as getroot().iterfind(path), which is element.iterfind()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorS)r,rNrOrrr rS�s
zElementTree.iterfindT)�short_empty_elementscCs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|j�}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�ddl}
|
j�}	|d	|	f�|d
kr�t||j�n,t|j|�\}}t|}
|
||j|||d�WdQRXdS)
a�Write element tree to a file as XML.

        Arguments:
          *file_or_filename* -- file name or a file object opened for writing

          *encoding* -- the output encoding (default: US-ASCII)

          *xml_declaration* -- bool indicating if an XML declaration should be
                               added to the output. If None, an XML declaration
                               is added if encoding IS NOT either of:
                               US-ASCII, UTF-8, or Unicode

          *default_namespace* -- sets the default XML namespace (for "xmlns")

          *method* -- either "xml" (default), "html, "text", or "c14n"

          *short_empty_elements* -- controls the formatting of elements
                                    that contain no content. If True (default)
                                    they are emitted as a single self-closed
                                    tag, otherwise they are emitted as a pair
                                    of start/end tags

        �xmlzunknown method %r�c14n�utf-8�us-asciiN�unicoderz$<?xml version='1.0' encoding='%s'?>
r2)r)r�r�r�)	�
_serialize�
ValueError�lower�_get_writer�locale�getpreferredencoding�_serialize_textro�_namespaces)r,�file_or_filename�encodingZxml_declaration�default_namespace�methodrZ	enc_lower�writeZdeclared_encodingr��qnamesrOZ	serializerrr r��s2
zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,rprrr �
write_c14n
szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr	r\r_rMrPrRrSr�r�rrrr rs"



%

	



5ccs"y
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVWdQRXYn�X|dkrl|Vn�tj���}t|tj�r�|}nft|tj�r�tj	|�}|j
|j�nBtj�}dd�|_||_y|j
|_
|j|_Wntk
r�YnXtj||ddd�}|j
|j�|jVWdQRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS)NTrrrrr �<lambda>3sz_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorrv�
contextlib�	ExitStackr$�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�rp�stackrrr r�s>



r�csddi�i��rd��<���fdd�}x�|j�D]�}|j}t|t�r\|j�kr�||j�n<t|t�rx|�kr�||�n |dk	r�|tk	r�|tk	r�t|�xR|j	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�W|j}t|t�r2|j�kr2||j�q2W��fS)N�cs�y�|dd�dkr�|dd�jdd�\}}�j|�}|dkrjtj|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitrU�_namespace_mapr5r�r&�_raise_serialization_error)Zqname�urir!�prefix)r�rOr�rr �	add_qnamePs&


z_namespaces.<locals>.add_qname)
r\r!r$r
r2r`rrr�rZ)r4r�r�r!rVrWr2r)r�rOr�r r�Es4




r�cKs�|j}|j}|tkr$|d|��n�|tkr<|d|��nv||}|dkr�|r\|t|��x|D]}t|||d|d�qbW�n2|d|�t|j��}	|	s�|�rD|r�x@t|j�dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�WxZt|	�D]N\}}
t
|t��r|j}t
|
t��r$||
j}
nt	|
�}
|d
|||
f�q�W|�s\t|��s\|�r�|d�|�rv|t|��x |D]}t|||d|d��q|W|d|d�n|d
�|j
�r�|t|j
��dS)Nz	<!--%s-->z<?%s?>)r�<cSs|dS)Nrr)�xrrr r��sz _serialize_xml.<locals>.<lambda>)rV�:z
 xmlns%s="%s"z %s="%s"�>z</z />)r!r2rr�
_escape_cdata�_serialize_xmlr^rZ�sorted�_escape_attribr$r
r5r3)r�r4r�rOr�kwargsr!r2rIrZ�v�krrr r��sT





r��area�base�basefont�br�col�frame�hr�img�input�isindex�link�meta�paramcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���n|||}|dkr�|rd|t|��x|D]}t|||d�qjW�n<|d|�t|j��}|s�|�rH|r�x@t|j�dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�WxZt|�D]N\}
}	t
|
t��r|
j}
t
|	t��r(||	j}	nt|	�}	|d	||
|	f�q�W|d
�|j
�}|�r�|dk�sr|dk�r|||�n|t|��x|D]}t|||d��q�W|tk�r�|d
|d
�|j�r�|t|j��dS)Nz	<!--%s-->z<?%s?>r�cSs|dS)Nrr)r�rrr r��sz!_serialize_html.<locals>.<lambda>)rVr�z
 xmlns%s="%s"z %s="%s"r�ZscriptZstylez</)r!r2rr�r�_serialize_htmlr^rZr�r�r$r
�_escape_attrib_htmlr��
HTML_EMPTYr3)r�r4r�rOr�r!r2rIrZr�r�Zltagrrr r��sT





r�cCs.x|j�D]}||�q
W|jr*||j�dS)N)rar3)r�r4�partrrr r��sr�)r��htmlr2cCsPtjd|�rtd��x.ttj��D]\}}||ks:||kr"t|=q"W|t|<dS)atRegister a namespace prefix.

    The registry is global, and any existing mapping for either the
    given prefix or the namespace URI will be removed.

    *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
    attributes in this namespace will be serialized with prefix if possible.

    ValueError is raised if prefix is reserved or is invalid.

    zns\d+$z'Prefix format reserved for internal useN)�re�matchr�r^r�rZ)r�r�r�r�rrr r�s
r�r�ZrdfZwsdlZxsZxsiZdc)z$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r&rHr)r2rrr r�sr�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)N�&z&amp;r�z&lt;r�z&gt;)�replacer&r�r�)r2rrr r�$sr�cCs�y�d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}d|krR|jdd�}d	|krf|jd	d
�}d|krz|jdd
�}d
|kr�|jd
d�}d
|kr�|jd
d�}|Sttfk
r�t|�YnXdS)Nr�z&amp;r�z&lt;r�z&gt;�"z&quot;z
r��
z&#10;�	z&#09;)r�r&r�r�)r2rrr r�4s(r�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)Nr�z&amp;r�z&gt;r�z&quot;)r�r&r�r�)r2rrr r�Psr�T)rcCs6|dkrtj�ntj�}t|�j||||d�|j�S)a�Generate string representation of XML element.

    All subelements are included.  If encoding is "unicode", a string
    is returned. Otherwise a bytestring is returned.

    *element* is an Element instance, *encoding* is an optional output
    encoding defaulting to US-ASCII, *method* is an optional output which can
    be one of "xml" (default), "html", "text" or "c14n".

    Returns an (optionally) encoded string containing the XML data.

    r�)r�r)r��StringIO�BytesIOrr��getvalue)r#r�r�r�streamrrr r_sc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs
||_dS)N)�lst)r,r�rrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr r�wsz_ListDataStream.writablecCsdS)NTr)r,rrr r�zsz_ListDataStream.seekablecCs|jj|�dS)N)r�rB)r,�brrr r�}sz_ListDataStream.writecCs
t|j�S)N)r5r�)r,rrr r��sz_ListDataStream.tellN)	rrrrr.r�r�r�r�rrrr r�rsr�cCs&g}t|�}t|�j||||d�|S)N)r�r)r�rr�)r#r�r�rr�r�rrr r�s
cCsNt|t�st|�}|jtjdd�|j�j}|s>|ddkrJtjjd�dS)a#Write element tree or element structure to sys.stdout.

    This function should be used for debugging only.

    *elem* is either an ElementTree, or a single Element.  The exact output
    format is implementation dependent.  In this version, it's written as an
    ordinary XML file.

    r�)r�rr�N���)r$rr��sys�stdoutrqr3)r4r3rrr r�s

cCst�}|j||�|S)z�Parse XML document into element tree.

    *source* is a filename or file object containing XML data,
    *parser* is an optional parser instance defaulting to XMLParser.

    Return an ElementTree instance.

    )rr	)ryrz�treerrr r	�s	csdt||d������fdd��G�fdd�dtj�}|��d�_�~d�t�d�s`t�d	��d
��S)aJIncrementally parse XML document into ElementTree.

    This class also reports what's going on to the user based on the
    *events* it is initialized with.  The supported events are the strings
    "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
    detailed namespace information).  If *events* is omitted, only
    "end" events are reported.

    *source* is a filename or file object containing XML data, *events* is
    a list of events to report back, *parser* is an optional parser instance.

    Returns an iterator providing (event, elem) pairs.

    )�events�_parserc
3sbzNx,�j�EdH�jd�}|s"P�j|�qW�j�}�j�EdH|�_Wd�r\�j�XdS)N�ii@)�read_eventsrsrw�_close_and_return_root�rootrx)r|r�)r{�it�
pullparserryrr �iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r)r�rr �IterParseIterator�sr�NFrsrtT)r�collections�Iteratorr�r"rv)ryr�rzr�r)r{r�r�r�ryr r�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)r�cCs<tj�|_|ptt�d�|_|dkr(d}|jj|j|�dS)N)re�end)r�)r��deque�
_events_queuerrr��
_setevents)r,r�r�rrr r.�s

zXMLPullParser.__init__cCsZ|jdkrtd��|rVy|jj|�Wn.tk
rT}z|jj|�WYdd}~XnXdS)zFeed encoded data to parser.Nz!feed() called after end of stream)r�r�rw�SyntaxErrorr�rB)r,r|�excrrr rw�s
zXMLPullParser.feedcCs|jj�}d|_|S)N)r�rx)r,r�rrr r��s
z$XMLPullParser._close_and_return_rootcCs|j�dS)z�Finish feeding data to parser.

        Unlike XMLParser, does not return the root element. Use
        read_events() to consume elements from XMLPullParser.
        N)r�)r,rrr rx�szXMLPullParser.closeccs2|j}x&|r,|j�}t|t�r$|�q|VqWdS)z�Return an iterator over currently available (event, elem) pairs.

        Events are consumed from the internal event queue as they are
        retrieved from the iterator.
        N)r��popleftr$�	Exception)r,r��eventrrr r�s
zXMLPullParser.read_events)N)rrrr.rwr�rxr�rrrr r�s

cCs"|stt�d�}|j|�|j�S)aParse XML document from string constant.

    This function can be used to embed "XML Literals" in Python code.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    )re)rrrwrx)r2rzrrr rs
cCsV|stt�d�}|j|�|j�}i}x&|j�D]}|jd�}|r0|||<q0W||fS)aParse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    )rer/)rrrwrxr\rU)r2rzr�Zidsr4r/rrr r&s


cCs0|stt�d�}x|D]}|j|�qW|j�S)z�Parse XML document from sequence of string fragments.

    *sequence* is a list of other sequence, *parser* is an optional parser
    instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    )re)rrrwrx)Zsequencerzr2rrr r>s
	
c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)ra�Generic element structure builder.

    This builder converts a sequence of start, data, and end method
    calls to a well-formed element structure.

    You can use this class to build an element structure using a custom XML
    parser, or a parser for some other XML-like format.

    *element_factory* is an optional element factory which is called
    to create new Element instances, as necessary.

    NcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)�_data�_elem�_last�_tailr�_factory)r,Zelement_factoryrrr r.]szTreeBuilder.__init__cCs|jS)z;Flush builder buffers and return toplevel document Element.)r�)r,rrr rxfszTreeBuilder.closecCs>|jr:|jdk	r4dj|j�}|jr,||j_n||j_g|_dS)Nr�)r�r��joinr�r3r2)r,r2rrr �_flushls

zTreeBuilder._flushcCs|jj|�dS)zAdd text to current element.N)r�rB)r,r|rrr r|xszTreeBuilder.datacCsF|j�|j||�|_}|jr0|jdj|�|jj|�d|_|S)z�Open new element and return it.

        *tag* is the element name, *attrs* is a dict containing element
        attributes.

        rrr�)r�r�r�r�rBr�)r,r!Zattrsr4rrr �start|szTreeBuilder.startcCs |j�|jj�|_d|_|jS)zOClose and return current Element.

        *tag* is the element name.

        r)r�r��popr�r�)r,r!rrr r��szTreeBuilder.end)N)
rrrrr.rxr�r|r�r�rrrr rPs
	c@sfeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
dd�ZdS)ra�Element structure builder for XML source data based on the expat parser.

    *html* are predefined HTML entities (deprecated and not supported),
    *target* is an optional target object which defaults to an instance of the
    standard TreeBuilder class, *encoding* is an optional encoding string
    which if given, overrides the encoding specified in the XML file:
    http://www.iana.org/assignments/character-sets

    rNcCs<yddlm}Wn>tk
rNyddl}Wntk
rHtd��YnXYnX|j|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_d
|_d
|_d
|_d|_i|_yd|j|_ Wnt!k
�r6YnXdS)Nr)�expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r�r�r|�comment�pirzExpat %d.%d.%d)"�xml.parsersr��ImportErrorZpyexpatZParserCreaterrzr�re�_target�error�_error�_names�_defaultZDefaultHandlerExpandr"�_start�StartElementHandler�_end�EndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r,r�rer�r�rzrrr r.�sF




zXMLParser.__init__cCs�|j}|j}x�|D]�}|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�||fdd�}||_q|d	kr�||fd
d�}||_	qt
d|��qWdS)Nr�rcSs|||||�f�dS)Nr)r!Z	attrib_inr�rBr�rrr �handler�sz%XMLParser._setevents.<locals>.handlerr�cSs||||�f�dS)Nr)r!r�rBr�rrr r�szstart-nscSs|||p
d|pdff�dS)Nr�r)r�r�r�rBrrr r�szend-nscSs||df�dS)Nr)r�r�rBrrr r�szunknown event %r)r�rBr
rr	r
rrZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr�)r,Zevents_queueZevents_to_reportrzrBZ
event_namerrrr r��s(
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dS)N)r
�code�lineno�offsetZposition)r,rW�errrrr �_raiseerror�szXMLParser._raiseerrorcCsFy|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r�KeyError)r,rV�namerrr �_fixname�szXMLParser._fixnamecCsV|j}||�}i}|rHx0tdt|�d�D]}||d||||�<q(W|jj||�S)Nrr7r)r�ranger5rer�)r,r!Z	attr_listZfixnamer*�irrr r	szXMLParser._startcCs|jj|j|��S)N)rer�r)r,r!rrr rszXMLParser._endcCs�|dd�}|dkr�y|jj}Wntk
r4dSXy||j|dd��WnZtk
r�ddlm}|jd||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�nD|dkr�|dd�d	kr�g|_�n"|jdk	�r�|d
kr�d|_dS|j�}|�sdS|jj|�t|j�}|dk�r�|jd}|dk�rb|d
k�rb|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|jj||	|
dd��n:|j|jk�r�|j||	|
dd��|j||	|
dd��d|_dS)Nrr�r)r�z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r7ZPUBLIC�ZSYSTEM��doctyper�r�r�r�r�)rer|r�rrrr�rrzZErrorLineNumberZErrorColumnNumberrrrr�striprBr5r"r"�_XMLParser__doctype)r,r2r�Zdata_handlerr�r�nrHr�pubid�systemrrr rsZ





zXMLParser._defaultcCstjdt�dS)z�(Deprecated)  Handle doctype declaration

        *name* is the Doctype name, *pubid* is the public identifier,
        and *system* is the system identifier.

        z[This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.N)r9r:rK)r,rr&r'rrr r"EszXMLParser.doctypecCsFy|jj|d�Wn.|jk
r@}z|j|�WYdd}~XnXdS)zFeed encoded data to parser.rN)rz�Parserr)r,r|r�rrr rwUszXMLParser.feedcCs�y|jjdd�Wn.|jk
r@}z|j|�WYdd}~XnXz,y|jj}Wntk
rdYnX|�SWd|`|`|`|`XdS)z;Finish feeding data to parser and return element structure.r�rN)	rzr(rrrerxr�r�r)r,r�Z
close_handlerrrr rx\s
zXMLParser.close)rNN)rrrrr.r�rrr	rrr"r$rwrxrrrr r�s	
*!4)r[)N)N)N)
r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)NN)N)NN)N)N)N)6r�__all__rr�r�r9r�r�r�r�rr�r
rrrrrrr
r�contextmanagerr�r�r�r�rX�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrrGZ_elementtreerrrrr �<module>"s�)A

0t4
=22

05


KUPK�e�Z#�}P��-__pycache__/cElementTree.cpython-36.opt-2.pycnu�[���3


 \R�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.6/xml/etree/cElementTree.py�<module>sPK�e�Z��xr/__pycache__/ElementInclude.cpython-36.opt-2.pycnu�[���3


 \�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}tj|�j�}WdQRXn*|s6d}t|d|d��}|j�}WdQRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsp|dkrt}d}�xX|t|�k�rj||}|jtk�r:|jd�}|jdd�}|dkr�|||�}|dkrvtd||f��tj|�}|jr�|jp�d|j|_|||<n�|dk�r,||||jd��}|dkr�td||f��|�r||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rVtd|j��n
t
||�|d	}qWdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsF





)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK�e�Z��xr/__pycache__/ElementInclude.cpython-36.opt-1.pycnu�[���3


 \�@sPddlZddlmZdZedZedZGdd�de�Zdd	d
�Zd
dd�Z	dS)�N�)�ElementTreez!{http://www.w3.org/2001/XInclude}�includeZfallbackc@seZdZdS)�FatalIncludeErrorN)�__name__�
__module__�__qualname__�r	r	�0/usr/lib64/python3.6/xml/etree/ElementInclude.pyr>src	Cs\|dkr.t|d��}tj|�j�}WdQRXn*|s6d}t|d|d��}|j�}WdQRX|S)N�xml�rbzUTF-8�r)�encoding)�openr�parseZgetroot�read)�hrefrr�file�datar	r	r
�default_loaderMsrcCsp|dkrt}d}�xX|t|�k�rj||}|jtk�r:|jd�}|jdd�}|dkr�|||�}|dkrvtd||f��tj|�}|jr�|jp�d|j|_|||<n�|dk�r,||||jd��}|dkr�td||f��|�r||d	}|jp�d||jp�d|_n|j�pd||j�pd|_||=qntd
|��n&|jt	k�rVtd|j��n
t
||�|d	}qWdS)Nrrrrzcannot load %r as %r��textrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))r�len�tag�XINCLUDE_INCLUDE�getr�copy�tailr�XINCLUDE_FALLBACKr)�elem�loader�i�errZnoderr	r	r
rcsF





)N)N)
rrrZXINCLUDErr�SyntaxErrorrrrr	r	r	r
�<module>3s
PK�e�Z�Ib}��,__pycache__/ElementPath.cpython-36.opt-1.pycnu�[���3


 \�&�@s�ddlZejd�Zddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
eeee	ee
d�ZiZGdd�d�Z
ddd�Zd dd�Zd!dd�Zd"dd�ZdS)#�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�y6|jdd�\}}|sJt�|dd|||ffVWq�tk
r�td|��Yq�Xq|VqWdS)N�r�{�:z{%s}%sz!prefix %r not found in prefix map)�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)�pattern�
namespaces�token�tag�prefixZuri�r�-/usr/lib64/python3.6/xml/etree/ElementPath.py�xpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jj�D]}x|D]}|||<q.Wq$W|S)N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapWs

rcs|d��fdd�}|S)Nrc3s0x*|D]"}x|D]}|j�kr|VqWqWdS)N)r
)r�result�elemr)r
rr�selectbs


zprepare_child.<locals>.selectr)�nextrrr)r
r�
prepare_child`srcCsdd�}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs
zprepare_star.<locals>.selectr)rrrrrr�prepare_starisrcCsdd�}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self.<locals>.selectr)rrrrrr�prepare_selfosrcs\y
|�}Wntk
rdSX|ddkr2d�n|dsD|d�ntd���fdd�}|S)Nr�*rzinvalid descendantc3s4x.|D]&}x |j��D]}||k	r|VqWqWdS)N)r)rrrr)r
rrrs
z"prepare_descendant.<locals>.select)�
StopIterationr	)rrrr)r
r�prepare_descendantts

r"cCsdd�}|S)NcssDt|�}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ
result_mapr�parentrrrr�s
zprepare_parent.<locals>.selectr)rrrrrr�prepare_parent�s
r$cs*g}g}x�y
|�}Wntk
r(dSX|ddkr8P|drh|ddd�dkrhd|ddd�f}|j|dpvd�|j|d�q
Wdj|�}|dkr�|d��fd	d
�}|S|dkr�|d�|d���fdd
�}|S|dk�rtjd
|d��r|d��fdd
�}|S|dk�rVtjd
|d��rV|d�|d���fdd
�}|S|dk�st|dk�st|dk�r|dk�r�t|d�d��dk�rtd��nl|ddk�r�td��|dk�r
yt|d�d�Wntk
�r�td��YnX�dk�rtd��nd��fdd
�}|Std��dS) Nr�]rz'"�'�-�z@-c3s&x |D]}|j��dk	r|VqWdS)N)�get)rrr)�keyrrr�s
z!prepare_predicate.<locals>.selectz@-='c3s&x |D]}|j���kr|VqWdS)N)r))rrr)r*�valuerrr�s
z\-?\d+$c3s&x |D]}|j��dk	r|VqWdS)N)�find)rrr)r
rrr�s
z-='c3s@x:|D]2}x,|j��D]}dj|j���kr|VPqWqWdS)Nr()r�joinZitertext)rrrr)r
r+rrr�s

z-()z-()-zXPath position >= 1 expectedZlastzunsupported function�zunsupported expressionz)XPath offset from last() must be negativec
3sbt|�}xT|D]L}y.||}t|j|j��}|�|kr>|VWqttfk
rXYqXqWdS)N)r�listrr
�
IndexErrorr)rrrrr#Zelems)�indexrrr�s

zinvalid predicate���r2r2���r2)r!�appendr-�re�match�intr	�
ValueError)rrZ	signatureZ	predicaterr)r1r*r
r+r�prepare_predicate�sd







r9)r(r �.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dS)N)r)�selfrrrr�__init__�sz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr>rrrrr<�sr<c
!Csh||dkrdntt|j���f}|dd�dkr8|d}yt|}Wn�tk
�r:tt�dkrjtj�|dd�dkr�td��tt	||��j
}y
|�}Wntk
r�dSXg}xvy|jt
|d||��Wntk
r�td��YnXy|�}|ddk�r|�}Wq�tk
�r(PYq�Xq�W|t|<YnX|g}t|�}x|D]}	|	||�}�qPW|S)	Nr�/r �dz#cannot use absolute path on elementrzinvalid pathr2)�tuple�sorted�items�_cacher�len�clearr	rr�__next__r!r4�opsr<)
r�pathrZ	cache_keyZselectorrrrrrrrr�iterfindsD


rMcCstt|||�d�S)N)rrM)rrLrrrrr,)sr,cCstt|||��S)N)r/rM)rrLrrrrr/srcCs4ytt|||��}|jpdStk
r.|SXdS)Nr()rrM�textr!)rrL�defaultrrrr�findtext5s

rP)N)N)N)N)NN)r5�compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr�<module>;s,
		
Y

)

PK�e�Z#�}P��'__pycache__/cElementTree.cpython-36.pycnu�[���3


 \R�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.6/xml/etree/cElementTree.py�<module>sPK�e�Z�1�b�m�m,__pycache__/ElementTree.cpython-36.opt-2.pycnu�[���3


 \���@sDdddddddddd	d
ddd
dddddddddgZdZddlZddlZddlZddlZddlZddlZddlm	Z	Gdd	�d	e
�Zdd�ZGdd�d�Z
ifdd
�Zd]d d�Zd^d!d�ZeZGd"d�d�ZGd#d�d�Zejd$d%��Zd_d&d'�Zd(d)�Zd`Zyee�ZWnek
�rYnXd7d8�Zd9d:�Zeeed;�Zd<d�Zd=d>d?d@dAdBdCdD�Zee_dEdF�Z dGdH�Z!dIdJ�Z"dKdL�Z#dadMdN�dOd�Z$GdPdQ�dQej%�Z&dbdMdN�dRd�Z'dSd�Z(dcdTd�Z)dddUd�Z*GdVd�d�Z+dedWd�Z,dfdXd�Z-e,Z.dgdYd�Z/GdZd�d�Z0Gd[d�d�Z1ye
Z2dd\l3TWne4k
�r>YnXdS)h�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespacez1.3.0�N�)�ElementPathc@seZdZdS)r
N)�__name__�
__module__�__qualname__�rr�-/usr/lib64/python3.6/xml/etree/ElementTree.pyr
hs	cCs
t|d�S)N�tag)�hasattr)�elementrrrrvsc@seZdZdZdZdZdZifdd�Zdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd8d d!�Zd9d"d#�Zd:d$d%�Zd;d&d'�Zd(d)�Zd<d*d+�Zd,d-�Zd.d/�Zd0d1�Zd=d2d3�Zd>d4d5�Z d6d7�Z!dS)?rNcKsDt|t�std|jjf��|j�}|j|�||_||_g|_	dS)Nzattrib must be dict, not %s)
�
isinstance�dict�	TypeError�	__class__r�copy�updater �attrib�	_children)�selfr r)�extrarrr�__init__�s

zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r&rr �id)r+rrr�__repr__�szElement.__repr__cCs|j||�S)N)r&)r+r r)rrr�makeelement�s	zElement.makeelementcCs0|j|j|j�}|j|_|j|_||dd�<|S)N)r0r r)�text�tail)r+�elemrrrr'�s
zElement.copycCs
t|j�S)N)�lenr*)r+rrr�__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.�)�
stacklevelr)�warnings�warn�
FutureWarningr4r*)r+rrr�__bool__�s
zElement.__bool__cCs
|j|S)N)r*)r+�indexrrr�__getitem__�szElement.__getitem__cCs||j|<dS)N)r*)r+r<r"rrr�__setitem__�szElement.__setitem__cCs|j|=dS)N)r*)r+r<rrr�__delitem__�szElement.__delitem__cCs|j|�|jj|�dS)N)�_assert_is_elementr*�append)r+�
subelementrrrrA�s
zElement.appendcCs(x|D]}|j|�qW|jj|�dS)N)r@r*�extend)r+�elementsr"rrrrC�s
zElement.extendcCs|j|�|jj||�dS)N)r@r*�insert)r+r<rBrrrrE�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r#�_Element_Pyr%�typer)r+�errrr@�s
zElement._assert_is_elementcCs|jj|�dS)N)r*�remove)r+rBrrrrIs
zElement.removecCstjdtdd�|jS)NzaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r6)r7)r8r9�DeprecationWarningr*)r+rrr�getchildrens
zElement.getchildrencCstj|||�S)N)r�find)r+�path�
namespacesrrrrL!s	zElement.findcCstj||||�S)N)r�findtext)r+rM�defaultrNrrrrO,szElement.findtextcCstj|||�S)N)r�findall)r+rMrNrrrrQ:s	zElement.findallcCstj|||�S)N)r�iterfind)r+rMrNrrrrREs	zElement.iterfindcCs |jj�g|_d|_|_dS)N)r)�clearr*r1r2)r+rrrrSPs
z
Element.clearcCs|jj||�S)N)r)�get)r+�keyrPrrrrT[szElement.getcCs||j|<dS)N)r))r+rU�valuerrr�sethszElement.setcCs
|jj�S)N)r)�keys)r+rrrrXrszElement.keyscCs
|jj�S)N)r)�items)r+rrrrY{s	z
Element.itemsccsH|dkrd}|dks|j|kr$|Vx|jD]}|j|�EdHq,WdS)N�*)r r*�iter)r+r rHrrrr[�szElement.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r6)r7)r8r9�PendingDeprecationWarning�listr[)r+r rrr�getiterator�s
zElement.getiteratorccs^|j}t|t�r|dk	rdS|j}|r.|Vx*|D]"}|j�EdH|j}|r4|Vq4WdS)N)r r#�strr1�itertextr2)r+r �trHrrrr`�s
zElement.itertext)N)NN)N)N)N)N)N)"rrrr r)r1r2r-r/r0r'r5r;r=r>r?rArCrEr@rIrKrLrOrQrRrSrTrWrXrYr[r^r`rrrrr{s>	









	

	cKs,|j�}|j|�|j||�}|j|�|S)N)r'r(r0rA)�parentr r)r,r"rrrr�s


cCstt�}||_|S)N)rrr1)r1r"rrrr�s	cCs&tt�}||_|r"|jd||_|S)N� )rrr1)�targetr1r"rrrr�s

c@sVeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r
NcCs|rd||f}||_dS)Nz{%s}%s)r1)r+Ztext_or_urir rrrr-�szQName.__init__cCs|jS)N)r1)r+rrr�__str__sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r&rr1)r+rrrr/szQName.__repr__cCs
t|j�S)N)�hashr1)r+rrr�__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kS)N)r#r
r1)r+�otherrrr�__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kS)N)r#r
r1)r+rhrrr�__lt__
s
zQName.__lt__cCs t|t�r|j|jkS|j|kS)N)r#r
r1)r+rhrrr�__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kS)N)r#r
r1)r+rhrrr�__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kS)N)r#r
r1)r+rhrrr�__eq__s
zQName.__eq__)N)rrrr-rer/rgrirjrkrlrmrrrrr
�s
c@s�eZdZddd�Zdd�Zdd�Zddd	�Zdd
d�Zddd
�Zd dd�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�dd�Z
dd�ZdS)%rNcCs||_|r|j|�dS)N)�_rootr	)r+r"�filerrrr-)szElementTree.__init__cCs|jS)N)rn)r+rrr�getroot/szElementTree.getrootcCs
||_dS)N)rn)r+r"rrr�_setroot3szElementTree._setrootc
Cs�d}t|d�st|d�}d}zZ|dkrHt�}t|d�rH|j|�|_|jSx|jd�}|sZP|j|�qJW|j�|_|jS|r�|j�XdS)NF�read�rbT�_parse_wholei)r!�openrrtrnrr�feed�close)r+�source�parser�close_source�datarrrr	=s&




zElementTree.parsecCs|jj|�S)N)rnr[)r+r rrrr[bs
zElementTree.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r6)r7)r8r9r\r]r[)r+r rrrr^os
zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr6)r7)r8r9r:rnrL)r+rMrNrrrrLxs
zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|jj|||�S)Nrr|r}z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr6)r7)r8r9r:rnrO)r+rMrPrNrrrrO�s
zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)Nrr|r}z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr6)r7)r8r9r:rnrQ)r+rMrNrrrrQ�s
zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)Nrr|r}z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr6)r7)r8r9r:rnrR)r+rMrNrrrrR�s
zElementTree.iterfindT)�short_empty_elementscCs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|j�}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�ddl}
|
j�}	|d|	f�|d	kr�t||j�n,t|j|�\}}t|}
|
||j|||d
�WdQRXdS)N�xmlzunknown method %r�c14n�utf-8�us-ascii�unicoderz$<?xml version='1.0' encoding='%s'?>
r1)r~)r�r�r�)	�
_serialize�
ValueError�lower�_get_writer�locale�getpreferredencoding�_serialize_textrn�_namespaces)r+�file_or_filename�encodingZxml_declaration�default_namespace�methodr~Z	enc_lower�writeZdeclared_encodingr��qnamesrNZ	serializerrrr��s2
zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r+rorrr�
write_c14n
szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr-rprqr	r[r^rLrOrQrRr�r�rrrrrs 


%

	



5ccs"y
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVWdQRXYn�X|dkrl|Vn�tj���}t|tj�r�|}nft|tj�r�tj	|�}|j
|j�nBtj�}dd�|_||_y|j
|_
|j|_Wntk
r�YnXtj||ddd�}|j
|j�|jVWdQRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS)NTrrrrr�<lambda>3sz_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorru�
contextlib�	ExitStackr#�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�ro�stackrrrr�s>



r�csddi�i��rd��<���fdd�}x�|j�D]�}|j}t|t�r\|j�kr�||j�n<t|t�rx|�kr�||�n |dk	r�|tk	r�|tk	r�t|�xR|j	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�W|j}t|t�r2|j�kr2||j�q2W��fS)N�cs�y�|dd�dkr�|dd�jdd�\}}�j|�}|dkrjtj|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%drz%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitrT�_namespace_mapr4r�r%�_raise_serialization_error)Zqname�urir �prefix)r�rNr�rr�	add_qnamePs&


z_namespaces.<locals>.add_qname)
r[r r#r
r1r_rrr�rY)r3r�r�r rUrVr1r)r�rNr�rr�Es4




r�cKs�|j}|j}|tkr$|d|��n�|tkr<|d|��nv||}|dkr�|r\|t|��x|D]}t|||d|d�qbW�n2|d|�t|j��}	|	s�|�rD|r�x@t|j�dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�WxZt|	�D]N\}}
t
|t��r|j}t
|
t��r$||
j}
nt	|
�}
|d
|||
f�q�W|�s\t|��s\|�r�|d�|�rv|t|��x |D]}t|||d|d��q|W|d|d�n|d
�|j
�r�|t|j
��dS)Nz	<!--%s-->z<?%s?>)r~�<cSs|dS)Nrr)�xrrrr��sz _serialize_xml.<locals>.<lambda>)rU�:z
 xmlns%s="%s"z %s="%s"�>z</z />)r r1rr�
_escape_cdata�_serialize_xmlr]rY�sorted�_escape_attribr#r
r4r2)r�r3r�rNr~�kwargsr r1rHrY�v�krrrr��sT





r��area�base�basefont�br�col�frame�hr�img�input�isindex�link�meta�paramcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���n|||}|dkr�|rd|t|��x|D]}t|||d�qjW�n<|d|�t|j��}|s�|�rH|r�x@t|j�dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�WxZt|�D]N\}
}	t
|
t��r|
j}
t
|	t��r(||	j}	nt|	�}	|d	||
|	f�q�W|d
�|j
�}|�r�|dk�sr|dk�r|||�n|t|��x|D]}t|||d��q�W|tk�r�|d
|d
�|j�r�|t|j��dS)Nz	<!--%s-->z<?%s?>r�cSs|dS)Nrr)r�rrrr��sz!_serialize_html.<locals>.<lambda>)rUr�z
 xmlns%s="%s"z %s="%s"r�ZscriptZstylez</)r r1rr�r�_serialize_htmlr]rYr�r�r#r
�_escape_attrib_htmlr��
HTML_EMPTYr2)r�r3r�rNr�r r1rHrYr�r�Zltagrrrr��sT





r�cCs.x|j�D]}||�q
W|jr*||j�dS)N)r`r2)r�r3�partrrrr��sr�)r�htmlr1cCsPtjd|�rtd��x.ttj��D]\}}||ks:||kr"t|=q"W|t|<dS)Nzns\d+$z'Prefix format reserved for internal use)�re�matchr�r]r�rY)r�r�r�r�rrrr�s
rr�ZrdfZwsdlZxsZxsiZdc)z$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r%rGr)r1rrrr�sr�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)N�&z&amp;r�z&lt;r�z&gt;)�replacer%r�r�)r1rrrr�$sr�cCs�y�d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}d|krR|jdd�}d	|krf|jd	d
�}d|krz|jdd
�}d
|kr�|jd
d�}d
|kr�|jd
d�}|Sttfk
r�t|�YnXdS)Nr�z&amp;r�z&lt;r�z&gt;�"z&quot;z
r��
z&#10;�	z&#09;)r�r%r�r�)r1rrrr�4s(r�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)Nr�z&amp;r�z&gt;r�z&quot;)r�r%r�r�)r1rrrr�Psr�T)r~cCs6|dkrtj�ntj�}t|�j||||d�|j�S)Nr�)r�r~)r��StringIO�BytesIOrr��getvalue)r"r�r�r~�streamrrrr_sc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ListDataStreamcCs
||_dS)N)�lst)r+r�rrrr-tsz_ListDataStream.__init__cCsdS)NTr)r+rrrr�wsz_ListDataStream.writablecCsdS)NTr)r+rrrr�zsz_ListDataStream.seekablecCs|jj|�dS)N)r�rA)r+�brrrr�}sz_ListDataStream.writecCs
t|j�S)N)r4r�)r+rrrr��sz_ListDataStream.tellN)rrrr-r�r�r�r�rrrrr�rs
r�cCs&g}t|�}t|�j||||d�|S)N)r�r~)r�rr�)r"r�r�r~r�r�rrrr�s
cCsNt|t�st|�}|jtjdd�|j�j}|s>|ddkrJtjjd�dS)Nr�)r�rr����)r#rr��sys�stdoutrpr2)r3r2rrrr�s

cCst�}|j||�|S)N)rr	)rxry�treerrrr	�s	csdt||d������fdd��G�fdd�dtj�}|��d�_�~d�t�d�s`t�d��d	��S)
N)�events�_parserc
3sbzNx,�j�EdH�jd�}|s"P�j|�qW�j�}�j�EdH|�_Wd�r\�j�XdS)N�ii@)�read_eventsrrrv�_close_and_return_root�rootrw)r{r�)rz�it�
pullparserrxrr�iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r)r�rr�IterParseIterator�sr�FrrrsT)r�collections�Iteratorr�r!ru)rxr�ryr�r)rzr�r�r�rxrr�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)r�cCs<tj�|_|ptt�d�|_|dkr(d}|jj|j|�dS)N)rd�end)r�)r��deque�
_events_queuerrr��
_setevents)r+r�r�rrrr-�s

zXMLPullParser.__init__cCsZ|jdkrtd��|rVy|jj|�Wn.tk
rT}z|jj|�WYdd}~XnXdS)Nz!feed() called after end of stream)r�r�rv�SyntaxErrorr�rA)r+r{�excrrrrv�s
zXMLPullParser.feedcCs|jj�}d|_|S)N)r�rw)r+r�rrrr��s
z$XMLPullParser._close_and_return_rootcCs|j�dS)N)r�)r+rrrrw�szXMLPullParser.closeccs2|j}x&|r,|j�}t|t�r$|�q|VqWdS)N)r��popleftr#�	Exception)r+r��eventrrrr�s
zXMLPullParser.read_events)N)rrrr-rvr�rwr�rrrrr�s

cCs"|stt�d�}|j|�|j�S)N)rd)rrrvrw)r1ryrrrrs
cCsV|stt�d�}|j|�|j�}i}x&|j�D]}|jd�}|r0|||<q0W||fS)N)rdr.)rrrvrwr[rT)r1ryr�Zidsr3r.rrrr&s


cCs0|stt�d�}x|D]}|j|�qW|j�S)N)rd)rrrvrw)Zsequenceryr1rrrr>s
	
c@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rNcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)�_data�_elem�_last�_tailr�_factory)r+Zelement_factoryrrrr-]szTreeBuilder.__init__cCs|jS)N)r�)r+rrrrwfszTreeBuilder.closecCs>|jr:|jdk	r4dj|j�}|jr,||j_n||j_g|_dS)Nr�)r�r��joinr�r2r1)r+r1rrr�_flushls

zTreeBuilder._flushcCs|jj|�dS)N)r�rA)r+r{rrrr{xszTreeBuilder.datacCsF|j�|j||�|_}|jr0|jdj|�|jj|�d|_|S)Nrrr�)r�r�r�r�rAr�)r+r Zattrsr3rrr�start|szTreeBuilder.startcCs |j�|jj�|_d|_|jS)Nr)r�r��popr�r�)r+r rrrr��szTreeBuilder.end)N)	rrrr-rwr�r{r�r�rrrrrPs
	c@sbeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
e
Zdd�Zdd�Z
dS)rrNcCs<yddlm}Wn>tk
rNyddl}Wntk
rHtd��YnXYnX|j|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_d
|_d
|_d
|_d|_i|_yd|j|_ Wnt!k
�r6YnXdS)Nr)�expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r�r�r{�comment�pirzExpat %d.%d.%d)"�xml.parsersr��ImportErrorZpyexpatZParserCreaterryr�rd�_target�error�_error�_names�_defaultZDefaultHandlerExpandr!�_start�StartElementHandler�_end�EndElementHandlerr{ZCharacterDataHandlerr�ZCommentHandlerrZProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r+r�rdr�r�ryrrrr-�sF




zXMLParser.__init__cCs�|j}|j}x�|D]�}|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�||fdd�}||_q|d	kr�||fd
d�}||_	qt
d|��qWdS)Nr�rcSs|||||�f�dS)Nr)r Z	attrib_inr�rAr�rrr�handler�sz%XMLParser._setevents.<locals>.handlerr�cSs||||�f�dS)Nr)r r�rAr�rrrr�szstart-nscSs|||p
d|pdff�dS)Nr�r)r�r�r�rArrrr�szend-nscSs||df�dS)Nr)r�r�rArrrr�szunknown event %r)r�rArr
rr	r
rZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr�)r+Zevents_queueZevents_to_reportryrAZ
event_namerrrrr��s(
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dS)N)r
�code�lineno�offsetZposition)r+rV�errrrr�_raiseerror�szXMLParser._raiseerrorcCsFy|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r�KeyError)r+rU�namerrr�_fixname�szXMLParser._fixnamecCsV|j}||�}i}|rHx0tdt|�d�D]}||d||||�<q(W|jj||�S)Nrr6r)r�ranger4rdr�)r+r Z	attr_listZfixnamer)�irrrrszXMLParser._startcCs|jj|j|��S)N)rdr�r)r+r rrrr
szXMLParser._endcCs�|dd�}|dkr�y|jj}Wntk
r4dSXy||j|dd��WnZtk
r�ddlm}|jd||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�nD|dkr�|dd�d	kr�g|_�n"|jdk	�r�|d
kr�d|_dS|j�}|�sdS|jj|�t|j�}|dk�r�|jd}|dk�rb|d
k�rb|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|jj||	|
dd��n:|j|jk�r�|j||	|
dd��|j||	|
dd��d|_dS)Nrr�r)r�z'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r6ZPUBLIC�ZSYSTEM��doctyper�r�r�r�r�)rdr{r�rrrr�rryZErrorLineNumberZErrorColumnNumberrrrr�striprAr4r!r!�_XMLParser__doctype)r+r1r�Zdata_handlerr�r�nrGr�pubid�systemrrrrsZ





zXMLParser._defaultcCstjdt�dS)Nz[This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.)r8r9rJ)r+rr%r&rrrr!EszXMLParser.doctypecCsFy|jj|d�Wn.|jk
r@}z|j|�WYdd}~XnXdS)Nr)ry�Parserr)r+r{r�rrrrvUszXMLParser.feedcCs�y|jjdd�Wn.|jk
r@}z|j|�WYdd}~XnXz,y|jj}Wntk
rdYnX|�SWd|`|`|`|`XdS)Nr�r)	ryr'rrrdrwr�r�r)r+r�Z
close_handlerrrrrw\s
zXMLParser.close)rNN)rrrr-r�rrrr
rr!r#rvrwrrrrr�s
*!4)rZ)N)N)N)
r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)NN)N)NN)N)N)N)5�__all__rr�r�r8r�r�r�r�rr�r
rrrrrrr
r�contextmanagerr�r�r�r�rW�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrrFZ_elementtreerrrrr�<module>Ks�A

0t4
=22

05


KUPK�e�Z#�}P��-__pycache__/cElementTree.cpython-36.opt-1.pycnu�[���3


 \R�@sddlTdS)�)�*N)Zxml.etree.ElementTree�rr�./usr/lib64/python3.6/xml/etree/cElementTree.py�<module>sPK�e�Z�M휺���&__pycache__/ElementTree.cpython-36.pycnu�[���3


 \���@sHdZddddddddd	d
ddd
ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl	m
Z
Gdd
�d
e�Zdd�Z
Gdd�d�Zifd d�Zd^d!d�Zd_d"d�ZeZGd#d
�d
�ZGd$d�d�Zejd%d&��Zd`d'd(�Zd)d*�ZdaZyee�ZWnek
�r"YnXd8d9�Zd:d;�Zeeed<�Zd=d�Zd>d?d@dAdBdCdDdE�Z e e_ dFdG�Z!dHdI�Z"dJdK�Z#dLdM�Z$dbdNdO�dPd�Z%GdQdR�dRej&�Z'dcdNdO�dSd�Z(dTd�Z)dddUd	�Z*dedVd�Z+GdWd�d�Z,dfdXd�Z-dgdYd�Z.e-Z/dhdZd�Z0Gd[d�d�Z1Gd\d�d�Z2yeZ3dd]l4TWne5k
�rBYnXdS)iaLightweight XML support for Python.

 XML is an inherently hierarchical data format, and the most natural way to
 represent it is with a tree.  This module has two classes for this purpose:

    1. ElementTree represents the whole XML document as a tree and

    2. Element represents a single node in this tree.

 Interactions with the whole document (reading and writing to/from files) are
 usually done on the ElementTree level.  Interactions with a single XML element
 and its sub-elements are done on the Element level.

 Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:

    'tag' - a string containing the element's name.

    'attributes' - a Python dictionary storing the element's attributes.

    'text' - a string containing the element's text content.

    'tail' - an optional string containing text after the element's end tag.

    And a number of child elements stored in a Python sequence.

 To create an element instance, use the Element constructor,
 or the SubElement factory function.

 You can also use the ElementTree class to wrap an element structure
 and convert it to and from XML.

�Comment�dump�Element�ElementTree�
fromstring�fromstringlist�	iselement�	iterparse�parse�
ParseError�PI�ProcessingInstruction�QName�
SubElement�tostring�tostringlist�TreeBuilder�VERSION�XML�XMLID�	XMLParser�
XMLPullParser�register_namespacez1.3.0�N�)�ElementPathc@seZdZdZdS)r
z�An error when parsing an XML document.

    In addition to its exception value, a ParseError contains
    two extra attributes:
        'code'     - the specific exception code
        'position' - the line and column of the error

    N)�__name__�
__module__�__qualname__�__doc__�rr�-/usr/lib64/python3.6/xml/etree/ElementTree.pyr
hscCs
t|d�S)z2Return True if *element* appears to be an Element.�tag)�hasattr)�elementrrr rvsc@s
eZdZdZdZdZdZdZifdd�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd9d!d"�Zd:d#d$�Zd;d%d&�Zd<d'd(�Zd)d*�Zd=d+d,�Zd-d.�Zd/d0�Zd1d2�Zd>d3d4�Z d?d5d6�Z!d7d8�Z"dS)@rahAn XML element.

    This class is the reference implementation of the Element interface.

    An element's length is its number of subelements.  That means if you
    want to check if an element is truly empty, you should check BOTH
    its length AND its text attribute.

    The element tag, attribute names, and attribute values can be either
    bytes or strings.

    *tag* is the element name.  *attrib* is an optional dictionary containing
    element attributes. *extra* are additional element attributes given as
    keyword arguments.

    Example form:
        <tag attrib>text<child/>...</tag>tail

    NcKsDt|t�std|jjf��|j�}|j|�||_||_g|_	dS)Nzattrib must be dict, not %s)
�
isinstance�dict�	TypeError�	__class__r�copy�updater!�attrib�	_children)�selfr!r*�extrarrr �__init__�s

zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r'rr!�id)r,rrr �__repr__�szElement.__repr__cCs|j||�S)z�Create a new element with the same type.

        *tag* is a string containing the element name.
        *attrib* is a dictionary containing the element attributes.

        Do not call this method, use the SubElement factory function instead.

        )r')r,r!r*rrr �makeelement�s	zElement.makeelementcCs0|j|j|j�}|j|_|j|_||dd�<|S)z�Return copy of current element.

        This creates a shallow copy. Subelements will be shared with the
        original tree.

        N)r1r!r*�text�tail)r,�elemrrr r(�s
zElement.copycCs
t|j�S)N)�lenr+)r,rrr �__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.�)�
stacklevelr)�warnings�warn�
FutureWarningr5r+)r,rrr �__bool__�s
zElement.__bool__cCs
|j|S)N)r+)r,�indexrrr �__getitem__�szElement.__getitem__cCs||j|<dS)N)r+)r,r=r#rrr �__setitem__�szElement.__setitem__cCs|j|=dS)N)r+)r,r=rrr �__delitem__�szElement.__delitem__cCs|j|�|jj|�dS)aAdd *subelement* to the end of this element.

        The new element will appear in document order after the last existing
        subelement (or directly after the text, if it's the first subelement),
        but before the end tag for this element.

        N)�_assert_is_elementr+�append)r,�
subelementrrr rB�s
zElement.appendcCs(x|D]}|j|�qW|jj|�dS)zkAppend subelements from a sequence.

        *elements* is a sequence with zero or more elements.

        N)rAr+�extend)r,�elementsr#rrr rD�s
zElement.extendcCs|j|�|jj||�dS)z(Insert *subelement* at position *index*.N)rAr+�insert)r,r=rCrrr rF�s
zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r$�_Element_Pyr&�typer)r,�errr rA�s
zElement._assert_is_elementcCs|jj|�dS)a�Remove matching subelement.

        Unlike the find methods, this method compares elements based on
        identity, NOT ON tag value or contents.  To remove subelements by
        other means, the easiest way is to use a list comprehension to
        select what elements to keep, and then use slice assignment to update
        the parent element.

        ValueError is raised if a matching element could not be found.

        N)r+�remove)r,rCrrr rJs
zElement.removecCstjdtdd�|jS)z`(Deprecated) Return all subelements.

        Elements are returned in document order.

        zaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.r7)r8)r9r:�DeprecationWarningr+)r,rrr �getchildrens
zElement.getchildrencCstj|||�S)aFind first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        )r�find)r,�path�
namespacesrrr rM!s	zElement.findcCstj||||�S)a�Find text for first matching element by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *default* is the value to return if the element was not found,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return text content of first matching element, or default value if
        none was found.  Note that if an element is found having no text
        content, the empty string is returned.

        )r�findtext)r,rN�defaultrOrrr rP,szElement.findtextcCstj|||�S)aFind all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Returns list containing all matching elements in document order.

        )r�findall)r,rNrOrrr rR:s	zElement.findallcCstj|||�S)a Find all matching subelements by tag name or path.

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        )r�iterfind)r,rNrOrrr rSEs	zElement.iterfindcCs |jj�g|_d|_|_dS)z�Reset element.

        This function removes all subelements, clears all attributes, and sets
        the text and tail attributes to None.

        N)r*�clearr+r2r3)r,rrr rTPs
z
Element.clearcCs|jj||�S)agGet element attribute.

        Equivalent to attrib.get, but some implementations may handle this a
        bit more efficiently.  *key* is what attribute to look for, and
        *default* is what to return if the attribute was not found.

        Returns a string containing the attribute value, or the default if
        attribute was not found.

        )r*�get)r,�keyrQrrr rU[szElement.getcCs||j|<dS)z�Set element attribute.

        Equivalent to attrib[key] = value, but some implementations may handle
        this a bit more efficiently.  *key* is what attribute to set, and
        *value* is the attribute value to set it to.

        N)r*)r,rV�valuerrr �sethszElement.setcCs
|jj�S)z�Get list of attribute names.

        Names are returned in an arbitrary order, just like an ordinary
        Python dict.  Equivalent to attrib.keys()

        )r*�keys)r,rrr rYrszElement.keyscCs
|jj�S)z�Get element attributes as a sequence.

        The attributes are returned in arbitrary order.  Equivalent to
        attrib.items().

        Return a list of (name, value) tuples.

        )r*�items)r,rrr rZ{s	z
Element.itemsccsH|dkrd}|dks|j|kr$|Vx|jD]}|j|�EdHq,WdS)aCreate tree iterator.

        The iterator loops over the element and all subelements in document
        order, returning all elements with a matching tag.

        If the tree structure is modified during iteration, new or removed
        elements may or may not be included.  To get a stable set, use the
        list() function on the iterator, and loop over the resulting list.

        *tag* is what tags to look for (default is to return all elements)

        Return an iterator containing all the matching elements.

        �*N)r!r+�iter)r,r!rIrrr r\�szElement.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:�PendingDeprecationWarning�listr\)r,r!rrr �getiterator�s
zElement.getiteratorccs^|j}t|t�r|dk	rdS|j}|r.|Vx*|D]"}|j�EdH|j}|r4|Vq4WdS)z�Create text iterator.

        The iterator loops over the element and all subelements in document
        order, returning all inner text.

        N)r!r$�strr2�itertextr3)r,r!�trIrrr ra�s
zElement.itertext)N)NN)N)N)N)N)N)#rrrrr!r*r2r3r.r0r1r(r6r<r>r?r@rBrDrFrArJrLrMrPrRrSrTrUrXrYrZr\r_rarrrr r{s@	









	

	cKs,|j�}|j|�|j||�}|j|�|S)a�Subelement factory which creates an element instance, and appends it
    to an existing parent.

    The element tag, attribute names, and attribute values can be either
    bytes or Unicode strings.

    *parent* is the parent element, *tag* is the subelements name, *attrib* is
    an optional directory containing element attributes, *extra* are
    additional attributes given as keyword arguments.

    )r(r)r1rB)�parentr!r*r-r#rrr r�s


cCstt�}||_|S)z�Comment element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *text* is a string containing the comment string.

    )rrr2)r2r#rrr r�s	cCs&tt�}||_|r"|jd||_|S)a*Processing Instruction element factory.

    This function creates a special element which the standard serializer
    serializes as an XML comment.

    *target* is a string containing the processing instruction, *text* is a
    string containing the processing instruction contents, if any.

    � )rrr2)�targetr2r#rrr r�s

c@sZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)r
a�Qualified name wrapper.

    This class can be used to wrap a QName attribute value in order to get
    proper namespace handing on output.

    *text_or_uri* is a string containing the QName value either in the form
    {uri}local, or if the tag argument is given, the URI part of a QName.

    *tag* is an optional argument which if given, will make the first
    argument (text_or_uri) be interpreted as a URI, and this argument (tag)
    be interpreted as a local name.

    NcCs|rd||f}||_dS)Nz{%s}%s)r2)r,Ztext_or_urir!rrr r.�szQName.__init__cCs|jS)N)r2)r,rrr �__str__sz
QName.__str__cCsd|jj|jfS)Nz<%s %r>)r'rr2)r,rrr r0szQName.__repr__cCs
t|j�S)N)�hashr2)r,rrr �__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,�otherrrr �__le__s
zQName.__le__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__lt__
s
zQName.__lt__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__ge__s
zQName.__ge__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__gt__s
zQName.__gt__cCs t|t�r|j|jkS|j|kS)N)r$r
r2)r,rirrr �__eq__s
zQName.__eq__)N)
rrrrr.rfr0rhrjrkrlrmrnrrrr r
�s

c@s�eZdZdZddd�Zdd�Zdd�Zdd	d
�Zddd�Zd d
d�Z	d!dd�Z
d"dd�Zd#dd�Zd$dd�Z
d%dd�dd�Zdd�ZdS)&ra%An XML element hierarchy.

    This class also provides support for serialization to and from
    standard XML.

    *element* is an optional root element node,
    *file* is an optional file handle or file name of an XML file whose
    contents will be used to initialize the tree with.

    NcCs||_|r|j|�dS)N)�_rootr	)r,r#�filerrr r.)szElementTree.__init__cCs|jS)z!Return root element of this tree.)ro)r,rrr �getroot/szElementTree.getrootcCs
||_dS)z�Replace root element of this tree.

        This will discard the current contents of the tree and replace it
        with the given element.  Use with care!

        N)ro)r,r#rrr �_setroot3szElementTree._setrootc
Cs�d}t|d�st|d�}d}zZ|dkrHt�}t|d�rH|j|�|_|jSx|jd�}|sZP|j|�qJW|j�|_|jS|r�|j�XdS)a=Load external XML document into element tree.

        *source* is a file name or file object, *parser* is an optional parser
        instance that defaults to XMLParser.

        ParseError is raised if the parser fails to parse the document.

        Returns the root element of the given source document.

        F�read�rbTN�_parse_wholei)r"�openrrurors�feed�close)r,�source�parser�close_source�datarrr r	=s&




zElementTree.parsecCs|jj|�S)z�Create and return tree iterator for the root element.

        The iterator loops over all elements in this tree, in document order.

        *tag* is a string with the tag name to iterate over
        (default is to return all elements).

        )ror\)r,r!rrr r\bs
zElementTree.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.r7)r8)r9r:r]r^r\)r,r!rrr r_os
zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)a\Find first matching element by tag name or path.

        Same as getroot().find(path), which is Element.find()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorM)r,rNrOrrr rMxs
zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|jj|||�S)aeFind first matching element by tag name or path.

        Same as getroot().findtext(path),  which is Element.findtext()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return the first matching element, or None if no element was found.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorP)r,rNrQrOrrr rP�s
zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)aaFind all matching subelements by tag name or path.

        Same as getroot().findall(path), which is Element.findall().

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return list containing all matching elements in document order.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorR)r,rNrOrrr rR�s
zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)agFind all matching subelements by tag name or path.

        Same as getroot().iterfind(path), which is element.iterfind()

        *path* is a string having either an element tag or an XPath,
        *namespaces* is an optional mapping from namespace prefix to full name.

        Return an iterable yielding all matching elements in document order.

        Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorS)r,rNrOrrr rS�s
zElementTree.iterfindT)�short_empty_elementscCs�|s
d}n|tkrtd|��|s4|dkr0d}nd}|j�}t||���}|dkr�|sd|dkr�|dkr�|}	|dkr�ddl}
|
j�}	|d	|	f�|d
kr�t||j�n,t|j|�\}}t|}
|
||j|||d�WdQRXdS)
a�Write element tree to a file as XML.

        Arguments:
          *file_or_filename* -- file name or a file object opened for writing

          *encoding* -- the output encoding (default: US-ASCII)

          *xml_declaration* -- bool indicating if an XML declaration should be
                               added to the output. If None, an XML declaration
                               is added if encoding IS NOT either of:
                               US-ASCII, UTF-8, or Unicode

          *default_namespace* -- sets the default XML namespace (for "xmlns")

          *method* -- either "xml" (default), "html, "text", or "c14n"

          *short_empty_elements* -- controls the formatting of elements
                                    that contain no content. If True (default)
                                    they are emitted as a single self-closed
                                    tag, otherwise they are emitted as a pair
                                    of start/end tags

        �xmlzunknown method %r�c14n�utf-8�us-asciiN�unicoderz$<?xml version='1.0' encoding='%s'?>
r2)r)r�r�r�)	�
_serialize�
ValueError�lower�_get_writer�locale�getpreferredencoding�_serialize_textro�_namespaces)r,�file_or_filename�encodingZxml_declaration�default_namespace�methodrZ	enc_lower�writeZdeclared_encodingr��qnamesrOZ	serializerrr r��s2
zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,rprrr �
write_c14n
szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr	r\r_rMrPrRrSr�r�rrrr rs"



%

	



5ccs"y
|j}WnPtk
rZ|dkr.t|d�}nt|d|dd�}|�|jVWdQRXYn�X|dkrl|Vn�tj���}t|tj�r�|}nft|tj�r�tj	|�}|j
|j�nBtj�}dd�|_||_y|j
|_
|j|_Wntk
r�YnXtj||ddd�}|j
|j�|jVWdQRXdS)	Nr��w�xmlcharrefreplace)r��errorscSsdS)NTrrrrr �<lambda>3sz_get_writer.<locals>.<lambda>�
)r�r��newline)r��AttributeErrorrv�
contextlib�	ExitStackr$�io�BufferedIOBase�	RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell�
TextIOWrapper)r�r�r�rp�stackrrr r�s>



r�csddi�i��rd��<���fdd�}x�|j�D]�}|j}t|t�r\|j�kr�||j�n<t|t�rx|�kr�||�n |dk	r�|tk	r�|tk	r�t|�xR|j	�D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�W|j}t|t�r2|j�kr2||j�q2W��fS)N�cs�y�|dd�dkr�|dd�jdd�\}}�j|�}|dkrjtj|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk
r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitrU�_namespace_mapr5r�r&�_raise_serialization_error)Zqname�urir!�prefix)r�rOr�rr �	add_qnamePs&


z_namespaces.<locals>.add_qname)
r\r!r$r
r2r`rrr�rZ)r4r�r�r!rVrWr2r)r�rOr�r r�Es4




r�cKs�|j}|j}|tkr$|d|��n�|tkr<|d|��nv||}|dkr�|r\|t|��x|D]}t|||d|d�qbW�n2|d|�t|j��}	|	s�|�rD|r�x@t|j�dd�d�D](\}
}|r�d|}|d	|t	|
�f�q�WxZt|	�D]N\}}
t
|t��r|j}t
|
t��r$||
j}
nt	|
�}
|d
|||
f�q�W|�s\t|��s\|�r�|d�|�rv|t|��x |D]}t|||d|d��q|W|d|d�n|d
�|j
�r�|t|j
��dS)Nz	<!--%s-->z<?%s?>)r�<cSs|dS)Nrr)�xrrr r��sz _serialize_xml.<locals>.<lambda>)rV�:z
 xmlns%s="%s"z %s="%s"�>z</z />)r!r2rr�
_escape_cdata�_serialize_xmlr^rZ�sorted�_escape_attribr$r
r5r3)r�r4r�rOr�kwargsr!r2rIrZ�v�krrr r��sT





r��area�base�basefont�br�col�frame�hr�img�input�isindex�link�meta�paramcKs�|j}|j}|tkr(|dt|���n�|tkrD|dt|���n|||}|dkr�|rd|t|��x|D]}t|||d�qjW�n<|d|�t|j��}|s�|�rH|r�x@t|j�dd�d�D](\}	}
|
r�d|
}
|d|
t	|	�f�q�WxZt|�D]N\}
}	t
|
t��r|
j}
t
|	t��r(||	j}	nt|	�}	|d	||
|	f�q�W|d
�|j
�}|�r�|dk�sr|dk�r|||�n|t|��x|D]}t|||d��q�W|tk�r�|d
|d
�|j�r�|t|j��dS)Nz	<!--%s-->z<?%s?>r�cSs|dS)Nrr)r�rrr r��sz!_serialize_html.<locals>.<lambda>)rVr�z
 xmlns%s="%s"z %s="%s"r�ZscriptZstylez</)r!r2rr�r�_serialize_htmlr^rZr�r�r$r
�_escape_attrib_htmlr��
HTML_EMPTYr3)r�r4r�rOr�r!r2rIrZr�r�Zltagrrr r��sT





r�cCs.x|j�D]}||�q
W|jr*||j�dS)N)rar3)r�r4�partrrr r��sr�)r��htmlr2cCsPtjd|�rtd��x.ttj��D]\}}||ks:||kr"t|=q"W|t|<dS)atRegister a namespace prefix.

    The registry is global, and any existing mapping for either the
    given prefix or the namespace URI will be removed.

    *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and
    attributes in this namespace will be serialized with prefix if possible.

    ValueError is raised if prefix is reserved or is invalid.

    zns\d+$z'Prefix format reserved for internal useN)�re�matchr�r^r�rZ)r�r�r�r�rrr r�s
r�r�ZrdfZwsdlZxsZxsiZdc)z$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r&rHr)r2rrr r�sr�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)N�&z&amp;r�z&lt;r�z&gt;)�replacer&r�r�)r2rrr r�$sr�cCs�y�d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}d|krR|jdd�}d	|krf|jd	d
�}d|krz|jdd
�}d
|kr�|jd
d�}d
|kr�|jd
d�}|Sttfk
r�t|�YnXdS)Nr�z&amp;r�z&lt;r�z&gt;�"z&quot;z
r��
z&#10;�	z&#09;)r�r&r�r�)r2rrr r�4s(r�cCsfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk
r`t|�YnXdS)Nr�z&amp;r�z&gt;r�z&quot;)r�r&r�r�)r2rrr r�Psr�T)rcCs6|dkrtj�ntj�}t|�j||||d�|j�S)a�Generate string representation of XML element.

    All subelements are included.  If encoding is "unicode", a string
    is returned. Otherwise a bytestring is returned.

    *element* is an Element instance, *encoding* is an optional output
    encoding defaulting to US-ASCII, *method* is an optional output which can
    be one of "xml" (default), "html", "text" or "c14n".

    Returns an (optionally) encoded string containing the XML data.

    r�)r�r)r��StringIO�BytesIOrr��getvalue)r#r�r�r�streamrrr r_sc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs
||_dS)N)�lst)r,r�rrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr r�wsz_ListDataStream.writablecCsdS)NTr)r,rrr r�zsz_ListDataStream.seekablecCs|jj|�dS)N)r�rB)r,�brrr r�}sz_ListDataStream.writecCs
t|j�S)N)r5r�)r,rrr r��sz_ListDataStream.tellN)	rrrrr.r�r�r�r�rrrr r�rsr�cCs&g}t|�}t|�j||||d�|S)N)r�r)r�rr�)r#r�r�rr�r�rrr r�s
cCsNt|t�st|�}|jtjdd�|j�j}|s>|ddkrJtjjd�dS)a#Write element tree or element structure to sys.stdout.

    This function should be used for debugging only.

    *elem* is either an ElementTree, or a single Element.  The exact output
    format is implementation dependent.  In this version, it's written as an
    ordinary XML file.

    r�)r�rr�N���)r$rr��sys�stdoutrqr3)r4r3rrr r�s

cCst�}|j||�|S)z�Parse XML document into element tree.

    *source* is a filename or file object containing XML data,
    *parser* is an optional parser instance defaulting to XMLParser.

    Return an ElementTree instance.

    )rr	)ryrz�treerrr r	�s	csdt||d������fdd��G�fdd�dtj�}|��d�_�~d�t�d�s`t�d	��d
��S)aJIncrementally parse XML document into ElementTree.

    This class also reports what's going on to the user based on the
    *events* it is initialized with.  The supported events are the strings
    "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get
    detailed namespace information).  If *events* is omitted, only
    "end" events are reported.

    *source* is a filename or file object containing XML data, *events* is
    a list of events to report back, *parser* is an optional parser instance.

    Returns an iterator providing (event, elem) pairs.

    )�events�_parserc
3sbzNx,�j�EdH�jd�}|s"P�j|�qW�j�}�j�EdH|�_Wd�r\�j�XdS)N�ii@)�read_eventsrsrw�_close_and_return_root�rootrx)r|r�)r{�it�
pullparserryrr �iterator�s

ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r)r�rr �IterParseIterator�sr�NFrsrtT)r�collections�Iteratorr�r"rv)ryr�rzr�r)r{r�r�r�ryr r�s

c@s<eZdZd
dd�dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)rN)r�cCs<tj�|_|ptt�d�|_|dkr(d}|jj|j|�dS)N)re�end)r�)r��deque�
_events_queuerrr��
_setevents)r,r�r�rrr r.�s

zXMLPullParser.__init__cCsZ|jdkrtd��|rVy|jj|�Wn.tk
rT}z|jj|�WYdd}~XnXdS)zFeed encoded data to parser.Nz!feed() called after end of stream)r�r�rw�SyntaxErrorr�rB)r,r|�excrrr rw�s
zXMLPullParser.feedcCs|jj�}d|_|S)N)r�rx)r,r�rrr r��s
z$XMLPullParser._close_and_return_rootcCs|j�dS)z�Finish feeding data to parser.

        Unlike XMLParser, does not return the root element. Use
        read_events() to consume elements from XMLPullParser.
        N)r�)r,rrr rx�szXMLPullParser.closeccs2|j}x&|r,|j�}t|t�r$|�q|VqWdS)z�Return an iterator over currently available (event, elem) pairs.

        Events are consumed from the internal event queue as they are
        retrieved from the iterator.
        N)r��popleftr$�	Exception)r,r��eventrrr r�s
zXMLPullParser.read_events)N)rrrr.rwr�rxr�rrrr r�s

cCs"|stt�d�}|j|�|j�S)aParse XML document from string constant.

    This function can be used to embed "XML Literals" in Python code.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    )re)rrrwrx)r2rzrrr rs
cCsV|stt�d�}|j|�|j�}i}x&|j�D]}|jd�}|r0|||<q0W||fS)aParse XML document from string constant for its IDs.

    *text* is a string containing XML data, *parser* is an
    optional parser instance, defaulting to the standard XMLParser.

    Returns an (Element, dict) tuple, in which the
    dict maps element id:s to elements.

    )rer/)rrrwrxr\rU)r2rzr�Zidsr4r/rrr r&s


cCs0|stt�d�}x|D]}|j|�qW|j�S)z�Parse XML document from sequence of string fragments.

    *sequence* is a list of other sequence, *parser* is an optional parser
    instance, defaulting to the standard XMLParser.

    Returns an Element instance.

    )re)rrrwrx)Zsequencerzr2rrr r>s
	
c@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)ra�Generic element structure builder.

    This builder converts a sequence of start, data, and end method
    calls to a well-formed element structure.

    You can use this class to build an element structure using a custom XML
    parser, or a parser for some other XML-like format.

    *element_factory* is an optional element factory which is called
    to create new Element instances, as necessary.

    NcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)�_data�_elem�_last�_tailr�_factory)r,Zelement_factoryrrr r.]szTreeBuilder.__init__cCs.t|j�dkstd��|jdk	s(td��|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagsNzmissing toplevel element)r5r��AssertionErrorr�)r,rrr rxfszTreeBuilder.closecCsf|jrb|jdk	r\dj|j�}|jr@|jjdks6td��||j_n|jjdksTtd��||j_g|_dS)Nr�zinternal error (tail)zinternal error (text))r�r��joinr�r3r�r2)r,r2rrr �_flushls

zTreeBuilder._flushcCs|jj|�dS)zAdd text to current element.N)r�rB)r,r|rrr r|xszTreeBuilder.datacCsF|j�|j||�|_}|jr0|jdj|�|jj|�d|_|S)z�Open new element and return it.

        *tag* is the element name, *attrs* is a dict containing element
        attributes.

        rrr�)r�r�r�r�rBr�)r,r!�attrsr4rrr �start|szTreeBuilder.startcCs@|j�|jj�|_|jj|ks4td|jj|f��d|_|jS)zOClose and return current Element.

        *tag* is the element name.

        z&end tag mismatch (expected %s, got %s)r)r�r��popr�r!r�r�)r,r!rrr r��szTreeBuilder.end)N)
rrrrr.rxr�r|r�r�rrrr rPs
	c@sfeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
dd�ZdS)ra�Element structure builder for XML source data based on the expat parser.

    *html* are predefined HTML entities (deprecated and not supported),
    *target* is an optional target object which defaults to an instance of the
    standard TreeBuilder class, *encoding* is an optional encoding string
    which if given, overrides the encoding specified in the XML file:
    http://www.iana.org/assignments/character-sets

    rNcCs<yddlm}Wn>tk
rNyddl}Wntk
rHtd��YnXYnX|j|d�}|dkrjt�}||_|_||_|_	|j
|_i|_|j
|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d	�r�|j|_d
|_d
|_d
|_d|_i|_yd|j|_ Wnt!k
�r6YnXdS)Nr)�expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r�r�r|�comment�pirzExpat %d.%d.%d)"�xml.parsersr�ImportErrorZpyexpatZParserCreaterrzr�re�_target�error�_error�_names�_defaultZDefaultHandlerExpandr"�_start�StartElementHandler�_end�EndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZbuffer_text�ordered_attributes�specified_attributes�_doctype�entity�version_info�versionr�)r,r�rer�rrzrrr r.�sF




zXMLParser.__init__cCs�|j}|j}x�|D]�}|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�||fdd�}||_q|d	kr�||fd
d�}||_	qt
d|��qWdS)Nr�rcSs|||||�f�dS)Nr)r!Z	attrib_inr�rBr�rrr �handler�sz%XMLParser._setevents.<locals>.handlerr�cSs||||�f�dS)Nr)r!r�rBr�rrr r�szstart-nscSs|||p
d|pdff�dS)Nr�r)r�r�r�rBrrr r�szend-nscSs||df�dS)Nr)r�r�rBrrr r�szunknown event %r)r�rBrrrrr
rZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr�)r,Zevents_queueZevents_to_reportrzrBZ
event_namerrrr r��s(
zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dS)N)r
�code�lineno�offsetZposition)r,rW�errrrr �_raiseerror�szXMLParser._raiseerrorcCsFy|j|}Wn2tk
r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r	�KeyError)r,rV�namerrr �_fixname�szXMLParser._fixnamecCsV|j}||�}i}|rHx0tdt|�d�D]}||d||||�<q(W|jj||�S)Nrr7r)r�ranger5rer�)r,r!Z	attr_listZfixnamer*�irrr rszXMLParser._startcCs|jj|j|��S)N)rer�r)r,r!rrr r
szXMLParser._endcCs�|dd�}|dkr�y|jj}Wntk
r4dSXy||j|dd��WnZtk
r�ddlm}|jd||jj	|jj
f�}d|_|jj	|_|jj
|_
|�YnX�nD|dkr�|dd�d	kr�g|_�n"|jdk	�r�|d
kr�d|_dS|j�}|�sdS|jj|�t|j�}|dk�r�|jd}|dk�rb|d
k�rb|j\}}}	}
|	�r�|	dd�}	n*|dk�r�|dk�r�|j\}}}
d}	ndSt|jd��r�|jj||	|
dd��n:|j|jk�r�|j||	|
dd��|j||	|
dd��d|_dS)Nrr�r)rz'undefined entity %s: line %d, column %d�r��	z	<!DOCTYPEr�r7ZPUBLIC�ZSYSTEM��doctyper�r�r�r�r�)rer|r�rrrrrrzZErrorLineNumberZErrorColumnNumberrrrr�striprBr5r"r$�_XMLParser__doctype)r,r2r�Zdata_handlerrr�nrHr�pubid�systemrrr r
sZ





zXMLParser._defaultcCstjdt�dS)z�(Deprecated)  Handle doctype declaration

        *name* is the Doctype name, *pubid* is the public identifier,
        and *system* is the system identifier.

        z[This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.N)r9r:rK)r,rr(r)rrr r$EszXMLParser.doctypecCsFy|jj|d�Wn.|jk
r@}z|j|�WYdd}~XnXdS)zFeed encoded data to parser.rN)rz�Parserr)r,r|r�rrr rwUszXMLParser.feedcCs�y|jjdd�Wn.|jk
r@}z|j|�WYdd}~XnXz,y|jj}Wntk
rdYnX|�SWd|`|`|`|`XdS)z;Finish feeding data to parser and return element structure.r�rN)	rzr*rrrerxr�r�r)r,r�Z
close_handlerrrr rx\s
zXMLParser.close)rNN)rrrrr.r�rrrr
r
r$r&rwrxrrrr r�s	
*!4)r[)N)N)N)
r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)NN)N)NN)N)N)N)6r�__all__rr�r�r9r�r�r�r�rr�r
rrrrrrr
r�contextmanagerr�r�r�r�rX�	NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr	rrrrrrrrrGZ_elementtreerrrrr �<module>"s�)A

0t4
=22

05


KUPK�e�Z�Ib}��,__pycache__/ElementPath.cpython-36.opt-2.pycnu�[���3


 \�&�@s�ddlZejd�Zddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
eeee	ee
d�ZiZGdd�d�Z
ddd�Zd dd�Zd!dd�Zd"dd�ZdS)#�Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�y6|jdd�\}}|sJt�|dd|||ffVWq�tk
r�td|��Yq�Xq|VqWdS)N�r�{�:z{%s}%sz!prefix %r not found in prefix map)�xpath_tokenizer_re�findall�split�KeyError�SyntaxError)�pattern�
namespaces�token�tag�prefixZuri�r�-/usr/lib64/python3.6/xml/etree/ElementPath.py�xpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jj�D]}x|D]}|||<q.Wq$W|S)N)�
parent_map�root�iter)�contextr�p�errr�get_parent_mapWs

rcs|d��fdd�}|S)Nrc3s0x*|D]"}x|D]}|j�kr|VqWqWdS)N)r
)r�result�elemr)r
rr�selectbs


zprepare_child.<locals>.selectr)�nextrrr)r
r�
prepare_child`srcCsdd�}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs
zprepare_star.<locals>.selectr)rrrrrr�prepare_starisrcCsdd�}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self.<locals>.selectr)rrrrrr�prepare_selfosrcs\y
|�}Wntk
rdSX|ddkr2d�n|dsD|d�ntd���fdd�}|S)Nr�*rzinvalid descendantc3s4x.|D]&}x |j��D]}||k	r|VqWqWdS)N)r)rrrr)r
rrrs
z"prepare_descendant.<locals>.select)�
StopIterationr	)rrrr)r
r�prepare_descendantts

r"cCsdd�}|S)NcssDt|�}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ
result_mapr�parentrrrr�s
zprepare_parent.<locals>.selectr)rrrrrr�prepare_parent�s
r$cs*g}g}x�y
|�}Wntk
r(dSX|ddkr8P|drh|ddd�dkrhd|ddd�f}|j|dpvd�|j|d�q
Wdj|�}|dkr�|d��fd	d
�}|S|dkr�|d�|d���fdd
�}|S|dk�rtjd
|d��r|d��fdd
�}|S|dk�rVtjd
|d��rV|d�|d���fdd
�}|S|dk�st|dk�st|dk�r|dk�r�t|d�d��dk�rtd��nl|ddk�r�td��|dk�r
yt|d�d�Wntk
�r�td��YnX�dk�rtd��nd��fdd
�}|Std��dS) Nr�]rz'"�'�-�z@-c3s&x |D]}|j��dk	r|VqWdS)N)�get)rrr)�keyrrr�s
z!prepare_predicate.<locals>.selectz@-='c3s&x |D]}|j���kr|VqWdS)N)r))rrr)r*�valuerrr�s
z\-?\d+$c3s&x |D]}|j��dk	r|VqWdS)N)�find)rrr)r
rrr�s
z-='c3s@x:|D]2}x,|j��D]}dj|j���kr|VPqWqWdS)Nr()r�joinZitertext)rrrr)r
r+rrr�s

z-()z-()-zXPath position >= 1 expectedZlastzunsupported function�zunsupported expressionz)XPath offset from last() must be negativec
3sbt|�}xT|D]L}y.||}t|j|j��}|�|kr>|VWqttfk
rXYqXqWdS)N)r�listrr
�
IndexErrorr)rrrrr#Zelems)�indexrrr�s

zinvalid predicate���r2r2���r2)r!�appendr-�re�match�intr	�
ValueError)rrZ	signatureZ	predicaterr)r1r*r
r+r�prepare_predicate�sd







r9)r(r �.z..z//�[c@seZdZdZdd�ZdS)�_SelectorContextNcCs
||_dS)N)r)�selfrrrr�__init__�sz_SelectorContext.__init__)�__name__�
__module__�__qualname__rr>rrrrr<�sr<c
!Csh||dkrdntt|j���f}|dd�dkr8|d}yt|}Wn�tk
�r:tt�dkrjtj�|dd�dkr�td��tt	||��j
}y
|�}Wntk
r�dSXg}xvy|jt
|d||��Wntk
r�td��YnXy|�}|ddk�r|�}Wq�tk
�r(PYq�Xq�W|t|<YnX|g}t|�}x|D]}	|	||�}�qPW|S)	Nr�/r �dz#cannot use absolute path on elementrzinvalid pathr2)�tuple�sorted�items�_cacher�len�clearr	rr�__next__r!r4�opsr<)
r�pathrZ	cache_keyZselectorrrrrrrrr�iterfindsD


rMcCstt|||�d�S)N)rrM)rrLrrrrr,)sr,cCstt|||��S)N)r/rM)rrLrrrrr/srcCs4ytt|||��}|jpdStk
r.|SXdS)Nr()rrM�textr!)rrL�defaultrrrr�findtext5s

rP)N)N)N)N)NN)r5�compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr�<module>;s,
		
Y

)

PK�e�Z�A�3}}#__pycache__/__init__.cpython-36.pycnu�[���3


 \D�@sdS)N�rrr�*/usr/lib64/python3.6/xml/etree/__init__.py�<module>sPK�e�Z�A�3}})__pycache__/__init__.cpython-36.opt-1.pycnu�[���3


 \D�@sdS)N�rrr�*/usr/lib64/python3.6/xml/etree/__init__.py�<module>sPKJ}�ZP��^��cElementTree.pyonu�[����
{fc@sddlTdS(i����(t*N(t_elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyt<module>tPKJ}�ZhNwW��__init__.pyonu�[����
{fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyt<module>tPKJ}�Z���G|�|�ElementTree.pycnu�[����
{fc@s>dddddddddd	d
ddd
dddddddgZdZddlZddlZddlZdefd��YZyddlmZWne	k
r�e�ZnXd	e
fd��YZd�Zdefd��YZ
e
ZZid�Zed �Zed!�ZeZdefd"��YZdefd#��YZed$�Zd%�Zd&d'd(d)d*d+d,d-d.d/d0d1d2f
Zyee�ZWnek
r�nXd3�Zd4�Zied56ed66ed76Zd8�Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dE�Z!dF�Z"dG�Z#dH�Z$dI�Z%eedJ�Z&eedK�Z'dL�Z(edM�Z)eedN�Z*dOefdP��YZ+edQ�Z,edR�Z-e,Z.edS�Z/defdT��YZ0dUgZ1defdV��YZ2e2Z3yddWl4m5Z5e5edX<Wne	k
r9nXdS(YtCommenttdumptElementtElementTreet
fromstringtfromstringlistt	iselementt	iterparsetparset
ParseErrortPItProcessingInstructiontQNamet
SubElementttostringttostringlisttTreeBuildertVERSIONtXMLt	XMLParsertXMLTreeBuilders1.3.0i����Nt_SimpleElementPathcBs;eZdd�Zddd�Zdd�Zdd�ZRS(cCs(x!|D]}|j|kr|SqWdS(N(ttagtNone(tselftelementRt
namespacestelem((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindjs
cCs/|j||�}|dkr"|S|jp.dS(Nt(RRttext(RRRtdefaultRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindtextosccsb|d dkr6x#|j|d�D]}|Vq$Wnx%|D]}|j|kr=|Vq=q=WdS(Nis.//(titerR(RRRRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytiterfindts
cCst|j|||��S(N(tlistR"(RRRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindall{sN(t__name__t
__module__RRR R"R$(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRhsi(tElementPathcBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR	�scCst|t�pt|d�S(NR(t
isinstanceRthasattr(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scBs%eZdZdZdZdZid�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zdd�Zddd�Zdd�Zdd�Zd�Zdd�Zd�Zd�Zd�Zdd�Zdd�Zd�Z RS(cKs8|j�}|j|�||_||_g|_dS(N(tcopytupdateRtattribt	_children(RRR,textra((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__init__�s

		cCsdt|j�t|�fS(Ns<Element %s at 0x%x>(treprRtid(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__repr__�scCs|j||�S(N(t	__class__(RRR,((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytmakeelement�scCs;|j|j|j�}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*�s
cCs
t|j�S(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__�scCs)tjdtdd�t|j�dkS(NsyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.t
stacklevelii(twarningstwarnt
FutureWarningR6R-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__nonzero__�s
cCs|j|S(N(R-(Rtindex((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__getitem__	scCs||j|<dS(N(R-(RR=R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__setitem__scCs|j|=dS(N(R-(RR=((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__delitem__!scCs|jj|�dS(N(R-tappend(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRA,scCs|jj|�dS(N(R-textend(Rtelements((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRB6scCs|jj||�dS(N(R-tinsert(RR=R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRD@scCs|jj|�dS(N(R-tremove(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyREOscCstjdtdd�|jS(NsaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.R8i(R9R:tDeprecationWarningR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetchildrenZs
cCstj|||�S(N(R'R(RtpathR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRjscCstj||||�S(N(R'R (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR yscCstj|||�S(N(R'R$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$�scCstj|||�S(N(R'R"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"�scCs*|jj�g|_d|_|_dS(N(R,tclearR-RRR5(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRI�s
	cCs|jj||�S(N(R,tget(RtkeyR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRJ�scCs||j|<dS(N(R,(RRKtvalue((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytset�scCs
|jj�S(N(R,tkeys(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRN�scCs
|jj�S(N(R,titems(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRO�sccso|dkrd}n|dks0|j|kr8|Vnx0|jD]%}x|j|�D]}|VqXWqBWdS(Nt*(RRR-R!(RRte((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!�s	cCs)tjdtdd�t|j|��S(NsbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.R8i(R9R:tPendingDeprecationWarningR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetiterator�s
ccs�|j}t|t�r)|dk	r)dS|jr=|jVnx>|D]6}x|j�D]}|VqWW|jrD|jVqDqDWdS(N(RR(t
basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRU�s		
		N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s<
	
						
			
	
				
		
	
cKs<|j�}|j|�|j||�}|j|�|S(N(R*R+R4RA(tparentRR,R.R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR
s


cCstt�}||_|S(N(RRR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s	cCs6tt�}||_|r2|jd||_n|S(Nt (RRR(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR1s
	cBs/eZdd�Zd�Zd�Zd�ZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rttext_or_uriR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/EscCs|jS(N(R(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__str__IscCs
t|j�S(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|t�r"t|j|j�St|j|�S(N(R(RtcmpR(Rtother((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__cmp__MsN(R%R&RR/R[R]R`(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRDs		cBs�eZddd�Zd�Zd�Zdd�Zdd�Zdd�Zdd�Z	ddd�Z
dd�Zdd	�Zddddd
�Z
d�ZRS(
cCs#||_|r|j|�ndS(N(t_rootR(RRtfile((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/_s	cCs|jS(N(Ra(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetrootkscCs
||_dS(N(Ra(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_setrootuscCs�t}t|d�s-t|d�}t}nzb|sKtdt��}nx*|jd�}|sgPn|j|�qNW|j�|_	|j	SWd|r�|j�nXdS(NtreadtrbRYi(
tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsertclose_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s 	cCs|jj|�S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!�scCs)tjdtdd�t|j|��S(NsbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.R8i(R9R:RRR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRS�s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(Nit/t.s�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s
cCsM|d dkr7d|}tjd|tdd�n|jj|||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR �s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$�s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"�s
cCs=|sd}n|tkr.td|��nt|d�rF|}nt|d�}|j}|s�|dkryd}q�d}n>|s�|dkr�|d
kr�|dkr�|d|�q�n|d	kr�t||j|�n>t|j||�\}}	t|}
|
||j|||	�||k	r9|j	�ndS(Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$<?xml version='1.0' encoding='%s'?>
R(sutf-8sus-ascii(
t
_serializet
ValueErrorR)RhRsRt_serialize_textRat_namespacesRk(Rtfile_or_filenametencodingtxml_declarationtdefault_namespacetmethodRbRstqnamesRt	serialize((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRss0					
cCs|j|dd�S(NR~Ru(Rs(RRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt
write_c14n8sN(R%R&RR/RcRdRR!RSRR R$R"RsR�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR]s	
	 c	s�idd6�i��r&d��<n�fd������fd�}y
|j}Wntk
rv|j}nXx]|�D]R}|j}t|t�r�|j�kr||j�qn\t|t�r�|�kr||�qn1|dk	r|t	k	r|t
k	rt|�nx||j�D]n\}}t|t�rQ|j}n|�krj||�nt|t�r*|j�kr*||j�q*q*W|j}t|t�r�|j�kr�||j�q�q�W��fS(NRcs
|j��S(N(tencode(R(R{(s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�Jscsy�|d dkr�|djdd�\}}�j|�}|dkr�tj|�}|dkrxdt��}n|dkr�|�|<q�n|r��d||f��|<q��|��|<n%�r�td��n�|��|<Wntk
r
t|�nXdS(Nit{t}sns%dRrs%s:%ss<cannot use non-qualified names with default_namespace option(trsplitRJRt_namespace_mapR6Rwt	TypeErrort_raise_serialization_error(tqnameturiRtprefix(R}R�RR(s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt	add_qnameMs&
(
RR!tAttributeErrorRSRR(RRRTRR
R�RO(	RR{R}R�titerateRRKRLR((R}R�R{RRs-/usr/lib64/python2.7/xml/etree/ElementTree.pyRy?s>




	$

	cCss|j}|j}|tkr8|dt||��n|tkr^|dt||��n�||}|dkr�|r�|t||��nx�|D]}t||||d�q�Wn�|d|�|j�}|s�|r�|rNxet	|j�dd��D]E\}	}
|
r!d|
}
n|d|
j
|�t|	|�f�qWnx~t	|�D]m\}
}	t|
t
�r�|
j}
nt|	t
�r�||	j}	nt|	|�}	|d||
|	f�q[Wn|s�t|�rC|d	�|r|t||��nx$|D]}t||||d�qW|d
|d	�n
|d�|jro|t|j|��ndS(Ns	<!--%s-->s<?%s?>t<RKcSs|dS(Ni((tx((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt<lambda>�Rt:s
 xmlns%s="%s"s %s="%s"t>s</s />(RRRt_encodeRRt
_escape_cdatat_serialize_xmlROtsortedR�t_escape_attribR(RR6R5(RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��sP		





	tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamcCs�|j}|j}|tkr8|dt||��n?|tkr^|dt||��n||}|dkr�|r�|t||��nx�|D]}t||||d�q�Wn�|d|�|j�}|s�|r�|rNxet|j�dd��D]E\}	}
|
r!d|
}
n|d|
j	|�t
|	|�f�qWnx~t|�D]m\}
}	t|
t�r�|
j}
nt|	t�r�||	j}	nt
|	|�}	|d||
|	f�q[Wn|d	�|j�}|r/|d
ks|dkr|t||��q/|t||��nx$|D]}t||||d�q6W|tkrw|d|d	�n|jr�|t|j|��ndS(
Ns	<!--%s-->s<?%s?>R�RKcSs|dS(Ni((R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��RR�s
 xmlns%s="%s"s %s="%s"R�tscripttstyles</(RRRR�RRt_serialize_htmlROR�R�R�R(Rt_escape_attrib_htmltlowerR�t
HTML_EMPTYR5(RsRR{RRRRRQROR�R�tltag((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��sT		




	cCsPx'|j�D]}||j|��q
W|jrL||jj|��ndS(N(RUR�R5(RsRR{tpart((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRx�s	RrthtmlRcCsntjd|�r!td��nx<tj�D].\}}||ksR||kr.t|=q.q.W|t|<dS(Nsns\d+$s'Prefix format reserved for internal use(tretmatchRwR�RO(R�R�R�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytregister_namespacess$http://www.w3.org/XML/1998/namespaceshttp://www.w3.org/1999/xhtmltrdfs+http://www.w3.org/1999/02/22-rdf-syntax-ns#twsdls http://schemas.xmlsoap.org/wsdl/txss http://www.w3.org/2001/XMLSchematxsis)http://www.w3.org/2001/XMLSchema-instancetdcs http://purl.org/dc/elements/1.1/cCs#td|t|�jf��dS(Nscannot serialize %r (type %s)(R�ttypeR%(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs<y|j|d�SWn!ttfk
r7t|�nXdS(Ntxmlcharrefreplace(R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs�ywd|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}n|j|d�SWn!ttfk
r�t|�nXdS(Nt&s&amp;R�s&lt;R�s&gt;R�(treplaceR�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�%scCs�y�d|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}nd|kr�|jdd�}nd	|kr�|jd	d
�}n|j|d�SWn!ttfk
r�t|�nXdS(NR�s&amp;R�s&lt;R�s&gt;s"s&quot;s
s&#10;R�(R�R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�5scCs�ywd|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}n|j|d�SWn!ttfk
r�t|�nXdS(NR�s&amp;R�s&gt;s"s&quot;R�(R�R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�FscCsWddd��Y}g}|�}|j|_t|�j||d|�dj|�S(NtdummycBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�asR~R((RARsRtjoin(RR{R~R�RoRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR`s	cCsNddd��Y}g}|�}|j|_t|�j||d|�|S(NR�cBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�vsR~((RARsR(RR{R~R�RoRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRus	cCskt|t�st|�}n|jtj�|j�j}|sT|ddkrgtjjd�ndS(Ni����s
(R(RRstsyststdoutRcR5(RR5((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCst�}|j||�|S(N(RR(RlRmttree((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s	cCs�t}t|d�s-t|d�}t}ny2|sKtdt��}nt||||�SWn|rx|j�n�nXdS(NReRfRY(RgR)RhRiRRt_IterParseIteratorRk(RlteventsRmRn((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s	
R�cBs&eZed�Zd�Zd�ZRS(cCs�||_||_g|_d|_d|_d|_|_||_|jj}|jj	}|dkrvdg}nx|D]}|dkr�y7d|_
d|_|||jjd�}||_
Wq�tk
r�|||jjd�}||_
q�Xq}|dkr.|||jjd�}||_q}|dkrU||d	�}||_q}|d
kr|||d�}||_q}td|��q}WdS(
NitendtstarticSs|||||�f�dS(N((Rt	attrib_inteventRAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pythandler�scSs|||||�f�dS(N((RR�R�RAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��scSs||||�f�dS(N((RR�RAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��ssstart-nscSsSy|pdjd�}Wntk
r,nX|||p<d|pEdff�dS(NRtascii(R�tUnicodeError(R�R�R�RA((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s

send-nscSs||df�dS(N(R(R�R�RA((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��ssunknown event %r(t_filet_close_filet_eventst_indexRt_errortrootRat_parserRAtordered_attributestspecified_attributest_start_listtStartElementHandlerR�t_startt_endtEndElementHandlertStartNamespaceDeclHandlertEndNamespaceDeclHandlerRw(RRlR�RmRnRAR�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/�sD						
		

cCsKyx�y'|j|j}|jd7_|SWntk
r@nX|jre|j}d|_|�n|jdkr�|j|_Pn|j2d|_|jj	d�}|r�y|jj
|�Wq�tk
r�}||_q�Xq|jj�|_d|_qWWn#|j
r!|jj�n�nX|j
rA|jj�nt�dS(Niii@(R�R�t
IndexErrorR�RR�RaR�R�ReRjtSyntaxErrorRkR�t
StopIteration(RtitemRQRotexc((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytnext�s@
							cCs|S(N((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__iter__s(R%R&RgR/R�R�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s/	$cCs2|stdt��}n|j|�|j�S(NRY(RRRjRk(RRm((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs
cCs}|stdt��}n|j|�|j�}i}x6|j�D](}|jd�}|rG|||<qGqGW||fS(NRYR1(RRRjRkR!RJ(RRmR�tidsRR1((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytXMLID,s
cCsC|stdt��}nx|D]}|j|�q"W|j�S(NRY(RRRjRk(tsequenceRmR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRLs

cBsAeZdd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsFg|_g|_d|_d|_|dkr9t}n||_dS(N(t_datat_elemRt_lastt_tailRt_factory(Rtelement_factory((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/bs					cCsCt|j�dks!td��|jdk	s<td��|jS(Nismissing end tagssmissing toplevel element(R6R�tAssertionErrorR�R(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRkrs!cCs�|jr�|jdk	r�dj|j�}|jr`|jjdksQtd��||j_q�|jjdks~td��||j_ng|_ndS(NRsinternal error (tail)sinternal error (text)(R�R�RR�R�R5R�R(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_flushws		cCs|jj|�dS(N(R�RA(RRo((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRo�scCs`|j�|j||�|_}|jrC|jdj|�n|jj|�d|_|S(Ni����i(R�R�R�R�RAR�(RRtattrsR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s
		cCsZ|j�|jj�|_|jj|ksJtd|jj|f��d|_|jS(Ns&end tag mismatch (expected %s, got %s)i(R�R�tpopR�RR�R�(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s
	N(	R%R&RR/RkR�RoR�R�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR`s				tsentinelcBs�eZeddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZeZd�Zd
�ZRS(cCs�|tk	r%tjdtdd�nyddlm}WnAtk
r|yddl}Wq}tk
rxtd��q}XnX|j|d�}|dkr�t
�}n||_|_||_
|_|j|_i|_|j|_|j|_|j|_|j|_|j|_|j|_yd|j_Wntk
rGnXy(d|j_ d|j_!|j"|_Wntk
r�nXd|_#i|_$yd	|j%|_&Wntk
r�nXdS(
Ns.The html argument of XMLParser() is deprecatedR8ii����(texpats7No module named expat; use SimpleXMLTreeBuilder insteadR�isExpat %d.%d.%d('t	_sentinelR9twarnpy3kRFtxml.parsersR�tImportErrortpyexpattParserCreateRRRmR�RYt_targetterrorR�t_namest_defaulttDefaultHandlerExpandR�R�R�R�R�tCharacterDataHandlert_commenttCommentHandlert_pitProcessingInstructionHandlertbuffer_textR�R�R�R�t_doctypetentitytversion_infotversion(RR�RYR{R�Rm((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/�sR

	

		
cCs7t|�}|j|_|j|jf|_|�dS(N(R	tcodetlinenotoffsettposition(RRLterr((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_raiseerror�scCs*y|jd�SWntk
r%|SXdS(NR�(R�R�(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_fixtext�s
cCsby|j|}WnJtk
r]|}d|kr@d|}n|j|�|j|<}nX|S(NR�R�(R�tKeyErrorR(RRKtname((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_fixname�s

cCsj|j}|j}||�}i}x0|j�D]"\}}||�|||�<q1W|jj||�S(N(RRRORYR�(RRR�tfixnametfixtextR,RKRL((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s		cCs�|j}|j}||�}i}|rrxEtdt|�d�D](}|||d�||||�<qCWn|jj||�S(Niii(RRtrangeR6RYR�(RRR�RRR,ti((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s		)cCs|jj|j|��S(N(RYRoR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs|jj|j|��S(N(RYR�R(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs;y|jj}Wntk
r#nX||j|��SdS(N(RYtcommentR�R(RRoR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR� s

cCsGy|jj}Wntk
r#n X||j|�|j|��SdS(N(RYtpiR�R(RRYRoR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�(s

c
Cs]|d }|dkr�y"|jj|j|dd!�WqYtk
r�ddlm}|jd||jj|jj	f�}d|_
|jj|_|jj	|_|�qYXn�|dkr�|d d	kr�g|_
n}|j
dk	rY|d
krd|_
dS|j�}|sdS|j
j|�t|j
�}|dkrY|j
d}|dkr�|d
kr�|j
\}}}}	n7|dkr�|dkr�|j
\}}}	d}ndS|r�|dd!}nt|jd�r|jj|||	dd!�nI|j|jkrJ|j|||	dd!�|j|||	dd!�nd|_
qYndS(NiR�i����(R�s'undefined entity %s: line %d, column %diR�i	s	<!DOCTYPER�itPUBLICitSYSTEMitdoctype(RYRoRR
R�R�R�R�tErrorLineNumbertErrorColumnNumberRRRRRtstripRAR6R)Rt_XMLParser__doctype(
RRR�R�R
tnR�Rtpubidtsystem((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�0sR
"
	
	
	 cCstjdt�dS(s'This method of XMLParser is deprecated.s[This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.N(R9R:RF(RRRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRgscCsAy|jj|d�Wn#|jk
r<}|j|�nXdS(Ni(R�tParseR�R(RRoR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRjwscCs\y|jjdd�Wn#|jk
r<}|j|�nX|jj�}|`|`|S(NRi(R�R R�RRYRk(RR�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRk�sN(R%R&R�RR/RRRR�R�R�R�R�R�R�RRRjRk(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s1						
					7			(t_serialize_c14nRu(6t__all__RR�R�R9tobjectRRR'R�R�R	RRt_Elementt_ElementInterfaceR
RRRR
RRRyR�R�RMt	NameErrorR�RxRvR�R�R�R�R�R�R�RRRRRR�RR�RRRR�RRtElementC14NR!(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt<module>;s�

		�U
�D	/
	2	
	
						bM	�
PKJ}�Z�B�u��ElementPath.pyonu�[����
{fc@s�ddlZejd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zied6ed6ed
6e
d6e	d6ed6ZiZ
ddd��YZdd�Zdd�Zdd�Zddd�ZdS(i����NsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�yH|jdd�\}}|slt�n|dd|||ffVWq�tk
r�td|��q�Xq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrortSyntaxError(tpatternt
namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs
"	!
cCs^|j}|dkrZi|_}x5|jj�D]!}x|D]}|||<q?Wq2Wn|S(N(t
parent_maptNonetroottiter(tcontextRtpte((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytget_parent_mapWs	

cs|d��fd�}|S(Nic3s=x6|D].}x%|D]}|j�kr|VqqWqWdS(N(R
(RtresulttelemR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytselectbs

((tnextR	R((R
s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt
prepare_child`s
cCs
d�}|S(Ncss+x$|D]}x|D]}|VqWqWdS(N((RRRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRjs

((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_staris	cCs
d�}|S(Ncssx|D]}|VqWdS(N((RRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRqs
((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_selfps	csX|�}|ddkr"d�n#|ds9|d�ntd���fd�}|S(Nit*isinvalid descendantc3sCx<|D]4}x+|j��D]}||k	r|VqqWqWdS(N(R(RRRR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR~s
(R(RR	R((R
s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_descendantvs		

cCs
d�}|S(Ncss^t|�}i}xE|D]=}||kr||}||krVd||<|VqVqqWdS(N(RR(RRRt
result_mapRtparent((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s


((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_parent�s	
csag}g}x�|�}|ddkr,Pn|drd|dd dkrdd|ddd!f}n|j|dpwd�|j|d�qWdj|�}|d	kr�|d��fd
�}|S|dkr�|d�|d���fd�}|S|dkr>tjd
|d�r>|d��fd�}|S|dkr�tjd
|d�r�|d�|d���fd�}|S|dks�|dks�|dkrQ|dkr�t|d�d�nl|ddkr�td��n|dkr8yt|d�d�Wq>tk
r4td��q>Xnd��fd�}|Std��dS(Nit]is'"t'i����t-ts@-c3s2x+|D]#}|j��dk	r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s@-='c3s2x+|D]#}|j���kr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s\d+$c3s2x+|D]#}|j��dk	r|VqqWdS(N(tfindR(RRR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s-='c3sSxL|D]D}x;|j��D]*}dj|j���kr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R
R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s

s-()s-()-tlastsunsupported functionisunsupported expressionc3syt|�}xf|D]^}y>||}t|j|j��}|�|krV|VnWqttfk
rpqXqWdS(N(RtlistRR
t
IndexErrorR(RRRRR telems(tindex(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s

sinvalid predicate(tappendR*tretmatchtintRt
ValueError(RR	t	signaturet	predicateR((R0R'R
R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicate�sV	


#
#

$
R%Rt.s..s//t[t_SelectorContextcBseZdZd�ZRS(cCs
||_dS(N(R(tselfR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt__init__�sN(t__name__t
__module__RRR=(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR;�sc	Csn|ddkr|d}nyt|}Wntk
r4tt�dkrZtj�n|d dkrytd��ntt||��j}|�}g}x�y"|jt	|d||��Wnt
k
r�td��nXy)|�}|ddkr
|�}nWq�t
k
r"Pq�Xq�W|t|<nX|g}t|�}x|D]}|||�}qQW|S(	Ni����t/Ridis#cannot use absolute path on elementisinvalid path(t_cacheRtlentclearRRR
RR1topst
StopIterationR;(	RtpathRtselectorRR	RRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytiterfind�s:


	"
	
		
cCs3yt|||�j�SWntk
r.dSXdS(N(RHRRER(RRFR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR)s
cCstt|||��S(N(R-RH(RRFR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR$scCsBy)t|||�j�}|jp'dSWntk
r=|SXdS(NR%(RHRttextRE(RRFtdefaultR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytfindtext*s

((R2tcompileRRR
RRRRRR!R8RDRAR;RHR)RRK(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt<module>;s.									
	P

$	PKJ}�ZP��^��cElementTree.pycnu�[����
{fc@sddlTdS(i����(t*N(t_elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyt<module>tPKJ}�Z�Y檯�ElementInclude.pycnu�[����
{fc@shddlZddlmZdZedZedZdefd��YZdd	�Z	dd
�Z
dS(i����Ni(tElementTrees!{http://www.w3.org/2001/XInclude}tincludetfallbacktFatalIncludeErrorcBseZRS((t__name__t
__module__(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyR>scCsat|��O}|dkr3tj|�j�}n$|j�}|rW|j|�}nWdQX|S(Ntxml(topenRtparsetgetroottreadtdecode(threfRtencodingtfiletdata((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pytdefault_loaderMscCs�|dkrt}nd}x�|t|�kr�||}|jtkr�|jd�}|jdd�}|dkr�|||�}|dkr�td||f��ntj|�}|jr�|jp�d|j|_n|||<q�|dkr�||||jd��}|dkr7td||f��n|rq||d	}|jpWd||jpgd|_n#|j	p}d||jp�d|_	||=qq�td
|��n2|jt
kr�td|j��n
t||�|d	}qWdS(NiRRRscannot load %r as %rtttextR
is)unknown parse type in xi:include tag (%r)s0xi:fallback tag must be child of xi:include (%r)(tNoneRtlenttagtXINCLUDE_INCLUDEtgetRtcopyttailRtXINCLUDE_FALLBACKR(telemtloadertiteRRtnodeR((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyRbsF	
	
&#
(RRRtXINCLUDERRtSyntaxErrorRRRR(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyt<module>3s

PKJ}�Z[��	��ElementTree.pyonu�[����
{fc@s>dddddddddd	d
ddd
dddddddgZdZddlZddlZddlZdefd��YZyddlmZWne	k
r�e�ZnXd	e
fd��YZd�Zdefd��YZ
e
ZZid�Zed �Zed!�ZeZdefd"��YZdefd#��YZed$�Zd%�Zd&d'd(d)d*d+d,d-d.d/d0d1d2f
Zyee�ZWnek
r�nXd3�Zd4�Zied56ed66ed76Zd8�Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dE�Z!dF�Z"dG�Z#dH�Z$dI�Z%eedJ�Z&eedK�Z'dL�Z(edM�Z)eedN�Z*dOefdP��YZ+edQ�Z,edR�Z-e,Z.edS�Z/defdT��YZ0dUgZ1defdV��YZ2e2Z3yddWl4m5Z5e5edX<Wne	k
r9nXdS(YtCommenttdumptElementtElementTreet
fromstringtfromstringlistt	iselementt	iterparsetparset
ParseErrortPItProcessingInstructiontQNamet
SubElementttostringttostringlisttTreeBuildertVERSIONtXMLt	XMLParsertXMLTreeBuilders1.3.0i����Nt_SimpleElementPathcBs;eZdd�Zddd�Zdd�Zdd�ZRS(cCs(x!|D]}|j|kr|SqWdS(N(ttagtNone(tselftelementRt
namespacestelem((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindjs
cCs/|j||�}|dkr"|S|jp.dS(Nt(RRttext(RRRtdefaultRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindtextosccsb|d dkr6x#|j|d�D]}|Vq$Wnx%|D]}|j|kr=|Vq=q=WdS(Nis.//(titerR(RRRRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytiterfindts
cCst|j|||��S(N(tlistR"(RRRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytfindall{sN(t__name__t
__module__RRR R"R$(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRhsi(tElementPathcBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR	�scCst|t�pt|d�S(NR(t
isinstanceRthasattr(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scBs%eZdZdZdZdZid�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zdd�Zddd�Zdd�Zdd�Zd�Zdd�Zd�Zd�Zd�Zdd�Zdd�Zd�Z RS(cKs8|j�}|j|�||_||_g|_dS(N(tcopytupdateRtattribt	_children(RRR,textra((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__init__�s

		cCsdt|j�t|�fS(Ns<Element %s at 0x%x>(treprRtid(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__repr__�scCs|j||�S(N(t	__class__(RRR,((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytmakeelement�scCs;|j|j|j�}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*�s
cCs
t|j�S(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__�scCs)tjdtdd�t|j�dkS(NsyThe behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.t
stacklevelii(twarningstwarnt
FutureWarningR6R-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__nonzero__�s
cCs|j|S(N(R-(Rtindex((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__getitem__	scCs||j|<dS(N(R-(RR=R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__setitem__scCs|j|=dS(N(R-(RR=((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__delitem__!scCs|jj|�dS(N(R-tappend(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRA,scCs|jj|�dS(N(R-textend(Rtelements((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRB6scCs|jj||�dS(N(R-tinsert(RR=R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRD@scCs|jj|�dS(N(R-tremove(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyREOscCstjdtdd�|jS(NsaThis method will be removed in future versions.  Use 'list(elem)' or iteration over elem instead.R8i(R9R:tDeprecationWarningR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetchildrenZs
cCstj|||�S(N(R'R(RtpathR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRjscCstj||||�S(N(R'R (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR yscCstj|||�S(N(R'R$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$�scCstj|||�S(N(R'R"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"�scCs*|jj�g|_d|_|_dS(N(R,tclearR-RRR5(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRI�s
	cCs|jj||�S(N(R,tget(RtkeyR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRJ�scCs||j|<dS(N(R,(RRKtvalue((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytset�scCs
|jj�S(N(R,tkeys(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRN�scCs
|jj�S(N(R,titems(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRO�sccso|dkrd}n|dks0|j|kr8|Vnx0|jD]%}x|j|�D]}|VqXWqBWdS(Nt*(RRR-R!(RRte((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!�s	cCs)tjdtdd�t|j|��S(NsbThis method will be removed in future versions.  Use 'elem.iter()' or 'list(elem.iter())' instead.R8i(R9R:tPendingDeprecationWarningR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetiterator�s
ccs�|j}t|t�r)|dk	r)dS|jr=|jVnx>|D]6}x|j�D]}|VqWW|jrD|jVqDqDWdS(N(RR(t
basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRU�s		
		N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s<
	
						
			
	
				
		
	
cKs<|j�}|j|�|j||�}|j|�|S(N(R*R+R4RA(tparentRR,R.R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR
s


cCstt�}||_|S(N(RRR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"s	cCs6tt�}||_|r2|jd||_n|S(Nt (RRR(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR1s
	cBs/eZdd�Zd�Zd�Zd�ZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rttext_or_uriR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/EscCs|jS(N(R(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__str__IscCs
t|j�S(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|t�r"t|j|j�St|j|�S(N(R(RtcmpR(Rtother((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__cmp__MsN(R%R&RR/R[R]R`(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRDs		cBs�eZddd�Zd�Zd�Zdd�Zdd�Zdd�Zdd�Z	ddd�Z
dd�Zdd	�Zddddd
�Z
d�ZRS(
cCs#||_|r|j|�ndS(N(t_rootR(RRtfile((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/_s	cCs|jS(N(Ra(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytgetrootkscCs
||_dS(N(Ra(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_setrootuscCs�t}t|d�s-t|d�}t}nzb|sKtdt��}nx*|jd�}|sgPn|j|�qNW|j�|_	|j	SWd|r�|j�nXdS(NtreadtrbRYi(
tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsertclose_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s 	cCs|jj|�S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!�scCs)tjdtdd�t|j|��S(NsbThis method will be removed in future versions.  Use 'tree.iter()' or 'list(tree.iter())' instead.R8i(R9R:RRR#R!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRS�s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(Nit/t.s�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s
cCsM|d dkr7d|}tjd|tdd�n|jj|||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR (RRHRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR �s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR$(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR$�s
cCsJ|d dkr7d|}tjd|tdd�n|jj||�S(NiRpRqs�This search is broken in 1.3 and earlier, and will be fixed in a future version.  If you rely on the current behaviour, change it to %rR8i(R9R:R;RaR"(RRHR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR"�s
cCs=|sd}n|tkr.td|��nt|d�rF|}nt|d�}|j}|s�|dkryd}q�d}n>|s�|dkr�|d
kr�|dkr�|d|�q�n|d	kr�t||j|�n>t|j||�\}}	t|}
|
||j|||	�||k	r9|j	�ndS(Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$<?xml version='1.0' encoding='%s'?>
R(sutf-8sus-ascii(
t
_serializet
ValueErrorR)RhRsRt_serialize_textRat_namespacesRk(Rtfile_or_filenametencodingtxml_declarationtdefault_namespacetmethodRbRstqnamesRt	serialize((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRss0					
cCs|j|dd�S(NR~Ru(Rs(RRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt
write_c14n8sN(R%R&RR/RcRdRR!RSRR R$R"RsR�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR]s	
	 c	s�idd6�i��r&d��<n�fd������fd�}y
|j}Wntk
rv|j}nXx]|�D]R}|j}t|t�r�|j�kr||j�qn\t|t�r�|�kr||�qn1|dk	r|t	k	r|t
k	rt|�nx||j�D]n\}}t|t�rQ|j}n|�krj||�nt|t�r*|j�kr*||j�q*q*W|j}t|t�r�|j�kr�||j�q�q�W��fS(NRcs
|j��S(N(tencode(R(R{(s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�Jscsy�|d dkr�|djdd�\}}�j|�}|dkr�tj|�}|dkrxdt��}n|dkr�|�|<q�n|r��d||f��|<q��|��|<n%�r�td��n�|��|<Wntk
r
t|�nXdS(Nit{t}sns%dRrs%s:%ss<cannot use non-qualified names with default_namespace option(trsplitRJRt_namespace_mapR6Rwt	TypeErrort_raise_serialization_error(tqnameturiRtprefix(R}R�RR(s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt	add_qnameMs&
(
RR!tAttributeErrorRSRR(RRRTRR
R�RO(	RR{R}R�titerateRRKRLR((R}R�R{RRs-/usr/lib64/python2.7/xml/etree/ElementTree.pyRy?s>




	$

	cCss|j}|j}|tkr8|dt||��n|tkr^|dt||��n�||}|dkr�|r�|t||��nx�|D]}t||||d�q�Wn�|d|�|j�}|s�|r�|rNxet	|j�dd��D]E\}	}
|
r!d|
}
n|d|
j
|�t|	|�f�qWnx~t	|�D]m\}
}	t|
t
�r�|
j}
nt|	t
�r�||	j}	nt|	|�}	|d||
|	f�q[Wn|s�t|�rC|d	�|r|t||��nx$|D]}t||||d�qW|d
|d	�n
|d�|jro|t|j|��ndS(Ns	<!--%s-->s<?%s?>t<RKcSs|dS(Ni((tx((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt<lambda>�Rt:s
 xmlns%s="%s"s %s="%s"t>s</s />(RRRt_encodeRRt
_escape_cdatat_serialize_xmlROtsortedR�t_escape_attribR(RR6R5(RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��sP		





	tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamcCs�|j}|j}|tkr8|dt||��n?|tkr^|dt||��n||}|dkr�|r�|t||��nx�|D]}t||||d�q�Wn�|d|�|j�}|s�|r�|rNxet|j�dd��D]E\}	}
|
r!d|
}
n|d|
j	|�t
|	|�f�qWnx~t|�D]m\}
}	t|
t�r�|
j}
nt|	t�r�||	j}	nt
|	|�}	|d||
|	f�q[Wn|d	�|j�}|r/|d
ks|dkr|t||��q/|t||��nx$|D]}t||||d�q6W|tkrw|d|d	�n|jr�|t|j|��ndS(
Ns	<!--%s-->s<?%s?>R�RKcSs|dS(Ni((R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��RR�s
 xmlns%s="%s"s %s="%s"R�tscripttstyles</(RRRR�RRt_serialize_htmlROR�R�R�R(Rt_escape_attrib_htmltlowerR�t
HTML_EMPTYR5(RsRR{RRRRRQROR�R�tltag((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��sT		




	cCsPx'|j�D]}||j|��q
W|jrL||jj|��ndS(N(RUR�R5(RsRR{tpart((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRx�s	RrthtmlRcCsntjd|�r!td��nx<tj�D].\}}||ksR||kr.t|=q.q.W|t|<dS(Nsns\d+$s'Prefix format reserved for internal use(tretmatchRwR�RO(R�R�R�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytregister_namespacess$http://www.w3.org/XML/1998/namespaceshttp://www.w3.org/1999/xhtmltrdfs+http://www.w3.org/1999/02/22-rdf-syntax-ns#twsdls http://schemas.xmlsoap.org/wsdl/txss http://www.w3.org/2001/XMLSchematxsis)http://www.w3.org/2001/XMLSchema-instancetdcs http://purl.org/dc/elements/1.1/cCs#td|t|�jf��dS(Nscannot serialize %r (type %s)(R�ttypeR%(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs<y|j|d�SWn!ttfk
r7t|�nXdS(Ntxmlcharrefreplace(R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs�ywd|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}n|j|d�SWn!ttfk
r�t|�nXdS(Nt&s&amp;R�s&lt;R�s&gt;R�(treplaceR�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�%scCs�y�d|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}nd|kr�|jdd�}nd	|kr�|jd	d
�}n|j|d�SWn!ttfk
r�t|�nXdS(NR�s&amp;R�s&lt;R�s&gt;s"s&quot;s
s&#10;R�(R�R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�5scCs�ywd|kr$|jdd�}nd|krE|jdd�}nd|krf|jdd�}n|j|d�SWn!ttfk
r�t|�nXdS(NR�s&amp;R�s&gt;s"s&quot;R�(R�R�R�R�R�(RR{((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�FscCsWddd��Y}g}|�}|j|_t|�j||d|�dj|�S(NtdummycBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�asR~R((RARsRtjoin(RR{R~R�RoRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR`s	cCsNddd��Y}g}|�}|j|_t|�j||d|�|S(NR�cBseZRS((R%R&(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�vsR~((RARsR(RR{R~R�RoRb((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRus	cCskt|t�st|�}n|jtj�|j�j}|sT|ddkrgtjjd�ndS(Ni����s
(R(RRstsyststdoutRcR5(RR5((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCst�}|j||�|S(N(RR(RlRmttree((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s	cCs�t}t|d�s-t|d�}t}ny2|sKtdt��}nt||||�SWn|rx|j�n�nXdS(NReRfRY(RgR)RhRiRRt_IterParseIteratorRk(RlteventsRmRn((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s	
R�cBs&eZed�Zd�Zd�ZRS(cCs�||_||_g|_d|_d|_d|_|_||_|jj}|jj	}|dkrvdg}nx|D]}|dkr�y7d|_
d|_|||jjd�}||_
Wq�tk
r�|||jjd�}||_
q�Xq}|dkr.|||jjd�}||_q}|dkrU||d	�}||_q}|d
kr|||d�}||_q}td|��q}WdS(
NitendtstarticSs|||||�f�dS(N((Rt	attrib_inteventRAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pythandler�scSs|||||�f�dS(N((RR�R�RAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��scSs||||�f�dS(N((RR�RAR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��ssstart-nscSsSy|pdjd�}Wntk
r,nX|||p<d|pEdff�dS(NRtascii(R�tUnicodeError(R�R�R�RA((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s

send-nscSs||df�dS(N(R(R�R�RA((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��ssunknown event %r(t_filet_close_filet_eventst_indexRt_errortrootRat_parserRAtordered_attributestspecified_attributest_start_listtStartElementHandlerR�t_startt_endtEndElementHandlertStartNamespaceDeclHandlertEndNamespaceDeclHandlerRw(RRlR�RmRnRAR�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/�sD						
		

cCsKyx�y'|j|j}|jd7_|SWntk
r@nX|jre|j}d|_|�n|jdkr�|j|_Pn|j2d|_|jj	d�}|r�y|jj
|�Wq�tk
r�}||_q�Xq|jj�|_d|_qWWn#|j
r!|jj�n�nX|j
rA|jj�nt�dS(Niii@(R�R�t
IndexErrorR�RR�RaR�R�ReRjtSyntaxErrorRkR�t
StopIteration(RtitemRQRotexc((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytnext�s@
							cCs|S(N((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__iter__s(R%R&RgR/R�R�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s/	$cCs2|stdt��}n|j|�|j�S(NRY(RRRjRk(RRm((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs
cCs}|stdt��}n|j|�|j�}i}x6|j�D](}|jd�}|rG|||<qGqGW||fS(NRYR1(RRRjRkR!RJ(RRmR�tidsRR1((s-/usr/lib64/python2.7/xml/etree/ElementTree.pytXMLID,s
cCsC|stdt��}nx|D]}|j|�q"W|j�S(NRY(RRRjRk(tsequenceRmR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRLs

cBsAeZdd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsFg|_g|_d|_d|_|dkr9t}n||_dS(N(t_datat_elemRt_lastt_tailRt_factory(Rtelement_factory((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/bs					cCs|jS(N(R�(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRkrscCsa|jr]|jdk	rQdj|j�}|jrB||j_qQ||j_ng|_ndS(NR(R�R�RR�R�R5R(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_flushws		cCs|jj|�dS(N(R�RA(RRo((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRo�scCs`|j�|j||�|_}|jrC|jdj|�n|jj|�d|_|S(Ni����i(R�R�R�R�RAR�(RRtattrsR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s
		cCs,|j�|jj�|_d|_|jS(Ni(R�R�tpopR�R�(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR��s
	N(	R%R&RR/RkR�RoR�R�(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR`s				tsentinelcBs�eZeddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�ZeZd�Zd
�ZRS(cCs�|tk	r%tjdtdd�nyddlm}WnAtk
r|yddl}Wq}tk
rxtd��q}XnX|j|d�}|dkr�t
�}n||_|_||_
|_|j|_i|_|j|_|j|_|j|_|j|_|j|_|j|_yd|j_Wntk
rGnXy(d|j_ d|j_!|j"|_Wntk
r�nXd|_#i|_$yd	|j%|_&Wntk
r�nXdS(
Ns.The html argument of XMLParser() is deprecatedR8ii����(texpats7No module named expat; use SimpleXMLTreeBuilder insteadR�isExpat %d.%d.%d('t	_sentinelR9twarnpy3kRFtxml.parsersR�tImportErrortpyexpattParserCreateRRRmR�RYt_targetterrorR�t_namest_defaulttDefaultHandlerExpandR�R�R�R�R�tCharacterDataHandlert_commenttCommentHandlert_pitProcessingInstructionHandlertbuffer_textR�R�R�R�t_doctypetentitytversion_infotversion(RR�RYR{R�Rm((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR/�sR

	

		
cCs7t|�}|j|_|j|jf|_|�dS(N(R	tcodetlinenotoffsettposition(RRLterr((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_raiseerror�scCs*y|jd�SWntk
r%|SXdS(NR�(R�R�(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_fixtext�s
cCsby|j|}WnJtk
r]|}d|kr@d|}n|j|�|j|<}nX|S(NR�R�(R�tKeyErrorR(RRKtname((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt_fixname�s

cCsj|j}|j}||�}i}x0|j�D]"\}}||�|||�<q1W|jj||�S(N(RRRORYR�(RRR�tfixnametfixtextR,RKRL((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s		cCs�|j}|j}||�}i}|rrxEtdt|�d�D](}|||d�||||�<qCWn|jj||�S(Niii(RRtrangeR6RYR�(RRR�RRR,ti((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s		)cCs|jj|j|��S(N(RYRoR(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs|jj|j|��S(N(RYR�R(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�scCs;y|jj}Wntk
r#nX||j|��SdS(N(RYtcommentR�R(RRoR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR� s

cCsGy|jj}Wntk
r#n X||j|�|j|��SdS(N(RYtpiR�R(RRYRoR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�(s

c
Cs]|d }|dkr�y"|jj|j|dd!�WqYtk
r�ddlm}|jd||jj|jj	f�}d|_
|jj|_|jj	|_|�qYXn�|dkr�|d d	kr�g|_
n}|j
dk	rY|d
krd|_
dS|j�}|sdS|j
j|�t|j
�}|dkrY|j
d}|dkr�|d
kr�|j
\}}}}	n7|dkr�|dkr�|j
\}}}	d}ndS|r�|dd!}nt|jd�r|jj|||	dd!�nI|j|jkrJ|j|||	dd!�|j|||	dd!�nd|_
qYndS(NiR�i����(R�s'undefined entity %s: line %d, column %diR�i	s	<!DOCTYPER�itPUBLICitSYSTEMitdoctype(RYRoRRR�R�R�R�tErrorLineNumbertErrorColumnNumberRRRRRtstripRAR6R)Rt_XMLParser__doctype(
RRR�R�R	tnR�R
tpubidtsystem((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�0sR
"
	
	
	 cCstjdt�dS(s'This method of XMLParser is deprecated.s[This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.N(R9R:RF(RR
RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRgscCsAy|jj|d�Wn#|jk
r<}|j|�nXdS(Ni(R�tParseR�R
(RRoR�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRjwscCs\y|jjdd�Wn#|jk
r<}|j|�nX|jj�}|`|`|S(NRi(R�RR�R
RYRk(RR�R�((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRk�sN(R%R&R�RR/R
RRR�R�R�R�R�R�R�RRRjRk(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR�s1						
					7			(t_serialize_c14nRu(6t__all__RR�R�R9tobjectRRR'R�R�R	RRt_Elementt_ElementInterfaceR
RRRR
RRRyR�R�RMt	NameErrorR�RxRvR�R�R�R�R�R�R�RRRRRR�RR�RRRR�RRtElementC14NR (((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt<module>;s�

		�U
�D	/
	2	
	
						bM	�
PKJ}�Z�Y檯�ElementInclude.pyonu�[����
{fc@shddlZddlmZdZedZedZdefd��YZdd	�Z	dd
�Z
dS(i����Ni(tElementTrees!{http://www.w3.org/2001/XInclude}tincludetfallbacktFatalIncludeErrorcBseZRS((t__name__t
__module__(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyR>scCsat|��O}|dkr3tj|�j�}n$|j�}|rW|j|�}nWdQX|S(Ntxml(topenRtparsetgetroottreadtdecode(threfRtencodingtfiletdata((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pytdefault_loaderMscCs�|dkrt}nd}x�|t|�kr�||}|jtkr�|jd�}|jdd�}|dkr�|||�}|dkr�td||f��ntj|�}|jr�|jp�d|j|_n|||<q�|dkr�||||jd��}|dkr7td||f��n|rq||d	}|jpWd||jpgd|_n#|j	p}d||jp�d|_	||=qq�td
|��n2|jt
kr�td|j��n
t||�|d	}qWdS(NiRRRscannot load %r as %rtttextR
is)unknown parse type in xi:include tag (%r)s0xi:fallback tag must be child of xi:include (%r)(tNoneRtlenttagtXINCLUDE_INCLUDEtgetRtcopyttailRtXINCLUDE_FALLBACKR(telemtloadertiteRRtnodeR((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyRbsF	
	
&#
(RRRtXINCLUDERRtSyntaxErrorRRRR(((s0/usr/lib64/python2.7/xml/etree/ElementInclude.pyt<module>3s

PKJ}�Z�B�u��ElementPath.pycnu�[����
{fc@s�ddlZejd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zied6ed6ed
6e
d6e	d6ed6ZiZ
ddd��YZdd�Zdd�Zdd�Zddd�ZdS(i����NsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccs�x�tj|�D]�}|d}|r�|ddkr�d|kr�yH|jdd�\}}|slt�n|dd|||ffVWq�tk
r�td|��q�Xq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrortSyntaxError(tpatternt
namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs
"	!
cCs^|j}|dkrZi|_}x5|jj�D]!}x|D]}|||<q?Wq2Wn|S(N(t
parent_maptNonetroottiter(tcontextRtpte((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytget_parent_mapWs	

cs|d��fd�}|S(Nic3s=x6|D].}x%|D]}|j�kr|VqqWqWdS(N(R
(RtresulttelemR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytselectbs

((tnextR	R((R
s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt
prepare_child`s
cCs
d�}|S(Ncss+x$|D]}x|D]}|VqWqWdS(N((RRRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRjs

((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_staris	cCs
d�}|S(Ncssx|D]}|VqWdS(N((RRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRqs
((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_selfps	csX|�}|ddkr"d�n#|ds9|d�ntd���fd�}|S(Nit*isinvalid descendantc3sCx<|D]4}x+|j��D]}||k	r|VqqWqWdS(N(R(RRRR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR~s
(R(RR	R((R
s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_descendantvs		

cCs
d�}|S(Ncss^t|�}i}xE|D]=}||kr||}||krVd||<|VqVqqWdS(N(RR(RRRt
result_mapRtparent((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s


((RR	R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_parent�s	
csag}g}x�|�}|ddkr,Pn|drd|dd dkrdd|ddd!f}n|j|dpwd�|j|d�qWdj|�}|d	kr�|d��fd
�}|S|dkr�|d�|d���fd�}|S|dkr>tjd
|d�r>|d��fd�}|S|dkr�tjd
|d�r�|d�|d���fd�}|S|dks�|dks�|dkrQ|dkr�t|d�d�nl|ddkr�td��n|dkr8yt|d�d�Wq>tk
r4td��q>Xnd��fd�}|Std��dS(Nit]is'"t'i����t-ts@-c3s2x+|D]#}|j��dk	r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s@-='c3s2x+|D]#}|j���kr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s\d+$c3s2x+|D]#}|j��dk	r|VqqWdS(N(tfindR(RRR(R
(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s
s-='c3sSxL|D]D}x;|j��D]*}dj|j���kr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R
R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s

s-()s-()-tlastsunsupported functionisunsupported expressionc3syt|�}xf|D]^}y>||}t|j|j��}|�|krV|VnWqttfk
rpqXqWdS(N(RtlistRR
t
IndexErrorR(RRRRR telems(tindex(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR�s

sinvalid predicate(tappendR*tretmatchtintRt
ValueError(RR	t	signaturet	predicateR((R0R'R
R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicate�sV	


#
#

$
R%Rt.s..s//t[t_SelectorContextcBseZdZd�ZRS(cCs
||_dS(N(R(tselfR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt__init__�sN(t__name__t
__module__RRR=(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR;�sc	Csn|ddkr|d}nyt|}Wntk
r4tt�dkrZtj�n|d dkrytd��ntt||��j}|�}g}x�y"|jt	|d||��Wnt
k
r�td��nXy)|�}|ddkr
|�}nWq�t
k
r"Pq�Xq�W|t|<nX|g}t|�}x|D]}|||�}qQW|S(	Ni����t/Ridis#cannot use absolute path on elementisinvalid path(t_cacheRtlentclearRRR
RR1topst
StopIterationR;(	RtpathRtselectorRR	RRR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytiterfind�s:


	"
	
		
cCs3yt|||�j�SWntk
r.dSXdS(N(RHRRER(RRFR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR)s
cCstt|||��S(N(R-RH(RRFR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyR$scCsBy)t|||�j�}|jp'dSWntk
r=|SXdS(NR%(RHRttextRE(RRFtdefaultR((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytfindtext*s

((R2tcompileRRR
RRRRRR!R8RDRAR;RHR)RRK(((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyt<module>;s.									
	P

$	PKJ}�ZhNwW��__init__.pycnu�[����
{fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyt<module>tPK��ZW�Z�DD__init__.pynu�[���PK��Z�):��ElementTree.pynu�[���PK��Zn=mE��,�#__pycache__/ElementTree.cpython-38.opt-1.pycnu�[���PK��Z4��1�1�,�__pycache__/ElementTree.cpython-38.opt-2.pycnu�[���PK��Z�r�� � &��__pycache__/ElementPath.cpython-38.pycnu�[���PK��Z��H�H�&׭__pycache__/ElementTree.cpython-38.pycnu�[���PK��Z�b�2��-u�__pycache__/cElementTree.cpython-38.opt-1.pycnu�[���PK��Z��J--/��__pycache__/ElementInclude.cpython-38.opt-2.pycnu�[���PK��Z��J--/
�__pycache__/ElementInclude.cpython-38.opt-1.pycnu�[���PK��Z�%�'��)��__pycache__/__init__.cpython-38.opt-1.pycnu�[���PK��Z�%�'��)w�__pycache__/__init__.cpython-38.opt-2.pycnu�[���PK��Z�r�� � ,U�__pycache__/ElementPath.cpython-38.opt-1.pycnu�[���PK��Z�b�2��'��__pycache__/cElementTree.cpython-38.pycnu�[���PK��Z�r�� � ,��__pycache__/ElementPath.cpython-38.opt-2.pycnu�[���PK��Z�b�2��-��__pycache__/cElementTree.cpython-38.opt-2.pycnu�[���PK��Z��J--)�__pycache__/ElementInclude.cpython-38.pycnu�[���PK��Z�%�'��#��__pycache__/__init__.cpython-38.pycnu�[���PK��Z����RRe�cElementTree.pynu�[���PK��Z��<>3>3��ElementPath.pynu�[���PK��Z�V�rElementInclude.pynu�[���PK�e�Z��xr)�+__pycache__/ElementInclude.cpython-36.pycnu�[���PK�e�Z�Ib}��&D2__pycache__/ElementPath.cpython-36.pycnu�[���PK�e�Z�A�3}})�J__pycache__/__init__.cpython-36.opt-2.pycnu�[���PK�e�ZtH������,iK__pycache__/ElementTree.cpython-36.opt-1.pycnu�[���PK�e�Z#�}P��-P�__pycache__/cElementTree.cpython-36.opt-2.pycnu�[���PK�e�Z��xr/T�__pycache__/ElementInclude.cpython-36.opt-2.pycnu�[���PK�e�Z��xr/�__pycache__/ElementInclude.cpython-36.opt-1.pycnu�[���PK�e�Z�Ib}��,D__pycache__/ElementPath.cpython-36.opt-1.pycnu�[���PK�e�Z#�}P��'�__pycache__/cElementTree.cpython-36.pycnu�[���PK�e�Z�1�b�m�m,� __pycache__/ElementTree.cpython-36.opt-2.pycnu�[���PK�e�Z#�}P��-�__pycache__/cElementTree.cpython-36.opt-1.pycnu�[���PK�e�Z�M휺���&�__pycache__/ElementTree.cpython-36.pycnu�[���PK�e�Z�Ib}��,�>__pycache__/ElementPath.cpython-36.opt-2.pycnu�[���PK�e�Z�A�3}}#LW__pycache__/__init__.cpython-36.pycnu�[���PK�e�Z�A�3}})X__pycache__/__init__.cpython-36.opt-1.pycnu�[���PKJ}�ZP��^���XcElementTree.pyonu�[���PKJ}�ZhNwW���Y__init__.pyonu�[���PKJ}�Z���G|�|��ZElementTree.pycnu�[���PKJ}�Z�B�u��Z�ElementPath.pyonu�[���PKJ}�ZP��^��[cElementTree.pycnu�[���PKJ}�Z�Y檯�KElementInclude.pycnu�[���PKJ}�Z[��	��<ElementTree.pyonu�[���PKJ}�Z�Y檯�|�ElementInclude.pyonu�[���PKJ}�Z�B�u��m�ElementPath.pycnu�[���PKJ}�ZhNwW��n�__init__.pycnu�[���PK--+�