PKD#]catalognu[ PKi#]=p66 __init__.pyonu[ {fc@sdZddddgZd Zydd lZWnek rAn]Xy ejZWnek rbn<Xeekrdd lZej j e eej e s     PKi#]G||etree/ElementTree.pycnu[ {fc@s>dddddddddd d d d d dddddddgZdZddlZddlZddlZdefdYZyddlmZWne k reZnXd e fdYZ dZ defdYZ e ZZidZed Zed!ZeZd efd"YZdefd#YZed$Zd%Zd&d'd(d)d*d+d,d-d.d/d0d1d2f ZyeeZWnek rnXd3Zd4Zied56ed66ed76Zd8Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dEZ!dFZ"dGZ#dHZ$dIZ%eedJZ&eedKZ'dLZ(edMZ)eedNZ*dOefdPYZ+edQZ,edRZ-e,Z.edSZ/defdTYZ0dUgZ1defdVYZ2e2Z3yddWl4m5Z5e5edX(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.pyt makeelementscCs;|j|j|j}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*s   cCs t|jS(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__scCs)tjdtddt|jdkS(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||D]6}x|jD] }|VqWW|jrD|jVqDqDWdS(N(RR(t basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRUs      N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs<             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 (RR R(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR 1s   cBs/eZddZdZdZdZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rt text_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|jS(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|tr"t|j|jSt|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   cBseZd d dZdZdZd dZd dZd dZd dZ d d dZ d dZ d 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_setrootuscCst}t|ds-t|d}t}nzb|sKtdt}nx*|jd}|sgPn|j|qNW|j|_ |j SWd|r|jnXdS(NtreadtrbRYi( tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsert close_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs   cCs|jj|S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!scCs)tjdtddt|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.pyRSs cCsJ|d dkr7d|}tjd|tddn|jj||S(Nit/t.sThis 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.pyRs cCsM|d dkr7d|}tjd|tddn|jj|||S(NiRpRqsThis 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|tddn|jj||S(NiRpRqsThis 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|tddn|jj||S(NiRpRqsThis 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 c Cs=|sd}n|tkr.td|nt|drF|}nt|d}|j}|s|dkryd}qd}n>|s|dkr|d kr|dkr|d|qn|d krt||j|n>t|j||\}} t|} | ||j||| ||k r9|j ndS( Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$ 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|ddS(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 sidd6ir&d       $     c Css|j}|j}|tkr8|dt||n|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet |jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t |D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|st|rC|d |r|t||nx$|D]}t||||dqW|d |d n |d |jro|t|j|ndS( Ns stRt:s xmlns%s="%s"s %s="%s"t>s(RRRt_encodeR Rt _escape_cdatat_serialize_xmlROtsortedRt_escape_attribR(R R6R5( RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRsP                tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamc Cs|j}|j}|tkr8|dt||n?|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet|jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t|D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|d |j} |r/| d ks| d kr|t||q/|t||nx$|D]}t||||dq6W| tkrw|d |d n|jr|t|j|ndS( Ns sRRKcSs|dS(Ni((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRRRs xmlns%s="%s"s %s="%s"Rtscripttstyles;s       U      D /  2           b   M  PKi#]hNwWetree/__init__.pyonu[ {fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyttPKi#][ etree/ElementTree.pyonu[ {fc@s>dddddddddd d d d d dddddddgZdZddlZddlZddlZdefdYZyddlmZWne k reZnXd e fdYZ dZ defdYZ e ZZidZed Zed!ZeZd efd"YZdefd#YZed$Zd%Zd&d'd(d)d*d+d,d-d.d/d0d1d2f ZyeeZWnek rnXd3Zd4Zied56ed66ed76Zd8Zid5d96d6d:6d;d<6d=d>6d?d@6dAdB6dCdD6Z dEZ!dFZ"dGZ#dHZ$dIZ%eedJZ&eedKZ'dLZ(edMZ)eedNZ*dOefdPYZ+edQZ,edRZ-e,Z.edSZ/defdTYZ0dUgZ1defdVYZ2e2Z3yddWl4m5Z5e5edX(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.pyt makeelementscCs;|j|j|j}|j|_|j|_||(|S(N(R4RR,Rttail(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR*s   cCs t|jS(N(tlenR-(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__len__scCs)tjdtddt|jdkS(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||D]6}x|jD] }|VqWW|jrD|jVqDqDWdS(N(RR(t basestringRRtitertextR5(RRRQts((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRUs      N(!R%R&RRR,RR5R/R2R4R*R7R<R>R?R@RARBRDRERGRR R$R"RIRJRMRNROR!RSRU(((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs<             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 (RR R(ttargetRR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR 1s   cBs/eZddZdZdZdZRS(cCs&|rd||f}n||_dS(Ns{%s}%s(R(Rt text_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|jS(N(thashR(R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyt__hash__KscCs2t|tr"t|j|jSt|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   cBseZd d dZdZdZd dZd dZd dZd dZ d d dZ d dZ d 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_setrootuscCst}t|ds-t|d}t}nzb|sKtdt}nx*|jd}|sgPn|j|qNW|j|_ |j SWd|r|jnXdS(NtreadtrbRYi( tFalseR)topentTrueRRRetfeedtcloseRa(Rtsourcetparsert close_sourcetdata((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRs   cCs|jj|S(N(RaR!(RR((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyR!scCs)tjdtddt|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.pyRSs cCsJ|d dkr7d|}tjd|tddn|jj||S(Nit/t.sThis 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.pyRs cCsM|d dkr7d|}tjd|tddn|jj|||S(NiRpRqsThis 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|tddn|jj||S(NiRpRqsThis 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|tddn|jj||S(NiRpRqsThis 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 c Cs=|sd}n|tkr.td|nt|drF|}nt|d}|j}|s|dkryd}qd}n>|s|dkr|d kr|dkr|d|qn|d krt||j|n>t|j||\}} t|} | ||j||| ||k r9|j ndS( Ntxmlsunknown method %rtwritetwbtc14nsutf-8sus-asciis$ 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|ddS(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 sidd6ir&d       $     c Css|j}|j}|tkr8|dt||n|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet |jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t |D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|st|rC|d |r|t||nx$|D]}t||||dqW|d |d n |d |jro|t|j|ndS( Ns stRt:s xmlns%s="%s"s %s="%s"t>s(RRRt_encodeR Rt _escape_cdatat_serialize_xmlROtsortedRt_escape_attribR(R R6R5( RsRR{RRRRRQROtvtk((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRsP                tareatbasetbasefonttbrtcoltframethrtimgtinputtisindextlinktmetatparamc Cs|j}|j}|tkr8|dt||n?|tkr^|dt||n||}|dkr|r|t||nx|D]}t||||dqWn|d||j}|s|r|rNxet|jddD]E\} } | r!d| } n|d| j |t | |fqWnx~t|D]m\} } t | t r| j} nt | t r|| j} nt | |} |d|| | fq[Wn|d |j} |r/| d ks| d kr|t||q/|t||nx$|D]}t||||dq6W| tkrw|d |d n|jr|t|j|ndS( Ns sRRKcSs|dS(Ni((R((s-/usr/lib64/python2.7/xml/etree/ElementTree.pyRRRs xmlns%s="%s"s %s="%s"Rtscripttstyles;s       U      D /  2           b   M  PKi#]:W@!!!!etree/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 https://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", "indent", "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 import weakref 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: text...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): 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( "Testing an element's truth value will always return True in " "future versions. " "Use specific 'len(elem)' or 'elem is not None' test instead.", DeprecationWarning, 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 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) 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 data := source.read(65536): 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) 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" with _get_writer(file_or_filename, encoding) as (write, declared_encoding): if method == "xml" and (xml_declaration or (xml_declaration is None and encoding.lower() != "unicode" and declared_encoding.lower() not in ("utf-8", "us-ascii"))): write("\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.lower() == "unicode": encoding="utf-8" with open(file_or_filename, "w", encoding=encoding, errors="xmlcharrefreplace") as file: yield file.write, encoding else: # file_or_filename is a file-like object # encoding determines if it is a text or binary writer if encoding.lower() == "unicode": # use a text writer as is yield write, getattr(file_or_filename, "encoding", None) or "utf-8" 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, encoding 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("" % text) elif tag is ProcessingInstruction: write("" % 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("") else: write(" />") if elem.tail: write(_escape_cdata(elem.tail)) HTML_EMPTY = {"area", "base", "basefont", "br", "col", "embed", "frame", "hr", "img", "input", "isindex", "link", "meta", "param", "source", "track", "wbr"} def _serialize_html(write, elem, qnames, namespaces, **kwargs): tag = elem.tag text = elem.text if tag is Comment: write("" % _escape_cdata(text)) elif tag is ProcessingInstruction: write("" % _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("") 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("&", "&") if "<" in text: text = text.replace("<", "<") if ">" in text: text = text.replace(">", ">") return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib(text): # escape attribute value try: if "&" in text: text = text.replace("&", "&") if "<" in text: text = text.replace("<", "<") if ">" in text: text = text.replace(">", ">") if "\"" in text: text = text.replace("\"", """) # Although section 2.11 of the XML specification states that CR or # CR LN should be replaced with just LN, it applies only to EOLNs # which take part of organizing file into lines. Within attributes, # we are replacing these with entity numbers, so they do not count. # http://www.w3.org/TR/REC-xml/#sec-line-ends # The current solution, contained in following six lines, was # discussed in issue 17582 and 39011. if "\r" in text: text = text.replace("\r", " ") if "\n" in text: text = text.replace("\n", " ") if "\t" in text: text = text.replace("\t", " ") return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib_html(text): # escape attribute value try: if "&" in text: text = text.replace("&", "&") if ">" in text: text = text.replace(">", ">") if "\"" in text: text = text.replace("\"", """) 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") def indent(tree, space=" ", level=0): """Indent an XML document by inserting newlines and indentation space after elements. *tree* is the ElementTree or Element to modify. The (root) element itself will not be changed, but the tail text of all elements in its subtree will be adapted. *space* is the whitespace to insert for each indentation level, two space characters by default. *level* is the initial indentation level. Setting this to a higher value than 0 can be used for indenting subtrees that are more deeply nested inside of a document. """ if isinstance(tree, ElementTree): tree = tree.getroot() if level < 0: raise ValueError(f"Initial indentation level must be >= 0, got {level}") if not len(tree): return # Reduce the memory consumption by reusing indentation strings. indentations = ["\n" + level * space] def _indent_children(elem, level): # Start a new indentation level for the first child. child_level = level + 1 try: child_indentation = indentations[child_level] except IndexError: child_indentation = indentations[level] + space indentations.append(child_indentation) if not elem.text or not elem.text.strip(): elem.text = child_indentation for child in elem: if len(child): _indent_children(child, child_level) if not child.tail or not child.tail.strip(): child.tail = child_indentation # Dedent after the last child by overwriting the previous indentation. if not child.tail.strip(): child.tail = indentations[level] _indent_children(tree, 0) # -------------------------------------------------------------------- # 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) if not hasattr(source, "read"): source = open(source, "rb") close_source = True else: close_source = False def iterator(source): 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 = wr() if it is not None: it.root = root finally: if close_source: source.close() class IterParseIterator(collections.abc.Iterator): __next__ = iterator(source).__next__ def __del__(self): if close_source: source.close() it = IterParseIterator() it.root = None wr = weakref.ref(it) 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 https://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 flush(self): if self._parser is None: raise ValueError("flush() called after end of stream") self._parser.flush() 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 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 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] == "": 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, False) except self._error as v: self._raiseerror(v) def close(self): """Finish feeding data to parser and return element structure.""" try: self.parser.Parse(b"", True) # 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 def flush(self): was_enabled = self.parser.GetReparseDeferralEnabled() try: self.parser.SetReparseDeferralEnabled(False) self.parser.Parse(b"", False) except self._error as v: self._raiseerror(v) finally: self.parser.SetReparseDeferralEnabled(was_enabled) # -------------------------------------------------------------------- # 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._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'') 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'' if data else f'') 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('&', '&') if '<' in text: text = text.replace('<', '<') if '>' in text: text = text.replace('>', '>') if '\r' in text: text = text.replace('\r', ' ') return text except (TypeError, AttributeError): _raise_serialization_error(text) def _escape_attrib_c14n(text): # escape attribute value try: if '&' in text: text = text.replace('&', '&') if '<' in text: text = text.replace('<', '<') if '"' in text: text = text.replace('"', '"') if '\t' in text: text = text.replace('\t', ' ') if '\n' in text: text = text.replace('\n', ' ') if '\r' in text: text = text.replace('\r', ' ') 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) PKi#]Buetree/ElementPath.pycnu[ {fc@sddlZejdZddZdZdZdZdZdZ d Z d Z ied 6ed 6ed 6e d6e d6e d6Z iZ dddYZddZddZddZdddZdS(iNsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccsxtj|D]}|d}|r|ddkrd|kryH|jdd\}}|sltn|dd|||ffVWqtk rtd|qXq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrort SyntaxError(tpatternt namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs " ! cCs^|j}|dkrZi|_}x5|jjD]!}x|D]}|||tjd |d r>|dfd}|S|dkrtjd |d r|d|dfd}|S|dks|dks|dkrQ|dkrt|ddnl|ddkrtdn|dkr8yt|ddWq>tk r4tdq>Xndfd}|StddS(Nit]is'"t'it-ts@-c3s2x+|D]#}|jdk r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s@-='c3s2x+|D]#}|jkr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s\d+$c3s2x+|D]#}|jdk r|VqqWdS(N(tfindR(RRR(R (s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s-='c3sSxL|D]D}x;|jD]*}dj|jkr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs  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.pyRs    sinvalid predicate(tappendR*tretmatchtintRt ValueError(RR t signaturet predicateR((R0R'R R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicatesV      # #  $    R%Rt.s..s//t[t_SelectorContextcBseZdZdZRS(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 r4ttdkrZtjn|d dkrytdntt||j}|}g}xy"|jt |d||Wnt k rtdnXy)|}|ddkr |}nWqt k r"PqXqW|t|;s.      P  $ PKi#]RRetree/cElementTree.pynu[# Deprecated alias for xml.etree.ElementTree from xml.etree.ElementTree import * PKi#]P^etree/cElementTree.pycnu[ {fc@sddlTdS(i(t*N(t _elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyttPKi#]Buetree/ElementPath.pyonu[ {fc@sddlZejdZddZdZdZdZdZdZ d Z d Z ied 6ed 6ed 6e d6e d6e d6Z iZ dddYZddZddZddZdddZdS(iNsY('[^']*'|"[^"]*"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+ccsxtj|D]}|d}|r|ddkrd|kryH|jdd\}}|sltn|dd|||ffVWqtk rtd|qXq|VqWdS(Niit{t:s{%s}%ss!prefix %r not found in prefix map(txpath_tokenizer_retfindalltsplittKeyErrort SyntaxError(tpatternt namespacesttokenttagtprefixturi((s-/usr/lib64/python2.7/xml/etree/ElementPath.pytxpath_tokenizerIs " ! cCs^|j}|dkrZi|_}x5|jjD]!}x|D]}|||tjd |d r>|dfd}|S|dkrtjd |d r|d|dfd}|S|dks|dks|dkrQ|dkrt|ddnl|ddkrtdn|dkr8yt|ddWq>tk r4tdq>Xndfd}|StddS(Nit]is'"t'it-ts@-c3s2x+|D]#}|jdk r|VqqWdS(N(tgetR(RRR(tkey(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s@-='c3s2x+|D]#}|jkr|VqqWdS(N(R&(RRR(R'tvalue(s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s\d+$c3s2x+|D]#}|jdk r|VqqWdS(N(tfindR(RRR(R (s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs s-='c3sSxL|D]D}x;|jD]*}dj|jkr|VPqqWqWdS(NR%(Rtjointitertext(RRRR(R R((s-/usr/lib64/python2.7/xml/etree/ElementPath.pyRs  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.pyRs    sinvalid predicate(tappendR*tretmatchtintRt ValueError(RR t signaturet predicateR((R0R'R R(s-/usr/lib64/python2.7/xml/etree/ElementPath.pytprepare_predicatesV      # #  $    R%Rt.s..s//t[t_SelectorContextcBseZdZdZRS(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 r4ttdkrZtjn|d dkrytdntt||j}|}g}xy"|jt |d||Wnt k rtdnXy)|}|ddkr |}nWqt k r"PqXqW|t|;s.      P  $ PKi#]dX((etree/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 https://www.python.org/psf/license for licensing details. ## # Limited XInclude support for the ElementTree package. ## import copy from . import ElementTree from urllib.parse import urljoin XINCLUDE = "{http://www.w3.org/2001/XInclude}" XINCLUDE_INCLUDE = XINCLUDE + "include" XINCLUDE_FALLBACK = XINCLUDE + "fallback" # For security reasons, the inclusion depth is limited to this read-only value by default. DEFAULT_MAX_INCLUSION_DEPTH = 6 ## # Fatal include error. class FatalIncludeError(SyntaxError): pass class LimitedRecursiveIncludeError(FatalIncludeError): 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 Element instance. If the parse mode is "text", this # is a 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 or any ElementTree of a tree to be expanded # @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 default_loader. # @param base_url The base URL of the original file, to resolve # relative include file references. # @param max_depth The maximum number of recursive inclusions. # Limited to reduce the risk of malicious content explosion. # Pass None to disable the limitation. # @throws LimitedRecursiveIncludeError If the {@link max_depth} was exceeded. # @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. # @throws ValueError If negative {@link max_depth} is passed. # @returns None. Modifies tree pointed by {@link elem} def include(elem, loader=None, base_url=None, max_depth=DEFAULT_MAX_INCLUSION_DEPTH): if max_depth is None: max_depth = -1 elif max_depth < 0: raise ValueError("expected non-negative depth or None for 'max_depth', got %r" % max_depth) if hasattr(elem, 'getroot'): elem = elem.getroot() if loader is None: loader = default_loader _include(elem, loader, base_url, max_depth, set()) def _include(elem, loader, base_url, max_depth, _parent_hrefs): # 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") if base_url: href = urljoin(base_url, href) parse = e.get("parse", "xml") if parse == "xml": if href in _parent_hrefs: raise FatalIncludeError("recursive include of %s" % href) if max_depth == 0: raise LimitedRecursiveIncludeError( "maximum xinclude depth reached when including file %s" % href) _parent_hrefs.add(href) node = loader(href, parse) if node is None: raise FatalIncludeError( "cannot load %r as %r" % (href, parse) ) node = copy.copy(node) # FIXME: this makes little sense with recursive includes _include(node, loader, href, max_depth - 1, _parent_hrefs) _parent_hrefs.remove(href) 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 e.tail: text += e.tail if i: node = elem[i-1] node.tail = (node.tail or "") + text else: elem.text = (elem.text or "") + text 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, base_url, max_depth, _parent_hrefs) i += 1 PKi#]Y檯etree/ElementInclude.pyonu[ {fc@shddlZddlmZdZedZedZdefdYZdd Z dd Z dS( iNi(t ElementTrees!{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|||}|dkrtd||fntj|}|jr|jpd|j|_n|||3s    PKi#]P^etree/cElementTree.pyonu[ {fc@sddlTdS(i(t*N(t _elementtree(((s./usr/lib64/python2.7/xml/etree/cElementTree.pyttPKi#]2QEEetree/__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 https://www.python.org/psf/license for licensing details. PKi#]Y檯etree/ElementInclude.pycnu[ {fc@shddlZddlmZdZedZedZdefdYZdd Z dd Z dS( iNi(t ElementTrees!{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|||}|dkrtd||fntj|}|jr|jpd|j|_n|||3s    PKi#]hNwWetree/__init__.pycnu[ {fc@sdS(N((((s*/usr/lib64/python2.7/xml/etree/__init__.pyttPKi#]q66etree/ElementPath.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 https://www.python.org/psf/license for licensing details. ## # Implementation module for XPath support. There's usually no reason # to import this module directly; the ElementTree does this for # you, if needed. ## import re xpath_tokenizer_re = re.compile( r"(" 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://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 == "@-='" or signature == "@-!='": # [@attribute='value'] or [@attribute!='value'] key = predicate[1] value = predicate[-1] def select(context, result): for elem in result: if elem.get(key) == value: yield elem def select_negated(context, result): for elem in result: if (attr_value := elem.get(key)) is not None and attr_value != value: yield elem return select_negated if '!=' in signature else 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 == ".!='" or ( (signature == "-='" or signature == "-!='") and not re.match(r"\-?\d+$", predicate[0])): # [.='value'] or [tag='value'] or [.!='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 def select_negated(context, result): for elem in result: for e in elem.iterfind(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 def select_negated(context, result): for elem in result: if "".join(elem.itertext()) != value: yield elem return select_negated if '!=' in signature else 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)) if elem.text is None: return "" return elem.text except StopIteration: return default PKi#]}ffdom/NodeFilter.pyonu[ {fc@sdddYZdS(t NodeFiltercBsweZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZRS(sL This is the DOM2 NodeFilter interface. It contains only constants. iiiliiii i@iiiiicCs tdS(N(tNotImplementedError(tselftnode((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyt acceptNodes(t__name__t __module__t__doc__t FILTER_ACCEPTt FILTER_REJECTt FILTER_SKIPtSHOW_ALLt SHOW_ELEMENTtSHOW_ATTRIBUTEt SHOW_TEXTtSHOW_CDATA_SECTIONtSHOW_ENTITY_REFERENCEt SHOW_ENTITYtSHOW_PROCESSING_INSTRUCTIONt SHOW_COMMENTt SHOW_DOCUMENTtSHOW_DOCUMENT_TYPEtSHOW_DOCUMENT_FRAGMENTt SHOW_NOTATIONR(((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyRs$N((R(((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyttPKi#]]Cn~n~dom/expatbuilder.pyonu[ {fc@sdZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZddlTejZejZejZejjZejjZejjZejjZejZi ejedd 6ejed d 6ejed d 6ejedd6ejedd6ejedd6ejedd6ejedd6ejedd6ZdefdYZdZdZ dfdYZ!eeefZ"d efd!YZ#d"efd#YZ$d$e$fd%YZ%d&e$fd'YZ&d(Z'd)e'Z(d*e!fd+YZ)d,fd-YZ*d.e*e!fd/YZ+d0e*e)fd1YZ,d2e-fd3YZ.d4e!fd5YZ/e0d6Z1e0d7Z2e0d8Z3e0d9Z4d:Z5d;S(<sFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. i(t xmlbuildertminidomtNode(tEMPTY_NAMESPACEt EMPTY_PREFIXtXMLNS_NAMESPACE(texpat(t _append_childt_set_attribute_node(t NodeFilter(t*tcdatatCDATAt enumerationtENUMtentitytENTITYtentitiestENTITIEStidtIDtidreftIDREFtidrefstIDREFStnmtokentNMTOKENtnmtokenstNMTOKENSt ElementInfocBsbeZd Zd dZdZdZdZdZdZ d Z d Z d Z RS(t _attr_infot_modelttagNamecCs||_g|_||_dS(N(R RR(tselfR tmodel((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt__init__As  cCs|j|j|jfS(N(RRR (R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt __getstate__FscCs|\|_|_|_dS(N(RRR (R!tstate((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt __setstate__IscCs\xR|jD]G}|d|kr |d}|ddkrBtdSt|dSq q WtjS(Niiit(R(Rt _typeinfo_mapRt_no_type(R!tanametinfott((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytgetAttributeTypeLs cCstjS(N(RR)(R!t namespaceURIt localName((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytgetAttributeTypeNSVscCs:|jr2|jd}|tjjtjjfkStSdS(Ni(RRR"t XML_CTYPE_ANYtXML_CTYPE_MIXEDtFalse(R!ttype((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisElementContentYs    cCs(|jr |jdtjjkStSdS(Ni(RRR"tXML_CTYPE_EMPTYR3(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisEmptyas cCs6x/|jD]$}|d|kr |ddkSq WtS(NiiR(RR3(R!R*R+((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisIdgscCs|j||fS(N(R8(R!teuritenametauriR*((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisIdNSms(RRR N( t__name__t __module__t __slots__tNoneR#R$R&R-R0R5R7R8R<(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR>s       cCs|j||S(N(t_intern_setdefault(tbuilderts((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_internqscCs|jd}|j}t|dkry|\}}}|||}d||f}|||}|||}n%|\}}t}|||}}||||||fS(Nt is%s:%s(tsplitRAtlenR(RBtnametpartstinternturit localnametprefixtqname((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_parse_ns_namets  t ExpatBuildercBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sPDocument builder that uses Expat to build a ParsedXML.DOM document instance.cCsw|dkrtj}n||_|jjdk rNt|jj|_nd|_t|_d|_ |j dS(N( R@RtOptionst_optionstfiltertFilterVisibilityControllert_filterRt_finish_start_elementt_parsertreset(R!toptions((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#s     cCs tjS(sCreate a new parser object.(Rt ParserCreate(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt createParserscCsh|jsa|j|_|jjj|_t|j_t|j_t|j_|j |jn|jS(s7Return the parser object, creating a new one if needed.( RWR[RJt setdefaultRAtTruet buffer_texttordered_attributestspecified_attributestinstall(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt getParsers    cCs@tjtdd|_|j|_|jj|_t|_dS(s6Free all data structures used during DOM construction.N( ttheDOMImplementationtcreateDocumentRR@tdocumenttcurNodet _elem_infoR3t_cdata(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRXs  cCs|j|_|j|_|j|_|j|_|jj rK|j |_ n|j |_ |jjrr|j|_n|jjr|j|_|j|_|j|_n |j|_|j|_|j|_|j|_|j|_ dS(s>Install the callbacks needed to build the DOM into the parser.N(!tstart_doctype_decl_handlertStartDoctypeDeclHandlertfirst_element_handlertStartElementHandlertend_element_handlertEndElementHandlert pi_handlertProcessingInstructionHandlerRRRtentity_decl_handlertEntityDeclHandlertnotation_decl_handlertNotationDeclHandlertcommentstcomment_handlertCommentHandlertcdata_sectionststart_cdata_section_handlertStartCdataSectionHandlertend_cdata_section_handlertEndCdataSectionHandlertcharacter_data_handler_cdatatCharacterDataHandlertcharacter_data_handlertexternal_entity_ref_handlertExternalEntityRefHandlertxml_decl_handlertXmlDeclHandlertelement_decl_handlertElementDeclHandlertattlist_decl_handlertAttlistDeclHandler(R!tparser((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRas$              cCs|j}t}ylxU|jd}|s1Pn|j|d|rc|jjrc|j|nt}qW|jdtWntk rnX|j}|j d|_ |S(sIParse a document from a file object, returning the document node.iiiti@N( RbR]treadtParseRetdocumentElementt _setup_subsetR3t ParseEscapeRXR@RW(R!tfileRt first_buffertbuffertdoc((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseFiles$      cCsa|j}y!|j|t|j|Wntk r@nX|j}|jd|_|S(s<Parse a document from a string, returning the document node.N( RbRR]RRReRXR@RW(R!tstringRR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseStrings     cCsD|jjr@t}|j||j}||jj_ndS(s/Load the internal subset if there might be one.N(RetdoctypetInternalSubsetExtractorRt getSubsettinternalSubset(R!Rt extractortsubset((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     cCs|jjj|||}|j|_t|j|||j_|jr|jj|tkrd|j_|jj d=d}d|j _ d|j _ n|r|dk rg|j_g|j_nd|j _d|j _|j|j _ndS(Ni(RetimplementationtcreateDocumentTypet ownerDocumentRRRUt acceptNodet FILTER_REJECTR@t childNodesRWRrRtRt_seqt notationsRwRptend_doctype_decl_handlertEndDoctypeDeclHandler(R!t doctypeNametsystemIdtpublicIdthas_internal_subsetR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRis$   !       cCsO|jjr|j|j_n|j|j_|jp<|jsKt |_ ndS(N( RRRuRvRWRwRoRpRgRURt_finish_end_element(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs  cCs]|jj||}t|j||jrY|jj|tkrY|jj|ndS(N(RetcreateProcessingInstructionRRfRURRt removeChild(R!ttargettdatatnode((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRo s!cCs|jj}|jrd|jrF|djtkrF|dj|dS|jj|}t |_n|r|djt kr|d}|j |}|j }||d<|dt__doc__R@R#R[RbRXRaRRRRiRRoR}RRqRsRvRyR{RRkRRVRmRRRRR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRPs:                       RTcBseZdZdZdZdZdZi eje j 6ej e j 6ej e j6eje j6eje j6eje j6eje j6eje j6eje j6eje j6eje j6eje j 6Z!RS(soWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.RScCs ||_dS(N(RS(R!RS((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#scCsu|j|j}|jj|@rm|jj|}|tkrGtn|tkritdt |n|St SdS(Ns)startContainer() returned illegal value: ( t_nodetype_maskRRSt whatToShowRtFILTER_INTERRUPTRt_ALLOWED_FILTER_RETURNSt ValueErrortreprR(R!Rtmasktval((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs   cCs|j|j}|jj|@r|jj|}|tkrGtn|tkr|j}x|j D]}|j |qgWt S|t krt dt|n|StSdS(Ns%acceptNode() returned illegal value: (RRRSRRRRRRRt appendChildRRRRR(R!RRRtparentR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     (RS("R=R>RR?R#RRR t SHOW_ELEMENTRt ELEMENT_NODEtSHOW_ATTRIBUTEtATTRIBUTE_NODEt SHOW_TEXTRtSHOW_CDATA_SECTIONRtSHOW_ENTITY_REFERENCEtENTITY_REFERENCE_NODEt SHOW_ENTITYt ENTITY_NODEtSHOW_PROCESSING_INSTRUCTIONtPROCESSING_INSTRUCTION_NODEt SHOW_COMMENTt COMMENT_NODEt SHOW_DOCUMENTt DOCUMENT_NODEtSHOW_DOCUMENT_TYPEtDOCUMENT_TYPE_NODEtSHOW_DOCUMENT_FRAGMENTtDOCUMENT_FRAGMENT_NODEt SHOW_NOTATIONt NOTATION_NODER(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRTs$             t FilterCrutchcBseZdZdZRS(t_buildert_levelt _old_startt_old_endcCsOd|_||_|j}|j|_|j|_|j|_|j|_dS(Ni( RRRWRlRRnRRRm(R!RBR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR# s      (RRRR(R=R>R?R#(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR sRcBs)eZdZdZdZdZRS(cCs>tj|||j}xdD]}t||dq WdS(NRpRwR~RzR|R(RpRwR~RzR|R(RR#RWtsetattrR@(R!RBRRH((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#s  cGs|jd|_dS(Ni(R(R!targs((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR$scGsZ|jdkrF|jj}|jj||j|_|j|_n|jd|_dS(Nii(RRRWRaRRlRRn(R!RR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRm's   ((R=R>R?R#RRm(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs RcBs eZdZdZdZRS(cGsB|jj}|j||jj|k r>|jd|_ndS(Ni(RRfRR(R!RR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR4s  cGs`|jdkr?|j|jj_|j|jj_d|_n|jd|_|j|dS(Nii(RRRRWRlRRnR@(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRm:s  ((R=R>R?RRm(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR1s s8http://xml.python.org/entities/fragment-builder/internals %%s ]> &fragment-builder-internal;tFragmentBuildercBsPeZdZddZdZdZdZdZdZ dZ RS( sBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. cCsM|jtkr$||_||_n|j|_||_tj||dS(N(RRtoriginalDocumentRRRPR#(R!RRY((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#bs     cCstj|d|_dS(N(RPRXR@tfragment(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRXks cCs|j|jS(sRParse a document fragment from a file object, returning the fragment node.(RR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRosc Cs||_|j}|jj}d}|r|jp?|j}|jrdd|j|jf}q|jrd|j}qnd}|j}t |||f}y|j |dWn|j nX|j }|j |S(sMParse a document fragment from a string, returning the fragment node.RsPUBLIC "%s" "%s"s SYSTEM "%s"i( t_sourceRbR RRt_getDeclarationsRRt _getNSattrst_FRAGMENT_BUILDER_TEMPLATERRXR ( R!RRRtidentRtnsattrsReR ((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRts,         cCs|jjj}d}|rxt|jjD]v}|jj|}|rY|d}nd||jf}|jrd||j|j f}q.d||j f}q.Wxt|j jD]}|j j|}|r|d}nd||jf}|jrd||j|j f}n5|j r=d||j f}nd ||j j f}|j rrd ||j f}n|d }qWn|S( sRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. Rs s%ss%s SYSTEM "%s">s %s(RRRRRtlengthtitemtnodeNameRRRt firstChildRR(R!RRCRtnotationR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR s6      cCsdS(NR((R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR scCs|tkr|j}|j}|jj|}|j|_|jj|_|j|_z|j|j dWd||_||_d|_ XdSt j |||||SdS(Nii( t$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDReRfRWtExternalEntityParserCreateR tcreateDocumentFragmentR RR R@RPR(R!RRRRt old_documentt old_cur_nodeR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs        N( R=R>RR@R#RXRRR R R(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRYs    $ t NamespacescBs;eZdZdZdZdZdZdZRS(s7Mix-in class for builders; adds support for namespaces.cCs g|_dS(N(t_ns_ordered_prefixes(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_initNamespacesscCstjdd}t|_|S(s'Create a new namespace-handling parser.tnamespace_separatorRE(RRZR]tnamespace_prefixes(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR[s cCs/tj|||jjr+|j|_ndS(s.Insert the namespace-handlers onto the parser.N(RPRaRRtnamespace_declarationststart_namespace_decl_handlertStartNamespaceDeclHandler(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRas cCs|jj||fdS(s/Push this namespace declaration on our storage.N(RR(R!RMRK((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR"scCsd|kr*t||\}}}}nt}|}d}t}tj||||}|j|_t|j |||_ |j rIx|j D]\}}|rtj t |d|t |d}ntj dt dt}|jdj} || d<| d<|j} || d<| d<|j| dRRR[RaR"R(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     4tExpatBuilderNScBseZdZdZRS(s*Document builder that supports namespaces.cCstj||jdS(N(RPRXR(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRX5s (R=R>RRX(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR)2stFragmentBuilderNScBs eZdZdZdZRS(s*Fragment builder that supports namespaces.cCstj||jdS(N(RRXR(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRX=s cCsd}|j}g}x|rt|drx|jjD]p\}}||kr[q=n|j||r{d|}nd}|rd|||f}q=d||f}q=Wn|j}qW|S(sNReturn string of namespace attributes from this element and ancestors.Rt_ns_prefix_urisxmlns:R$s%s %s='%s's %s='%s'(RthasattrR+titemsRR(R!tattrsRRRMRKtdeclname((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR As"      (R=R>RRXR (((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR*:s RcBseZdZRS(sEException raised to short-circuit parsing in InternalSubsetExtractor.(R=R>R(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR_sRcBsSeZdZdZdZdZdZdZdZ dZ dZ RS( sBXML processor which can rip out the internal document type subset.cCs|jS(s'Return the internal subset as a string.(R(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRhscCs,ytj||Wntk r'nXdS(N(RPRR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRls cCs,ytj||Wntk r'nXdS(N(RPRR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRrs cCs|j|_|j|_dS(N(RiRjRRl(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRaxs cCsF|r9|j}g|_|jj|_|j|_n tdS(N(RbRRtDefaultHandlerRRR(R!RHRRRR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRi|s   cCs@dj|jjddjdd}||_tdS(NRs s s (tjoinRtreplaceR(R!RC((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs* cCs tdS(N(R(R!RHR.((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRsN( R=R>RR@RRRRRaRiRR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRcs     cCsp|rt}n t}t|tr]t|d}z|j|}Wd|jXn|j|}|S(s{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. trbN(R)RPt isinstancet StringTypestopenRtclose(Rt namespacesRBtfptresult((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytparses  cCs(|rt}n t}|j|S(sOParse a document from a string, returning the resulting Document node. (R)RPR(RR8RB((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs  cCsv|rt|}n t|}t|trct|d}z|j|}Wd|jXn|j|}|S(sParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. R3N(R*RR4R5R6RR7(RRR8RBR9R:((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseFragments cCs.|rt|}n t|}|j|S(sParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. (R*RR(RRR8RB((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytparseFragmentStrings cCs!|jrt|St|SdS(s,Create a builder based on an Options object.N(R8R)RP(RY((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt makeBuilders  N(6Rtxml.domRRRRRRt xml.parsersRtxml.dom.minidomRRtxml.dom.NodeFilterR txml.dom.minicompatRRRtDOMBuilderFilterRRRRtgetDOMImplementationRctTypeInfoR@R(tobjectRRDRORPRRTRRRRRRRR)R*t ExceptionRRR]R;RR<R=R>(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyts`         3  I:  ud%,   PKi#]xw{ { dom/domreg.pynu["""Registration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.""" # This is a list of well-known implementations. Well-known names # should be published by posting to xml-sig@python.org, and are # subsequently recorded in this file. import sys well_known_implementations = { 'minidom':'xml.dom.minidom', '4DOM': 'xml.dom.DOMImplementation', } # DOM implementations not officially registered should register # themselves with their registered = {} def registerDOMImplementation(name, factory): """registerDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).""" registered[name] = factory def _good_enough(dom, features): "_good_enough(dom, features) -> Return 1 if the dom offers the features" for f,v in features: if not dom.hasFeature(f,v): return 0 return 1 def getDOMImplementation(name=None, features=()): """getDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.""" import os creator = None mod = well_known_implementations.get(name) if mod: mod = __import__(mod, {}, {}, ['getDOMImplementation']) return mod.getDOMImplementation() elif name: return registered[name]() elif not sys.flags.ignore_environment and "PYTHON_DOM" in os.environ: return getDOMImplementation(name = os.environ["PYTHON_DOM"]) # User did not specify a name, try implementations in arbitrary # order, returning the one that has the required features if isinstance(features, str): features = _parse_feature_string(features) for creator in registered.values(): dom = creator() if _good_enough(dom, features): return dom for creator in well_known_implementations.keys(): try: dom = getDOMImplementation(name = creator) except Exception: # typically ImportError, or AttributeError continue if _good_enough(dom, features): return dom raise ImportError("no suitable DOM implementation found") def _parse_feature_string(s): features = [] parts = s.split() i = 0 length = len(parts) while i < length: feature = parts[i] if feature[0] in "0123456789": raise ValueError("bad feature name: %r" % (feature,)) i = i + 1 version = None if i < length: v = parts[i] if v[0] in "0123456789": i = i + 1 version = v features.append((feature, version)) return tuple(features) PKi#]iOOdom/__init__.pyonu[ {fc@s:dZdd=dYZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefd YZd!efd"YZd#efd$YZd%efd&YZd'efd(YZd)efd*YZd+efd,YZd-efd.YZ d/efd0YZ!d1efd2YZ"d3efd4YZ#d5d>d6YZ$d7Z%d8Z&d9Z'd<Z)d<Z*d:d;l+m,Z,m-Z-d<S(?s W3C Document Object Model implementation for Python. The Python mapping of the Document Object Model is documented in the Python Library Reference in the section on the xml.dom package. This package contains the following modules: minidom -- A simple implementation of the Level 1 DOM with namespace support added (based on the Level 2 specification) and other minor Level 2 functionality. pulldom -- DOM builder supporting on-demand tree-building for selected subtrees of the document. tNodecBsVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( s$Class giving the NodeType constants.iiiiiiiii i i i (t__name__t __module__t__doc__t ELEMENT_NODEtATTRIBUTE_NODEt TEXT_NODEtCDATA_SECTION_NODEtENTITY_REFERENCE_NODEt ENTITY_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt DOCUMENT_NODEtDOCUMENT_TYPE_NODEtDOCUMENT_FRAGMENT_NODEt NOTATION_NODE(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRs iiiiiiiii i i i i iiit DOMExceptioncBs eZdZdZdZRS(smAbstract base class for DOM exceptions. Exceptions with specific codes are specializations of this class.cOs5|jtkrtdntj|||dS(Ns0DOMException should not be instantiated directly(t __class__Rt RuntimeErrort Exceptiont__init__(tselftargstkw((s(/usr/lib64/python2.7/xml/dom/__init__.pyRAs cCs|jS(N(tcode(R((s(/usr/lib64/python2.7/xml/dom/__init__.pyt _get_codeGs(RRRRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR=s t IndexSizeErrcBseZeZRS((RRtINDEX_SIZE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRKstDomstringSizeErrcBseZeZRS((RRtDOMSTRING_SIZE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRNstHierarchyRequestErrcBseZeZRS((RRtHIERARCHY_REQUEST_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRQstWrongDocumentErrcBseZeZRS((RRtWRONG_DOCUMENT_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR TstInvalidCharacterErrcBseZeZRS((RRtINVALID_CHARACTER_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR"WstNoDataAllowedErrcBseZeZRS((RRtNO_DATA_ALLOWED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR$ZstNoModificationAllowedErrcBseZeZRS((RRtNO_MODIFICATION_ALLOWED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR&]st NotFoundErrcBseZeZRS((RRt NOT_FOUND_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR(`stNotSupportedErrcBseZeZRS((RRtNOT_SUPPORTED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR*cstInuseAttributeErrcBseZeZRS((RRtINUSE_ATTRIBUTE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR,fstInvalidStateErrcBseZeZRS((RRtINVALID_STATE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR.ist SyntaxErrcBseZeZRS((RRt SYNTAX_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR0lstInvalidModificationErrcBseZeZRS((RRtINVALID_MODIFICATION_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR2ost NamespaceErrcBseZeZRS((RRt NAMESPACE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR4rstInvalidAccessErrcBseZeZRS((RRtINVALID_ACCESS_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR6ust ValidationErrcBseZeZRS((RRtVALIDATION_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR8xstUserDataHandlercBs&eZdZdZdZdZdZRS(sBClass giving the operation constants for UserDataHandler.handle().iiii(RRRt NODE_CLONEDt NODE_IMPORTEDt NODE_DELETEDt NODE_RENAMED(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR:{s s$http://www.w3.org/XML/1998/namespaceshttp://www.w3.org/2000/xmlns/shttp://www.w3.org/1999/xhtmli(tgetDOMImplementationtregisterDOMImplementationN(((.RRRRRR!R#R%R'R)R+R-R/R1R3R5R7R9RRRRRR R"R$R&R(R*R,R.R0R2R4R6R8R:t XML_NAMESPACEtXMLNS_NAMESPACEtXHTML_NAMESPACEtNonetEMPTY_NAMESPACEt EMPTY_PREFIXtdomregR?R@(((s(/usr/lib64/python2.7/xml/dom/__init__.pytsR PKi#]Iӎ  dom/minidom.pynu["""Simple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces """ import io import xml.dom from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg from xml.dom.minicompat import * from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS # This is used by the ID-cache invalidation checks; the list isn't # actually complete, since the nodes being checked will never be the # DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE. (The node being checked is # the node being added or removed, not the node being modified.) # _nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE, xml.dom.Node.ENTITY_REFERENCE_NODE) class Node(xml.dom.Node): namespaceURI = None # this is non-null only for elements and attributes parentNode = None ownerDocument = None nextSibling = None previousSibling = None prefix = EMPTY_PREFIX # non-null only for NS elements and attributes def __bool__(self): return True def toxml(self, encoding=None, standalone=None): return self.toprettyxml("", "", encoding, standalone) def toprettyxml(self, indent="\t", newl="\n", encoding=None, standalone=None): if encoding is None: writer = io.StringIO() else: writer = io.TextIOWrapper(io.BytesIO(), encoding=encoding, errors="xmlcharrefreplace", newline='\n') if self.nodeType == Node.DOCUMENT_NODE: # Can pass encoding only to document, to put it into XML header self.writexml(writer, "", indent, newl, encoding, standalone) else: self.writexml(writer, "", indent, newl) if encoding is None: return writer.getvalue() else: return writer.detach().getvalue() def hasChildNodes(self): return bool(self.childNodes) def _get_childNodes(self): return self.childNodes def _get_firstChild(self): if self.childNodes: return self.childNodes[0] def _get_lastChild(self): if self.childNodes: return self.childNodes[-1] def insertBefore(self, newChild, refChild): if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: for c in tuple(newChild.childNodes): self.insertBefore(c, refChild) ### The DOM does not clearly specify what to return in this case return newChild if newChild.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(newChild), repr(self))) if newChild.parentNode is not None: newChild.parentNode.removeChild(newChild) if refChild is None: self.appendChild(newChild) else: try: index = self.childNodes.index(refChild) except ValueError: raise xml.dom.NotFoundErr() if newChild.nodeType in _nodeTypes_with_children: _clear_id_cache(self) self.childNodes.insert(index, newChild) newChild.nextSibling = refChild refChild.previousSibling = newChild if index: node = self.childNodes[index-1] node.nextSibling = newChild newChild.previousSibling = node else: newChild.previousSibling = None newChild.parentNode = self return newChild def appendChild(self, node): if node.nodeType == self.DOCUMENT_FRAGMENT_NODE: for c in tuple(node.childNodes): self.appendChild(c) ### The DOM does not clearly specify what to return in this case return node if node.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(node), repr(self))) elif node.nodeType in _nodeTypes_with_children: _clear_id_cache(self) if node.parentNode is not None: node.parentNode.removeChild(node) _append_child(self, node) node.nextSibling = None return node def replaceChild(self, newChild, oldChild): if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: refChild = oldChild.nextSibling self.removeChild(oldChild) return self.insertBefore(newChild, refChild) if newChild.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(newChild), repr(self))) if newChild is oldChild: return if newChild.parentNode is not None: newChild.parentNode.removeChild(newChild) try: index = self.childNodes.index(oldChild) except ValueError: raise xml.dom.NotFoundErr() self.childNodes[index] = newChild newChild.parentNode = self oldChild.parentNode = None if (newChild.nodeType in _nodeTypes_with_children or oldChild.nodeType in _nodeTypes_with_children): _clear_id_cache(self) newChild.nextSibling = oldChild.nextSibling newChild.previousSibling = oldChild.previousSibling oldChild.nextSibling = None oldChild.previousSibling = None if newChild.previousSibling: newChild.previousSibling.nextSibling = newChild if newChild.nextSibling: newChild.nextSibling.previousSibling = newChild return oldChild def removeChild(self, oldChild): try: self.childNodes.remove(oldChild) except ValueError: raise xml.dom.NotFoundErr() if oldChild.nextSibling is not None: oldChild.nextSibling.previousSibling = oldChild.previousSibling if oldChild.previousSibling is not None: oldChild.previousSibling.nextSibling = oldChild.nextSibling oldChild.nextSibling = oldChild.previousSibling = None if oldChild.nodeType in _nodeTypes_with_children: _clear_id_cache(self) oldChild.parentNode = None return oldChild def normalize(self): L = [] for child in self.childNodes: if child.nodeType == Node.TEXT_NODE: if not child.data: # empty text node; discard if L: L[-1].nextSibling = child.nextSibling if child.nextSibling: child.nextSibling.previousSibling = child.previousSibling child.unlink() elif L and L[-1].nodeType == child.nodeType: # collapse text node node = L[-1] node.data = node.data + child.data node.nextSibling = child.nextSibling if child.nextSibling: child.nextSibling.previousSibling = node child.unlink() else: L.append(child) else: L.append(child) if child.nodeType == Node.ELEMENT_NODE: child.normalize() self.childNodes[:] = L def cloneNode(self, deep): return _clone_node(self, deep, self.ownerDocument or self) def isSupported(self, feature, version): return self.ownerDocument.implementation.hasFeature(feature, version) def _get_localName(self): # Overridden in Element and Attr where localName can be Non-Null return None # Node interfaces from Level 3 (WD 9 April 2002) def isSameNode(self, other): return self is other def getInterface(self, feature): if self.isSupported(feature, None): return self else: return None # The "user data" functions use a dictionary that is only present # if some user data has been set, so be careful not to assume it # exists. def getUserData(self, key): try: return self._user_data[key][0] except (AttributeError, KeyError): return None def setUserData(self, key, data, handler): old = None try: d = self._user_data except AttributeError: d = {} self._user_data = d if key in d: old = d[key][0] if data is None: # ignore handlers passed for None handler = None if old is not None: del d[key] else: d[key] = (data, handler) return old def _call_user_data_handler(self, operation, src, dst): if hasattr(self, "_user_data"): for key, (data, handler) in list(self._user_data.items()): if handler is not None: handler.handle(operation, key, data, src, dst) # minidom-specific API: def unlink(self): self.parentNode = self.ownerDocument = None if self.childNodes: for child in self.childNodes: child.unlink() self.childNodes = NodeList() self.previousSibling = None self.nextSibling = None # A Node is its own context manager, to ensure that an unlink() call occurs. # This is similar to how a file object works. def __enter__(self): return self def __exit__(self, et, ev, tb): self.unlink() defproperty(Node, "firstChild", doc="First child node, or None.") defproperty(Node, "lastChild", doc="Last child node, or None.") defproperty(Node, "localName", doc="Namespace-local name of this node.") def _append_child(self, node): # fast path with less checks; usable by DOM builders if careful childNodes = self.childNodes if childNodes: last = childNodes[-1] node.previousSibling = last last.nextSibling = node childNodes.append(node) node.parentNode = self def _write_data(writer, data): "Writes datachars to writer." if data: data = data.replace("&", "&").replace("<", "<"). \ replace("\"", """).replace(">", ">") writer.write(data) def _get_elements_by_tagName_helper(parent, name, rc): for node in parent.childNodes: if node.nodeType == Node.ELEMENT_NODE and \ (name == "*" or node.tagName == name): rc.append(node) _get_elements_by_tagName_helper(node, name, rc) return rc def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc): for node in parent.childNodes: if node.nodeType == Node.ELEMENT_NODE: if ((localName == "*" or node.localName == localName) and (nsURI == "*" or node.namespaceURI == nsURI)): rc.append(node) _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc) return rc class DocumentFragment(Node): nodeType = Node.DOCUMENT_FRAGMENT_NODE nodeName = "#document-fragment" nodeValue = None attributes = None parentNode = None _child_node_types = (Node.ELEMENT_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.NOTATION_NODE) def __init__(self): self.childNodes = NodeList() class Attr(Node): __slots__=('_name', '_value', 'namespaceURI', '_prefix', 'childNodes', '_localName', 'ownerDocument', 'ownerElement') nodeType = Node.ATTRIBUTE_NODE attributes = None specified = False _is_id = False _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE) def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None, prefix=None): self.ownerElement = None self.ownerDocument = None self._name = qName self.namespaceURI = namespaceURI self._prefix = prefix if localName is not None: self._localName = localName self.childNodes = NodeList() # Add the single child node that represents the value of the attr self.childNodes.append(Text()) # nodeValue and value are set elsewhere def _get_localName(self): try: return self._localName except AttributeError: return self.nodeName.split(":", 1)[-1] def _get_specified(self): return self.specified def _get_name(self): return self._name def _set_name(self, value): self._name = value if self.ownerElement is not None: _clear_id_cache(self.ownerElement) nodeName = name = property(_get_name, _set_name) def _get_value(self): return self._value def _set_value(self, value): self._value = value self.childNodes[0].data = value if self.ownerElement is not None: _clear_id_cache(self.ownerElement) self.childNodes[0].data = value nodeValue = value = property(_get_value, _set_value) def _get_prefix(self): return self._prefix def _set_prefix(self, prefix): nsuri = self.namespaceURI if prefix == "xmlns": if nsuri and nsuri != XMLNS_NAMESPACE: raise xml.dom.NamespaceErr( "illegal use of 'xmlns' prefix for the wrong namespace") self._prefix = prefix if prefix is None: newName = self.localName else: newName = "%s:%s" % (prefix, self.localName) if self.ownerElement: _clear_id_cache(self.ownerElement) self.name = newName prefix = property(_get_prefix, _set_prefix) def unlink(self): # This implementation does not call the base implementation # since most of that is not needed, and the expense of the # method call is not warranted. We duplicate the removal of # children, but that's all we needed from the base class. elem = self.ownerElement if elem is not None: del elem._attrs[self.nodeName] del elem._attrsNS[(self.namespaceURI, self.localName)] if self._is_id: self._is_id = False elem._magic_id_nodes -= 1 self.ownerDocument._magic_id_count -= 1 for child in self.childNodes: child.unlink() del self.childNodes[:] def _get_isId(self): if self._is_id: return True doc = self.ownerDocument elem = self.ownerElement if doc is None or elem is None: return False info = doc._get_elem_info(elem) if info is None: return False if self.namespaceURI: return info.isIdNS(self.namespaceURI, self.localName) else: return info.isId(self.nodeName) def _get_schemaType(self): doc = self.ownerDocument elem = self.ownerElement if doc is None or elem is None: return _no_type info = doc._get_elem_info(elem) if info is None: return _no_type if self.namespaceURI: return info.getAttributeTypeNS(self.namespaceURI, self.localName) else: return info.getAttributeType(self.nodeName) defproperty(Attr, "isId", doc="True if this attribute is an ID.") defproperty(Attr, "localName", doc="Namespace-local name of this attribute.") defproperty(Attr, "schemaType", doc="Schema type for this attribute.") class NamedNodeMap(object): """The attribute list is a transient interface to the underlying dictionaries. Mutations here will change the underlying element's dictionary. Ordering is imposed artificially and does not reflect the order of attributes as found in an input document. """ __slots__ = ('_attrs', '_attrsNS', '_ownerElement') def __init__(self, attrs, attrsNS, ownerElement): self._attrs = attrs self._attrsNS = attrsNS self._ownerElement = ownerElement def _get_length(self): return len(self._attrs) def item(self, index): try: return self[list(self._attrs.keys())[index]] except IndexError: return None def items(self): L = [] for node in self._attrs.values(): L.append((node.nodeName, node.value)) return L def itemsNS(self): L = [] for node in self._attrs.values(): L.append(((node.namespaceURI, node.localName), node.value)) return L def __contains__(self, key): if isinstance(key, str): return key in self._attrs else: return key in self._attrsNS def keys(self): return self._attrs.keys() def keysNS(self): return self._attrsNS.keys() def values(self): return self._attrs.values() def get(self, name, value=None): return self._attrs.get(name, value) __len__ = _get_length def _cmp(self, other): if self._attrs is getattr(other, "_attrs", None): return 0 else: return (id(self) > id(other)) - (id(self) < id(other)) def __eq__(self, other): return self._cmp(other) == 0 def __ge__(self, other): return self._cmp(other) >= 0 def __gt__(self, other): return self._cmp(other) > 0 def __le__(self, other): return self._cmp(other) <= 0 def __lt__(self, other): return self._cmp(other) < 0 def __getitem__(self, attname_or_tuple): if isinstance(attname_or_tuple, tuple): return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple] # same as set def __setitem__(self, attname, value): if isinstance(value, str): try: node = self._attrs[attname] except KeyError: node = Attr(attname) node.ownerDocument = self._ownerElement.ownerDocument self.setNamedItem(node) node.value = value else: if not isinstance(value, Attr): raise TypeError("value must be a string or Attr object") node = value self.setNamedItem(node) def getNamedItem(self, name): try: return self._attrs[name] except KeyError: return None def getNamedItemNS(self, namespaceURI, localName): try: return self._attrsNS[(namespaceURI, localName)] except KeyError: return None def removeNamedItem(self, name): n = self.getNamedItem(name) if n is not None: _clear_id_cache(self._ownerElement) del self._attrs[n.nodeName] del self._attrsNS[(n.namespaceURI, n.localName)] if hasattr(n, 'ownerElement'): n.ownerElement = None return n else: raise xml.dom.NotFoundErr() def removeNamedItemNS(self, namespaceURI, localName): n = self.getNamedItemNS(namespaceURI, localName) if n is not None: _clear_id_cache(self._ownerElement) del self._attrsNS[(n.namespaceURI, n.localName)] del self._attrs[n.nodeName] if hasattr(n, 'ownerElement'): n.ownerElement = None return n else: raise xml.dom.NotFoundErr() def setNamedItem(self, node): if not isinstance(node, Attr): raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(node), repr(self))) old = self._attrs.get(node.name) if old: old.unlink() self._attrs[node.name] = node self._attrsNS[(node.namespaceURI, node.localName)] = node node.ownerElement = self._ownerElement _clear_id_cache(node.ownerElement) return old def setNamedItemNS(self, node): return self.setNamedItem(node) def __delitem__(self, attname_or_tuple): node = self[attname_or_tuple] _clear_id_cache(node.ownerElement) node.unlink() def __getstate__(self): return self._attrs, self._attrsNS, self._ownerElement def __setstate__(self, state): self._attrs, self._attrsNS, self._ownerElement = state defproperty(NamedNodeMap, "length", doc="Number of nodes in the NamedNodeMap.") AttributeList = NamedNodeMap class TypeInfo(object): __slots__ = 'namespace', 'name' def __init__(self, namespace, name): self.namespace = namespace self.name = name def __repr__(self): if self.namespace: return "<%s %r (from %r)>" % (self.__class__.__name__, self.name, self.namespace) else: return "<%s %r>" % (self.__class__.__name__, self.name) def _get_name(self): return self.name def _get_namespace(self): return self.namespace _no_type = TypeInfo(None, None) class Element(Node): __slots__=('ownerDocument', 'parentNode', 'tagName', 'nodeName', 'prefix', 'namespaceURI', '_localName', 'childNodes', '_attrs', '_attrsNS', 'nextSibling', 'previousSibling') nodeType = Node.ELEMENT_NODE nodeValue = None schemaType = _no_type _magic_id_nodes = 0 _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE) def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None, localName=None): self.ownerDocument = None self.parentNode = None self.tagName = self.nodeName = tagName self.prefix = prefix self.namespaceURI = namespaceURI self.childNodes = NodeList() self.nextSibling = self.previousSibling = None # Attribute dictionaries are lazily created # attributes are double-indexed: # tagName -> Attribute # URI,localName -> Attribute # in the future: consider lazy generation # of attribute objects this is too tricky # for now because of headaches with # namespaces. self._attrs = None self._attrsNS = None def _ensure_attributes(self): if self._attrs is None: self._attrs = {} self._attrsNS = {} def _get_localName(self): try: return self._localName except AttributeError: return self.tagName.split(":", 1)[-1] def _get_tagName(self): return self.tagName def unlink(self): if self._attrs is not None: for attr in list(self._attrs.values()): attr.unlink() self._attrs = None self._attrsNS = None Node.unlink(self) def getAttribute(self, attname): """Returns the value of the specified attribute. Returns the value of the element's attribute named attname as a string. An empty string is returned if the element does not have such an attribute. Note that an empty string may also be returned as an explicitly given attribute value, use the hasAttribute method to distinguish these two cases. """ if self._attrs is None: return "" try: return self._attrs[attname].value except KeyError: return "" def getAttributeNS(self, namespaceURI, localName): if self._attrsNS is None: return "" try: return self._attrsNS[(namespaceURI, localName)].value except KeyError: return "" def setAttribute(self, attname, value): attr = self.getAttributeNode(attname) if attr is None: attr = Attr(attname) attr.value = value # also sets nodeValue attr.ownerDocument = self.ownerDocument self.setAttributeNode(attr) elif value != attr.value: attr.value = value if attr.isId: _clear_id_cache(self) def setAttributeNS(self, namespaceURI, qualifiedName, value): prefix, localname = _nssplit(qualifiedName) attr = self.getAttributeNodeNS(namespaceURI, localname) if attr is None: attr = Attr(qualifiedName, namespaceURI, localname, prefix) attr.value = value attr.ownerDocument = self.ownerDocument self.setAttributeNode(attr) else: if value != attr.value: attr.value = value if attr.isId: _clear_id_cache(self) if attr.prefix != prefix: attr.prefix = prefix attr.nodeName = qualifiedName def getAttributeNode(self, attrname): if self._attrs is None: return None return self._attrs.get(attrname) def getAttributeNodeNS(self, namespaceURI, localName): if self._attrsNS is None: return None return self._attrsNS.get((namespaceURI, localName)) def setAttributeNode(self, attr): if attr.ownerElement not in (None, self): raise xml.dom.InuseAttributeErr("attribute node already owned") self._ensure_attributes() old1 = self._attrs.get(attr.name, None) if old1 is not None: self.removeAttributeNode(old1) old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None) if old2 is not None and old2 is not old1: self.removeAttributeNode(old2) _set_attribute_node(self, attr) if old1 is not attr: # It might have already been part of this node, in which case # it doesn't represent a change, and should not be returned. return old1 if old2 is not attr: return old2 setAttributeNodeNS = setAttributeNode def removeAttribute(self, name): if self._attrsNS is None: raise xml.dom.NotFoundErr() try: attr = self._attrs[name] except KeyError: raise xml.dom.NotFoundErr() self.removeAttributeNode(attr) def removeAttributeNS(self, namespaceURI, localName): if self._attrsNS is None: raise xml.dom.NotFoundErr() try: attr = self._attrsNS[(namespaceURI, localName)] except KeyError: raise xml.dom.NotFoundErr() self.removeAttributeNode(attr) def removeAttributeNode(self, node): if node is None: raise xml.dom.NotFoundErr() try: self._attrs[node.name] except KeyError: raise xml.dom.NotFoundErr() _clear_id_cache(self) node.unlink() # Restore this since the node is still useful and otherwise # unlinked node.ownerDocument = self.ownerDocument return node removeAttributeNodeNS = removeAttributeNode def hasAttribute(self, name): """Checks whether the element has an attribute with the specified name. Returns True if the element has an attribute with the specified name. Otherwise, returns False. """ if self._attrs is None: return False return name in self._attrs def hasAttributeNS(self, namespaceURI, localName): if self._attrsNS is None: return False return (namespaceURI, localName) in self._attrsNS def getElementsByTagName(self, name): """Returns all descendant elements with the given tag name. Returns the list of all descendant elements (not direct children only) with the specified tag name. """ return _get_elements_by_tagName_helper(self, name, NodeList()) def getElementsByTagNameNS(self, namespaceURI, localName): return _get_elements_by_tagName_ns_helper( self, namespaceURI, localName, NodeList()) def __repr__(self): return "" % (self.tagName, id(self)) def writexml(self, writer, indent="", addindent="", newl=""): """Write an XML element to a file-like object Write the element to the writer object that must provide a write method (e.g. a file or StringIO object). """ # indent = current indentation # addindent = indentation to add to higher levels # newl = newline string writer.write(indent+"<" + self.tagName) attrs = self._get_attributes() for a_name in attrs.keys(): writer.write(" %s=\"" % a_name) _write_data(writer, attrs[a_name].value) writer.write("\"") if self.childNodes: writer.write(">") if (len(self.childNodes) == 1 and self.childNodes[0].nodeType in ( Node.TEXT_NODE, Node.CDATA_SECTION_NODE)): self.childNodes[0].writexml(writer, '', '', '') else: writer.write(newl) for node in self.childNodes: node.writexml(writer, indent+addindent, addindent, newl) writer.write(indent) writer.write("%s" % (self.tagName, newl)) else: writer.write("/>%s"%(newl)) def _get_attributes(self): self._ensure_attributes() return NamedNodeMap(self._attrs, self._attrsNS, self) def hasAttributes(self): if self._attrs: return True else: return False # DOM Level 3 attributes, based on the 22 Oct 2002 draft def setIdAttribute(self, name): idAttr = self.getAttributeNode(name) self.setIdAttributeNode(idAttr) def setIdAttributeNS(self, namespaceURI, localName): idAttr = self.getAttributeNodeNS(namespaceURI, localName) self.setIdAttributeNode(idAttr) def setIdAttributeNode(self, idAttr): if idAttr is None or not self.isSameNode(idAttr.ownerElement): raise xml.dom.NotFoundErr() if _get_containing_entref(self) is not None: raise xml.dom.NoModificationAllowedErr() if not idAttr._is_id: idAttr._is_id = True self._magic_id_nodes += 1 self.ownerDocument._magic_id_count += 1 _clear_id_cache(self) defproperty(Element, "attributes", doc="NamedNodeMap of attributes on the element.") defproperty(Element, "localName", doc="Namespace-local name of this element.") def _set_attribute_node(element, attr): _clear_id_cache(element) element._ensure_attributes() element._attrs[attr.name] = attr element._attrsNS[(attr.namespaceURI, attr.localName)] = attr # This creates a circular reference, but Element.unlink() # breaks the cycle since the references to the attribute # dictionaries are tossed. attr.ownerElement = element class Childless: """Mixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. """ __slots__ = () attributes = None childNodes = EmptyNodeList() firstChild = None lastChild = None def _get_firstChild(self): return None def _get_lastChild(self): return None def appendChild(self, node): raise xml.dom.HierarchyRequestErr( self.nodeName + " nodes cannot have children") def hasChildNodes(self): return False def insertBefore(self, newChild, refChild): raise xml.dom.HierarchyRequestErr( self.nodeName + " nodes do not have children") def removeChild(self, oldChild): raise xml.dom.NotFoundErr( self.nodeName + " nodes do not have children") def normalize(self): # For childless nodes, normalize() has nothing to do. pass def replaceChild(self, newChild, oldChild): raise xml.dom.HierarchyRequestErr( self.nodeName + " nodes do not have children") class ProcessingInstruction(Childless, Node): nodeType = Node.PROCESSING_INSTRUCTION_NODE __slots__ = ('target', 'data') def __init__(self, target, data): self.target = target self.data = data # nodeValue is an alias for data def _get_nodeValue(self): return self.data def _set_nodeValue(self, value): self.data = value nodeValue = property(_get_nodeValue, _set_nodeValue) # nodeName is an alias for target def _get_nodeName(self): return self.target def _set_nodeName(self, value): self.target = value nodeName = property(_get_nodeName, _set_nodeName) def writexml(self, writer, indent="", addindent="", newl=""): writer.write("%s%s" % (indent,self.target, self.data, newl)) class CharacterData(Childless, Node): __slots__=('_data', 'ownerDocument','parentNode', 'previousSibling', 'nextSibling') def __init__(self): self.ownerDocument = self.parentNode = None self.previousSibling = self.nextSibling = None self._data = '' Node.__init__(self) def _get_length(self): return len(self.data) __len__ = _get_length def _get_data(self): return self._data def _set_data(self, data): self._data = data data = nodeValue = property(_get_data, _set_data) def __repr__(self): data = self.data if len(data) > 10: dotdotdot = "..." else: dotdotdot = "" return '' % ( self.__class__.__name__, data[0:10], dotdotdot) def substringData(self, offset, count): if offset < 0: raise xml.dom.IndexSizeErr("offset cannot be negative") if offset >= len(self.data): raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") if count < 0: raise xml.dom.IndexSizeErr("count cannot be negative") return self.data[offset:offset+count] def appendData(self, arg): self.data = self.data + arg def insertData(self, offset, arg): if offset < 0: raise xml.dom.IndexSizeErr("offset cannot be negative") if offset >= len(self.data): raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") if arg: self.data = "%s%s%s" % ( self.data[:offset], arg, self.data[offset:]) def deleteData(self, offset, count): if offset < 0: raise xml.dom.IndexSizeErr("offset cannot be negative") if offset >= len(self.data): raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") if count < 0: raise xml.dom.IndexSizeErr("count cannot be negative") if count: self.data = self.data[:offset] + self.data[offset+count:] def replaceData(self, offset, count, arg): if offset < 0: raise xml.dom.IndexSizeErr("offset cannot be negative") if offset >= len(self.data): raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") if count < 0: raise xml.dom.IndexSizeErr("count cannot be negative") if count: self.data = "%s%s%s" % ( self.data[:offset], arg, self.data[offset+count:]) defproperty(CharacterData, "length", doc="Length of the string data.") class Text(CharacterData): __slots__ = () nodeType = Node.TEXT_NODE nodeName = "#text" attributes = None def splitText(self, offset): if offset < 0 or offset > len(self.data): raise xml.dom.IndexSizeErr("illegal offset value") newText = self.__class__() newText.data = self.data[offset:] newText.ownerDocument = self.ownerDocument next = self.nextSibling if self.parentNode and self in self.parentNode.childNodes: if next is None: self.parentNode.appendChild(newText) else: self.parentNode.insertBefore(newText, next) self.data = self.data[:offset] return newText def writexml(self, writer, indent="", addindent="", newl=""): _write_data(writer, "%s%s%s" % (indent, self.data, newl)) # DOM Level 3 (WD 9 April 2002) def _get_wholeText(self): L = [self.data] n = self.previousSibling while n is not None: if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): L.insert(0, n.data) n = n.previousSibling else: break n = self.nextSibling while n is not None: if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): L.append(n.data) n = n.nextSibling else: break return ''.join(L) def replaceWholeText(self, content): # XXX This needs to be seriously changed if minidom ever # supports EntityReference nodes. parent = self.parentNode n = self.previousSibling while n is not None: if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): next = n.previousSibling parent.removeChild(n) n = next else: break n = self.nextSibling if not content: parent.removeChild(self) while n is not None: if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): next = n.nextSibling parent.removeChild(n) n = next else: break if content: self.data = content return self else: return None def _get_isWhitespaceInElementContent(self): if self.data.strip(): return False elem = _get_containing_element(self) if elem is None: return False info = self.ownerDocument._get_elem_info(elem) if info is None: return False else: return info.isElementContent() defproperty(Text, "isWhitespaceInElementContent", doc="True iff this text node contains only whitespace" " and is in element content.") defproperty(Text, "wholeText", doc="The text of all logically-adjacent text nodes.") def _get_containing_element(node): c = node.parentNode while c is not None: if c.nodeType == Node.ELEMENT_NODE: return c c = c.parentNode return None def _get_containing_entref(node): c = node.parentNode while c is not None: if c.nodeType == Node.ENTITY_REFERENCE_NODE: return c c = c.parentNode return None class Comment(CharacterData): nodeType = Node.COMMENT_NODE nodeName = "#comment" def __init__(self, data): CharacterData.__init__(self) self._data = data def writexml(self, writer, indent="", addindent="", newl=""): if "--" in self.data: raise ValueError("'--' is not allowed in a comment node") writer.write("%s%s" % (indent, self.data, newl)) class CDATASection(Text): __slots__ = () nodeType = Node.CDATA_SECTION_NODE nodeName = "#cdata-section" def writexml(self, writer, indent="", addindent="", newl=""): if self.data.find("]]>") >= 0: raise ValueError("']]>' not allowed in a CDATA section") writer.write("" % self.data) class ReadOnlySequentialNamedNodeMap(object): __slots__ = '_seq', def __init__(self, seq=()): # seq should be a list or tuple self._seq = seq def __len__(self): return len(self._seq) def _get_length(self): return len(self._seq) def getNamedItem(self, name): for n in self._seq: if n.nodeName == name: return n def getNamedItemNS(self, namespaceURI, localName): for n in self._seq: if n.namespaceURI == namespaceURI and n.localName == localName: return n def __getitem__(self, name_or_tuple): if isinstance(name_or_tuple, tuple): node = self.getNamedItemNS(*name_or_tuple) else: node = self.getNamedItem(name_or_tuple) if node is None: raise KeyError(name_or_tuple) return node def item(self, index): if index < 0: return None try: return self._seq[index] except IndexError: return None def removeNamedItem(self, name): raise xml.dom.NoModificationAllowedErr( "NamedNodeMap instance is read-only") def removeNamedItemNS(self, namespaceURI, localName): raise xml.dom.NoModificationAllowedErr( "NamedNodeMap instance is read-only") def setNamedItem(self, node): raise xml.dom.NoModificationAllowedErr( "NamedNodeMap instance is read-only") def setNamedItemNS(self, node): raise xml.dom.NoModificationAllowedErr( "NamedNodeMap instance is read-only") def __getstate__(self): return [self._seq] def __setstate__(self, state): self._seq = state[0] defproperty(ReadOnlySequentialNamedNodeMap, "length", doc="Number of entries in the NamedNodeMap.") class Identified: """Mix-in class that supports the publicId and systemId attributes.""" __slots__ = 'publicId', 'systemId' def _identified_mixin_init(self, publicId, systemId): self.publicId = publicId self.systemId = systemId def _get_publicId(self): return self.publicId def _get_systemId(self): return self.systemId class DocumentType(Identified, Childless, Node): nodeType = Node.DOCUMENT_TYPE_NODE nodeValue = None name = None publicId = None systemId = None internalSubset = None def __init__(self, qualifiedName): self.entities = ReadOnlySequentialNamedNodeMap() self.notations = ReadOnlySequentialNamedNodeMap() if qualifiedName: prefix, localname = _nssplit(qualifiedName) self.name = localname self.nodeName = self.name def _get_internalSubset(self): return self.internalSubset def cloneNode(self, deep): if self.ownerDocument is None: # it's ok clone = DocumentType(None) clone.name = self.name clone.nodeName = self.name operation = xml.dom.UserDataHandler.NODE_CLONED if deep: clone.entities._seq = [] clone.notations._seq = [] for n in self.notations._seq: notation = Notation(n.nodeName, n.publicId, n.systemId) clone.notations._seq.append(notation) n._call_user_data_handler(operation, n, notation) for e in self.entities._seq: entity = Entity(e.nodeName, e.publicId, e.systemId, e.notationName) entity.actualEncoding = e.actualEncoding entity.encoding = e.encoding entity.version = e.version clone.entities._seq.append(entity) e._call_user_data_handler(operation, e, entity) self._call_user_data_handler(operation, self, clone) return clone else: return None def writexml(self, writer, indent="", addindent="", newl=""): writer.write(""+newl) class Entity(Identified, Node): attributes = None nodeType = Node.ENTITY_NODE nodeValue = None actualEncoding = None encoding = None version = None def __init__(self, name, publicId, systemId, notation): self.nodeName = name self.notationName = notation self.childNodes = NodeList() self._identified_mixin_init(publicId, systemId) def _get_actualEncoding(self): return self.actualEncoding def _get_encoding(self): return self.encoding def _get_version(self): return self.version def appendChild(self, newChild): raise xml.dom.HierarchyRequestErr( "cannot append children to an entity node") def insertBefore(self, newChild, refChild): raise xml.dom.HierarchyRequestErr( "cannot insert children below an entity node") def removeChild(self, oldChild): raise xml.dom.HierarchyRequestErr( "cannot remove children from an entity node") def replaceChild(self, newChild, oldChild): raise xml.dom.HierarchyRequestErr( "cannot replace children of an entity node") class Notation(Identified, Childless, Node): nodeType = Node.NOTATION_NODE nodeValue = None def __init__(self, name, publicId, systemId): self.nodeName = name self._identified_mixin_init(publicId, systemId) class DOMImplementation(DOMImplementationLS): _features = [("core", "1.0"), ("core", "2.0"), ("core", None), ("xml", "1.0"), ("xml", "2.0"), ("xml", None), ("ls-load", "3.0"), ("ls-load", None), ] def hasFeature(self, feature, version): if version == "": version = None return (feature.lower(), version) in self._features def createDocument(self, namespaceURI, qualifiedName, doctype): if doctype and doctype.parentNode is not None: raise xml.dom.WrongDocumentErr( "doctype object owned by another DOM tree") doc = self._create_document() add_root_element = not (namespaceURI is None and qualifiedName is None and doctype is None) if not qualifiedName and add_root_element: # The spec is unclear what to raise here; SyntaxErr # would be the other obvious candidate. Since Xerces raises # InvalidCharacterErr, and since SyntaxErr is not listed # for createDocument, that seems to be the better choice. # XXX: need to check for illegal characters here and in # createElement. # DOM Level III clears this up when talking about the return value # of this function. If namespaceURI, qName and DocType are # Null the document is returned without a document element # Otherwise if doctype or namespaceURI are not None # Then we go back to the above problem raise xml.dom.InvalidCharacterErr("Element with no name") if add_root_element: prefix, localname = _nssplit(qualifiedName) if prefix == "xml" \ and namespaceURI != "http://www.w3.org/XML/1998/namespace": raise xml.dom.NamespaceErr("illegal use of 'xml' prefix") if prefix and not namespaceURI: raise xml.dom.NamespaceErr( "illegal use of prefix without namespaces") element = doc.createElementNS(namespaceURI, qualifiedName) if doctype: doc.appendChild(doctype) doc.appendChild(element) if doctype: doctype.parentNode = doctype.ownerDocument = doc doc.doctype = doctype doc.implementation = self return doc def createDocumentType(self, qualifiedName, publicId, systemId): doctype = DocumentType(qualifiedName) doctype.publicId = publicId doctype.systemId = systemId return doctype # DOM Level 3 (WD 9 April 2002) def getInterface(self, feature): if self.hasFeature(feature, None): return self else: return None # internal def _create_document(self): return Document() class ElementInfo(object): """Object that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. """ __slots__ = 'tagName', def __init__(self, name): self.tagName = name def getAttributeType(self, aname): return _no_type def getAttributeTypeNS(self, namespaceURI, localName): return _no_type def isElementContent(self): return False def isEmpty(self): """Returns true iff this element is declared to have an EMPTY content model.""" return False def isId(self, aname): """Returns true iff the named attribute is a DTD-style ID.""" return False def isIdNS(self, namespaceURI, localName): """Returns true iff the identified attribute is a DTD-style ID.""" return False def __getstate__(self): return self.tagName def __setstate__(self, state): self.tagName = state def _clear_id_cache(node): if node.nodeType == Node.DOCUMENT_NODE: node._id_cache.clear() node._id_search_stack = None elif node.ownerDocument: node.ownerDocument._id_cache.clear() node.ownerDocument._id_search_stack= None class Document(Node, DocumentLS): __slots__ = ('_elem_info', 'doctype', '_id_search_stack', 'childNodes', '_id_cache') _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE) implementation = DOMImplementation() nodeType = Node.DOCUMENT_NODE nodeName = "#document" nodeValue = None attributes = None parentNode = None previousSibling = nextSibling = None # Document attributes from Level 3 (WD 9 April 2002) actualEncoding = None encoding = None standalone = None version = None strictErrorChecking = False errorHandler = None documentURI = None _magic_id_count = 0 def __init__(self): self.doctype = None self.childNodes = NodeList() # mapping of (namespaceURI, localName) -> ElementInfo # and tagName -> ElementInfo self._elem_info = {} self._id_cache = {} self._id_search_stack = None def _get_elem_info(self, element): if element.namespaceURI: key = element.namespaceURI, element.localName else: key = element.tagName return self._elem_info.get(key) def _get_actualEncoding(self): return self.actualEncoding def _get_doctype(self): return self.doctype def _get_documentURI(self): return self.documentURI def _get_encoding(self): return self.encoding def _get_errorHandler(self): return self.errorHandler def _get_standalone(self): return self.standalone def _get_strictErrorChecking(self): return self.strictErrorChecking def _get_version(self): return self.version def appendChild(self, node): if node.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(node), repr(self))) if node.parentNode is not None: # This needs to be done before the next test since this # may *be* the document element, in which case it should # end up re-ordered to the end. node.parentNode.removeChild(node) if node.nodeType == Node.ELEMENT_NODE \ and self._get_documentElement(): raise xml.dom.HierarchyRequestErr( "two document elements disallowed") return Node.appendChild(self, node) def removeChild(self, oldChild): try: self.childNodes.remove(oldChild) except ValueError: raise xml.dom.NotFoundErr() oldChild.nextSibling = oldChild.previousSibling = None oldChild.parentNode = None if self.documentElement is oldChild: self.documentElement = None return oldChild def _get_documentElement(self): for node in self.childNodes: if node.nodeType == Node.ELEMENT_NODE: return node def unlink(self): if self.doctype is not None: self.doctype.unlink() self.doctype = None Node.unlink(self) def cloneNode(self, deep): if not deep: return None clone = self.implementation.createDocument(None, None, None) clone.encoding = self.encoding clone.standalone = self.standalone clone.version = self.version for n in self.childNodes: childclone = _clone_node(n, deep, clone) assert childclone.ownerDocument.isSameNode(clone) clone.childNodes.append(childclone) if childclone.nodeType == Node.DOCUMENT_NODE: assert clone.documentElement is None elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE: assert clone.doctype is None clone.doctype = childclone childclone.parentNode = clone self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED, self, clone) return clone def createDocumentFragment(self): d = DocumentFragment() d.ownerDocument = self return d def createElement(self, tagName): e = Element(tagName) e.ownerDocument = self return e def createTextNode(self, data): if not isinstance(data, str): raise TypeError("node contents must be a string") t = Text() t.data = data t.ownerDocument = self return t def createCDATASection(self, data): if not isinstance(data, str): raise TypeError("node contents must be a string") c = CDATASection() c.data = data c.ownerDocument = self return c def createComment(self, data): c = Comment(data) c.ownerDocument = self return c def createProcessingInstruction(self, target, data): p = ProcessingInstruction(target, data) p.ownerDocument = self return p def createAttribute(self, qName): a = Attr(qName) a.ownerDocument = self a.value = "" return a def createElementNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) e = Element(qualifiedName, namespaceURI, prefix) e.ownerDocument = self return e def createAttributeNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) a = Attr(qualifiedName, namespaceURI, localName, prefix) a.ownerDocument = self a.value = "" return a # A couple of implementation-specific helpers to create node types # not supported by the W3C DOM specs: def _create_entity(self, name, publicId, systemId, notationName): e = Entity(name, publicId, systemId, notationName) e.ownerDocument = self return e def _create_notation(self, name, publicId, systemId): n = Notation(name, publicId, systemId) n.ownerDocument = self return n def getElementById(self, id): if id in self._id_cache: return self._id_cache[id] if not (self._elem_info or self._magic_id_count): return None stack = self._id_search_stack if stack is None: # we never searched before, or the cache has been cleared stack = [self.documentElement] self._id_search_stack = stack elif not stack: # Previous search was completed and cache is still valid; # no matching node. return None result = None while stack: node = stack.pop() # add child elements to stack for continued searching stack.extend([child for child in node.childNodes if child.nodeType in _nodeTypes_with_children]) # check this node info = self._get_elem_info(node) if info: # We have to process all ID attributes before # returning in order to get all the attributes set to # be IDs using Element.setIdAttribute*(). for attr in node.attributes.values(): if attr.namespaceURI: if info.isIdNS(attr.namespaceURI, attr.localName): self._id_cache[attr.value] = node if attr.value == id: result = node elif not node._magic_id_nodes: break elif info.isId(attr.name): self._id_cache[attr.value] = node if attr.value == id: result = node elif not node._magic_id_nodes: break elif attr._is_id: self._id_cache[attr.value] = node if attr.value == id: result = node elif node._magic_id_nodes == 1: break elif node._magic_id_nodes: for attr in node.attributes.values(): if attr._is_id: self._id_cache[attr.value] = node if attr.value == id: result = node if result is not None: break return result def getElementsByTagName(self, name): return _get_elements_by_tagName_helper(self, name, NodeList()) def getElementsByTagNameNS(self, namespaceURI, localName): return _get_elements_by_tagName_ns_helper( self, namespaceURI, localName, NodeList()) def isSupported(self, feature, version): return self.implementation.hasFeature(feature, version) def importNode(self, node, deep): if node.nodeType == Node.DOCUMENT_NODE: raise xml.dom.NotSupportedErr("cannot import document nodes") elif node.nodeType == Node.DOCUMENT_TYPE_NODE: raise xml.dom.NotSupportedErr("cannot import document type nodes") return _clone_node(node, deep, self) def writexml(self, writer, indent="", addindent="", newl="", encoding=None, standalone=None): declarations = [] if encoding: declarations.append(f'encoding="{encoding}"') if standalone is not None: declarations.append(f'standalone="{"yes" if standalone else "no"}"') writer.write(f'{newl}') for node in self.childNodes: node.writexml(writer, indent, addindent, newl) # DOM Level 3 (WD 9 April 2002) def renameNode(self, n, namespaceURI, name): if n.ownerDocument is not self: raise xml.dom.WrongDocumentErr( "cannot rename nodes from other documents;\n" "expected %s,\nfound %s" % (self, n.ownerDocument)) if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE): raise xml.dom.NotSupportedErr( "renameNode() only applies to element and attribute nodes") if namespaceURI != EMPTY_NAMESPACE: if ':' in name: prefix, localName = name.split(':', 1) if ( prefix == "xmlns" and namespaceURI != xml.dom.XMLNS_NAMESPACE): raise xml.dom.NamespaceErr( "illegal use of 'xmlns' prefix") else: if ( name == "xmlns" and namespaceURI != xml.dom.XMLNS_NAMESPACE and n.nodeType == Node.ATTRIBUTE_NODE): raise xml.dom.NamespaceErr( "illegal use of the 'xmlns' attribute") prefix = None localName = name else: prefix = None localName = None if n.nodeType == Node.ATTRIBUTE_NODE: element = n.ownerElement if element is not None: is_id = n._is_id element.removeAttributeNode(n) else: element = None n.prefix = prefix n._localName = localName n.namespaceURI = namespaceURI n.nodeName = name if n.nodeType == Node.ELEMENT_NODE: n.tagName = name else: # attribute node n.name = name if element is not None: element.setAttributeNode(n) if is_id: element.setIdAttributeNode(n) # It's not clear from a semantic perspective whether we should # call the user data handlers for the NODE_RENAMED event since # we're re-using the existing node. The draft spec has been # interpreted as meaning "no, don't call the handler unless a # new node is created." return n defproperty(Document, "documentElement", doc="Top-level element of this document.") def _clone_node(node, deep, newOwnerDocument): """ Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode """ if node.ownerDocument.isSameNode(newOwnerDocument): operation = xml.dom.UserDataHandler.NODE_CLONED else: operation = xml.dom.UserDataHandler.NODE_IMPORTED if node.nodeType == Node.ELEMENT_NODE: clone = newOwnerDocument.createElementNS(node.namespaceURI, node.nodeName) for attr in node.attributes.values(): clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value) a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName) a.specified = attr.specified if deep: for child in node.childNodes: c = _clone_node(child, deep, newOwnerDocument) clone.appendChild(c) elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE: clone = newOwnerDocument.createDocumentFragment() if deep: for child in node.childNodes: c = _clone_node(child, deep, newOwnerDocument) clone.appendChild(c) elif node.nodeType == Node.TEXT_NODE: clone = newOwnerDocument.createTextNode(node.data) elif node.nodeType == Node.CDATA_SECTION_NODE: clone = newOwnerDocument.createCDATASection(node.data) elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE: clone = newOwnerDocument.createProcessingInstruction(node.target, node.data) elif node.nodeType == Node.COMMENT_NODE: clone = newOwnerDocument.createComment(node.data) elif node.nodeType == Node.ATTRIBUTE_NODE: clone = newOwnerDocument.createAttributeNS(node.namespaceURI, node.nodeName) clone.specified = True clone.value = node.value elif node.nodeType == Node.DOCUMENT_TYPE_NODE: assert node.ownerDocument is not newOwnerDocument operation = xml.dom.UserDataHandler.NODE_IMPORTED clone = newOwnerDocument.implementation.createDocumentType( node.name, node.publicId, node.systemId) clone.ownerDocument = newOwnerDocument if deep: clone.entities._seq = [] clone.notations._seq = [] for n in node.notations._seq: notation = Notation(n.nodeName, n.publicId, n.systemId) notation.ownerDocument = newOwnerDocument clone.notations._seq.append(notation) if hasattr(n, '_call_user_data_handler'): n._call_user_data_handler(operation, n, notation) for e in node.entities._seq: entity = Entity(e.nodeName, e.publicId, e.systemId, e.notationName) entity.actualEncoding = e.actualEncoding entity.encoding = e.encoding entity.version = e.version entity.ownerDocument = newOwnerDocument clone.entities._seq.append(entity) if hasattr(e, '_call_user_data_handler'): e._call_user_data_handler(operation, e, entity) else: # Note the cloning of Document and DocumentType nodes is # implementation specific. minidom handles those cases # directly in the cloneNode() methods. raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node)) # Check for _call_user_data_handler() since this could conceivably # used with other DOM implementations (one of the FourThought # DOMs, perhaps?). if hasattr(node, '_call_user_data_handler'): node._call_user_data_handler(operation, node, clone) return clone def _nssplit(qualifiedName): fields = qualifiedName.split(':', 1) if len(fields) == 2: return fields else: return (None, fields[0]) def _do_pulldom_parse(func, args, kwargs): events = func(*args, **kwargs) toktype, rootNode = events.getEvent() events.expandNode(rootNode) events.clear() return rootNode def parse(file, parser=None, bufsize=None): """Parse a file into a DOM by filename or file object.""" if parser is None and not bufsize: from xml.dom import expatbuilder return expatbuilder.parse(file) else: from xml.dom import pulldom return _do_pulldom_parse(pulldom.parse, (file,), {'parser': parser, 'bufsize': bufsize}) def parseString(string, parser=None): """Parse a file into a DOM from a string.""" if parser is None: from xml.dom import expatbuilder return expatbuilder.parseString(string) else: from xml.dom import pulldom return _do_pulldom_parse(pulldom.parseString, (string,), {'parser': parser}) def getDOMImplementation(features=None): if features: if isinstance(features, str): features = domreg._parse_feature_string(features) for f, v in features: if not Document.implementation.hasFeature(f, v): return None return Document.implementation PKi#]HJ8 8 dom/domreg.pyonu[ {fc@sddZddlTddlZidd6dd6ZiZdZd Zdd d Zd Z dS( sRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.i(t*Nsxml.dom.minidomtminidomsxml.dom.DOMImplementationt4DOMcCs|t| Return 1 if the dom offers the featuresii(t hasFeature(tdomtfeaturestftv((s&/usr/lib64/python2.7/xml/dom/domreg.pyt _good_enough"scCs<ddl}d}tj|}|rIt|iidg}|jS|rZt|Stjj rd|j krtd|j dSt |t rt |}nx0tjD]"}|}t||r|SqWxQtjD]C}ytd|}Wntk rqnXt||r|SqWtddS(sSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.iNtgetDOMImplementationt PYTHON_DOMRs$no suitable DOM implementation found(tostNonetwell_known_implementationstgett __import__R Rtsystflagstignore_environmenttenviront isinstancet StringTypest_parse_feature_stringtvaluesR tkeyst StandardErrort ImportError(RR RtcreatortmodR((s&/usr/lib64/python2.7/xml/dom/domreg.pyR )s0     cCsg}|j}d}t|}x||kr||}|ddkr`td|fn|d}d}||kr||}|ddkr|d}|}qn|j||fq'Wt|S(Nit 0123456789sbad feature name: %ri(tsplittlent ValueErrorRtappendttuple(tsR tpartstitlengthtfeaturetversionR ((s&/usr/lib64/python2.7/xml/dom/domreg.pyRTs"        (( t__doc__txml.dom.minicompatRRRRR RR R(((s&/usr/lib64/python2.7/xml/dom/domreg.pyts    +PKi#][s#33dom/pulldom.pycnu[ {fc@sddlZddlZddlZyejejgZWnek rYejgZnXdZdZ dZ dZ dZ dZ dZd Zd ejjfd YZd dd YZdddYZdefdYZdZdddZddZdS(iNt START_ELEMENTt END_ELEMENTtCOMMENTtSTART_DOCUMENTt END_DOCUMENTtPROCESSING_INSTRUCTIONtIGNORABLE_WHITESPACEt CHARACTERStPullDOMcBseZdZdZddZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZRS(cCsddlm}||_ddg|_|j|_g|_|jj|_y|jj |_ Wnt k rrnXid|6g|_ |j d|_ g|_ dS(Ni(t XML_NAMESPACEtxml(txml.domR tdocumentFactorytNonet firstEventt lastEventt elementStacktappendtpushtpoptAttributeErrort _ns_contextst_current_contexttpending_events(tselfR R ((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt__init__s    cCs|jd}|jd=|S(Ni(R(Rtresult((s'/usr/lib64/python2.7/xml/dom/pulldom.pyR's  cCs ||_dS(N(t_locator(Rtlocator((s'/usr/lib64/python2.7/xml/dom/pulldom.pytsetDocumentLocator,scCsgt|dsg|_n|jj|p-d|f|jj|jj|pYd|j|((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt startElementvs  cCs3t|jfdg|jd<|jd|_dS(Ni(RRR R(RR3((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt endElementscCsm|jrG|jj|}t|fdg|jd<|jd|_n"t|fdg}|jj|dS(Ni(R)t createCommentRR RRR(RtsR:tevent((s'/usr/lib64/python2.7/xml/dom/pulldom.pytcomments  cCss|jrJ|jj||}t|fdg|jd<|jd|_n%t||fdg}|jj|dS(Ni(R)tcreateProcessingInstructionRR RRR(RttargettdataR:RE((s'/usr/lib64/python2.7/xml/dom/pulldom.pytprocessingInstructions  cCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)tcreateTextNodeRR R(RtcharsR:((s'/usr/lib64/python2.7/xml/dom/pulldom.pytignorableWhitespacescCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)RKRR R(RRLR:((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt charactersscCs7|jdkr3ddl}|jjjj|_ndS(Ni(R R txml.dom.minidomtdomtminidomtDocumenttimplementation(RR ((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt startDocuments c Cs8|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj ||}t|f|dtj||||jd}|jd}|j|dS(Nii(RRARRz(RR3R5RR((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRA/s  cCsBtj||||jdd}|jd}|j|dS(Niii(RRJRRRz(RRHRIR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRJ5s cCs?tj|||jdd}|jd}|j|dS(Niii(RRMRRRz(RRLR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRM;s cCs?tj|||jdd}|jd}|j|dS(Niii(RRNRRRz(RRLR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRNAs (R^R_R?RARJRMRN(((s'/usr/lib64/python2.7/xml/dom/pulldom.pyR's     iiicCsd|dkrt}nt|tkr6t|}n|}|sTtjj}nt|||S(N( R tdefault_bufsizettypet _StringTypestopenR Rot make_parserRe(tstream_or_stringRhRiRg((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRJs  cCsxyddlm}Wn!tk r7ddlm}nXt|}||}|shtjj}nt|||S(Ni(tStringIO(t cStringIORt ImportErrortlenR RoRRe(tstringRhRRiR((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt parseStringUs   ((i@i?(txml.saxR txml.sax.handlerttypest StringTypet UnicodeTypeRRRRRRRRRRRotContentHandlerRR`ReRRR RR(((s'/usr/lib64/python2.7/xml/dom/pulldom.pyts*    U! PKi#]' ' dom/minicompat.pynu["""Python version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. """ # This module should only be imported using "import *". # # The following names are defined: # # NodeList -- lightest possible NodeList implementation # # EmptyNodeList -- lightest possible NodeList that is guaranteed to # remain empty (immutable) # # StringTypes -- tuple of defined string types # # defproperty -- function used in conjunction with GetattrMagic; # using these together is needed to make them work # as efficiently as possible in both Python 2.2+ # and older versions. For example: # # class MyClass(GetattrMagic): # def _get_myattr(self): # return something # # defproperty(MyClass, "myattr", # "return some value") # # For Python 2.2 and newer, this will construct a # property object on the class, which avoids # needing to override __getattr__(). It will only # work for read-only attributes. # # For older versions of Python, inheriting from # GetattrMagic will use the traditional # __getattr__() hackery to achieve the same effect, # but less efficiently. # # defproperty() should be used for each version of # the relevant _get_() function. __all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"] import xml.dom StringTypes = (str,) class NodeList(list): __slots__ = () def item(self, index): if 0 <= index < len(self): return self[index] def _get_length(self): return len(self) def _set_length(self, value): raise xml.dom.NoModificationAllowedErr( "attempt to modify read-only attribute 'length'") length = property(_get_length, _set_length, doc="The number of nodes in the NodeList.") # For backward compatibility def __setstate__(self, state): if state is None: state = [] self[:] = state class EmptyNodeList(tuple): __slots__ = () def __add__(self, other): NL = NodeList() NL.extend(other) return NL def __radd__(self, other): NL = NodeList() NL.extend(other) return NL def item(self, index): return None def _get_length(self): return 0 def _set_length(self, value): raise xml.dom.NoModificationAllowedErr( "attempt to modify read-only attribute 'length'") length = property(_get_length, _set_length, doc="The number of nodes in the NodeList.") def defproperty(klass, name, doc): get = getattr(klass, ("_get_" + name)) def set(self, value, name=name): raise xml.dom.NoModificationAllowedErr( "attempt to modify read-only attribute " + repr(name)) assert not hasattr(klass, "_set_" + name), \ "expected not to find _set_" + name prop = property(get, set, doc=doc) setattr(klass, name, prop) PKi#]skEEdom/minidom.pycnu[ {fc@sdZddlZddlmZmZmZmZddlTddlm Z m Z ej j j ej j jfZdej j fdYZ ee dd d ee d d d ee d d ddZdZdZdZdZde fdYZde fdYZeedd deed d deedd ddefdYZeedd d eZd!efd"YZeeeZd#e fd$YZeed%d d&eed d d'd(Zd)fd*YZ d+e e fd,YZ!d-e e fd.YZ"ee"dd d/d0e"fd1YZ#ee#d2d d3ee#d4d d5d6Z$d7Z%d8e e"fd9YZ&d:e#fd;YZ'd<efd=YZ(ee(dd d>d?fd@YZ)dAe)e e fdBYZ*dCe)e fdDYZ+dEe)e e fdFYZ,dGe fdHYZ-dIefdJYZ.dKZ/dLe e fdMYZ0ee0dNd dOdPZ1dQZ2dRZ3dSZ4eedTZ5edUZ6edVZ7dS(WscSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces iN(tEMPTY_NAMESPACEt EMPTY_PREFIXtXMLNS_NAMESPACEtdomreg(t*(tDOMImplementationLSt DocumentLStNodecBseZdZdZdZdZdZeZ dZ ddZ ddddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZRS(cCstS(N(tTrue(tself((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __nonzero__*scCs|jdd|S(Nt(t toprettyxml(R tencoding((s'/usr/lib64/python2.7/xml/dom/minidom.pyttoxml-ss s cCst}|dk r=ddl}|j|d|}n|jtjkrk|j|d|||n|j|d|||jS(NiiR ( t _get_StringIOtNonetcodecstlookuptnodeTypeRt DOCUMENT_NODEtwritexmltgetvalue(R tindenttnewlR twriterR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR 0s   cCs|jr tStSdS(N(t childNodesRtFalse(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasChildNodes?s cCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_childNodesEscCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_firstChildHs cCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_lastChildLs cCsw|j|jkr@x't|jD]}|j||q"W|S|j|jkr}tjjdt |t |fn|j dk r|j j |n|dkr|j |ny|jj|}Wn tk rtjjnX|jtkrt|n|jj||||_||_|ra|j|d}||_||_n d|_||_ |S(Ns%s cannot be child of %si(RtDOCUMENT_FRAGMENT_NODEttupleRt insertBeforet_child_node_typestxmltdomtHierarchyRequestErrtreprt parentNodeRt removeChildt appendChildtindext ValueErrort NotFoundErrt_nodeTypes_with_childrent_clear_id_cachetinsertt nextSiblingtpreviousSibling(R tnewChildtrefChildtcR+tnode((s'/usr/lib64/python2.7/xml/dom/minidom.pyR"Ps6 "         cCs|j|jkr=x$t|jD]}|j|q"W|S|j|jkrztjjdt |t |fn|jt krt |n|j dk r|j j|nt||d|_|S(Ns%s cannot be child of %s(RR R!RR*R#R$R%R&R'R.R/R(RR)t _append_childR1(R R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*ps "   cCs|j|jkr8|j}|j||j||S|j|jkrutjjdt |t |fn||krdS|j dk r|j j|ny|j j |}Wn tk rtjjnX||j |<||_ d|_ |jtks|jtkr*t|n|j|_|j|_d|_d|_|jrl||j_n|jr||j_n|S(Ns%s cannot be child of %s(RR R1R)R"R#R$R%R&R'R(RRR+R,R-R.R/R2(R R3toldChildR4R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceChilds<   "            cCsy|jj|Wn tk r6tjjnX|jdk rX|j|j_n|jdk ry|j|j_nd|_|_|j t krt |nd|_ |S(N( RtremoveR,R$R%R-R1RR2RR.R/R((R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs*g}x|jD]}|jtjkr|jsr|rJ|j|d_n|jre|j|j_n|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_n|jq|j|q|j||jtj kr|j qqW||j(dS(Ni( RRRt TEXT_NODEtdataR1R2tunlinktappendt ELEMENT_NODEt normalize(R tLtchildR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@s*        cCst|||jp|S(N(t _clone_nodet ownerDocument(R tdeep((s'/usr/lib64/python2.7/xml/dom/minidom.pyt cloneNodescCs|jjj||S(N(RDtimplementationt hasFeature(R tfeaturetversion((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSupportedscCsdS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_localNamescCs ||kS(N((R tother((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSameNodescCs|j|dr|SdSdS(N(RKR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getInterfacescCs2y|j|dSWnttfk r-dSXdS(Ni(t _user_datatAttributeErrortKeyErrorR(R tkey((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getUserDatascCsd}y |j}Wn tk r5i}||_nX||krS||d}n|dkr~d}|dk r||=qn||f||<|S(Ni(RRPRQ(R RSR<thandlertoldtd((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setUserDatas       cCsdt|dr`xN|jjD]:\}\}}|dk r|j|||||qqWndS(NRP(thasattrRPtitemsRthandle(R t operationtsrctdstRSR<RU((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_call_user_data_handlers" cCs\d|_|_|jrFx|jD]}|jq#Wt|_nd|_d|_dS(N(RR(RDRR=tNodeListR2R1(R RB((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s  N(t__name__t __module__Rt namespaceURIR(RDR1R2RtprefixR RR RRRRR"R*R9R)R@RFRKRLRNRORTRXR_R=(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s6                t firstChildtdocsFirst child node, or None.t lastChildsLast child node, or None.t localNames"Namespace-local name of this node.cCsT|j}|r6|d}||jd<||jd(R R6Rtlast((s'/usr/lib64/python2.7/xml/dom/minidom.pyR7s    cCs6x/|dk r1|jtjkr%tS|j}qWtS(N(RRRRRR(R(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _in_documents  cCsP|rL|jddjddjddjdd}|j|nd S( sWrites datachars to writer.t&s&ts>N(treplacetwrite(RR<((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _write_data%scCsex^|jD]S}|jtjkrM|dks=|j|krM|j|nt|||q W|S(NR(RRRR?ttagNameR>t_get_elements_by_tagName_helper(tparenttnametrcR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs,s cCsx|jD]t}|jtjkr |dks=|j|krh|dksX|j|krh|j|nt||||q q W|S(NR(RRRR?RhRcR>t"_get_elements_by_tagName_ns_helper(RttnsURIRhRvR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRw4stDocumentFragmentcBsbeZejZdZdZdZdZ ej ej ej ej ejejejfZdZRS(s#document-fragmentcCst|_dS(N(R`R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__init__KsN(RaRbRR RtnodeNameRt nodeValuet attributesR(R?R;tCDATA_SECTION_NODEtENTITY_REFERENCE_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt NOTATION_NODER#Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRy=s  tAttrcBseZejZd Zd ZeZ eZ ej ej fZ ed d dZdZdZdZdZdZdZdZdZRS( cCsS|j}||d<|d<||d<||dtText(R tqNameRcRhRdRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzXs     cCs|jjdddS(Nt:ii(R{tsplit(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLfscCs|jS(N(t specified(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_specifiediscCs|j}|dkrk||d<|d<|jdj}||d<|d<|jdk rt|jqnJ|dkr||d<|d<|jdk rt|jqn |||R{R(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRZscCsFg}x9|jjD](}|j|j|jf|jfqW|S(N(RRR>RcRhR(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pytitemsNSs&cCs-t|tr||jkS||jkSdS(N(t isinstancet StringTypesRR(R RS((s'/usr/lib64/python2.7/xml/dom/minidom.pythas_keys cCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytkeysNSscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(Rtget(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs<|jt|ddkrdStt|t|SdS(NRi(RtgetattrRtcmptid(R RM((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__cmp__scCs)t|tr|j|S|j|SdS(N(RR!RR(R tattname_or_tuple((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __getitem__s cCst|trhy|j|}Wn9tk r[t|}|jj|_|j|nX||_n.t|tst dn|}|j|dS(Ns%value must be a string or Attr object( RRRRRRRRDt setNamedItemRt TypeError(R tattnameRR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __setitem__ s    cCs(y|j|SWntk r#dSXdS(N(RRRR(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getNamedItems cCs.y|j||fSWntk r)dSXdS(N(RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetNamedItemNS"s cCs|j|}|dk rnt|j|j|j=|j|j|jf=d|j krjd|j ds (RRu(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__repr__hs cCs|jS(N(Ru(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_namenscCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_namespaceqs(RRu(RaRbRRzRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRas    tElementcBsLeZejZdZeZdZ ejej ej ej ej ejfZedddZdZdZdZdZdZdZdZd Zd Zd ZeZd Zd ZdZeZ dZ!dZ"dZ#dZ$dZ%ddddZ&dZ'dZ(dZ)dZ*dZ+RS(icCsD||_|_||_||_t|_i|_i|_dS(N(RrR{RdRcR`RRR(R RrRcRdRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs     cCs|jjdddS(NRii(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_tagNamescCsGx!|jjD]}|jqWd|_d|_tj|dS(N(RRR=RRR(R tattr((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s   cCs+y|j|jSWntk r&dSXdS(NR (RRRR(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getAttributes cCs1y|j||fjSWntk r,dSXdS(NR (RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetAttributeNSs cCs|j|}|dkr_t|}|j}||d<|d<|j|d<|j|nC||jkr|j}||d<|d<|jrt|qndS(NRR|RD( tgetAttributeNodeRRRiRDtsetAttributeNodeRRR/(R RRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setAttributes      cCst|\}}|j||}|dkrt||||}|j}||d<||d<||d<|d<|j|d<|j|ni|j}||jkr||d<|d<|jrt |qn|j |kr||d<||d(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRsR c Cs[|j|d|j|j}|j}|jx@|D]8}|jd|t|||j|jdqAW|jrF|jdt|jdkr|jdj t j kr|jdj |dddnH|j|x+|jD] }|j |||||qW|j||jd|j|fn|jd |dS( NRms %s="s"RniiR s%ss/>%s( RpRrt_get_attributesRtsortRqRRRRRR;R( R RRt addindentRRta_namesta_nameR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs&         cCst|j|j|S(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR4scCs|jr tStSdS(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasAttributes7s cCs |j|}|j|dS(N(RtsetIdAttributeNode(R RutidAttr((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttribute?scCs#|j||}|j|dS(N(RR(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttributeNSCscCs|dks|j|j r1tjjnt|dk rUtjjn|jst |j d<|j d7_ |j j d7_ t|ndS(NRi(RRNRR$R%R-t_get_containing_entreftNoModificationAllowedErrRRRiRRDRR/(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRGs  N(,RaRbRR?RRR|RRRRRR;R~RR#RRzRLRR=RRRRRRRtsetAttributeNodeNSRRRtremoveAttributeNodeNSRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRvsL                         R}s*NamedNodeMap of attributes on the element.s%Namespace-local name of this element.cCsDt|||j|j<||j|j|jf<||jd%s(RpRR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs( RaRbRRRRzRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs       t CharacterDatacBsteZdZeZdZdZeZeZdZdZ dZ dZ dZ dZ d ZRS( cCs t|jS(N(RR<(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jdS(NR<(Ri(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|j}||d<|di(R<Rt __class__Ra(R R<t dotdotdot((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs~|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|j|||!S(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%t IndexSizeErrRR<(R toffsettcount((s'/usr/lib64/python2.7/xml/dom/minidom.pyt substringDatas  cCs|j||_dS(N(R<(R targ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt appendDatascCs||dkr!tjjdn|t|jkrKtjjdn|rxd|j| ||j|f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datas%s%s%s(R$R%RRR<(R RR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt insertDatas cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|r|j| |j|||_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%RRR<(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt deleteDatas  cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|rd|j| ||j||f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negatives%s%s%s(R$R%RRR<(R RRR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceDatas  (RaRbRRRRt_get_nodeValuet_set_nodeValueRRR R R R R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs      sLength of the string data.RcBsSeZejZdZdZdZddddZ dZ dZ dZ RS(s#textcCs|dks!|t|jkr6tjjdn|j}|j||_|j|_|j}|jr||jj kr|dkr|jj |q|jj ||n|j| |_|S(Nisillegal offset value( RR<R$R%RRRDR1R(RRR*R"(R RtnewTexttnext((s'/usr/lib64/python2.7/xml/dom/minidom.pyt splitTexts!    R cCs!t|d||j|fdS(Ns%s%s%s(RqR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR scCs|jg}|j}xK|dk rb|jtjtjfkr^|jd|j|j}qPqW|j}xH|dk r|jtjtjfkr|j |j|j}qoPqoWdj |S(NiR ( R<R2RRRR;R~R0R1R>tjoin(R RAR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_wholeTexts     cCs|j}|j}xK|dk r_|jtjtjfkr[|j}|j||}qPqW|j}|s|j|nxK|dk r|jtjtjfkr|j}|j||}qPqW|r|j }||d<||d<|SdSdS(NR<R|( R(R2RRRR;R~R)R1Ri(R tcontentRtRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pytreplaceWholeText$s.            cCs_|jjrtSt|}|dkr/tS|jj|}|dkrQtS|jSdS(N(R<tstripRt_get_containing_elementRRDRtisElementContent(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt!_get_isWhitespaceInElementContentBs   N( RaRbRR;RR{RR}RRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs    tisWhitespaceInElementContentsKTrue iff this text node contains only whitespace and is in element content.t wholeTexts.The text of all logically-adjacent text nodes.cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR?(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyRUs   cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR]s   tCommentcBs2eZejZdZdZddddZRS(s#commentcCs||_|_dS(N(R<R|(R R<((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzjsR cCs?d|jkrtdn|jd||j|fdS(Ns--s%'--' is not allowed in a comment nodes %s%s(R<R,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRms(RaRbRRRR{RzR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRfs  t CDATASectioncBs)eZejZdZddddZRS(s#cdata-sectionR cCs?|jjddkr'tdn|jd|jdS(Ns]]>is$']]>' not allowed in a CDATA sections(R<tfindR,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR|s(RaRbRR~RR{R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRss tReadOnlySequentialNamedNodeMapcBseZdZddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(t_seqcCs ||_dS(N(R"(R tseq((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs+x$|jD]}|j|kr |Sq WdS(N(R"R{(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs:x3|jD](}|j|kr |j|kr |Sq WdS(N(R"RcRh(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCsLt|tr!|j|}n|j|}|dkrHt|n|S(N(RR!RRRRR(R t name_or_tupleR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs8|dkrdSy|j|SWntk r3dSXdS(Ni(RR"R(R R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCs |jgS(N(R"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|d|_dS(Ni(R"(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(R"((RaRbRRzRRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s           s&Number of entries in the NamedNodeMap.t IdentifiedcBs)eZdZdZdZdZRS(s@Mix-in class that supports the publicId and systemId attributes.cCs||_||_dS(N(tpublicIdtsystemId(R R&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_identified_mixin_inits cCs|jS(N(R&(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_publicIdscCs|jS(N(R'(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_systemIds(RaRbRR(R)R*(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR%s  t DocumentTypecBs\eZejZdZdZdZdZ dZ dZ dZ dZ ddddZRS(cCsLt|_t|_|r<t|\}}||_n|j|_dS(N(R!tentitiest notationsRRuR{(R RRdR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs    cCs|jS(N(tinternalSubset(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_internalSubsetscCs\|jdkrTtd}|j|_|j|_tjjj}|r=g|j _ g|j _ xU|j j D]G}t |j|j |j}|j j j||j|||qmWx|j j D]q}t|j|j |j|j}|j|_|j|_|j|_|j j j||j|||qWn|j||||SdSdS(N(RDRR+RuR{R$R%tUserDataHandlert NODE_CLONEDR,R"R-tNotationR&R'R>R_tEntityt notationNametactualEncodingR RJ(R REtcloneR\Rtnotationtetentity((s'/usr/lib64/python2.7/xml/dom/minidom.pyRFs.         R cCs|jd|j|j|jrL|jd||j||jfn&|jrr|jd||jfn|jdk r|jd|j|j|jdn|jd|dS(Ns R*R"R)R9(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR3s        R2cBs eZejZdZdZRS(cCs||_|j||dS(N(R{R((R RuR&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyRz<s N(RaRbRRRRR|Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR28s tDOMImplementationc BsSeZd d ddddddgZdZdZdZd Zd ZRS(tcores1.0s2.0R$sls-loads3.0cCs.|dkrd}n|j|f|jkS(NR (Rtlowert _features(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRHLs  c CsK|r*|jdk r*tjjdn|j}|dkoW|dkoW|dk }| r}|r}tjjdn|rt|\}}|dkr|dkrtjjdn|r| rtjjdn|j ||}|r |j |n|j |n|r5||_|_ n||_ ||_ |S(Ns(doctype object owned by another DOM treesElement with no nameR$s$http://www.w3.org/XML/1998/namespacesillegal use of 'xml' prefixs(illegal use of prefix without namespaces(R(RR$R%tWrongDocumentErrt_create_documenttInvalidCharacterErrRRtcreateElementNSR*RDtdoctypeRG( R RcRRHRftadd_root_elementRdRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentQs4              cCs"t|}||_||_|S(N(R+R&R'(R RR&R'RH((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentType~s   cCs|j|dr|SdSdS(N(RHR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyROscCstS(N(tDocument(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyREs(RAs1.0(RAs2.0N(RAN(R$s1.0(R$s2.0(R$N(sls-loads3.0(sls-loadN( RaRbRRCRHRJRKRORE(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@As   -  t ElementInfocBseeZdZd ZdZdZdZdZdZdZ dZ d Z d Z RS( sObject that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. RrcCs ||_dS(N(Rr(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCstS(N(R(R taname((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(sQReturns true iff this element is declared to have an EMPTY content model.(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytisEmptyscCstS(s7Returns true iff the named attribute is a DTD-style ID.(R(R RN((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(s<Returns true iff the identified attribute is a DTD-style ID.(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs ||_dS(N(Rr(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(Rr( RaRbRRRzRRRRORRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRMs        cCsZ|jtjkr+|jjd|_n+t|rV|jjjd|j_ndS(N( RRRt _id_cachetclearRt_id_search_stackRkRD(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR/s    RLcBseZejejejejfZejZ dZ d$Z d$Z d$Zd$Zd$ZZeZd$Zd$Zd$Zd$ZeZd$Zd$ZdZdZdZdZdZ dZ!dZ"dZ#d Z$d Z%d Z&d Z'd Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:d Z;d!d!d!d$d"Z<d#Z=RS(%s #documenticCs+t|_i|_i|_d|_dS(N(R`Rt _elem_infoRPRRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs   cCs7|jr|j|jf}n |j}|jj|S(N(RcRhRrRSR(R RRS((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  cCs|jS(N(R5(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR<scCs|jS(N(RH(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_doctypescCs|jS(N(t documentURI(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_documentURIscCs|jS(N(R (R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=scCs|jS(N(t errorHandler(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_errorHandlerscCs|jS(N(t standalone(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_standalonescCs|jS(N(tstrictErrorChecking(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_strictErrorCheckingscCs|jS(N(RJ(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR>scCs|j|jkr=tjjdt|t|fn|jdk r_|jj|n|jt j kr|j rtjjdnt j ||S(Ns%s cannot be child of %ss two document elements disallowed( RR#R$R%R&R'R(RR)RR?t_get_documentElementR*(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*s "   cCsoy|jj|Wn tk r6tjjnXd|_|_d|_ |j |krkd|_ n|S(N( RR:R,R$R%R-RR1R2R(tdocumentElement(R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs.x'|jD]}|jtjkr |Sq WdS(N(RRRR?(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR]scCs9|jdk r(|jjd|_ntj|dS(N(RHRR=R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=$s  cCs|s dS|jjddd}|j|_|j|_|j|_x|jD]}t|||}|jj |st |jj ||j t jkr|jdkst n3|j t jkr|jdkst ||_n||_qPW|jtjjj|||S(N(RRGRJR RYRJRRCRDRNtAssertionErrorR>RRRR^R;RHR(R_R$R%R0R1(R RER6Rt childclone((s'/usr/lib64/python2.7/xml/dom/minidom.pyRF*s&      cCst}||_|S(N(RyRD(R RW((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentFragment?s  cCst|}||_|S(N(RRD(R RrR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createElementDs  cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<tt((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateTextNodeIs     cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateCDATASectionQs     cCst|}||_|S(N(RRD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createCommentYs  cCst||}||_|S(N(RRD(R RR<tp((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateProcessingInstruction^s cCs"t|}||_d|_|S(NR (RRDR(R Rta((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributecs   cCs1t|\}}t|||}||_|S(N(RRRD(R RcRRdRhR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyRGis cCs=t|\}}t||||}||_d|_|S(NR (RRRDR(R RcRRdRhRi((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributeNSos   cCs"t||||}||_|S(N(R3RD(R RuR&R'R4R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_entityys cCst|||}||_|S(N(R2RD(R RuR&R'R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_notation~s cCsE||jkr|j|S|jp)|js0dS|j}|dkr]|jg}||_n |sgdSd}x|r@|j}|jg|jD]}|j t kr|^q|j |}|rxa|j j D]}|jr;|j|j|jr||j|j<|j|kr(|}q8|js8Pq8qq|j|jr||j|j<|j|kru|}q|jsPqq|jr||j|j<|j|kr|}q|jdkrPqqqWnZ|jr-xN|j j D]:}|jr||j|j<|j|kr&|}q&qqWn|dk rpPqpqpW|S(Ni(RPRSRRRRR^tpoptextendRRR.RR}RRcRRhRRRRuR(R RtstacktresultR6RBRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetElementByIds\                  cCst||tS(N(RsR`(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCst|||tS(N(RwR`(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(RGRH(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRKscCs^|jtjkr'tjjdn'|jtjkrNtjjdnt|||S(Nscannot import document nodess!cannot import document type nodes(RRRR$R%tNotSupportedErrR;RC(R R6RE((s'/usr/lib64/python2.7/xml/dom/minidom.pyt importNodes R cCse|dkr |jd|n|jd||fx'|jD]}|j||||qAWdS(Nss%%s(RRpRR(R RRRRR R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  c Cs|j|k r1tjjd||jfn|jtjtjfkratjjdn|t krd|kr|j dd\}}|dkr|tjj krtjj dqq'|dkr |tjj kr |jtjkr tjj dnd}|}n d}d}|jtjkrj|j}|dk rp|j}|j|qpnd}|j}||d<||d <||d <||d <|jtjkr||d RaRbRR?RRR;R#RRR{RR|R}RHR(R2R1R@RGR5R RYRJRR[RWRURRzRR<RTRVR=RXRZR\R>R*R)R]R=RFRaRbRdReRfRhRjRGRkRlRmRrRRRKRtRRv(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLsh                             :      R^s#Top-level element of this document.c Cs|jj|r$tjjj}ntjjj}|jtj kr|j |j |j }xW|j jD]F}|j|j |j |j|j|j |j}|j|_qmW|rx3|jD]%}t|||}|j|qWqn|jtjkrS|j}|rx3|jD]%}t|||}|j|q$Wqn|jtjkrz|j|j}nm|jtjkr|j|j}nF|jtjkr|j|j |j}n|jtj!kr|j"|j}n|jtj#kr7|j$|j |j }t%|_|j|_n|jtj&kr|j|k s^t'tjjj}|j(j)|j*|j+|j,}||_|rg|j-_.g|j/_.xp|j/j.D]b} t0| j | j+| j,} || _|j/j.j1| t2| dr| j3|| | qqWx|j-j.D]} t4| j | j+| j,| j5} | j6| _6| j7| _7| j8| _8|| _|j-j.j1| t2| dr5| j3|| | q5q5Wqntjj9dt:|t2|dr |j3|||n|S(so Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode R_sCannot clone node %s(;RDRNR$R%R0R1t NODE_IMPORTEDRRR?RGRcR{R}RRRRRhRRRCR*R RaR;RdR<R~ReRRhRRRfRRkRR;R_RGRKRuR&R'R,R"R-R2R>RYR_R3R4R5R RJRsR'( R6REtnewOwnerDocumentR\R6RRiRBR5RR7R8R9((s'/usr/lib64/python2.7/xml/dom/minidom.pyRCs~                  cCs:|jdd}t|dkr(|Sd|dfSdS(NRiii(RRR(Rtfields((s'/usr/lib64/python2.7/xml/dom/minidom.pyRfscCsddlm}|S(Ni(tStringIO(Rz(Rz((s'/usr/lib64/python2.7/xml/dom/minidom.pyRnscCs<|||}|j\}}|j||j|S(N(tgetEventt expandNodeRQ(tfunctargstkwargsteventsttoktypetrootNode((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_do_pulldom_parsess   cCsh|dkr0| r0ddlm}|j|Sddlm}t|j|fi|d6|d6SdS(s3Parse a file into a DOM by filename or file object.i(t expatbuilder(tpulldomtparsertbufsizeN(Rtxml.domRtparseRR(tfileRRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs  cCsZ|dkr)ddlm}|j|Sddlm}t|j|fi|d6SdS(s&Parse a file into a DOM from a string.i(R(RRN(RRRt parseStringRR(tstringRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCsa|rZt|tr'tj|}nx0|D]%\}}tjj||s.dSq.WntjS(N(RRRt_parse_feature_stringRLRGRHR(tfeaturestftv((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetDOMImplementations (8RRR$RRRRtxml.dom.minicompattxml.dom.xmlbuilderRRR%RR?RR.t defpropertyR7RkRqRsRwRyRtobjectRt AttributeListRRRRRRRRRRRRRR!R%R+R3R2R@RMR/RLRCRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyts "      r    (GZ     > <( O* O  R    PKi#]Sp ;;dom/xmlbuilder.pycnu[ {fc@sdZddlZddlZddlmZdddgZdddYZddd YZd Z de fd YZ de fd YZ d ddYZ [dddYZdddYZdS(s4Implementation of the DOM Level 3 'LS-Load' feature.iN(t NodeFiltert DOMBuildertDOMEntityResolvertDOMInputSourcetOptionscBseZdZdZeZeZeZeZ eZ eZ eZ eZ eZeZeZeZeZeZeZeZdZdZRS(sFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. iN(t__name__t __module__t__doc__t namespacestTruetnamespace_declarationstFalset validationtexternal_parameter_entitiestexternal_general_entitiestexternal_dtd_subsettvalidate_if_schematvalidatetdatatype_normalizationtcreate_entity_ref_nodestentitiestwhitespace_in_element_contenttcdata_sectionstcommentstcharset_overrides_xml_encodingtinfosettsupported_mediatypes_onlytNonet errorHandlertfilter(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR s(c BseZd#Zd#Zd#ZdZdZdZdZ eeee fZ dZ dZ dZ dZdZd Zd Zd Zd Zd Zid$gd%6d&gd'6d(gd)6d*gd+6d,gd-6d.gd/6d0gd16d2gd36d4gd56d6gd76d8d9gd:6d;gd<6d=gd>6d?gd@6dAgdB6dCgdD6dEgdF6dGgdH6dIgdJ6dKgdL6gdM6dNdOdPdQdRdSdTdUdVg dW6dXgdY6dZgd[6d\gd]6ZdZdZd Zd!Zd"ZRS(^iiiicCst|_dS(N(Rt_options(tself((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt__init__9scCs|jS(N(tentityResolver(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_entityResolver<scCs ||_dS(N(R!(RR!((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_entityResolver>scCs|jS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_errorHandlerAscCs ||_dS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_errorHandlerCscCs|jS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_filterFscCs ||_dS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_filterHscCs|j|r|rdpd}y|jt||f}Wn*tk rjtjjd|fqXxF|D]\}}t|j||qrWntjj dt |dS(Niisunsupported feature: %rsunknown feature: ( tsupportsFeaturet _settingst _name_xformtKeyErrortxmltdomtNotSupportedErrtsetattrRt NotFoundErrtrepr(Rtnametstatetsettingstvalue((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt setFeatureKs  cCst|jt|S(N(thasattrRR*(RR2((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR(YscCs+t||rdpdf}||jkS(Nii(R*R)(RR2R3tkey((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt canSetFeature\sR iR RR RRRRRRRRRRRcCst|}yt|j|SWntk r|dkr|j}|jo|jo|jo|jo|jp|j p|j p|j p|j St jjdt|nXdS(NRsfeature %s not known(R*tgetattrRtAttributeErrorRRRRR RRRRR,R-R0R1(RR2txnametoptions((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt getFeatures             cCsC|jr!|jjd|}ntjd|}|j|S(N(R!t resolveEntityRRtparse(Rturitinput((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytparseURIs cCsytj|j}|j|_|j|_|j}|dkri|jriddl}|j|j}n|j ||S(Ni( tcopyRRRt byteStreamRtsystemIdturllib2turlopent_parse_bytestream(RRBR=tfpRG((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR@s    cCs.||jkrtdntddS(Nsnot a legal actionsHaven't written this yet...(t_legal_actionst ValueErrortNotImplementedError(RRBtcnodetaction((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytparseWithContextscCs.ddl}|jjj|}|j|S(Ni(txml.dom.expatbuilderR-t expatbuildert makeBuildert parseFile(RtstreamR=R,tbuilder((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRIs N(R i(R i(R i(R i(R i(R i(Ri(Ri(Ri(Ri(R i(R i(R i(R i(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(R i(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(RRRR!RRtACTION_REPLACEtACTION_APPEND_AS_CHILDRENtACTION_INSERT_AFTERtACTION_INSERT_BEFORERKR R"R#R$R%R&R'R6R(R9R)R>RCR@RPRI(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR,sv                                      cCs|jjddS(Nt-t_(tlowertreplace(R2((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR*scBs2eZdZdZdZdZdZRS(t_openerc Cs|dk stt}||_||_|jj||_|j||_ ddl }ddl }|j |}|\}}} } } } | r| j d r|j | d} ||| | | | f}|j||_n|S(Nit/(RtAssertionErrorRtpublicIdRFt _get_openertopenREt_guess_media_encodingtencodingt posixpathturlparsetendswithtdirnamet urlunparsetbaseURI( RRbRFtsourceRgRhtpartstschemetnetloctpathtparamstquerytfragment((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR?s   cCs6y |jSWn$tk r1|j|_|jSXdS(N(R_R;t_create_opener(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRcs   cCsddl}|jS(Ni(RGt build_opener(RRG((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRus cCsb|jj}d|kr^x@|jD]/}|jdr(|jdddjSq(WndS(Ns Content-Typescharset=t=i(REtinfotgetplistt startswithtsplitR](RRmRxtparam((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRes  (R_(RRt __slots__R?RcRuRe(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRs    cBseZdZdZdZd Zd Zd Zd Zd Z dZ dZ dZ dZ dZdZdZdZRS(REtcharacterStreamt stringDataRfRbRFRlcCsCd|_d|_d|_d|_d|_d|_d|_dS(N(RRER~RRfRbRFRl(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR s      cCs|jS(N(RE(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_byteStream scCs ||_dS(N(RE(RRE((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_byteStreamscCs|jS(N(R~(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_characterStreamscCs ||_dS(N(R~(RR~((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_characterStreamscCs|jS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_stringDatascCs ||_dS(N(R(Rtdata((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_stringDatascCs|jS(N(Rf(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_encodingscCs ||_dS(N(Rf(RRf((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_encodingscCs|jS(N(Rb(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_publicId!scCs ||_dS(N(Rb(RRb((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_publicId#scCs|jS(N(RF(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_systemId&scCs ||_dS(N(RF(RRF((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_systemId(scCs|jS(N(Rl(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_baseURI+scCs ||_dS(N(Rl(RRA((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_baseURI-s(RER~RRfRbRFRl(RRR}R RRRRRRRRRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRs"             tDOMBuilderFiltercBsJeZdZdZdZdZdZejZ dZ dZ dZ RS(sSElement filter which can be used to tailor construction of a DOM instance. iiiicCs|jS(N(t whatToShow(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_whatToShowBscCs|jS(N(t FILTER_ACCEPT(Rtelement((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt acceptNodeEscCs|jS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytstartContainerHs( RRRRt FILTER_REJECTt FILTER_SKIPtFILTER_INTERRUPTRtSHOW_ALLRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR1s   t DocumentLScBsJeZdZeZdZdZdZdZdZ dZ RS(s=Mixin to create documents that conform to the load/save spec.cCstS(N(R (R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_asyncSscCs|rtjjdndS(Ns.asynchronous document loading is not supported(R,R-R.(Rtasync((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_asyncUs cCstddS(Ns'haven't figured out what this means yet(RM(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytabortZscCstddS(Nshaven't written this yet(RM(RRA((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytload`scCstddS(Nshaven't written this yet(RM(RRm((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytloadXMLcscCs@|dkr|}n!|j|k r6tjjn|jS(N(Rt ownerDocumentR,R-tWrongDocumentErrttoxml(Rtsnode((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytsaveXMLfs   ( RRRR RRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRNs     tDOMImplementationLScBs/eZdZdZdZdZdZRS(iicCsk|dk r!tjjdn||jkr7tS||jkr[tjjdntddS(NsschemaType not yet supporteds'asynchronous builders are not supportedsunknown value for mode(RR,R-R.tMODE_SYNCHRONOUSRtMODE_ASYNCHRONOUSRL(Rtmodet schemaType((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMBuilderrs     cCstddS(Ns-the writer interface hasn't been written yet!(RM(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMWriter}scCstS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMInputSources(RRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRns  ((((((RRDtxml.domR,txml.dom.NodeFilterRt__all__RRR*tobjectRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyts    ,1 PKi#]"idom/minidom.pyonu[ {fc@sdZddlZddlmZmZmZmZddlTddlm Z m Z ej j j ej j jfZdej j fdYZ ee dd d ee d d d ee d d ddZdZdZdZdZde fdYZde fdYZeedd deed d deedd ddefdYZeedd d eZd!efd"YZeeeZd#e fd$YZeed%d d&eed d d'd(Zd)fd*YZ d+e e fd,YZ!d-e e fd.YZ"ee"dd d/d0e"fd1YZ#ee#d2d d3ee#d4d d5d6Z$d7Z%d8e e"fd9YZ&d:e#fd;YZ'd<efd=YZ(ee(dd d>d?fd@YZ)dAe)e e fdBYZ*dCe)e fdDYZ+dEe)e e fdFYZ,dGe fdHYZ-dIefdJYZ.dKZ/dLe e fdMYZ0ee0dNd dOdPZ1dQZ2dRZ3dSZ4eedTZ5edUZ6edVZ7dS(WscSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces iN(tEMPTY_NAMESPACEt EMPTY_PREFIXtXMLNS_NAMESPACEtdomreg(t*(tDOMImplementationLSt DocumentLStNodecBseZdZdZdZdZdZeZ dZ ddZ ddddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZRS(cCstS(N(tTrue(tself((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __nonzero__*scCs|jdd|S(Nt(t toprettyxml(R tencoding((s'/usr/lib64/python2.7/xml/dom/minidom.pyttoxml-ss s cCst}|dk r=ddl}|j|d|}n|jtjkrk|j|d|||n|j|d|||jS(NiiR ( t _get_StringIOtNonetcodecstlookuptnodeTypeRt DOCUMENT_NODEtwritexmltgetvalue(R tindenttnewlR twriterR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR 0s   cCs|jr tStSdS(N(t childNodesRtFalse(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasChildNodes?s cCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_childNodesEscCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_firstChildHs cCs|jr|jdSdS(Ni(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_lastChildLs cCsw|j|jkr@x't|jD]}|j||q"W|S|j|jkr}tjjdt |t |fn|j dk r|j j |n|dkr|j |ny|jj|}Wn tk rtjjnX|jtkrt|n|jj||||_||_|ra|j|d}||_||_n d|_||_ |S(Ns%s cannot be child of %si(RtDOCUMENT_FRAGMENT_NODEttupleRt insertBeforet_child_node_typestxmltdomtHierarchyRequestErrtreprt parentNodeRt removeChildt appendChildtindext ValueErrort NotFoundErrt_nodeTypes_with_childrent_clear_id_cachetinsertt nextSiblingtpreviousSibling(R tnewChildtrefChildtcR+tnode((s'/usr/lib64/python2.7/xml/dom/minidom.pyR"Ps6 "         cCs|j|jkr=x$t|jD]}|j|q"W|S|j|jkrztjjdt |t |fn|jt krt |n|j dk r|j j|nt||d|_|S(Ns%s cannot be child of %s(RR R!RR*R#R$R%R&R'R.R/R(RR)t _append_childR1(R R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*ps "   cCs|j|jkr8|j}|j||j||S|j|jkrutjjdt |t |fn||krdS|j dk r|j j|ny|j j |}Wn tk rtjjnX||j |<||_ d|_ |jtks|jtkr*t|n|j|_|j|_d|_d|_|jrl||j_n|jr||j_n|S(Ns%s cannot be child of %s(RR R1R)R"R#R$R%R&R'R(RRR+R,R-R.R/R2(R R3toldChildR4R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceChilds<   "            cCsy|jj|Wn tk r6tjjnX|jdk rX|j|j_n|jdk ry|j|j_nd|_|_|j t krt |nd|_ |S(N( RtremoveR,R$R%R-R1RR2RR.R/R((R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs*g}x|jD]}|jtjkr|jsr|rJ|j|d_n|jre|j|j_n|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_n|jq|j|q|j||jtj kr|j qqW||j(dS(Ni( RRRt TEXT_NODEtdataR1R2tunlinktappendt ELEMENT_NODEt normalize(R tLtchildR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@s*        cCst|||jp|S(N(t _clone_nodet ownerDocument(R tdeep((s'/usr/lib64/python2.7/xml/dom/minidom.pyt cloneNodescCs|jjj||S(N(RDtimplementationt hasFeature(R tfeaturetversion((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSupportedscCsdS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_localNamescCs ||kS(N((R tother((s'/usr/lib64/python2.7/xml/dom/minidom.pyt isSameNodescCs|j|dr|SdSdS(N(RKR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getInterfacescCs2y|j|dSWnttfk r-dSXdS(Ni(t _user_datatAttributeErrortKeyErrorR(R tkey((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getUserDatascCsd}y |j}Wn tk r5i}||_nX||krS||d}n|dkr~d}|dk r||=qn||f||<|S(Ni(RRPRQ(R RSR<thandlertoldtd((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setUserDatas       cCsdt|dr`xN|jjD]:\}\}}|dk r|j|||||qqWndS(NRP(thasattrRPtitemsRthandle(R t operationtsrctdstRSR<RU((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_call_user_data_handlers" cCs\d|_|_|jrFx|jD]}|jq#Wt|_nd|_d|_dS(N(RR(RDRR=tNodeListR2R1(R RB((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s  N(t__name__t __module__Rt namespaceURIR(RDR1R2RtprefixR RR RRRRR"R*R9R)R@RFRKRLRNRORTRXR_R=(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s6                t firstChildtdocsFirst child node, or None.t lastChildsLast child node, or None.t localNames"Namespace-local name of this node.cCsT|j}|r6|d}||jd<||jd(R R6Rtlast((s'/usr/lib64/python2.7/xml/dom/minidom.pyR7s    cCs6x/|dk r1|jtjkr%tS|j}qWtS(N(RRRRRR(R(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _in_documents  cCsP|rL|jddjddjddjdd}|j|nd S( sWrites datachars to writer.t&s&ts>N(treplacetwrite(RR<((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _write_data%scCsex^|jD]S}|jtjkrM|dks=|j|krM|j|nt|||q W|S(NR(RRRR?ttagNameR>t_get_elements_by_tagName_helper(tparenttnametrcR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs,s cCsx|jD]t}|jtjkr |dks=|j|krh|dksX|j|krh|j|nt||||q q W|S(NR(RRRR?RhRcR>t"_get_elements_by_tagName_ns_helper(RttnsURIRhRvR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRw4stDocumentFragmentcBsbeZejZdZdZdZdZ ej ej ej ej ejejejfZdZRS(s#document-fragmentcCst|_dS(N(R`R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__init__KsN(RaRbRR RtnodeNameRt nodeValuet attributesR(R?R;tCDATA_SECTION_NODEtENTITY_REFERENCE_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt NOTATION_NODER#Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRy=s  tAttrcBseZejZd Zd ZeZ eZ ej ej fZ ed d dZdZdZdZdZdZdZdZdZRS( cCsS|j}||d<|d<||d<||dtText(R tqNameRcRhRdRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzXs     cCs|jjdddS(Nt:ii(R{tsplit(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLfscCs|jS(N(t specified(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_specifiediscCs|j}|dkrk||d<|d<|jdj}||d<|d<|jdk rt|jqnJ|dkr||d<|d<|jdk rt|jqn |||R{R(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRZscCsFg}x9|jjD](}|j|j|jf|jfqW|S(N(RRR>RcRhR(R RAR6((s'/usr/lib64/python2.7/xml/dom/minidom.pytitemsNSs&cCs-t|tr||jkS||jkSdS(N(t isinstancet StringTypesRR(R RS((s'/usr/lib64/python2.7/xml/dom/minidom.pythas_keys cCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytkeysNSscCs |jjS(N(RR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(Rtget(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs<|jt|ddkrdStt|t|SdS(NRi(RtgetattrRtcmptid(R RM((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__cmp__scCs)t|tr|j|S|j|SdS(N(RR!RR(R tattname_or_tuple((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __getitem__s cCst|trhy|j|}Wn9tk r[t|}|jj|_|j|nX||_n.t|tst dn|}|j|dS(Ns%value must be a string or Attr object( RRRRRRRRDt setNamedItemRt TypeError(R tattnameRR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyt __setitem__ s    cCs(y|j|SWntk r#dSXdS(N(RRRR(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getNamedItems cCs.y|j||fSWntk r)dSXdS(N(RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetNamedItemNS"s cCs|j|}|dk rnt|j|j|j=|j|j|jf=d|j krjd|j ds (RRu(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt__repr__hs cCs|jS(N(Ru(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_namenscCs|jS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_namespaceqs(RRu(RaRbRRzRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRas    tElementcBsLeZejZdZeZdZ ejej ej ej ej ejfZedddZdZdZdZdZdZdZdZd Zd Zd ZeZd Zd ZdZeZ dZ!dZ"dZ#dZ$dZ%ddddZ&dZ'dZ(dZ)dZ*dZ+RS(icCsD||_|_||_||_t|_i|_i|_dS(N(RrR{RdRcR`RRR(R RrRcRdRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs     cCs|jjdddS(NRii(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_tagNamescCsGx!|jjD]}|jqWd|_d|_tj|dS(N(RRR=RRR(R tattr((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=s   cCs+y|j|jSWntk r&dSXdS(NR (RRRR(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt getAttributes cCs1y|j||fjSWntk r,dSXdS(NR (RRRR(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetAttributeNSs cCs|j|}|dkr_t|}|j}||d<|d<|j|d<|j|nC||jkr|j}||d<|d<|jrt|qndS(NRR|RD( tgetAttributeNodeRRRiRDtsetAttributeNodeRRR/(R RRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pyt setAttributes      cCst|\}}|j||}|dkrt||||}|j}||d<||d<||d<|d<|j|d<|j|ni|j}||jkr||d<|d<|jrt |qn|j |kr||d<||d(RrR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRsR c Cs[|j|d|j|j}|j}|jx@|D]8}|jd|t|||j|jdqAW|jrF|jdt|jdkr|jdj t j kr|jdj |dddnH|j|x+|jD] }|j |||||qW|j||jd|j|fn|jd |dS( NRms %s="s"RniiR s%ss/>%s( RpRrt_get_attributesRtsortRqRRRRRR;R( R RRt addindentRRta_namesta_nameR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs&         cCst|j|j|S(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR4scCs|jr tStSdS(N(RRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt hasAttributes7s cCs |j|}|j|dS(N(RtsetIdAttributeNode(R RutidAttr((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttribute?scCs#|j||}|j|dS(N(RR(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pytsetIdAttributeNSCscCs|dks|j|j r1tjjnt|dk rUtjjn|jst |j d<|j d7_ |j j d7_ t|ndS(NRi(RRNRR$R%R-t_get_containing_entreftNoModificationAllowedErrRRRiRRDRR/(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRGs  N(,RaRbRR?RRR|RRRRRR;R~RR#RRzRLRR=RRRRRRRtsetAttributeNodeNSRRRtremoveAttributeNodeNSRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRvsL                         R}s*NamedNodeMap of attributes on the element.s%Namespace-local name of this element.cCsDt|||j|j<||j|j|jf<||jd%s(RpRR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs( RaRbRRRRzRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs       t CharacterDatacBsteZdZeZdZdZeZeZdZdZ dZ dZ dZ dZ d ZRS( cCs t|jS(N(RR<(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs |jdS(NR<(Ri(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|j}||d<|di(R<Rt __class__Ra(R R<t dotdotdot((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs~|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|j|||!S(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%t IndexSizeErrRR<(R toffsettcount((s'/usr/lib64/python2.7/xml/dom/minidom.pyt substringDatas  cCs|j||_dS(N(R<(R targ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt appendDatascCs||dkr!tjjdn|t|jkrKtjjdn|rxd|j| ||j|f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datas%s%s%s(R$R%RRR<(R RR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt insertDatas cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|r|j| |j|||_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negative(R$R%RRR<(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt deleteDatas  cCs|dkr!tjjdn|t|jkrKtjjdn|dkrltjjdn|rd|j| ||j||f|_ndS(Nisoffset cannot be negatives#offset cannot be beyond end of datascount cannot be negatives%s%s%s(R$R%RRR<(R RRR ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt replaceDatas  (RaRbRRRRt_get_nodeValuet_set_nodeValueRRR R R R R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs      sLength of the string data.RcBsSeZejZdZdZdZddddZ dZ dZ dZ RS(s#textcCs|dks!|t|jkr6tjjdn|j}|j||_|j|_|j}|jr||jj kr|dkr|jj |q|jj ||n|j| |_|S(Nisillegal offset value( RR<R$R%RRRDR1R(RRR*R"(R RtnewTexttnext((s'/usr/lib64/python2.7/xml/dom/minidom.pyt splitTexts!    R cCs!t|d||j|fdS(Ns%s%s%s(RqR<(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR scCs|jg}|j}xK|dk rb|jtjtjfkr^|jd|j|j}qPqW|j}xH|dk r|jtjtjfkr|j |j|j}qoPqoWdj |S(NiR ( R<R2RRRR;R~R0R1R>tjoin(R RAR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_wholeTexts     cCs|j}|j}xK|dk r_|jtjtjfkr[|j}|j||}qPqW|j}|s|j|nxK|dk r|jtjtjfkr|j}|j||}qPqW|r|j }||d<||d<|SdSdS(NR<R|( R(R2RRRR;R~R)R1Ri(R tcontentRtRRRW((s'/usr/lib64/python2.7/xml/dom/minidom.pytreplaceWholeText$s.            cCs_|jjrtSt|}|dkr/tS|jj|}|dkrQtS|jSdS(N(R<tstripRt_get_containing_elementRRDRtisElementContent(R RR((s'/usr/lib64/python2.7/xml/dom/minidom.pyt!_get_isWhitespaceInElementContentBs   N( RaRbRR;RR{RR}RRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs    tisWhitespaceInElementContentsKTrue iff this text node contains only whitespace and is in element content.t wholeTexts.The text of all logically-adjacent text nodes.cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR?(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyRUs   cCs?|j}x/|dk r:|jtjkr.|S|j}q WdS(N(R(RRRR(R6R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyR]s   tCommentcBs2eZejZdZdZddddZRS(s#commentcCs||_|_dS(N(R<R|(R R<((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzjsR cCs?d|jkrtdn|jd||j|fdS(Ns--s%'--' is not allowed in a comment nodes %s%s(R<R,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRms(RaRbRRRR{RzR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRfs  t CDATASectioncBs)eZejZdZddddZRS(s#cdata-sectionR cCs?|jjddkr'tdn|jd|jdS(Ns]]>is$']]>' not allowed in a CDATA sections(R<tfindR,Rp(R RRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyR|s(RaRbRR~RR{R(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRss tReadOnlySequentialNamedNodeMapcBseZdZddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(t_seqcCs ||_dS(N(R"(R tseq((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs t|jS(N(RR"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs+x$|jD]}|j|kr |Sq WdS(N(R"R{(R RuR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs:x3|jD](}|j|kr |j|kr |Sq WdS(N(R"RcRh(R RcRhR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCsLt|tr!|j|}n|j|}|dkrHt|n|S(N(RR!RRRRR(R t name_or_tupleR6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCs8|dkrdSy|j|SWntk r3dSXdS(Ni(RR"R(R R+((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCstjjddS(Ns"NamedNodeMap instance is read-only(R$R%R(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs cCs |jgS(N(R"(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|d|_dS(Ni(R"(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(R"((RaRbRRzRRRRRRRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR!s           s&Number of entries in the NamedNodeMap.t IdentifiedcBs)eZdZdZdZdZRS(s@Mix-in class that supports the publicId and systemId attributes.cCs||_||_dS(N(tpublicIdtsystemId(R R&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_identified_mixin_inits cCs|jS(N(R&(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_publicIdscCs|jS(N(R'(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_systemIds(RaRbRR(R)R*(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR%s  t DocumentTypecBs\eZejZdZdZdZdZ dZ dZ dZ dZ ddddZRS(cCsLt|_t|_|r<t|\}}||_n|j|_dS(N(R!tentitiest notationsRRuR{(R RRdR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs    cCs|jS(N(tinternalSubset(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_internalSubsetscCs\|jdkrTtd}|j|_|j|_tjjj}|r=g|j _ g|j _ xU|j j D]G}t |j|j |j}|j j j||j|||qmWx|j j D]q}t|j|j |j|j}|j|_|j|_|j|_|j j j||j|||qWn|j||||SdSdS(N(RDRR+RuR{R$R%tUserDataHandlert NODE_CLONEDR,R"R-tNotationR&R'R>R_tEntityt notationNametactualEncodingR RJ(R REtcloneR\Rtnotationtetentity((s'/usr/lib64/python2.7/xml/dom/minidom.pyRFs.         R cCs|jd|j|j|jrL|jd||j||jfn&|jrr|jd||jfn|jdk r|jd|j|j|jdn|jd|dS(Ns R*R"R)R9(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR3s        R2cBs eZejZdZdZRS(cCs||_|j||dS(N(R{R((R RuR&R'((s'/usr/lib64/python2.7/xml/dom/minidom.pyRz<s N(RaRbRRRRR|Rz(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR28s tDOMImplementationc BsSeZd d ddddddgZdZdZdZd Zd ZRS(tcores1.0s2.0R$sls-loads3.0cCs.|dkrd}n|j|f|jkS(NR (Rtlowert _features(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRHLs  c CsK|r*|jdk r*tjjdn|j}|dkoW|dkoW|dk }| r}|r}tjjdn|rt|\}}|dkr|dkrtjjdn|r| rtjjdn|j ||}|r |j |n|j |n|r5||_|_ n||_ ||_ |S(Ns(doctype object owned by another DOM treesElement with no nameR$s$http://www.w3.org/XML/1998/namespacesillegal use of 'xml' prefixs(illegal use of prefix without namespaces(R(RR$R%tWrongDocumentErrt_create_documenttInvalidCharacterErrRRtcreateElementNSR*RDtdoctypeRG( R RcRRHRftadd_root_elementRdRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentQs4              cCs"t|}||_||_|S(N(R+R&R'(R RR&R'RH((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentType~s   cCs|j|dr|SdSdS(N(RHR(R RI((s'/usr/lib64/python2.7/xml/dom/minidom.pyROscCstS(N(tDocument(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyREs(RAs1.0(RAs2.0N(RAN(R$s1.0(R$s2.0(R$N(sls-loads3.0(sls-loadN( RaRbRRCRHRJRKRORE(((s'/usr/lib64/python2.7/xml/dom/minidom.pyR@As   -  t ElementInfocBseeZdZd ZdZdZdZdZdZdZ dZ d Z d Z RS( sObject that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. RrcCs ||_dS(N(Rr(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzscCstS(N(R(R taname((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(N(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(sQReturns true iff this element is declared to have an EMPTY content model.(R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pytisEmptyscCstS(s7Returns true iff the named attribute is a DTD-style ID.(R(R RN((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCstS(s<Returns true iff the identified attribute is a DTD-style ID.(R(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jS(N(Rr(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs ||_dS(N(Rr(R R((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs(Rr( RaRbRRRzRRRRORRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRMs        cCsZ|jtjkr+|jjd|_n+t|rV|jjjd|j_ndS(N( RRRt _id_cachetclearRt_id_search_stackRkRD(R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR/s    RLcBseZejejejejfZejZ dZ d$Z d$Z d$Zd$Zd$ZZeZd$Zd$Zd$Zd$ZeZd$Zd$ZdZdZdZdZdZ dZ!dZ"dZ#d Z$d Z%d Z&d Z'd Z(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:d Z;d!d!d!d$d"Z<d#Z=RS(%s #documenticCs+t|_i|_i|_d|_dS(N(R`Rt _elem_infoRPRRR(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs   cCs7|jr|j|jf}n |j}|jj|S(N(RcRhRrRSR(R RRS((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  cCs|jS(N(R5(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR<scCs|jS(N(RH(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt _get_doctypescCs|jS(N(t documentURI(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_documentURIscCs|jS(N(R (R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=scCs|jS(N(t errorHandler(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_errorHandlerscCs|jS(N(t standalone(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_standalonescCs|jS(N(tstrictErrorChecking(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_get_strictErrorCheckingscCs|jS(N(RJ(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR>scCs|j|jkr=tjjdt|t|fn|jdk r_|jj|n|jt j kr|j rtjjdnt j ||S(Ns%s cannot be child of %ss two document elements disallowed( RR#R$R%R&R'R(RR)RR?t_get_documentElementR*(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR*s "   cCsoy|jj|Wn tk r6tjjnXd|_|_d|_ |j |krkd|_ n|S(N( RR:R,R$R%R-RR1R2R(tdocumentElement(R R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyR)s   cCs.x'|jD]}|jtjkr |Sq WdS(N(RRRR?(R R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyR]scCs9|jdk r(|jjd|_ntj|dS(N(RHRR=R(R ((s'/usr/lib64/python2.7/xml/dom/minidom.pyR=$s  cCs|s dS|jjddd}|j|_|j|_|j|_xo|jD]d}t|||}|jj||j t j krn|j t j kr||_ n||_qPW|jtjjj|||S(N(RRGRJR RYRJRRCR>RRRR;RHR(R_R$R%R0R1(R RER6Rt childclone((s'/usr/lib64/python2.7/xml/dom/minidom.pyRF*s"      cCst}||_|S(N(RyRD(R RW((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateDocumentFragment?s  cCst|}||_|S(N(RRD(R RrR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createElementDs  cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<tt((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateTextNodeIs     cCs:t|tstdnt}||_||_|S(Nsnode contents must be a string(RRRRR<RD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateCDATASectionQs     cCst|}||_|S(N(RRD(R R<R5((s'/usr/lib64/python2.7/xml/dom/minidom.pyt createCommentYs  cCst||}||_|S(N(RRD(R RR<tp((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateProcessingInstruction^s cCs"t|}||_d|_|S(NR (RRDR(R Rta((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributecs   cCs1t|\}}t|||}||_|S(N(RRRD(R RcRRdRhR8((s'/usr/lib64/python2.7/xml/dom/minidom.pyRGis cCs=t|\}}t||||}||_d|_|S(NR (RRRDR(R RcRRdRhRh((s'/usr/lib64/python2.7/xml/dom/minidom.pytcreateAttributeNSos   cCs"t||||}||_|S(N(R3RD(R RuR&R'R4R8((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_entityys cCst|||}||_|S(N(R2RD(R RuR&R'R((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_create_notation~s cCsE||jkr|j|S|jp)|js0dS|j}|dkr]|jg}||_n |sgdSd}x|r@|j}|jg|jD]}|j t kr|^q|j |}|rxa|j j D]}|jr;|j|j|jr||j|j<|j|kr(|}q8|js8Pq8qq|j|jr||j|j<|j|kru|}q|jsPqq|jr||j|j<|j|kr|}q|jdkrPqqqWnZ|jr-xN|j j D]:}|jr||j|j<|j|kr&|}q&qqWn|dk rpPqpqpW|S(Ni(RPRSRRRRR^tpoptextendRRR.RR}RRcRRhRRRRuR(R RtstacktresultR6RBRR((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetElementByIds\                  cCst||tS(N(RsR`(R Ru((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCst|||tS(N(RwR`(R RcRh((s'/usr/lib64/python2.7/xml/dom/minidom.pyRscCs|jj||S(N(RGRH(R RIRJ((s'/usr/lib64/python2.7/xml/dom/minidom.pyRKscCs^|jtjkr'tjjdn'|jtjkrNtjjdnt|||S(Nscannot import document nodess!cannot import document type nodes(RRRR$R%tNotSupportedErrR;RC(R R6RE((s'/usr/lib64/python2.7/xml/dom/minidom.pyt importNodes R cCse|dkr |jd|n|jd||fx'|jD]}|j||||qAWdS(Nss%%s(RRpRR(R RRRRR R6((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs  c Cs|j|k r1tjjd||jfn|jtjtjfkratjjdn|t krd|kr|j dd\}}|dkr|tjj krtjj dqq'|dkr |tjj kr |jtjkr tjj dnd}|}n d}d}|jtjkrj|j}|dk rp|j}|j|qpnd}|j}||d<||d <||d <||d <|jtjkr||d RaRbRR?RRR;R#RRR{RR|R}RHR(R2R1R@RGR5R RYRJRR[RWRURRzRR<RTRVR=RXRZR\R>R*R)R]R=RFR`RaRcRdReRgRiRGRjRkRlRqRRRKRsRRu(((s'/usr/lib64/python2.7/xml/dom/minidom.pyRLsh                             :      R^s#Top-level element of this document.c Cs|jj|r$tjjj}ntjjj}|jtj kr|j |j |j }xW|j jD]F}|j|j |j |j|j|j |j}|j|_qmW|rx3|jD]%}t|||}|j|qWqn|jtjkrS|j}|rx3|jD]%}t|||}|j|q$Wqn|jtjkrz|j|j}nX|jtjkr|j|j}n1|jtjkr|j|j |j}n|jtj!kr|j"|j}n|jtj#kr7|j$|j |j }t%|_|j|_n|jtj&krtjjj}|j'j(|j)|j*|j+}||_|rg|j,_-g|j._-xp|j.j-D]b} t/| j | j*| j+} || _|j.j-j0| t1| dr| j2|| | qqWx|j,j-D]} t3| j | j*| j+| j4} | j5| _5| j6| _6| j7| _7|| _|j,j-j0| t1| dr | j2|| | q q Wqntjj8dt9|t1|dr|j2|||n|S(so Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode R_sCannot clone node %s(:RDRNR$R%R0R1t NODE_IMPORTEDRRR?RGRcR{R}RRRRRhRRRCR*R R`R;RcR<R~RdRRgRRReRRjRR;RGRKRuR&R'R,R"R-R2R>RYR_R3R4R5R RJRrR'( R6REtnewOwnerDocumentR\R6RRhRBR5RR7R8R9((s'/usr/lib64/python2.7/xml/dom/minidom.pyRCs|                  cCs:|jdd}t|dkr(|Sd|dfSdS(NRiii(RRR(Rtfields((s'/usr/lib64/python2.7/xml/dom/minidom.pyRfscCsddlm}|S(Ni(tStringIO(Ry(Ry((s'/usr/lib64/python2.7/xml/dom/minidom.pyRnscCs<|||}|j\}}|j||j|S(N(tgetEventt expandNodeRQ(tfunctargstkwargsteventsttoktypetrootNode((s'/usr/lib64/python2.7/xml/dom/minidom.pyt_do_pulldom_parsess   cCsh|dkr0| r0ddlm}|j|Sddlm}t|j|fi|d6|d6SdS(s3Parse a file into a DOM by filename or file object.i(t expatbuilder(tpulldomtparsertbufsizeN(Rtxml.domRtparseRR(tfileRRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRzs  cCsZ|dkr)ddlm}|j|Sddlm}t|j|fi|d6SdS(s&Parse a file into a DOM from a string.i(R(RRN(RRRt parseStringRR(tstringRRR((s'/usr/lib64/python2.7/xml/dom/minidom.pyRs   cCsa|rZt|tr'tj|}nx0|D]%\}}tjj||s.dSq.WntjS(N(RRRt_parse_feature_stringRLRGRHR(tfeaturestftv((s'/usr/lib64/python2.7/xml/dom/minidom.pytgetDOMImplementations (8RRR$RRRRtxml.dom.minicompattxml.dom.xmlbuilderRRR%RR?RR.t defpropertyR7RkRqRsRwRyRtobjectRt AttributeListRRRRRRRRRRRRRR!R%R+R3R2R@RMR/RLRCRRRRRR(((s'/usr/lib64/python2.7/xml/dom/minidom.pyts "      r    (GZ     > <( O* O  R    PKi#]8n?00dom/xmlbuilder.pynu["""Implementation of the DOM Level 3 'LS-Load' feature.""" import copy import xml.dom from xml.dom.NodeFilter import NodeFilter __all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"] class Options: """Features object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. """ # Note that the DOMBuilder class in LoadSave constrains which of these # values can be set using the DOM Level 3 LoadSave feature. namespaces = 1 namespace_declarations = True validation = False external_parameter_entities = True external_general_entities = True external_dtd_subset = True validate_if_schema = False validate = False datatype_normalization = False create_entity_ref_nodes = True entities = True whitespace_in_element_content = True cdata_sections = True comments = True charset_overrides_xml_encoding = True infoset = False supported_mediatypes_only = False errorHandler = None filter = None class DOMBuilder: entityResolver = None errorHandler = None filter = None ACTION_REPLACE = 1 ACTION_APPEND_AS_CHILDREN = 2 ACTION_INSERT_AFTER = 3 ACTION_INSERT_BEFORE = 4 _legal_actions = (ACTION_REPLACE, ACTION_APPEND_AS_CHILDREN, ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE) def __init__(self): self._options = Options() def _get_entityResolver(self): return self.entityResolver def _set_entityResolver(self, entityResolver): self.entityResolver = entityResolver def _get_errorHandler(self): return self.errorHandler def _set_errorHandler(self, errorHandler): self.errorHandler = errorHandler def _get_filter(self): return self.filter def _set_filter(self, filter): self.filter = filter def setFeature(self, name, state): if self.supportsFeature(name): state = state and 1 or 0 try: settings = self._settings[(_name_xform(name), state)] except KeyError: raise xml.dom.NotSupportedErr( "unsupported feature: %r" % (name,)) from None else: for name, value in settings: setattr(self._options, name, value) else: raise xml.dom.NotFoundErr("unknown feature: " + repr(name)) def supportsFeature(self, name): return hasattr(self._options, _name_xform(name)) def canSetFeature(self, name, state): key = (_name_xform(name), state and 1 or 0) return key in self._settings # This dictionary maps from (feature,value) to a list of # (option,value) pairs that should be set on the Options object. # If a (feature,value) setting is not in this dictionary, it is # not supported by the DOMBuilder. # _settings = { ("namespace_declarations", 0): [ ("namespace_declarations", 0)], ("namespace_declarations", 1): [ ("namespace_declarations", 1)], ("validation", 0): [ ("validation", 0)], ("external_general_entities", 0): [ ("external_general_entities", 0)], ("external_general_entities", 1): [ ("external_general_entities", 1)], ("external_parameter_entities", 0): [ ("external_parameter_entities", 0)], ("external_parameter_entities", 1): [ ("external_parameter_entities", 1)], ("validate_if_schema", 0): [ ("validate_if_schema", 0)], ("create_entity_ref_nodes", 0): [ ("create_entity_ref_nodes", 0)], ("create_entity_ref_nodes", 1): [ ("create_entity_ref_nodes", 1)], ("entities", 0): [ ("create_entity_ref_nodes", 0), ("entities", 0)], ("entities", 1): [ ("entities", 1)], ("whitespace_in_element_content", 0): [ ("whitespace_in_element_content", 0)], ("whitespace_in_element_content", 1): [ ("whitespace_in_element_content", 1)], ("cdata_sections", 0): [ ("cdata_sections", 0)], ("cdata_sections", 1): [ ("cdata_sections", 1)], ("comments", 0): [ ("comments", 0)], ("comments", 1): [ ("comments", 1)], ("charset_overrides_xml_encoding", 0): [ ("charset_overrides_xml_encoding", 0)], ("charset_overrides_xml_encoding", 1): [ ("charset_overrides_xml_encoding", 1)], ("infoset", 0): [], ("infoset", 1): [ ("namespace_declarations", 0), ("validate_if_schema", 0), ("create_entity_ref_nodes", 0), ("entities", 0), ("cdata_sections", 0), ("datatype_normalization", 1), ("whitespace_in_element_content", 1), ("comments", 1), ("charset_overrides_xml_encoding", 1)], ("supported_mediatypes_only", 0): [ ("supported_mediatypes_only", 0)], ("namespaces", 0): [ ("namespaces", 0)], ("namespaces", 1): [ ("namespaces", 1)], } def getFeature(self, name): xname = _name_xform(name) try: return getattr(self._options, xname) except AttributeError: if name == "infoset": options = self._options return (options.datatype_normalization and options.whitespace_in_element_content and options.comments and options.charset_overrides_xml_encoding and not (options.namespace_declarations or options.validate_if_schema or options.create_entity_ref_nodes or options.entities or options.cdata_sections)) raise xml.dom.NotFoundErr("feature %s not known" % repr(name)) def parseURI(self, uri): if self.entityResolver: input = self.entityResolver.resolveEntity(None, uri) else: input = DOMEntityResolver().resolveEntity(None, uri) return self.parse(input) def parse(self, input): options = copy.copy(self._options) options.filter = self.filter options.errorHandler = self.errorHandler fp = input.byteStream if fp is None and input.systemId: import urllib.request fp = urllib.request.urlopen(input.systemId) return self._parse_bytestream(fp, options) def parseWithContext(self, input, cnode, action): if action not in self._legal_actions: raise ValueError("not a legal action") raise NotImplementedError("Haven't written this yet...") def _parse_bytestream(self, stream, options): import xml.dom.expatbuilder builder = xml.dom.expatbuilder.makeBuilder(options) return builder.parseFile(stream) def _name_xform(name): return name.lower().replace('-', '_') class DOMEntityResolver(object): __slots__ = '_opener', def resolveEntity(self, publicId, systemId): assert systemId is not None source = DOMInputSource() source.publicId = publicId source.systemId = systemId source.byteStream = self._get_opener().open(systemId) # determine the encoding if the transport provided it source.encoding = self._guess_media_encoding(source) # determine the base URI is we can import posixpath, urllib.parse parts = urllib.parse.urlparse(systemId) scheme, netloc, path, params, query, fragment = parts # XXX should we check the scheme here as well? if path and not path.endswith("/"): path = posixpath.dirname(path) + "/" parts = scheme, netloc, path, params, query, fragment source.baseURI = urllib.parse.urlunparse(parts) return source def _get_opener(self): try: return self._opener except AttributeError: self._opener = self._create_opener() return self._opener def _create_opener(self): import urllib.request return urllib.request.build_opener() def _guess_media_encoding(self, source): info = source.byteStream.info() # import email.message # assert isinstance(info, email.message.Message) charset = info.get_param('charset') if charset is not None: return charset.lower() return None class DOMInputSource(object): __slots__ = ('byteStream', 'characterStream', 'stringData', 'encoding', 'publicId', 'systemId', 'baseURI') def __init__(self): self.byteStream = None self.characterStream = None self.stringData = None self.encoding = None self.publicId = None self.systemId = None self.baseURI = None def _get_byteStream(self): return self.byteStream def _set_byteStream(self, byteStream): self.byteStream = byteStream def _get_characterStream(self): return self.characterStream def _set_characterStream(self, characterStream): self.characterStream = characterStream def _get_stringData(self): return self.stringData def _set_stringData(self, data): self.stringData = data def _get_encoding(self): return self.encoding def _set_encoding(self, encoding): self.encoding = encoding def _get_publicId(self): return self.publicId def _set_publicId(self, publicId): self.publicId = publicId def _get_systemId(self): return self.systemId def _set_systemId(self, systemId): self.systemId = systemId def _get_baseURI(self): return self.baseURI def _set_baseURI(self, uri): self.baseURI = uri class DOMBuilderFilter: """Element filter which can be used to tailor construction of a DOM instance. """ # There's really no need for this class; concrete implementations # should just implement the endElement() and startElement() # methods as appropriate. Using this makes it easy to only # implement one of them. FILTER_ACCEPT = 1 FILTER_REJECT = 2 FILTER_SKIP = 3 FILTER_INTERRUPT = 4 whatToShow = NodeFilter.SHOW_ALL def _get_whatToShow(self): return self.whatToShow def acceptNode(self, element): return self.FILTER_ACCEPT def startContainer(self, element): return self.FILTER_ACCEPT del NodeFilter class DocumentLS: """Mixin to create documents that conform to the load/save spec.""" async_ = False def _get_async(self): return False def _set_async(self, flag): if flag: raise xml.dom.NotSupportedErr( "asynchronous document loading is not supported") def abort(self): # What does it mean to "clear" a document? Does the # documentElement disappear? raise NotImplementedError( "haven't figured out what this means yet") def load(self, uri): raise NotImplementedError("haven't written this yet") def loadXML(self, source): raise NotImplementedError("haven't written this yet") def saveXML(self, snode): if snode is None: snode = self elif snode.ownerDocument is not self: raise xml.dom.WrongDocumentErr() return snode.toxml() class DOMImplementationLS: MODE_SYNCHRONOUS = 1 MODE_ASYNCHRONOUS = 2 def createDOMBuilder(self, mode, schemaType): if schemaType is not None: raise xml.dom.NotSupportedErr( "schemaType not yet supported") if mode == self.MODE_SYNCHRONOUS: return DOMBuilder() if mode == self.MODE_ASYNCHRONOUS: raise xml.dom.NotSupportedErr( "asynchronous builders are not supported") raise ValueError("unknown value for mode") def createDOMWriter(self): raise NotImplementedError( "the writer interface hasn't been written yet!") def createDOMInputSource(self): return DOMInputSource() PKi#] .dom/expatbuilder.pycnu[ {fc@sdZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZddlTejZejZejZejjZejjZejjZejjZejZi ejedd 6ejed d 6ejed d 6ejedd6ejedd6ejedd6ejedd6ejedd6ejedd6ZdefdYZdZdZ dfdYZ!eeefZ"d efd!YZ#d"efd#YZ$d$e$fd%YZ%d&e$fd'YZ&d(Z'd)e'Z(d*e!fd+YZ)d,fd-YZ*d.e*e!fd/YZ+d0e*e)fd1YZ,d2e-fd3YZ.d4e!fd5YZ/e0d6Z1e0d7Z2e0d8Z3e0d9Z4d:Z5d;S(<sFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. i(t xmlbuildertminidomtNode(tEMPTY_NAMESPACEt EMPTY_PREFIXtXMLNS_NAMESPACE(texpat(t _append_childt_set_attribute_node(t NodeFilter(t*tcdatatCDATAt enumerationtENUMtentitytENTITYtentitiestENTITIEStidtIDtidreftIDREFtidrefstIDREFStnmtokentNMTOKENtnmtokenstNMTOKENSt ElementInfocBsbeZd Zd dZdZdZdZdZdZ d Z d Z d Z RS(t _attr_infot_modelttagNamecCs||_g|_||_dS(N(R RR(tselfR tmodel((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt__init__As  cCs|j|j|jfS(N(RRR (R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt __getstate__FscCs|\|_|_|_dS(N(RRR (R!tstate((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt __setstate__IscCs\xR|jD]G}|d|kr |d}|ddkrBtdSt|dSq q WtjS(Niiit(R(Rt _typeinfo_mapRt_no_type(R!tanametinfott((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytgetAttributeTypeLs cCstjS(N(RR)(R!t namespaceURIt localName((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytgetAttributeTypeNSVscCs:|jr2|jd}|tjjtjjfkStSdS(Ni(RRR"t XML_CTYPE_ANYtXML_CTYPE_MIXEDtFalse(R!ttype((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisElementContentYs    cCs(|jr |jdtjjkStSdS(Ni(RRR"tXML_CTYPE_EMPTYR3(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisEmptyas cCs6x/|jD]$}|d|kr |ddkSq WtS(NiiR(RR3(R!R*R+((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisIdgscCs|j||fS(N(R8(R!teuritenametauriR*((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytisIdNSms(RRR N( t__name__t __module__t __slots__tNoneR#R$R&R-R0R5R7R8R<(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR>s       cCs|j||S(N(t_intern_setdefault(tbuilderts((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_internqscCsd|kst|jd}|j}t|dkr|\}}}|||}d||f}|||}|||}n%|\}}t}|||}}||||||fS(Nt is%s:%s(tAssertionErrortsplitRAtlenR(RBtnametpartstinternturit localnametprefixtqname((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_parse_ns_namets  t ExpatBuildercBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sPDocument builder that uses Expat to build a ParsedXML.DOM document instance.cCsw|dkrtj}n||_|jjdk rNt|jj|_nd|_t|_d|_ |j dS(N( R@RtOptionst_optionstfiltertFilterVisibilityControllert_filterRt_finish_start_elementt_parsertreset(R!toptions((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#s     cCs tjS(sCreate a new parser object.(Rt ParserCreate(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt createParserscCsh|jsa|j|_|jjj|_t|j_t|j_t|j_|j |jn|jS(s7Return the parser object, creating a new one if needed.( RXR\RKt setdefaultRAtTruet buffer_texttordered_attributestspecified_attributestinstall(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt getParsers    cCs@tjtdd|_|j|_|jj|_t|_dS(s6Free all data structures used during DOM construction.N( ttheDOMImplementationtcreateDocumentRR@tdocumenttcurNodet _elem_infoR3t_cdata(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRYs  cCs|j|_|j|_|j|_|j|_|jj rK|j |_ n|j |_ |jjrr|j|_n|jjr|j|_|j|_|j|_n |j|_|j|_|j|_|j|_|j|_ dS(s>Install the callbacks needed to build the DOM into the parser.N(!tstart_doctype_decl_handlertStartDoctypeDeclHandlertfirst_element_handlertStartElementHandlertend_element_handlertEndElementHandlert pi_handlertProcessingInstructionHandlerRSRtentity_decl_handlertEntityDeclHandlertnotation_decl_handlertNotationDeclHandlertcommentstcomment_handlertCommentHandlertcdata_sectionststart_cdata_section_handlertStartCdataSectionHandlertend_cdata_section_handlertEndCdataSectionHandlertcharacter_data_handler_cdatatCharacterDataHandlertcharacter_data_handlertexternal_entity_ref_handlertExternalEntityRefHandlertxml_decl_handlertXmlDeclHandlertelement_decl_handlertElementDeclHandlertattlist_decl_handlertAttlistDeclHandler(R!tparser((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRbs$              cCs|j}t}ylxU|jd}|s1Pn|j|d|rc|jjrc|j|nt}qW|jdtWntk rnX|j}|j d|_ |S(sIParse a document from a file object, returning the document node.iiiti@N( RcR^treadtParseRftdocumentElementt _setup_subsetR3t ParseEscapeRYR@RX(R!tfileRt first_buffertbuffertdoc((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseFiles$      cCsa|j}y!|j|t|j|Wntk r@nX|j}|jd|_|S(s<Parse a document from a string, returning the document node.N( RcRR^RRRfRYR@RX(R!tstringRR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseStrings     cCsD|jjr@t}|j||j}||jj_ndS(s/Load the internal subset if there might be one.N(RftdoctypetInternalSubsetExtractorRt getSubsettinternalSubset(R!Rt extractortsubset((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     cCs|jjj|||}|j|_t|j|||j_|jr|jj|tkrd|j_|jj d=d}d|j _ d|j _ n|r|dk rg|j_g|j_nd|j _d|j _|j|j _ndS(Ni(RftimplementationtcreateDocumentTypet ownerDocumentRRRVt acceptNodet FILTER_REJECTR@t childNodesRXRsRuRt_seqt notationsRxRqtend_doctype_decl_handlertEndDoctypeDeclHandler(R!t doctypeNametsystemIdtpublicIdthas_internal_subsetR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRjs$   !       cCsO|jjr|j|j_n|j|j_|jp<|jsKt |_ ndS(N( RSRvRwRXRxRpRqRhRVRt_finish_end_element(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs  cCs]|jj||}t|j||jrY|jj|tkrY|jj|ndS(N(RftcreateProcessingInstructionRRgRVRRt removeChild(R!ttargettdatatnode((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRp s!cCs|jj}|jrd|jrF|djtkrF|dj|dS|jj|}t |_n|r|djt kr|d}|j |}|j }||d<|dt__doc__R@R#R\RcRYRbRRRRjRRpR~RRrRtRwRzR|RRlRRWRnRRRRR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRQs:                       RUcBseZdZdZdZdZdZi eje j 6ej e j 6ej e j6eje j6eje j6eje j6eje j6eje j6eje j6eje j6eje j6eje j 6Z!RS(soWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.RTcCs ||_dS(N(RT(R!RT((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#scCsu|j|j}|jj|@rm|jj|}|tkrGtn|tkritdt |n|St SdS(Ns)startContainer() returned illegal value: ( t_nodetype_maskRRTt whatToShowRtFILTER_INTERRUPTRt_ALLOWED_FILTER_RETURNSt ValueErrortreprR(R!Rtmasktval((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs   cCs|j|j}|jj|@r|jj|}|tkrGtn|tkr|j}x|j D]}|j |qgWt S|t krt dt|n|StSdS(Ns%acceptNode() returned illegal value: (RRRTRRRRRRRt appendChildRRRRR(R!RRRtparentR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     (RT("R=R>RR?R#RRR t SHOW_ELEMENTRt ELEMENT_NODEtSHOW_ATTRIBUTEtATTRIBUTE_NODEt SHOW_TEXTRtSHOW_CDATA_SECTIONRtSHOW_ENTITY_REFERENCEtENTITY_REFERENCE_NODEt SHOW_ENTITYt ENTITY_NODEtSHOW_PROCESSING_INSTRUCTIONtPROCESSING_INSTRUCTION_NODEt SHOW_COMMENTt COMMENT_NODEt SHOW_DOCUMENTt DOCUMENT_NODEtSHOW_DOCUMENT_TYPEtDOCUMENT_TYPE_NODEtSHOW_DOCUMENT_FRAGMENTtDOCUMENT_FRAGMENT_NODEt SHOW_NOTATIONt NOTATION_NODER(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRUs$             t FilterCrutchcBseZdZdZRS(t_buildert_levelt _old_startt_old_endcCsOd|_||_|j}|j|_|j|_|j|_|j|_dS(Ni( RRRXRmRRoRRRn(R!RBR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR# s      (RRRR(R=R>R?R#(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR sRcBs)eZdZdZdZdZRS(cCs>tj|||j}xdD]}t||dq WdS(NRqRxRR{R}R(RqRxRR{R}R(RR#RXtsetattrR@(R!RBRRI((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#s  cGs|jd|_dS(Ni(R(R!targs((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR$scGsZ|jdkrF|jj}|jj||j|_|j|_n|jd|_dS(Nii(RRRXRbRRmRRo(R!RR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRn's   ((R=R>R?R#RRn(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs RcBs eZdZdZdZRS(cGsB|jj}|j||jj|k r>|jd|_ndS(Ni(RRgRR(R!RR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR4s  cGs`|jdkr?|j|jj_|j|jj_d|_n|jd|_|j|dS(Nii(RRRRXRmRRoR@(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRn:s  ((R=R>R?RRn(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR1s s8http://xml.python.org/entities/fragment-builder/internals %%s ]> &fragment-builder-internal;tFragmentBuildercBsPeZdZddZdZdZdZdZdZ dZ RS( sBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. cCsM|jtkr$||_||_n|j|_||_tj||dS(N(RRtoriginalDocumentRRRQR#(R!RRZ((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#bs     cCstj|d|_dS(N(RQRYR@tfragment(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRYks cCs|j|jS(sRParse a document fragment from a file object, returning the fragment node.(RR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRosc Cs||_|j}|jj}d}|r|jp?|j}|jrdd|j|jf}q|jrd|j}qnd}|j}t |||f}y|j |dWn|j nX|j }|j |S(sMParse a document fragment from a string, returning the fragment node.RsPUBLIC "%s" "%s"s SYSTEM "%s"i( t_sourceRcR RRt_getDeclarationsRRt _getNSattrst_FRAGMENT_BUILDER_TEMPLATERRYR ( R!RRRtidentRtnsattrsRfR ((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRts,         cCs|jjj}d}|rxt|jjD]v}|jj|}|rY|d}nd||jf}|jrd||j|j f}q.d||j f}q.Wxt|j jD]}|j j|}|r|d}nd||jf}|jrd||j|j f}n5|j r=d||j f}nd ||j j f}|j rrd ||j f}n|d }qWn|S( sRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. Rs s%ss%s SYSTEM "%s">s %s(RRRRRtlengthtitemtnodeNameRRRt firstChildRR(R!RRCRtnotationR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR s6      cCsdS(NR((R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRscCs|tkr|j}|j}|jj|}|j|_|jj|_|j|_z|j|j dWd||_||_d|_ XdSt j |||||SdS(Nii( t$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDRfRgRXtExternalEntityParserCreateR tcreateDocumentFragmentR RR R@RQR(R!RRRRt old_documentt old_cur_nodeR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs        N( R=R>RR@R#RYRRR RR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR Ys    $ t NamespacescBsDeZdZdZdZdZdZdZdZRS(s7Mix-in class for builders; adds support for namespaces.cCs g|_dS(N(t_ns_ordered_prefixes(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt_initNamespacesscCstjdd}t|_|S(s'Create a new namespace-handling parser.tnamespace_separatorRE(RR[R^tnamespace_prefixes(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR\s cCs/tj|||jjr+|j|_ndS(s.Insert the namespace-handlers onto the parser.N(RQRbRStnamespace_declarationststart_namespace_decl_handlertStartNamespaceDeclHandler(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRbs cCs|jj||fdS(s/Push this namespace declaration on our storage.N(RR(R!RNRL((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR#scCsd|kr*t||\}}}}nt}|}d}t}tj||||}|j|_t|j |||_ |j rIx|j D]\}}|rtj t |d|t |d}ntj dt dt}|jdj} || d<| d<|j} || d<| d<|j| dRRR\RbR#RRn(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs     :tExpatBuilderNScBseZdZdZRS(s*Document builder that supports namespaces.cCstj||jdS(N(RQRYR(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRY5s (R=R>RRY(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR*2stFragmentBuilderNScBs eZdZdZdZRS(s*Fragment builder that supports namespaces.cCstj||jdS(N(R RYR(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRY=s cCsd}|j}g}x|rt|drx|jjD]p\}}||kr[q=n|j||r{d|}nd}|rd|||f}q=d||f}q=Wn|j}qW|S(sNReturn string of namespace attributes from this element and ancestors.Rt_ns_prefix_urisxmlns:R%s%s %s='%s's %s='%s'(RthasattrR,titemsRR(R!tattrsRRRNRLtdeclname((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRAs"      (R=R>RRYR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR+:s RcBseZdZRS(sEException raised to short-circuit parsing in InternalSubsetExtractor.(R=R>R(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyR_sRcBsSeZdZdZdZdZdZdZdZ dZ dZ RS( sBXML processor which can rip out the internal document type subset.cCs|jS(s'Return the internal subset as a string.(R(R!((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRhscCs,ytj||Wntk r'nXdS(N(RQRR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRls cCs,ytj||Wntk r'nXdS(N(RQRR(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRrs cCs|j|_|j|_dS(N(RjRkRRm(R!R((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRbxs cCsF|r9|j}g|_|jj|_|j|_n tdS(N(RcRRtDefaultHandlerRRR(R!RIRRRR((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRj|s   cCs@dj|jjddjdd}||_tdS(NRs s s (tjoinRtreplaceR(R!RC((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs* cCs tdS(N(R(R!RIR/((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRsN( R=R>RR@RRRRRbRjRR(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRcs     cCsp|rt}n t}t|tr]t|d}z|j|}Wd|jXn|j|}|S(s{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. trbN(R*RQt isinstancet StringTypestopenRtclose(Rt namespacesRBtfptresult((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytparses  cCs(|rt}n t}|j|S(sOParse a document from a string, returning the resulting Document node. (R*RQR(RR9RB((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyRs  cCsv|rt|}n t|}t|trct|d}z|j|}Wd|jXn|j|}|S(sParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. R4N(R+R R5R6R7RR8(RRR9RBR:R;((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt parseFragments cCs.|rt|}n t|}|j|S(sParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. (R+R R(RRR9RB((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pytparseFragmentStrings cCs!|jrt|St|SdS(s,Create a builder based on an Options object.N(R9R*RQ(RZ((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyt makeBuilders  N(6Rtxml.domRRRRRRt xml.parsersRtxml.dom.minidomRRtxml.dom.NodeFilterR txml.dom.minicompatRRRtDOMBuilderFilterRRRRtgetDOMImplementationRdtTypeInfoR@R(tobjectRRDRPRQRRURRRRRR RR*R+t ExceptionRRR^R<RR=R>R?(((s,/usr/lib64/python2.7/xml/dom/expatbuilder.pyts`         3  I:  ud%,   PKi#] 5Iu-u-dom/pulldom.pynu[import xml.sax import xml.sax.handler START_ELEMENT = "START_ELEMENT" END_ELEMENT = "END_ELEMENT" COMMENT = "COMMENT" START_DOCUMENT = "START_DOCUMENT" END_DOCUMENT = "END_DOCUMENT" PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION" IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE" CHARACTERS = "CHARACTERS" class PullDOM(xml.sax.ContentHandler): _locator = None document = None def __init__(self, documentFactory=None): from xml.dom import XML_NAMESPACE self.documentFactory = documentFactory self.firstEvent = [None, None] self.lastEvent = self.firstEvent self.elementStack = [] self.push = self.elementStack.append try: self.pop = self.elementStack.pop except AttributeError: # use class' pop instead pass self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts self._current_context = self._ns_contexts[-1] self.pending_events = [] def pop(self): result = self.elementStack[-1] del self.elementStack[-1] return result def setDocumentLocator(self, locator): self._locator = locator def startPrefixMapping(self, prefix, uri): if not hasattr(self, '_xmlns_attrs'): self._xmlns_attrs = [] self._xmlns_attrs.append((prefix or 'xmlns', uri)) self._ns_contexts.append(self._current_context.copy()) self._current_context[uri] = prefix or None def endPrefixMapping(self, prefix): self._current_context = self._ns_contexts.pop() def startElementNS(self, name, tagName , attrs): # Retrieve xml namespace declaration attributes. xmlns_uri = 'http://www.w3.org/2000/xmlns/' xmlns_attrs = getattr(self, '_xmlns_attrs', None) if xmlns_attrs is not None: for aname, value in xmlns_attrs: attrs._attrs[(xmlns_uri, aname)] = value self._xmlns_attrs = [] uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: prefix = self._current_context[uri] if prefix: tagName = prefix + ":" + localname else: tagName = localname if self.document: node = self.document.createElementNS(uri, tagName) else: node = self.buildDocument(uri, tagName) else: # When the tagname is not prefixed, it just appears as # localname if self.document: node = self.document.createElement(localname) else: node = self.buildDocument(None, localname) for aname,value in attrs.items(): a_uri, a_localname = aname if a_uri == xmlns_uri: if a_localname == 'xmlns': qname = a_localname else: qname = 'xmlns:' + a_localname attr = self.document.createAttributeNS(a_uri, qname) node.setAttributeNodeNS(attr) elif a_uri: prefix = self._current_context[a_uri] if prefix: qname = prefix + ":" + a_localname else: qname = a_localname attr = self.document.createAttributeNS(a_uri, qname) node.setAttributeNodeNS(attr) else: attr = self.document.createAttribute(a_localname) node.setAttributeNode(attr) attr.value = value self.lastEvent[1] = [(START_ELEMENT, node), None] self.lastEvent = self.lastEvent[1] self.push(node) def endElementNS(self, name, tagName): self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] self.lastEvent = self.lastEvent[1] def startElement(self, name, attrs): if self.document: node = self.document.createElement(name) else: node = self.buildDocument(None, name) for aname,value in attrs.items(): attr = self.document.createAttribute(aname) attr.value = value node.setAttributeNode(attr) self.lastEvent[1] = [(START_ELEMENT, node), None] self.lastEvent = self.lastEvent[1] self.push(node) def endElement(self, name): self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] self.lastEvent = self.lastEvent[1] def comment(self, s): if self.document: node = self.document.createComment(s) self.lastEvent[1] = [(COMMENT, node), None] self.lastEvent = self.lastEvent[1] else: event = [(COMMENT, s), None] self.pending_events.append(event) def processingInstruction(self, target, data): if self.document: node = self.document.createProcessingInstruction(target, data) self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None] self.lastEvent = self.lastEvent[1] else: event = [(PROCESSING_INSTRUCTION, target, data), None] self.pending_events.append(event) def ignorableWhitespace(self, chars): node = self.document.createTextNode(chars) self.lastEvent[1] = [(IGNORABLE_WHITESPACE, node), None] self.lastEvent = self.lastEvent[1] def characters(self, chars): node = self.document.createTextNode(chars) self.lastEvent[1] = [(CHARACTERS, node), None] self.lastEvent = self.lastEvent[1] def startDocument(self): if self.documentFactory is None: import xml.dom.minidom self.documentFactory = xml.dom.minidom.Document.implementation def buildDocument(self, uri, tagname): # Can't do that in startDocument, since we need the tagname # XXX: obtain DocumentType node = self.documentFactory.createDocument(uri, tagname, None) self.document = node self.lastEvent[1] = [(START_DOCUMENT, node), None] self.lastEvent = self.lastEvent[1] self.push(node) # Put everything we have seen so far into the document for e in self.pending_events: if e[0][0] == PROCESSING_INSTRUCTION: _,target,data = e[0] n = self.document.createProcessingInstruction(target, data) e[0] = (PROCESSING_INSTRUCTION, n) elif e[0][0] == COMMENT: n = self.document.createComment(e[0][1]) e[0] = (COMMENT, n) else: raise AssertionError("Unknown pending event ",e[0][0]) self.lastEvent[1] = e self.lastEvent = e self.pending_events = None return node.firstChild def endDocument(self): self.lastEvent[1] = [(END_DOCUMENT, self.document), None] self.pop() def clear(self): "clear(): Explicitly release parsing structures" self.document = None class ErrorHandler: def warning(self, exception): print(exception) def error(self, exception): raise exception def fatalError(self, exception): raise exception class DOMEventStream: def __init__(self, stream, parser, bufsize): self.stream = stream self.parser = parser self.bufsize = bufsize if not hasattr(self.parser, 'feed'): self.getEvent = self._slurp self.reset() def reset(self): self.pulldom = PullDOM() # This content handler relies on namespace support self.parser.setFeature(xml.sax.handler.feature_namespaces, 1) self.parser.setContentHandler(self.pulldom) def __next__(self): rc = self.getEvent() if rc: return rc raise StopIteration def __iter__(self): return self def expandNode(self, node): event = self.getEvent() parents = [node] while event: token, cur_node = event if cur_node is node: return if token != END_ELEMENT: parents[-1].appendChild(cur_node) if token == START_ELEMENT: parents.append(cur_node) elif token == END_ELEMENT: del parents[-1] event = self.getEvent() def getEvent(self): # use IncrementalParser interface, so we get the desired # pull effect if not self.pulldom.firstEvent[1]: self.pulldom.lastEvent = self.pulldom.firstEvent while not self.pulldom.firstEvent[1]: buf = self.stream.read(self.bufsize) if not buf: self.parser.close() return None self.parser.feed(buf) rc = self.pulldom.firstEvent[1][0] self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] return rc def _slurp(self): """ Fallback replacement for getEvent() using the standard SAX2 interface, which means we slurp the SAX events into memory (no performance gain, but we are compatible to all SAX parsers). """ self.parser.parse(self.stream) self.getEvent = self._emit return self._emit() def _emit(self): """ Fallback replacement for getEvent() that emits the events that _slurp() read previously. """ rc = self.pulldom.firstEvent[1][0] self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] return rc def clear(self): """clear(): Explicitly release parsing objects""" self.pulldom.clear() del self.pulldom self.parser = None self.stream = None class SAX2DOM(PullDOM): def startElementNS(self, name, tagName , attrs): PullDOM.startElementNS(self, name, tagName, attrs) curNode = self.elementStack[-1] parentNode = self.elementStack[-2] parentNode.appendChild(curNode) def startElement(self, name, attrs): PullDOM.startElement(self, name, attrs) curNode = self.elementStack[-1] parentNode = self.elementStack[-2] parentNode.appendChild(curNode) def processingInstruction(self, target, data): PullDOM.processingInstruction(self, target, data) node = self.lastEvent[0][1] parentNode = self.elementStack[-1] parentNode.appendChild(node) def ignorableWhitespace(self, chars): PullDOM.ignorableWhitespace(self, chars) node = self.lastEvent[0][1] parentNode = self.elementStack[-1] parentNode.appendChild(node) def characters(self, chars): PullDOM.characters(self, chars) node = self.lastEvent[0][1] parentNode = self.elementStack[-1] parentNode.appendChild(node) default_bufsize = (2 ** 14) - 20 def parse(stream_or_string, parser=None, bufsize=None): if bufsize is None: bufsize = default_bufsize if isinstance(stream_or_string, str): stream = open(stream_or_string, 'rb') else: stream = stream_or_string if not parser: parser = xml.sax.make_parser() return DOMEventStream(stream, parser, bufsize) def parseString(string, parser=None): from io import StringIO bufsize = len(string) buf = StringIO(string) if not parser: parser = xml.sax.make_parser() return DOMEventStream(buf, parser, bufsize) PKi#]}ffdom/NodeFilter.pycnu[ {fc@sdddYZdS(t NodeFiltercBsweZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZRS(sL This is the DOM2 NodeFilter interface. It contains only constants. iiiliiii i@iiiiicCs tdS(N(tNotImplementedError(tselftnode((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyt acceptNodes(t__name__t __module__t__doc__t FILTER_ACCEPTt FILTER_REJECTt FILTER_SKIPtSHOW_ALLt SHOW_ELEMENTtSHOW_ATTRIBUTEt SHOW_TEXTtSHOW_CDATA_SECTIONtSHOW_ENTITY_REFERENCEt SHOW_ENTITYtSHOW_PROCESSING_INSTRUCTIONt SHOW_COMMENTt SHOW_DOCUMENTtSHOW_DOCUMENT_TYPEtSHOW_DOCUMENT_FRAGMENTt SHOW_NOTATIONR(((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyRs$N((R(((s*/usr/lib64/python2.7/xml/dom/NodeFilter.pyttPKi#]#@ dom/minicompat.pyonu[ {fc@sdZddddgZddlZyeWn ek rNedfZnXedeedfZdefdYZ de fd YZ d Z dS( s1Python version compatibility support for minidom.tNodeListt EmptyNodeListt StringTypest defpropertyiNtcBsGeZdZdZdZdZeeeddZdZRS(cCs.d|kot|knr*||SdS(Ni(tlen(tselftindex((s*/usr/lib64/python2.7/xml/dom/minicompat.pytitem6s"cCs t|S(N(R(R((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt _get_length:scCstjjddS(Ns.attempt to modify read-only attribute 'length'(txmltdomtNoModificationAllowedErr(Rtvalue((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt _set_length=s tdocs$The number of nodes in the NodeList.cCs |dkrg}n||(dS(N(tNone(Rtstate((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt __setstate__Es  (( t__name__t __module__t __slots__RR RtpropertytlengthR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR3s     cBsPeZdZdZdZdZdZdZeeeddZ RS(cCst}|j||S(N(Rtextend(RtothertNL((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt__add__Ns  cCst}|j||S(N(RR(RRR((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt__radd__Ss  cCsdS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRXscCsdS(Ni((R((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR [scCstjjddS(Ns.attempt to modify read-only attribute 'length'(R R R (RR ((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR^s Rs$The number of nodes in the NodeList.(( RRRRRRR RRR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRKs      cCsKt|d|j}|d}t||d|}t|||dS(Nt_get_cSs tjjdt|dS(Ns&attempt to modify read-only attribute (R R R trepr(RR tname((s*/usr/lib64/python2.7/xml/dom/minicompat.pytseths R(tgetattrtim_funcRtsetattr(tklassRRtgetR tprop((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRfs ( t__doc__t__all__txml.domR tunicodet NameErrorttypeRtlistRttupleRR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyts&  PKi#]ȳdom/__init__.pynu["""W3C Document Object Model implementation for Python. The Python mapping of the Document Object Model is documented in the Python Library Reference in the section on the xml.dom package. This package contains the following modules: minidom -- A simple implementation of the Level 1 DOM with namespace support added (based on the Level 2 specification) and other minor Level 2 functionality. pulldom -- DOM builder supporting on-demand tree-building for selected subtrees of the document. """ class Node: """Class giving the NodeType constants.""" __slots__ = () # DOM implementations may use this as a base class for their own # Node implementations. If they don't, the constants defined here # should still be used as the canonical definitions as they match # the values given in the W3C recommendation. Client code can # safely refer to these values in all tests of Node.nodeType # values. ELEMENT_NODE = 1 ATTRIBUTE_NODE = 2 TEXT_NODE = 3 CDATA_SECTION_NODE = 4 ENTITY_REFERENCE_NODE = 5 ENTITY_NODE = 6 PROCESSING_INSTRUCTION_NODE = 7 COMMENT_NODE = 8 DOCUMENT_NODE = 9 DOCUMENT_TYPE_NODE = 10 DOCUMENT_FRAGMENT_NODE = 11 NOTATION_NODE = 12 #ExceptionCode INDEX_SIZE_ERR = 1 DOMSTRING_SIZE_ERR = 2 HIERARCHY_REQUEST_ERR = 3 WRONG_DOCUMENT_ERR = 4 INVALID_CHARACTER_ERR = 5 NO_DATA_ALLOWED_ERR = 6 NO_MODIFICATION_ALLOWED_ERR = 7 NOT_FOUND_ERR = 8 NOT_SUPPORTED_ERR = 9 INUSE_ATTRIBUTE_ERR = 10 INVALID_STATE_ERR = 11 SYNTAX_ERR = 12 INVALID_MODIFICATION_ERR = 13 NAMESPACE_ERR = 14 INVALID_ACCESS_ERR = 15 VALIDATION_ERR = 16 class DOMException(Exception): """Abstract base class for DOM exceptions. Exceptions with specific codes are specializations of this class.""" def __init__(self, *args, **kw): if self.__class__ is DOMException: raise RuntimeError( "DOMException should not be instantiated directly") Exception.__init__(self, *args, **kw) def _get_code(self): return self.code class IndexSizeErr(DOMException): code = INDEX_SIZE_ERR class DomstringSizeErr(DOMException): code = DOMSTRING_SIZE_ERR class HierarchyRequestErr(DOMException): code = HIERARCHY_REQUEST_ERR class WrongDocumentErr(DOMException): code = WRONG_DOCUMENT_ERR class InvalidCharacterErr(DOMException): code = INVALID_CHARACTER_ERR class NoDataAllowedErr(DOMException): code = NO_DATA_ALLOWED_ERR class NoModificationAllowedErr(DOMException): code = NO_MODIFICATION_ALLOWED_ERR class NotFoundErr(DOMException): code = NOT_FOUND_ERR class NotSupportedErr(DOMException): code = NOT_SUPPORTED_ERR class InuseAttributeErr(DOMException): code = INUSE_ATTRIBUTE_ERR class InvalidStateErr(DOMException): code = INVALID_STATE_ERR class SyntaxErr(DOMException): code = SYNTAX_ERR class InvalidModificationErr(DOMException): code = INVALID_MODIFICATION_ERR class NamespaceErr(DOMException): code = NAMESPACE_ERR class InvalidAccessErr(DOMException): code = INVALID_ACCESS_ERR class ValidationErr(DOMException): code = VALIDATION_ERR class UserDataHandler: """Class giving the operation constants for UserDataHandler.handle().""" # Based on DOM Level 3 (WD 9 April 2002) NODE_CLONED = 1 NODE_IMPORTED = 2 NODE_DELETED = 3 NODE_RENAMED = 4 XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace" XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/" XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" EMPTY_NAMESPACE = None EMPTY_PREFIX = None from .domreg import getDOMImplementation, registerDOMImplementation PKi#]HJ8 8 dom/domreg.pycnu[ {fc@sddZddlTddlZidd6dd6ZiZdZd Zdd d Zd Z dS( sRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.i(t*Nsxml.dom.minidomtminidomsxml.dom.DOMImplementationt4DOMcCs|t| Return 1 if the dom offers the featuresii(t hasFeature(tdomtfeaturestftv((s&/usr/lib64/python2.7/xml/dom/domreg.pyt _good_enough"scCs<ddl}d}tj|}|rIt|iidg}|jS|rZt|Stjj rd|j krtd|j dSt |t rt |}nx0tjD]"}|}t||r|SqWxQtjD]C}ytd|}Wntk rqnXt||r|SqWtddS(sSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.iNtgetDOMImplementationt PYTHON_DOMRs$no suitable DOM implementation found(tostNonetwell_known_implementationstgett __import__R Rtsystflagstignore_environmenttenviront isinstancet StringTypest_parse_feature_stringtvaluesR tkeyst StandardErrort ImportError(RR RtcreatortmodR((s&/usr/lib64/python2.7/xml/dom/domreg.pyR )s0     cCsg}|j}d}t|}x||kr||}|ddkr`td|fn|d}d}||kr||}|ddkr|d}|}qn|j||fq'Wt|S(Nit 0123456789sbad feature name: %ri(tsplittlent ValueErrorRtappendttuple(tsR tpartstitlengthtfeaturetversionR ((s&/usr/lib64/python2.7/xml/dom/domreg.pyRTs"        (( t__doc__txml.dom.minicompatRRRRR RR R(((s&/usr/lib64/python2.7/xml/dom/domreg.pyts    +PKi#][s#33dom/pulldom.pyonu[ {fc@sddlZddlZddlZyejejgZWnek rYejgZnXdZdZ dZ dZ dZ dZ dZd Zd ejjfd YZd dd YZdddYZdefdYZdZdddZddZdS(iNt START_ELEMENTt END_ELEMENTtCOMMENTtSTART_DOCUMENTt END_DOCUMENTtPROCESSING_INSTRUCTIONtIGNORABLE_WHITESPACEt CHARACTERStPullDOMcBseZdZdZddZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZRS(cCsddlm}||_ddg|_|j|_g|_|jj|_y|jj |_ Wnt k rrnXid|6g|_ |j d|_ g|_ dS(Ni(t XML_NAMESPACEtxml(txml.domR tdocumentFactorytNonet firstEventt lastEventt elementStacktappendtpushtpoptAttributeErrort _ns_contextst_current_contexttpending_events(tselfR R ((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt__init__s    cCs|jd}|jd=|S(Ni(R(Rtresult((s'/usr/lib64/python2.7/xml/dom/pulldom.pyR's  cCs ||_dS(N(t_locator(Rtlocator((s'/usr/lib64/python2.7/xml/dom/pulldom.pytsetDocumentLocator,scCsgt|dsg|_n|jj|p-d|f|jj|jj|pYd|j|((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt startElementvs  cCs3t|jfdg|jd<|jd|_dS(Ni(RRR R(RR3((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt endElementscCsm|jrG|jj|}t|fdg|jd<|jd|_n"t|fdg}|jj|dS(Ni(R)t createCommentRR RRR(RtsR:tevent((s'/usr/lib64/python2.7/xml/dom/pulldom.pytcomments  cCss|jrJ|jj||}t|fdg|jd<|jd|_n%t||fdg}|jj|dS(Ni(R)tcreateProcessingInstructionRR RRR(RttargettdataR:RE((s'/usr/lib64/python2.7/xml/dom/pulldom.pytprocessingInstructions  cCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)tcreateTextNodeRR R(RtcharsR:((s'/usr/lib64/python2.7/xml/dom/pulldom.pytignorableWhitespacescCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)RKRR R(RRLR:((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt charactersscCs7|jdkr3ddl}|jjjj|_ndS(Ni(R R txml.dom.minidomtdomtminidomtDocumenttimplementation(RR ((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt startDocuments c Cs8|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj ||}t|f|dtj||||jd}|jd}|j|dS(Nii(RRARRz(RR3R5RR((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRA/s  cCsBtj||||jdd}|jd}|j|dS(Niii(RRJRRRz(RRHRIR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRJ5s cCs?tj|||jdd}|jd}|j|dS(Niii(RRMRRRz(RRLR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRM;s cCs?tj|||jdd}|jd}|j|dS(Niii(RRNRRRz(RRLR:R((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRNAs (R^R_R?RARJRMRN(((s'/usr/lib64/python2.7/xml/dom/pulldom.pyR's     iiicCsd|dkrt}nt|tkr6t|}n|}|sTtjj}nt|||S(N( R tdefault_bufsizettypet _StringTypestopenR Rot make_parserRe(tstream_or_stringRhRiRg((s'/usr/lib64/python2.7/xml/dom/pulldom.pyRJs  cCsxyddlm}Wn!tk r7ddlm}nXt|}||}|shtjj}nt|||S(Ni(tStringIO(t cStringIORt ImportErrortlenR RoRRe(tstringRhRRiR((s'/usr/lib64/python2.7/xml/dom/pulldom.pyt parseStringUs   ((i@i?(txml.saxR txml.sax.handlerttypest StringTypet UnicodeTypeRRRRRRRRRRRotContentHandlerRR`ReRRR RR(((s'/usr/lib64/python2.7/xml/dom/pulldom.pyts*    U! PKi#]o;;dom/xmlbuilder.pyonu[ {fc@sdZddlZddlZddlmZdddgZdddYZddd YZd Z de fd YZ de fd YZ d ddYZ [dddYZdddYZdS(s4Implementation of the DOM Level 3 'LS-Load' feature.iN(t NodeFiltert DOMBuildertDOMEntityResolvertDOMInputSourcetOptionscBseZdZdZeZeZeZeZ eZ eZ eZ eZ eZeZeZeZeZeZeZeZdZdZRS(sFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. iN(t__name__t __module__t__doc__t namespacestTruetnamespace_declarationstFalset validationtexternal_parameter_entitiestexternal_general_entitiestexternal_dtd_subsettvalidate_if_schematvalidatetdatatype_normalizationtcreate_entity_ref_nodestentitiestwhitespace_in_element_contenttcdata_sectionstcommentstcharset_overrides_xml_encodingtinfosettsupported_mediatypes_onlytNonet errorHandlertfilter(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR s(c BseZd#Zd#Zd#ZdZdZdZdZ eeee fZ dZ dZ dZ dZdZd Zd Zd Zd Zd Zid$gd%6d&gd'6d(gd)6d*gd+6d,gd-6d.gd/6d0gd16d2gd36d4gd56d6gd76d8d9gd:6d;gd<6d=gd>6d?gd@6dAgdB6dCgdD6dEgdF6dGgdH6dIgdJ6dKgdL6gdM6dNdOdPdQdRdSdTdUdVg dW6dXgdY6dZgd[6d\gd]6ZdZdZd Zd!Zd"ZRS(^iiiicCst|_dS(N(Rt_options(tself((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt__init__9scCs|jS(N(tentityResolver(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_entityResolver<scCs ||_dS(N(R!(RR!((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_entityResolver>scCs|jS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_errorHandlerAscCs ||_dS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_errorHandlerCscCs|jS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_filterFscCs ||_dS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_filterHscCs|j|r|rdpd}y|jt||f}Wn*tk rjtjjd|fqXxF|D]\}}t|j||qrWntjj dt |dS(Niisunsupported feature: %rsunknown feature: ( tsupportsFeaturet _settingst _name_xformtKeyErrortxmltdomtNotSupportedErrtsetattrRt NotFoundErrtrepr(Rtnametstatetsettingstvalue((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt setFeatureKs  cCst|jt|S(N(thasattrRR*(RR2((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR(YscCs+t||rdpdf}||jkS(Nii(R*R)(RR2R3tkey((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt canSetFeature\sR iR RR RRRRRRRRRRRcCst|}yt|j|SWntk r|dkr|j}|jo|jo|jo|jo|jp|j p|j p|j p|j St jjdt|nXdS(NRsfeature %s not known(R*tgetattrRtAttributeErrorRRRRR RRRRR,R-R0R1(RR2txnametoptions((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt getFeatures             cCsC|jr!|jjd|}ntjd|}|j|S(N(R!t resolveEntityRRtparse(Rturitinput((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytparseURIs cCsytj|j}|j|_|j|_|j}|dkri|jriddl}|j|j}n|j ||S(Ni( tcopyRRRt byteStreamRtsystemIdturllib2turlopent_parse_bytestream(RRBR=tfpRG((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR@s    cCs.||jkrtdntddS(Nsnot a legal actionsHaven't written this yet...(t_legal_actionst ValueErrortNotImplementedError(RRBtcnodetaction((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytparseWithContextscCs.ddl}|jjj|}|j|S(Ni(txml.dom.expatbuilderR-t expatbuildert makeBuildert parseFile(RtstreamR=R,tbuilder((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRIs N(R i(R i(R i(R i(R i(R i(Ri(Ri(Ri(Ri(R i(R i(R i(R i(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(R i(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(Ri(RRRR!RRtACTION_REPLACEtACTION_APPEND_AS_CHILDRENtACTION_INSERT_AFTERtACTION_INSERT_BEFORERKR R"R#R$R%R&R'R6R(R9R)R>RCR@RPRI(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR,sv                                      cCs|jjddS(Nt-t_(tlowertreplace(R2((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR*scBs2eZdZdZdZdZdZRS(t_openerc Cst}||_||_|jj||_|j||_ddl}ddl }|j |}|\}}} } } } | r| j d r|j | d} ||| | | | f}|j ||_ n|S(Nit/(RtpublicIdRFt _get_openertopenREt_guess_media_encodingtencodingt posixpathturlparsetendswithtdirnamet urlunparsetbaseURI( RRaRFtsourceRfRgtpartstschemetnetloctpathtparamstquerytfragment((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR?s   cCs6y |jSWn$tk r1|j|_|jSXdS(N(R_R;t_create_opener(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRbs   cCsddl}|jS(Ni(RGt build_opener(RRG((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRts cCsb|jj}d|kr^x@|jD]/}|jdr(|jdddjSq(WndS(Ns Content-Typescharset=t=i(REtinfotgetplistt startswithtsplitR](RRlRwtparam((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRds  (R_(RRt __slots__R?RbRtRd(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRs    cBseZdZdZdZd Zd Zd Zd Zd Z dZ dZ dZ dZ dZdZdZdZRS(REtcharacterStreamt stringDataReRaRFRkcCsCd|_d|_d|_d|_d|_d|_d|_dS(N(RRER}R~ReRaRFRk(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR s      cCs|jS(N(RE(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_byteStream scCs ||_dS(N(RE(RRE((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_byteStreamscCs|jS(N(R}(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_characterStreamscCs ||_dS(N(R}(RR}((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_characterStreamscCs|jS(N(R~(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_stringDatascCs ||_dS(N(R~(Rtdata((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_set_stringDatascCs|jS(N(Re(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_encodingscCs ||_dS(N(Re(RRe((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_encodingscCs|jS(N(Ra(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_publicId!scCs ||_dS(N(Ra(RRa((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_publicId#scCs|jS(N(RF(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_systemId&scCs ||_dS(N(RF(RRF((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_systemId(scCs|jS(N(Rk(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_baseURI+scCs ||_dS(N(Rk(RRA((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_baseURI-s(RER}R~ReRaRFRk(RRR|R RRRRRRRRRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRs"             tDOMBuilderFiltercBsJeZdZdZdZdZdZejZ dZ dZ dZ RS(sSElement filter which can be used to tailor construction of a DOM instance. iiiicCs|jS(N(t whatToShow(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt_get_whatToShowBscCs|jS(N(t FILTER_ACCEPT(Rtelement((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt acceptNodeEscCs|jS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytstartContainerHs( RRRRt FILTER_REJECTt FILTER_SKIPtFILTER_INTERRUPTRtSHOW_ALLRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyR1s   t DocumentLScBsJeZdZeZdZdZdZdZdZ dZ RS(s=Mixin to create documents that conform to the load/save spec.cCstS(N(R (R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _get_asyncSscCs|rtjjdndS(Ns.asynchronous document loading is not supported(R,R-R.(Rtasync((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyt _set_asyncUs cCstddS(Ns'haven't figured out what this means yet(RM(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytabortZscCstddS(Nshaven't written this yet(RM(RRA((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytload`scCstddS(Nshaven't written this yet(RM(RRl((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytloadXMLcscCs@|dkr|}n!|j|k r6tjjn|jS(N(Rt ownerDocumentR,R-tWrongDocumentErrttoxml(Rtsnode((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytsaveXMLfs   ( RRRR RRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRNs     tDOMImplementationLScBs/eZdZdZdZdZdZRS(iicCsk|dk r!tjjdn||jkr7tS||jkr[tjjdntddS(NsschemaType not yet supporteds'asynchronous builders are not supportedsunknown value for mode(RR,R-R.tMODE_SYNCHRONOUSRtMODE_ASYNCHRONOUSRL(Rtmodet schemaType((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMBuilderrs     cCstddS(Ns-the writer interface hasn't been written yet!(RM(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMWriter}scCstS(N(R(R((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pytcreateDOMInputSources(RRRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyRns  ((((((RRDtxml.domR,txml.dom.NodeFilterRt__all__RRR*tobjectRRRRR(((s*/usr/lib64/python2.7/xml/dom/xmlbuilder.pyts    ,1 PKi#]mmtdom/NodeFilter.pynu[# This is the Python mapping for interface NodeFilter from # DOM2-Traversal-Range. It contains only constants. class NodeFilter: """ This is the DOM2 NodeFilter interface. It contains only constants. """ FILTER_ACCEPT = 1 FILTER_REJECT = 2 FILTER_SKIP = 3 SHOW_ALL = 0xFFFFFFFF SHOW_ELEMENT = 0x00000001 SHOW_ATTRIBUTE = 0x00000002 SHOW_TEXT = 0x00000004 SHOW_CDATA_SECTION = 0x00000008 SHOW_ENTITY_REFERENCE = 0x00000010 SHOW_ENTITY = 0x00000020 SHOW_PROCESSING_INSTRUCTION = 0x00000040 SHOW_COMMENT = 0x00000080 SHOW_DOCUMENT = 0x00000100 SHOW_DOCUMENT_TYPE = 0x00000200 SHOW_DOCUMENT_FRAGMENT = 0x00000400 SHOW_NOTATION = 0x00000800 def acceptNode(self, node): raise NotImplementedError PKi#]iOOdom/__init__.pycnu[ {fc@s:dZdd=dYZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefd YZd!efd"YZd#efd$YZd%efd&YZd'efd(YZd)efd*YZd+efd,YZd-efd.YZ d/efd0YZ!d1efd2YZ"d3efd4YZ#d5d>d6YZ$d7Z%d8Z&d9Z'd<Z)d<Z*d:d;l+m,Z,m-Z-d<S(?s W3C Document Object Model implementation for Python. The Python mapping of the Document Object Model is documented in the Python Library Reference in the section on the xml.dom package. This package contains the following modules: minidom -- A simple implementation of the Level 1 DOM with namespace support added (based on the Level 2 specification) and other minor Level 2 functionality. pulldom -- DOM builder supporting on-demand tree-building for selected subtrees of the document. tNodecBsVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( s$Class giving the NodeType constants.iiiiiiiii i i i (t__name__t __module__t__doc__t ELEMENT_NODEtATTRIBUTE_NODEt TEXT_NODEtCDATA_SECTION_NODEtENTITY_REFERENCE_NODEt ENTITY_NODEtPROCESSING_INSTRUCTION_NODEt COMMENT_NODEt DOCUMENT_NODEtDOCUMENT_TYPE_NODEtDOCUMENT_FRAGMENT_NODEt NOTATION_NODE(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRs iiiiiiiii i i i i iiit DOMExceptioncBs eZdZdZdZRS(smAbstract base class for DOM exceptions. Exceptions with specific codes are specializations of this class.cOs5|jtkrtdntj|||dS(Ns0DOMException should not be instantiated directly(t __class__Rt RuntimeErrort Exceptiont__init__(tselftargstkw((s(/usr/lib64/python2.7/xml/dom/__init__.pyRAs cCs|jS(N(tcode(R((s(/usr/lib64/python2.7/xml/dom/__init__.pyt _get_codeGs(RRRRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR=s t IndexSizeErrcBseZeZRS((RRtINDEX_SIZE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRKstDomstringSizeErrcBseZeZRS((RRtDOMSTRING_SIZE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRNstHierarchyRequestErrcBseZeZRS((RRtHIERARCHY_REQUEST_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyRQstWrongDocumentErrcBseZeZRS((RRtWRONG_DOCUMENT_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR TstInvalidCharacterErrcBseZeZRS((RRtINVALID_CHARACTER_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR"WstNoDataAllowedErrcBseZeZRS((RRtNO_DATA_ALLOWED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR$ZstNoModificationAllowedErrcBseZeZRS((RRtNO_MODIFICATION_ALLOWED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR&]st NotFoundErrcBseZeZRS((RRt NOT_FOUND_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR(`stNotSupportedErrcBseZeZRS((RRtNOT_SUPPORTED_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR*cstInuseAttributeErrcBseZeZRS((RRtINUSE_ATTRIBUTE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR,fstInvalidStateErrcBseZeZRS((RRtINVALID_STATE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR.ist SyntaxErrcBseZeZRS((RRt SYNTAX_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR0lstInvalidModificationErrcBseZeZRS((RRtINVALID_MODIFICATION_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR2ost NamespaceErrcBseZeZRS((RRt NAMESPACE_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR4rstInvalidAccessErrcBseZeZRS((RRtINVALID_ACCESS_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR6ust ValidationErrcBseZeZRS((RRtVALIDATION_ERRR(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR8xstUserDataHandlercBs&eZdZdZdZdZdZRS(sBClass giving the operation constants for UserDataHandler.handle().iiii(RRRt NODE_CLONEDt NODE_IMPORTEDt NODE_DELETEDt NODE_RENAMED(((s(/usr/lib64/python2.7/xml/dom/__init__.pyR:{s s$http://www.w3.org/XML/1998/namespaceshttp://www.w3.org/2000/xmlns/shttp://www.w3.org/1999/xhtmli(tgetDOMImplementationtregisterDOMImplementationN(((.RRRRRR!R#R%R'R)R+R-R/R1R3R5R7R9RRRRRR R"R$R&R(R*R,R.R0R2R4R6R8R:t XML_NAMESPACEtXMLNS_NAMESPACEtXHTML_NAMESPACEtNonetEMPTY_NAMESPACEt EMPTY_PREFIXtdomregR?R@(((s(/usr/lib64/python2.7/xml/dom/__init__.pytsR PKi#]xgmmdom/expatbuilder.pynu["""Facility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. """ # Warning! # # This module is tightly bound to the implementation details of the # minidom DOM and can't be used with other DOM implementations. This # is due, in part, to a lack of appropriate methods in the DOM (there is # no way to create Entity and Notation nodes via the DOM Level 2 # interface), and for performance. The latter is the cause of some fairly # cryptic code. # # Performance hacks: # # - .character_data_handler() has an extra case in which continuing # data is appended to an existing Text node; this can be a # speedup since pyexpat can break up character data into multiple # callbacks even though we set the buffer_text attribute on the # parser. This also gives us the advantage that we don't need a # separate normalization pass. # # - Determining that a node exists is done using an identity comparison # with None rather than a truth test; this avoids searching for and # calling any methods on the node object if it exists. (A rather # nice speedup is achieved this way as well!) from xml.dom import xmlbuilder, minidom, Node from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE from xml.parsers import expat from xml.dom.minidom import _append_child, _set_attribute_node from xml.dom.NodeFilter import NodeFilter TEXT_NODE = Node.TEXT_NODE CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE DOCUMENT_NODE = Node.DOCUMENT_NODE FILTER_ACCEPT = xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT FILTER_REJECT = xmlbuilder.DOMBuilderFilter.FILTER_REJECT FILTER_SKIP = xmlbuilder.DOMBuilderFilter.FILTER_SKIP FILTER_INTERRUPT = xmlbuilder.DOMBuilderFilter.FILTER_INTERRUPT theDOMImplementation = minidom.getDOMImplementation() # Expat typename -> TypeInfo _typeinfo_map = { "CDATA": minidom.TypeInfo(None, "cdata"), "ENUM": minidom.TypeInfo(None, "enumeration"), "ENTITY": minidom.TypeInfo(None, "entity"), "ENTITIES": minidom.TypeInfo(None, "entities"), "ID": minidom.TypeInfo(None, "id"), "IDREF": minidom.TypeInfo(None, "idref"), "IDREFS": minidom.TypeInfo(None, "idrefs"), "NMTOKEN": minidom.TypeInfo(None, "nmtoken"), "NMTOKENS": minidom.TypeInfo(None, "nmtokens"), } class ElementInfo(object): __slots__ = '_attr_info', '_model', 'tagName' def __init__(self, tagName, model=None): self.tagName = tagName self._attr_info = [] self._model = model def __getstate__(self): return self._attr_info, self._model, self.tagName def __setstate__(self, state): self._attr_info, self._model, self.tagName = state def getAttributeType(self, aname): for info in self._attr_info: if info[1] == aname: t = info[-2] if t[0] == "(": return _typeinfo_map["ENUM"] else: return _typeinfo_map[info[-2]] return minidom._no_type def getAttributeTypeNS(self, namespaceURI, localName): return minidom._no_type def isElementContent(self): if self._model: type = self._model[0] return type not in (expat.model.XML_CTYPE_ANY, expat.model.XML_CTYPE_MIXED) else: return False def isEmpty(self): if self._model: return self._model[0] == expat.model.XML_CTYPE_EMPTY else: return False def isId(self, aname): for info in self._attr_info: if info[1] == aname: return info[-2] == "ID" return False def isIdNS(self, euri, ename, auri, aname): # not sure this is meaningful return self.isId((auri, aname)) def _intern(builder, s): return builder._intern_setdefault(s, s) def _parse_ns_name(builder, name): assert ' ' in name parts = name.split(' ') intern = builder._intern_setdefault if len(parts) == 3: uri, localname, prefix = parts prefix = intern(prefix, prefix) qname = "%s:%s" % (prefix, localname) qname = intern(qname, qname) localname = intern(localname, localname) elif len(parts) == 2: uri, localname = parts prefix = EMPTY_PREFIX qname = localname = intern(localname, localname) else: raise ValueError("Unsupported syntax: spaces in URIs not supported: %r" % name) return intern(uri, uri), localname, prefix, qname class ExpatBuilder: """Document builder that uses Expat to build a ParsedXML.DOM document instance.""" def __init__(self, options=None): if options is None: options = xmlbuilder.Options() self._options = options if self._options.filter is not None: self._filter = FilterVisibilityController(self._options.filter) else: self._filter = None # This *really* doesn't do anything in this case, so # override it with something fast & minimal. self._finish_start_element = id self._parser = None self.reset() def createParser(self): """Create a new parser object.""" return expat.ParserCreate() def getParser(self): """Return the parser object, creating a new one if needed.""" if not self._parser: self._parser = self.createParser() self._intern_setdefault = self._parser.intern.setdefault self._parser.buffer_text = True self._parser.ordered_attributes = True self._parser.specified_attributes = True self.install(self._parser) return self._parser def reset(self): """Free all data structures used during DOM construction.""" self.document = theDOMImplementation.createDocument( EMPTY_NAMESPACE, None, None) self.curNode = self.document self._elem_info = self.document._elem_info self._cdata = False def install(self, parser): """Install the callbacks needed to build the DOM into the parser.""" # This creates circular references! parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler parser.StartElementHandler = self.first_element_handler parser.EndElementHandler = self.end_element_handler parser.ProcessingInstructionHandler = self.pi_handler if self._options.entities: parser.EntityDeclHandler = self.entity_decl_handler parser.NotationDeclHandler = self.notation_decl_handler if self._options.comments: parser.CommentHandler = self.comment_handler if self._options.cdata_sections: parser.StartCdataSectionHandler = self.start_cdata_section_handler parser.EndCdataSectionHandler = self.end_cdata_section_handler parser.CharacterDataHandler = self.character_data_handler_cdata else: parser.CharacterDataHandler = self.character_data_handler parser.ExternalEntityRefHandler = self.external_entity_ref_handler parser.XmlDeclHandler = self.xml_decl_handler parser.ElementDeclHandler = self.element_decl_handler parser.AttlistDeclHandler = self.attlist_decl_handler def parseFile(self, file): """Parse a document from a file object, returning the document node.""" parser = self.getParser() first_buffer = True try: while buffer := file.read(16*1024): parser.Parse(buffer, False) if first_buffer and self.document.documentElement: self._setup_subset(buffer) first_buffer = False parser.Parse(b"", True) except ParseEscape: pass doc = self.document self.reset() self._parser = None return doc def parseString(self, string): """Parse a document from a string, returning the document node.""" parser = self.getParser() try: parser.Parse(string, True) self._setup_subset(string) except ParseEscape: pass doc = self.document self.reset() self._parser = None return doc def _setup_subset(self, buffer): """Load the internal subset if there might be one.""" if self.document.doctype: extractor = InternalSubsetExtractor() extractor.parseString(buffer) subset = extractor.getSubset() self.document.doctype.internalSubset = subset def start_doctype_decl_handler(self, doctypeName, systemId, publicId, has_internal_subset): doctype = self.document.implementation.createDocumentType( doctypeName, publicId, systemId) doctype.ownerDocument = self.document _append_child(self.document, doctype) self.document.doctype = doctype if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT: self.document.doctype = None del self.document.childNodes[-1] doctype = None self._parser.EntityDeclHandler = None self._parser.NotationDeclHandler = None if has_internal_subset: if doctype is not None: doctype.entities._seq = [] doctype.notations._seq = [] self._parser.CommentHandler = None self._parser.ProcessingInstructionHandler = None self._parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler def end_doctype_decl_handler(self): if self._options.comments: self._parser.CommentHandler = self.comment_handler self._parser.ProcessingInstructionHandler = self.pi_handler if not (self._elem_info or self._filter): self._finish_end_element = id def pi_handler(self, target, data): node = self.document.createProcessingInstruction(target, data) _append_child(self.curNode, node) if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: self.curNode.removeChild(node) def character_data_handler_cdata(self, data): childNodes = self.curNode.childNodes if self._cdata: if ( self._cdata_continue and childNodes[-1].nodeType == CDATA_SECTION_NODE): childNodes[-1].appendData(data) return node = self.document.createCDATASection(data) self._cdata_continue = True elif childNodes and childNodes[-1].nodeType == TEXT_NODE: node = childNodes[-1] value = node.data + data node.data = value return else: node = minidom.Text() node.data = data node.ownerDocument = self.document _append_child(self.curNode, node) def character_data_handler(self, data): childNodes = self.curNode.childNodes if childNodes and childNodes[-1].nodeType == TEXT_NODE: node = childNodes[-1] node.data = node.data + data return node = minidom.Text() node.data = node.data + data node.ownerDocument = self.document _append_child(self.curNode, node) def entity_decl_handler(self, entityName, is_parameter_entity, value, base, systemId, publicId, notationName): if is_parameter_entity: # we don't care about parameter entities for the DOM return if not self._options.entities: return node = self.document._create_entity(entityName, publicId, systemId, notationName) if value is not None: # internal entity # node *should* be readonly, but we'll cheat child = self.document.createTextNode(value) node.childNodes.append(child) self.document.doctype.entities._seq.append(node) if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: del self.document.doctype.entities._seq[-1] def notation_decl_handler(self, notationName, base, systemId, publicId): node = self.document._create_notation(notationName, publicId, systemId) self.document.doctype.notations._seq.append(node) if self._filter and self._filter.acceptNode(node) == FILTER_ACCEPT: del self.document.doctype.notations._seq[-1] def comment_handler(self, data): node = self.document.createComment(data) _append_child(self.curNode, node) if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: self.curNode.removeChild(node) def start_cdata_section_handler(self): self._cdata = True self._cdata_continue = False def end_cdata_section_handler(self): self._cdata = False self._cdata_continue = False def external_entity_ref_handler(self, context, base, systemId, publicId): return 1 def first_element_handler(self, name, attributes): if self._filter is None and not self._elem_info: self._finish_end_element = id self.getParser().StartElementHandler = self.start_element_handler self.start_element_handler(name, attributes) def start_element_handler(self, name, attributes): node = self.document.createElement(name) _append_child(self.curNode, node) self.curNode = node if attributes: for i in range(0, len(attributes), 2): a = minidom.Attr(attributes[i], EMPTY_NAMESPACE, None, EMPTY_PREFIX) value = attributes[i+1] a.value = value a.ownerDocument = self.document _set_attribute_node(node, a) if node is not self.document.documentElement: self._finish_start_element(node) def _finish_start_element(self, node): if self._filter: # To be general, we'd have to call isSameNode(), but this # is sufficient for minidom: if node is self.document.documentElement: return filt = self._filter.startContainer(node) if filt == FILTER_REJECT: # ignore this node & all descendents Rejecter(self) elif filt == FILTER_SKIP: # ignore this node, but make it's children become # children of the parent node Skipper(self) else: return self.curNode = node.parentNode node.parentNode.removeChild(node) node.unlink() # If this ever changes, Namespaces.end_element_handler() needs to # be changed to match. # def end_element_handler(self, name): curNode = self.curNode self.curNode = curNode.parentNode self._finish_end_element(curNode) def _finish_end_element(self, curNode): info = self._elem_info.get(curNode.tagName) if info: self._handle_white_text_nodes(curNode, info) if self._filter: if curNode is self.document.documentElement: return if self._filter.acceptNode(curNode) == FILTER_REJECT: self.curNode.removeChild(curNode) curNode.unlink() def _handle_white_text_nodes(self, node, info): if (self._options.whitespace_in_element_content or not info.isElementContent()): return # We have element type information and should remove ignorable # whitespace; identify for text nodes which contain only # whitespace. L = [] for child in node.childNodes: if child.nodeType == TEXT_NODE and not child.data.strip(): L.append(child) # Remove ignorable whitespace from the tree. for child in L: node.removeChild(child) def element_decl_handler(self, name, model): info = self._elem_info.get(name) if info is None: self._elem_info[name] = ElementInfo(name, model) else: assert info._model is None info._model = model def attlist_decl_handler(self, elem, name, type, default, required): info = self._elem_info.get(elem) if info is None: info = ElementInfo(elem) self._elem_info[elem] = info info._attr_info.append( [None, name, None, None, default, 0, type, required]) def xml_decl_handler(self, version, encoding, standalone): self.document.version = version self.document.encoding = encoding # This is still a little ugly, thanks to the pyexpat API. ;-( if standalone >= 0: if standalone: self.document.standalone = True else: self.document.standalone = False # Don't include FILTER_INTERRUPT, since that's checked separately # where allowed. _ALLOWED_FILTER_RETURNS = (FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP) class FilterVisibilityController(object): """Wrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.""" __slots__ = 'filter', def __init__(self, filter): self.filter = filter def startContainer(self, node): mask = self._nodetype_mask[node.nodeType] if self.filter.whatToShow & mask: val = self.filter.startContainer(node) if val == FILTER_INTERRUPT: raise ParseEscape if val not in _ALLOWED_FILTER_RETURNS: raise ValueError( "startContainer() returned illegal value: " + repr(val)) return val else: return FILTER_ACCEPT def acceptNode(self, node): mask = self._nodetype_mask[node.nodeType] if self.filter.whatToShow & mask: val = self.filter.acceptNode(node) if val == FILTER_INTERRUPT: raise ParseEscape if val == FILTER_SKIP: # move all child nodes to the parent, and remove this node parent = node.parentNode for child in node.childNodes[:]: parent.appendChild(child) # node is handled by the caller return FILTER_REJECT if val not in _ALLOWED_FILTER_RETURNS: raise ValueError( "acceptNode() returned illegal value: " + repr(val)) return val else: return FILTER_ACCEPT _nodetype_mask = { Node.ELEMENT_NODE: NodeFilter.SHOW_ELEMENT, Node.ATTRIBUTE_NODE: NodeFilter.SHOW_ATTRIBUTE, Node.TEXT_NODE: NodeFilter.SHOW_TEXT, Node.CDATA_SECTION_NODE: NodeFilter.SHOW_CDATA_SECTION, Node.ENTITY_REFERENCE_NODE: NodeFilter.SHOW_ENTITY_REFERENCE, Node.ENTITY_NODE: NodeFilter.SHOW_ENTITY, Node.PROCESSING_INSTRUCTION_NODE: NodeFilter.SHOW_PROCESSING_INSTRUCTION, Node.COMMENT_NODE: NodeFilter.SHOW_COMMENT, Node.DOCUMENT_NODE: NodeFilter.SHOW_DOCUMENT, Node.DOCUMENT_TYPE_NODE: NodeFilter.SHOW_DOCUMENT_TYPE, Node.DOCUMENT_FRAGMENT_NODE: NodeFilter.SHOW_DOCUMENT_FRAGMENT, Node.NOTATION_NODE: NodeFilter.SHOW_NOTATION, } class FilterCrutch(object): __slots__ = '_builder', '_level', '_old_start', '_old_end' def __init__(self, builder): self._level = 0 self._builder = builder parser = builder._parser self._old_start = parser.StartElementHandler self._old_end = parser.EndElementHandler parser.StartElementHandler = self.start_element_handler parser.EndElementHandler = self.end_element_handler class Rejecter(FilterCrutch): __slots__ = () def __init__(self, builder): FilterCrutch.__init__(self, builder) parser = builder._parser for name in ("ProcessingInstructionHandler", "CommentHandler", "CharacterDataHandler", "StartCdataSectionHandler", "EndCdataSectionHandler", "ExternalEntityRefHandler", ): setattr(parser, name, None) def start_element_handler(self, *args): self._level = self._level + 1 def end_element_handler(self, *args): if self._level == 0: # restore the old handlers parser = self._builder._parser self._builder.install(parser) parser.StartElementHandler = self._old_start parser.EndElementHandler = self._old_end else: self._level = self._level - 1 class Skipper(FilterCrutch): __slots__ = () def start_element_handler(self, *args): node = self._builder.curNode self._old_start(*args) if self._builder.curNode is not node: self._level = self._level + 1 def end_element_handler(self, *args): if self._level == 0: # We're popping back out of the node we're skipping, so we # shouldn't need to do anything but reset the handlers. self._builder._parser.StartElementHandler = self._old_start self._builder._parser.EndElementHandler = self._old_end self._builder = None else: self._level = self._level - 1 self._old_end(*args) # framework document used by the fragment builder. # Takes a string for the doctype, subset string, and namespace attrs string. _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = \ "http://xml.python.org/entities/fragment-builder/internal" _FRAGMENT_BUILDER_TEMPLATE = ( '''\ %%s ]> &fragment-builder-internal;''' % _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID) class FragmentBuilder(ExpatBuilder): """Builder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. """ def __init__(self, context, options=None): if context.nodeType == DOCUMENT_NODE: self.originalDocument = context self.context = context else: self.originalDocument = context.ownerDocument self.context = context ExpatBuilder.__init__(self, options) def reset(self): ExpatBuilder.reset(self) self.fragment = None def parseFile(self, file): """Parse a document fragment from a file object, returning the fragment node.""" return self.parseString(file.read()) def parseString(self, string): """Parse a document fragment from a string, returning the fragment node.""" self._source = string parser = self.getParser() doctype = self.originalDocument.doctype ident = "" if doctype: subset = doctype.internalSubset or self._getDeclarations() if doctype.publicId: ident = ('PUBLIC "%s" "%s"' % (doctype.publicId, doctype.systemId)) elif doctype.systemId: ident = 'SYSTEM "%s"' % doctype.systemId else: subset = "" nsattrs = self._getNSattrs() # get ns decls from node's ancestors document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs) try: parser.Parse(document, True) except: self.reset() raise fragment = self.fragment self.reset() ## self._parser = None return fragment def _getDeclarations(self): """Re-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. """ doctype = self.context.ownerDocument.doctype s = "" if doctype: for i in range(doctype.notations.length): notation = doctype.notations.item(i) if s: s = s + "\n " s = "%s' \ % (s, notation.publicId, notation.systemId) else: s = '%s SYSTEM "%s">' % (s, notation.systemId) for i in range(doctype.entities.length): entity = doctype.entities.item(i) if s: s = s + "\n " s = "%s" return s def _getNSattrs(self): return "" def external_entity_ref_handler(self, context, base, systemId, publicId): if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID: # this entref is the one that we made to put the subtree # in; all of our given input is parsed in here. old_document = self.document old_cur_node = self.curNode parser = self._parser.ExternalEntityParserCreate(context) # put the real document back, parse into the fragment to return self.document = self.originalDocument self.fragment = self.document.createDocumentFragment() self.curNode = self.fragment try: parser.Parse(self._source, True) finally: self.curNode = old_cur_node self.document = old_document self._source = None return -1 else: return ExpatBuilder.external_entity_ref_handler( self, context, base, systemId, publicId) class Namespaces: """Mix-in class for builders; adds support for namespaces.""" def _initNamespaces(self): # list of (prefix, uri) ns declarations. Namespace attrs are # constructed from this and added to the element's attrs. self._ns_ordered_prefixes = [] def createParser(self): """Create a new namespace-handling parser.""" parser = expat.ParserCreate(namespace_separator=" ") parser.namespace_prefixes = True return parser def install(self, parser): """Insert the namespace-handlers onto the parser.""" ExpatBuilder.install(self, parser) if self._options.namespace_declarations: parser.StartNamespaceDeclHandler = ( self.start_namespace_decl_handler) def start_namespace_decl_handler(self, prefix, uri): """Push this namespace declaration on our storage.""" self._ns_ordered_prefixes.append((prefix, uri)) def start_element_handler(self, name, attributes): if ' ' in name: uri, localname, prefix, qname = _parse_ns_name(self, name) else: uri = EMPTY_NAMESPACE qname = name localname = None prefix = EMPTY_PREFIX node = minidom.Element(qname, uri, prefix, localname) node.ownerDocument = self.document _append_child(self.curNode, node) self.curNode = node if self._ns_ordered_prefixes: for prefix, uri in self._ns_ordered_prefixes: if prefix: a = minidom.Attr(_intern(self, 'xmlns:' + prefix), XMLNS_NAMESPACE, prefix, "xmlns") else: a = minidom.Attr("xmlns", XMLNS_NAMESPACE, "xmlns", EMPTY_PREFIX) a.value = uri a.ownerDocument = self.document _set_attribute_node(node, a) del self._ns_ordered_prefixes[:] if attributes: node._ensure_attributes() _attrs = node._attrs _attrsNS = node._attrsNS for i in range(0, len(attributes), 2): aname = attributes[i] value = attributes[i+1] if ' ' in aname: uri, localname, prefix, qname = _parse_ns_name(self, aname) a = minidom.Attr(qname, uri, localname, prefix) _attrs[qname] = a _attrsNS[(uri, localname)] = a else: a = minidom.Attr(aname, EMPTY_NAMESPACE, aname, EMPTY_PREFIX) _attrs[aname] = a _attrsNS[(EMPTY_NAMESPACE, aname)] = a a.ownerDocument = self.document a.value = value a.ownerElement = node if __debug__: # This only adds some asserts to the original # end_element_handler(), so we only define this when -O is not # used. If changing one, be sure to check the other to see if # it needs to be changed as well. # def end_element_handler(self, name): curNode = self.curNode if ' ' in name: uri, localname, prefix, qname = _parse_ns_name(self, name) assert (curNode.namespaceURI == uri and curNode.localName == localname and curNode.prefix == prefix), \ "element stack messed up! (namespace)" else: assert curNode.nodeName == name, \ "element stack messed up - bad nodeName" assert curNode.namespaceURI == EMPTY_NAMESPACE, \ "element stack messed up - bad namespaceURI" self.curNode = curNode.parentNode self._finish_end_element(curNode) class ExpatBuilderNS(Namespaces, ExpatBuilder): """Document builder that supports namespaces.""" def reset(self): ExpatBuilder.reset(self) self._initNamespaces() class FragmentBuilderNS(Namespaces, FragmentBuilder): """Fragment builder that supports namespaces.""" def reset(self): FragmentBuilder.reset(self) self._initNamespaces() def _getNSattrs(self): """Return string of namespace attributes from this element and ancestors.""" # XXX This needs to be re-written to walk the ancestors of the # context to build up the namespace information from # declarations, elements, and attributes found in context. # Otherwise we have to store a bunch more data on the DOM # (though that *might* be more reliable -- not clear). attrs = "" context = self.context L = [] while context: if hasattr(context, '_ns_prefix_uri'): for prefix, uri in context._ns_prefix_uri.items(): # add every new NS decl from context to L and attrs string if prefix in L: continue L.append(prefix) if prefix: declname = "xmlns:" + prefix else: declname = "xmlns" if attrs: attrs = "%s\n %s='%s'" % (attrs, declname, uri) else: attrs = " %s='%s'" % (declname, uri) context = context.parentNode return attrs class ParseEscape(Exception): """Exception raised to short-circuit parsing in InternalSubsetExtractor.""" pass class InternalSubsetExtractor(ExpatBuilder): """XML processor which can rip out the internal document type subset.""" subset = None def getSubset(self): """Return the internal subset as a string.""" return self.subset def parseFile(self, file): try: ExpatBuilder.parseFile(self, file) except ParseEscape: pass def parseString(self, string): try: ExpatBuilder.parseString(self, string) except ParseEscape: pass def install(self, parser): parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler parser.StartElementHandler = self.start_element_handler def start_doctype_decl_handler(self, name, publicId, systemId, has_internal_subset): if has_internal_subset: parser = self.getParser() self.subset = [] parser.DefaultHandler = self.subset.append parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler else: raise ParseEscape() def end_doctype_decl_handler(self): s = ''.join(self.subset).replace('\r\n', '\n').replace('\r', '\n') self.subset = s raise ParseEscape() def start_element_handler(self, name, attrs): raise ParseEscape() def parse(file, namespaces=True): """Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. """ if namespaces: builder = ExpatBuilderNS() else: builder = ExpatBuilder() if isinstance(file, str): with open(file, 'rb') as fp: result = builder.parseFile(fp) else: result = builder.parseFile(file) return result def parseString(string, namespaces=True): """Parse a document from a string, returning the resulting Document node. """ if namespaces: builder = ExpatBuilderNS() else: builder = ExpatBuilder() return builder.parseString(string) def parseFragment(file, context, namespaces=True): """Parse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. """ if namespaces: builder = FragmentBuilderNS(context) else: builder = FragmentBuilder(context) if isinstance(file, str): with open(file, 'rb') as fp: result = builder.parseFile(fp) else: result = builder.parseFile(file) return result def parseFragmentString(string, context, namespaces=True): """Parse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. """ if namespaces: builder = FragmentBuilderNS(context) else: builder = FragmentBuilder(context) return builder.parseString(string) def makeBuilder(options): """Create a builder based on an Options object.""" if options.namespaces: return ExpatBuilderNS(options) else: return ExpatBuilder(options) PKi#]VYf f dom/minicompat.pycnu[ {fc@sdZddddgZddlZyeWn ek rNedfZnXedeedfZdefdYZ de fd YZ d Z dS( s1Python version compatibility support for minidom.tNodeListt EmptyNodeListt StringTypest defpropertyiNtcBsGeZdZdZdZdZeeeddZdZRS(cCs.d|kot|knr*||SdS(Ni(tlen(tselftindex((s*/usr/lib64/python2.7/xml/dom/minicompat.pytitem6s"cCs t|S(N(R(R((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt _get_length:scCstjjddS(Ns.attempt to modify read-only attribute 'length'(txmltdomtNoModificationAllowedErr(Rtvalue((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt _set_length=s tdocs$The number of nodes in the NodeList.cCs |dkrg}n||(dS(N(tNone(Rtstate((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt __setstate__Es  (( t__name__t __module__t __slots__RR RtpropertytlengthR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR3s     cBsPeZdZdZdZdZdZdZeeeddZ RS(cCst}|j||S(N(Rtextend(RtothertNL((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt__add__Ns  cCst}|j||S(N(RR(RRR((s*/usr/lib64/python2.7/xml/dom/minicompat.pyt__radd__Ss  cCsdS(N(R(RR((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRXscCsdS(Ni((R((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR [scCstjjddS(Ns.attempt to modify read-only attribute 'length'(R R R (RR ((s*/usr/lib64/python2.7/xml/dom/minicompat.pyR^s Rs$The number of nodes in the NodeList.(( RRRRRRR RRR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRKs      cCsot|d|j}|d}t|d| sFtd|t||d|}t|||dS(Nt_get_cSs tjjdt|dS(Ns&attempt to modify read-only attribute (R R R trepr(RR tname((s*/usr/lib64/python2.7/xml/dom/minicompat.pytseths t_set_sexpected not to find _set_R(tgetattrtim_functhasattrtAssertionErrorRtsetattr(tklassRRtgetR tprop((s*/usr/lib64/python2.7/xml/dom/minicompat.pyRfs   ( t__doc__t__all__txml.domR tunicodet NameErrorttypeRtlistRttupleRR(((s*/usr/lib64/python2.7/xml/dom/minicompat.pyts&  PKi#]hjsax/__init__.pyonu[ {fc@sjdZddlmZddlmZmZddlmZmZm Z m Z m Z edZ edZ dgZdZerdd lZndd lZdd lZejj rd ejkrejd jd Zn[d Zejd dkr/ejjer/ejjejd ZngdZejd dkrZdZn dZ[d S(sSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. i(t InputSource(tContentHandlert ErrorHandler(t SAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t}|j||j||j|dS(N(t make_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlert errorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyR s   cCsyddlm}Wn!tk r7ddlm}nX|dkrPt}nt}|j||j|t}|j |||j |dS(Ni(tStringIO( t cStringIORt ImportErrortNoneRRR R Rt setByteStreamR (tstringR RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pyt parseString#s       sxml.sax.expatreaderiNt PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|SWq tk rU}ddl}||jkrfqfq tk req Xq WtdddS(s&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.iNsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(t parser_listt parser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs   cCs2ddlm}|j|dt}|jS(Ni(timpi(torg.python.coreR"t importNametglobalst create_parser(R R"t drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg}|jS(NR&(t __import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t xmlreaderRR RRt _exceptionsRRRRRR RRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistryt containsKeyt getPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyts*( %   PKi#]99sax/saxutils.pyonu[ {fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej ej gZ Wne k rej gZ nXdZ idZidZidZdZdejfd YZd ejfd YZd ejfd YZddZdS(snA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. iNcCs3x,|jD]\}}|j||}q W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd}|jdd}|jdd}|rNt||}n|S(sEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. t&s&t>s>t in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. s s s s s s t"t's"%s"s"s'%s'(tcopytupdateR R(R R ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt quoteattr5s "    cCs|dkr$ddl}|j}nt|tjrTtj|}d|_nTtj}d|_|j |_ y|j |_ |j |_ Wnt k rnXt |d|ddddS( NicSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pytVtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines (Rtsyststdoutt isinstancetiot RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"        R'cBseZdZRS(cCs$tt|j||jdS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t __module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jst XMLGeneratorcBseZdddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(s iso-8859-1cCsitjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ dS(Ni( thandlertContentHandlert__init__R*R#t_writeR,t_flusht _ns_contextst_current_contextt_undeclared_ns_mapst _encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs    cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s  cCs|jd|jdS(Nu$ (R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startDocuments cCs|jdS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endDocumentscCs@|jj|jj||j|<|jj||fdS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMappings cCs|jd|_|jd=dS(Ni(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMappingscCs\|jd|x7|jD])\}}|jd|t|fqW|jddS(Nu(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startElements!cCs|jd|dS(Nu(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementscCs|jd|j|xH|jD]=\}}|rP|jd||fq$|jd|q$Wg|_x@|jD]2\}}|jd|j|t|fq{W|jddS(Nu(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNSs *cCs|jd|j|dS(Nu(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementNSscCs;t|ts$t||j}n|jt|dS(N(RtunicodeR9R4R (R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt charactersscCs5t|ts$t||j}n|j|dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespacescCs|jd||fdS(Nu (R4(R-ttargetR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstructionsN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps           t XMLFilterBasecBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.cCstjj|||_dS(N(t xmlreadert XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3scCs|jj|dS(N(t _err_handlerterror(R-t exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRVscCs|jj|dS(N(RUt fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRXscCs|jj|dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRYscCs|jj|dS(N(t _cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[scCs|jjdS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>scCs|jjdS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?scCs|jj||dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRBscCs|jj|dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRCscCs|jj||dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyREscCs|jj|dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRFscCs|jj|||dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRHscCs|jj||dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRIscCs|jj|dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRLscCs|jj|dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRMscCs|jj||dS(N(RZRO(R-RNR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|dS(N(RZt skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||dS(N(t _dtd_handlert notationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR` scCs|jj||||dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRc scCs|jj||S(N(t _ent_handlert resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj||jj||jj||jj||jj|dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks cCs|jj|dS(N(RSt setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|S(N(RSt getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||dS(N(RSt setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|S(N(RSt getProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||dS(N(RSt setProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt getParent.scCs ||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRPs:                           RcCst|tkr$tj|}nSt|drw|}tj}|j|t|drw|j|jqwn|jdkry|j }t j j t j j|}tj}t|trt|tsdy|j|}Wqtk r|j|}qXqdnHt|trdy|j|}Wqdtk r`|j|}qdXnt j j||}t j j|}Wntk rt}nX|r|j|t|d}n4|jtj||j tj|j }|j|n|S(sThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet _StringTypesRQt InputSourcethasattrt setByteStreamt setSystemIdR;t getByteStreamRt getSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfilet UnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt sysidfilenameR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF         (RvRRRttypesRRR1RQt StringTypet UnicodeTypeRzR&RR R RR*t TextIOWrapperR'R2R0RRRPR(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyts$0          WoPKi#]99sax/saxutils.pycnu[ {fc@s-dZddlZddlZddlZddlZddlZddlZddlZddlZyej ej gZ Wne k rej gZ nXdZ idZidZidZdZdejfd YZd ejfd YZd ejfd YZddZdS(snA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. iNcCs3x,|jD]\}}|j||}q W|S(s2Replace substrings of a string using a dictionary.(titemstreplace(tstdtkeytvalue((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt__dict_replacescCsR|jdd}|jdd}|jdd}|rNt||}n|S(sEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. t&s&t>s>t in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. s s s s s s t"t's"%s"s"s'%s'(tcopytupdateR R(R R ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt quoteattr5s "    cCs|dkr$ddl}|j}nt|tjrTtj|}d|_nTtj}d|_|j |_ y|j |_ |j |_ Wnt k rnXt |d|ddddS( NicSsdS(N(tNone(((s(/usr/lib64/python2.7/xml/sax/saxutils.pytVtcSstS(N(tTrue(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[Rtencodingterrorstxmlcharrefreplacetnewlines (Rtsyststdoutt isinstancetiot RawIOBasetBufferedIOBasetclosetwritabletwritetseekablettelltAttributeErrort_UnbufferedTextIOWrapper(toutRRtbuffer((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_gettextwriterMs"        R'cBseZdZRS(cCs$tt|j||jdS(N(tsuperR'R#tflush(tselfR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR#ks(t__name__t __module__R#(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR'jst XMLGeneratorcBseZdddZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(s iso-8859-1cCsitjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ dS(Ni( thandlertContentHandlert__init__R*R#t_writeR,t_flusht _ns_contextst_current_contextt_undeclared_ns_mapst _encoding(R-R(R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3rs    cCsX|drPd|dkr&d|dS|j|d}|rP|d|dSn|dS(s7Builds a qualified name from a (ns_url, localname) pairis$http://www.w3.org/XML/1998/namespacesxml:it:(R7(R-tnametprefix((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt_qname|s  cCs|jd|jdS(Nu$ (R4R9(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startDocuments cCs|jdS(N(R5(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endDocumentscCs@|jj|jj||j|<|jj||fdS(N(R6tappendR7RR8(R-R<turi((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartPrefixMappings cCs|jd|_|jd=dS(Ni(R6R7(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pytendPrefixMappingscCs\|jd|x7|jD])\}}|jd|t|fqW|jddS(Nu(R4RR(R-R;tattrsR((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt startElements!cCs|jd|dS(Nu(R4(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementscCs|jd|j|xH|jD]=\}}|rP|jd||fq$|jd|q$Wg|_x@|jD]2\}}|jd|j|t|fq{W|jddS(Nu(R4R=R8RR(R-R;tqnameRDR<RAR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytstartElementNSs *cCs|jd|j|dS(Nu(R4R=(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt endElementNSscCs;t|ts$t||j}n|jt|dS(N(RtunicodeR9R4R (R-tcontent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt charactersscCs5t|ts$t||j}n|j|dS(N(RRJR9R4(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pytignorableWhitespacescCs|jd||fdS(Nu (R4(R-ttargetR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprocessingInstructionsN(R.R/RR3R=R>R?RBRCRERFRHRIRLRMRO(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR0ps           t XMLFilterBasecBs eZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.cCstjj|||_dS(N(t xmlreadert XMLReaderR3t_parent(R-tparent((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR3scCs|jj|dS(N(t _err_handlerterror(R-t exception((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRVscCs|jj|dS(N(RUt fatalError(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRXscCs|jj|dS(N(RUtwarning(R-RW((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRYscCs|jj|dS(N(t _cont_handlertsetDocumentLocator(R-tlocator((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR[scCs|jjdS(N(RZR>(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR>scCs|jjdS(N(RZR?(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR?scCs|jj||dS(N(RZRB(R-R<RA((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRBscCs|jj|dS(N(RZRC(R-R<((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRCscCs|jj||dS(N(RZRE(R-R;RD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyREscCs|jj|dS(N(RZRF(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRFscCs|jj|||dS(N(RZRH(R-R;RGRD((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRHscCs|jj||dS(N(RZRI(R-R;RG((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRIscCs|jj|dS(N(RZRL(R-RK((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRLscCs|jj|dS(N(RZRM(R-tchars((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRMscCs|jj||dS(N(RZRO(R-RNR ((s(/usr/lib64/python2.7/xml/sax/saxutils.pyROscCs|jj|dS(N(RZt skippedEntity(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR^scCs|jj|||dS(N(t _dtd_handlert notationDecl(R-R;tpublicIdtsystemId((s(/usr/lib64/python2.7/xml/sax/saxutils.pyR` scCs|jj||||dS(N(R_tunparsedEntityDecl(R-R;RaRbtndata((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRc scCs|jj||S(N(t _ent_handlert resolveEntity(R-RaRb((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRfscCsT|jj||jj||jj||jj||jj|dS(N(RStsetContentHandlertsetErrorHandlertsetEntityResolvert setDTDHandlertparse(R-tsource((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRks cCs|jj|dS(N(RSt setLocale(R-tlocale((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRmscCs|jj|S(N(RSt getFeature(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRo scCs|jj||dS(N(RSt setFeature(R-R;tstate((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRp#scCs|jj|S(N(RSt getProperty(R-R;((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRr&scCs|jj||dS(N(RSt setProperty(R-R;R((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRs)scCs|jS(N(RS(R-((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt getParent.scCs ||_dS(N(RS(R-RT((s(/usr/lib64/python2.7/xml/sax/saxutils.pyt setParent1sN( R.R/t__doc__RR3RVRXRYR[R>R?RBRCRERFRHRIRLRMROR^R`RcRfRkRmRoRpRrRsRtRu(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyRPs:                           RcCst|tkr$tj|}nSt|drw|}tj}|j|t|drw|j|jqwn|jdkry|j }t j j t j j|}tj}t|trt|tsdy|j|}Wqtk r|j|}qXqdnHt|trdy|j|}Wqdtk r`|j|}qdXnt j j||}t j j|}Wntk rt}nX|r|j|t|d}n4|jtj||j tj|j }|j|n|S(sThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.treadR;trbN(ttypet _StringTypesRQt InputSourcethasattrt setByteStreamt setSystemIdR;t getByteStreamRt getSystemIdtostpathtdirnametnormpathRtgetfilesystemencodingRRJtdecodetUnicodeDecodeErrortencodetjointisfilet UnicodeErrortFalsetopenturlparseturljointurllibturlopen(RltbasetftsysidtbaseheadRt sysidfilenameR((s(/usr/lib64/python2.7/xml/sax/saxutils.pytprepare_input_source6sF         (RvRRRttypesRRR1RQt StringTypet UnicodeTypeRzR&RR R RR*t TextIOWrapperR'R2R0RRRPR(((s(/usr/lib64/python2.7/xml/sax/saxutils.pyts$0          WoPKi#]ȳKKsax/xmlreader.pycnu[ {fc@sdZddlZddlmZmZdddYZdefdYZddd YZd dd YZd dd YZ de fdYZ dZ e dkre ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. iN(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont XMLReadercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs@tj|_tj|_tj|_tj|_dS(N( thandlertContentHandlert _cont_handlert DTDHandlert _dtd_handlertEntityResolvert _ent_handlert ErrorHandlert _err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstddS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(R tsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs ||_dS(s:Registers a new object to receive document content events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getDTDHandler*scCs ||_dS(s7Register an object to receive basic DTD-related events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs ||_dS(s0Register an object to resolve external entities.N(R (R tresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs ||_dS(s3Register an object to receive error-message events.N(R (R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstddS(sHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.sLocale support not implementedN(R(R tlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setLocaleBscCstd|dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R tname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getFeatureKscCstd|dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R Rtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setFeatureOscCstd|dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPropertySscCstd|dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(R Rtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPropertyWs(t__name__t __module__t__doc__R RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s               tIncrementalParsercBsGeZdZd dZdZdZdZdZdZRS( ssThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.iicCs||_tj|dS(N(t_bufsizeRR (R tbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR os cCsddl}|j|}|j||j}|j|j}x/|dkrw|j||j|j}qIW|jdS(Nit(tsaxutilstprepare_input_sourcet prepareParsert getByteStreamtreadR'tfeedtclose(R RR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss    cCstddS(sThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.s This method must be implemented!N(R(R tdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstddS(stThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,scCstddS(sThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0s cCstddS(sThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytresetsi( R#R$R%R RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s   tLocatorcBs2eZdZdZdZdZdZRS(sInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS(s6Return the column number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumberscCsdS(s4Return the line number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLineNumberscCsdS(s3Return the public identifier for the current event.N(tNone(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPublicIdscCsdS(s3Return the system identifier for the current event.N(R8(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getSystemIds(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5s    t InputSourcecBsteZdZd dZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( snEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(R t system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s     cCs ||_dS(s/Sets the public identifier of this InputSource.N(R=(R t public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPublicIdscCs|jS(s2Returns the public identifier of this InputSource.(R=(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9scCs ||_dS(s/Sets the system identifier of this InputSource.N(R<(R RA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setSystemIdscCs|jS(s2Returns the system identifier of this InputSource.(R<(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:scCs ||_dS(s4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N(R>(R tencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setEncodingscCs|jS(s/Get the character encoding of this InputSource.(R>(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getEncodingscCs ||_dS(sSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N(R?(R tbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setByteStreams cCs|jS(sGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.(R?(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-scCs ||_dS(s^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N(R@(R tcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;s        tAttributesImplcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZRS(cCs ||_dS(sQNon-NS-aware implementation. attrs should be of the form {name : value}.N(t_attrs(R tattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR scCs t|jS(N(tlenRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLengthscCsdS(NtCDATA((R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|n|S(N(RNtKeyError(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(s cCs||jkrt|n|S(N(RNRV(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-s cCs |jjS(N(RNtkeys(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getQNames5scCs t|jS(N(RPRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __getitem__;scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __contains__DscCs|jj||S(N(RNtget(R Rt alternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|jS(N(t __class__RN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs |jjS(N(RNtitems(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs |jjS(N(RNtvalues(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$                 tAttributesNSImplcBs>eZdZdZdZdZdZdZRS(cCs||_||_dS(sNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(R ROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR Ws cCsDx4|jjD]#\}}||kr|j|SqWt|dS(N(RgRdRNRV(R Rtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_s cCs=x-|jjD]\}}||kr|SqWt|dS(N(RgRdRV(R RRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfs cCs |j|S(N(Rg(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs |jjS(N(RgRe(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|jS(N(RbRNRg(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs      cCstttdS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__((((( R%Rt _exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyts PHYA"  PKi#]deq22sax/handler.pyonu[ {fc@sdZdZdddYZdddYZdddYZddd YZd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS(s0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ s2.0betat ErrorHandlercBs)eZdZdZdZdZRS(sBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs |dS(sHandle a recoverable error.N((tselft exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs |dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt fatalError$scCs |GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t __module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs  tContentHandlercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZRS(sInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs ||_dS(s#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N(R (Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(sReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt startDocumentPtcCsdS(sQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt endDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(sEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pyt startElement~RcCsdS(sSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementRcCsdS(sSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNSRcCsdS(sSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementNSRcCsdS(sReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt charactersRcCsdS(swReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.N((Rt whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespaceRcCsdS(sReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstructionRcCsdS(sReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt skippedEntityR(RRRR RRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR /s          t DTDHandlercBs eZdZdZdZRS(sHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pyt notationDeclRcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDeclR(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%s tEntityResolvercBseZdZdZRS(s7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S(sResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt resolveEntitys(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pest all_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt s:   PKi#]9==sax/handler.pynu[""" This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ """ version = '2.0beta' #============================================================================ # # HANDLER INTERFACES # #============================================================================ # ===== ERRORHANDLER ===== class ErrorHandler: """Basic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.""" def error(self, exception): "Handle a recoverable error." raise exception def fatalError(self, exception): "Handle a non-recoverable error." raise exception def warning(self, exception): "Handle a warning." print(exception) # ===== CONTENTHANDLER ===== class ContentHandler: """Interface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.""" def __init__(self): self._locator = None def setDocumentLocator(self, locator): """Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.""" self._locator = locator def startDocument(self): """Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).""" def endDocument(self): """Receive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.""" def startPrefixMapping(self, prefix, uri): """Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.""" def endPrefixMapping(self, prefix): """End the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.""" def startElement(self, name, attrs): """Signals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.""" def endElement(self, name): """Signals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.""" def startElementNS(self, name, qname, attrs): """Signals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.""" def endElementNS(self, name, qname): """Signals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.""" def characters(self, content): """Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.""" def ignorableWhitespace(self, whitespace): """Receive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.""" def processingInstruction(self, target, data): """Receive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.""" def skippedEntity(self, name): """Receive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.""" # ===== DTDHandler ===== class DTDHandler: """Handle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).""" def notationDecl(self, name, publicId, systemId): "Handle a notation declaration event." def unparsedEntityDecl(self, name, publicId, systemId, ndata): "Handle an unparsed entity declaration event." # ===== ENTITYRESOLVER ===== class EntityResolver: """Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.""" def resolveEntity(self, publicId, systemId): """Resolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.""" return systemId #============================================================================ # # CORE FEATURES # #============================================================================ feature_namespaces = "http://xml.org/sax/features/namespaces" # true: Perform Namespace processing (default). # false: Optionally do not perform Namespace processing # (implies namespace-prefixes). # access: (parsing) read-only; (not parsing) read/write feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes" # true: Report the original prefixed names and attributes used for Namespace # declarations. # false: Do not report attributes used for Namespace declarations, and # optionally do not report original prefixed names (default). # access: (parsing) read-only; (not parsing) read/write feature_string_interning = "http://xml.org/sax/features/string-interning" # true: All element names, prefixes, attribute names, Namespace URIs, and # local names are interned using the built-in intern function. # false: Names are not necessarily interned, although they may be (default). # access: (parsing) read-only; (not parsing) read/write feature_validation = "http://xml.org/sax/features/validation" # true: Report all validation errors (implies external-general-entities and # external-parameter-entities). # false: Do not report validation errors. # access: (parsing) read-only; (not parsing) read/write feature_external_ges = "http://xml.org/sax/features/external-general-entities" # true: Include all external general (text) entities. # false: Do not include external general entities. # access: (parsing) read-only; (not parsing) read/write feature_external_pes = "http://xml.org/sax/features/external-parameter-entities" # true: Include all external parameter entities, including the external # DTD subset. # false: Do not include any external parameter entities, even the external # DTD subset. # access: (parsing) read-only; (not parsing) read/write all_features = [feature_namespaces, feature_namespace_prefixes, feature_string_interning, feature_validation, feature_external_ges, feature_external_pes] #============================================================================ # # CORE PROPERTIES # #============================================================================ property_lexical_handler = "http://xml.org/sax/properties/lexical-handler" # data type: xml.sax.sax2lib.LexicalHandler # description: An optional extension handler for lexical events like comments. # access: read/write property_declaration_handler = "http://xml.org/sax/properties/declaration-handler" # data type: xml.sax.sax2lib.DeclHandler # description: An optional extension handler for DTD-related events other # than notations and unparsed entities. # access: read/write property_dom_node = "http://xml.org/sax/properties/dom-node" # data type: org.w3c.dom.Node # description: When parsing, the current DOM node being visited if this is # a DOM iterator; when not parsing, the root DOM node for # iteration. # access: (parsing) read-only; (not parsing) read/write property_xml_string = "http://xml.org/sax/properties/xml-string" # data type: String # description: The literal string of characters that was the source for # the current event. # access: read-only property_encoding = "http://www.python.org/sax/properties/encoding" # data type: String # description: The name of the encoding to assume for input data. # access: write: set the encoding, e.g. established by a higher-level # protocol. May change during parsing (e.g. after # processing a META tag) # read: return the current encoding (possibly established through # auto-detection. # initial value: UTF-8 # property_interning_dict = "http://www.python.org/sax/properties/interning-dict" # data type: Dictionary # description: The dictionary used to intern common strings in the document # access: write: Request that the parser uses a specific dictionary, to # allow interning across different documents # read: return the current interning dictionary, or None # all_properties = [property_lexical_handler, property_dom_node, property_declaration_handler, property_xml_string, property_encoding, property_interning_dict] class LexicalHandler: """Optional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.""" def comment(self, content): """Reports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.""" def startDTD(self, name, public_id, system_id): """Report the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).""" def endDTD(self): """Signals the end of DTD declarations.""" def startCDATA(self): """Reports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.""" def endCDATA(self): """Reports the end of a CDATA marked section.""" PKi#]ᶨP1P1sax/xmlreader.pynu["""An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. """ from . import handler from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException # ===== XMLREADER ===== class XMLReader: """Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.""" def __init__(self): self._cont_handler = handler.ContentHandler() self._dtd_handler = handler.DTDHandler() self._ent_handler = handler.EntityResolver() self._err_handler = handler.ErrorHandler() def parse(self, source): "Parse an XML document from a system identifier or an InputSource." raise NotImplementedError("This method must be implemented!") def getContentHandler(self): "Returns the current ContentHandler." return self._cont_handler def setContentHandler(self, handler): "Registers a new object to receive document content events." self._cont_handler = handler def getDTDHandler(self): "Returns the current DTD handler." return self._dtd_handler def setDTDHandler(self, handler): "Register an object to receive basic DTD-related events." self._dtd_handler = handler def getEntityResolver(self): "Returns the current EntityResolver." return self._ent_handler def setEntityResolver(self, resolver): "Register an object to resolve external entities." self._ent_handler = resolver def getErrorHandler(self): "Returns the current ErrorHandler." return self._err_handler def setErrorHandler(self, handler): "Register an object to receive error-message events." self._err_handler = handler def setLocale(self, locale): """Allow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.""" raise SAXNotSupportedException("Locale support not implemented") def getFeature(self, name): "Looks up and returns the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def setFeature(self, name, state): "Sets the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def getProperty(self, name): "Looks up and returns the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name) def setProperty(self, name, value): "Sets the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name) class IncrementalParser(XMLReader): """This interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.""" def __init__(self, bufsize=2**16): self._bufsize = bufsize XMLReader.__init__(self) def parse(self, source): from . import saxutils source = saxutils.prepare_input_source(source) self.prepareParser(source) file = source.getCharacterStream() if file is None: file = source.getByteStream() while buffer := file.read(self._bufsize): self.feed(buffer) self.close() def feed(self, data): """This method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.""" raise NotImplementedError("This method must be implemented!") def prepareParser(self, source): """This method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.""" raise NotImplementedError("prepareParser must be overridden!") def close(self): """This method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.""" raise NotImplementedError("This method must be implemented!") def reset(self): """This method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.""" raise NotImplementedError("This method must be implemented!") # ===== LOCATOR ===== class Locator: """Interface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.""" def getColumnNumber(self): "Return the column number where the current event ends." return -1 def getLineNumber(self): "Return the line number where the current event ends." return -1 def getPublicId(self): "Return the public identifier for the current event." return None def getSystemId(self): "Return the system identifier for the current event." return None # ===== INPUTSOURCE ===== class InputSource: """Encapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.""" def __init__(self, system_id = None): self.__system_id = system_id self.__public_id = None self.__encoding = None self.__bytefile = None self.__charfile = None def setPublicId(self, public_id): "Sets the public identifier of this InputSource." self.__public_id = public_id def getPublicId(self): "Returns the public identifier of this InputSource." return self.__public_id def setSystemId(self, system_id): "Sets the system identifier of this InputSource." self.__system_id = system_id def getSystemId(self): "Returns the system identifier of this InputSource." return self.__system_id def setEncoding(self, encoding): """Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.""" self.__encoding = encoding def getEncoding(self): "Get the character encoding of this InputSource." return self.__encoding def setByteStream(self, bytefile): """Set the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.""" self.__bytefile = bytefile def getByteStream(self): """Get the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.""" return self.__bytefile def setCharacterStream(self, charfile): """Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.""" self.__charfile = charfile def getCharacterStream(self): "Get the character stream for this input source." return self.__charfile # ===== ATTRIBUTESIMPL ===== class AttributesImpl: def __init__(self, attrs): """Non-NS-aware implementation. attrs should be of the form {name : value}.""" self._attrs = attrs def getLength(self): return len(self._attrs) def getType(self, name): return "CDATA" def getValue(self, name): return self._attrs[name] def getValueByQName(self, name): return self._attrs[name] def getNameByQName(self, name): if name not in self._attrs: raise KeyError(name) return name def getQNameByName(self, name): if name not in self._attrs: raise KeyError(name) return name def getNames(self): return list(self._attrs.keys()) def getQNames(self): return list(self._attrs.keys()) def __len__(self): return len(self._attrs) def __getitem__(self, name): return self._attrs[name] def keys(self): return list(self._attrs.keys()) def __contains__(self, name): return name in self._attrs def get(self, name, alternative=None): return self._attrs.get(name, alternative) def copy(self): return self.__class__(self._attrs) def items(self): return list(self._attrs.items()) def values(self): return list(self._attrs.values()) # ===== ATTRIBUTESNSIMPL ===== class AttributesNSImpl(AttributesImpl): def __init__(self, attrs, qnames): """NS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.""" self._attrs = attrs self._qnames = qnames def getValueByQName(self, name): for (nsname, qname) in self._qnames.items(): if qname == name: return self._attrs[nsname] raise KeyError(name) def getNameByQName(self, name): for (nsname, qname) in self._qnames.items(): if qname == name: return nsname raise KeyError(name) def getQNameByName(self, name): return self._qnames[name] def getQNames(self): return list(self._qnames.values()) def copy(self): return self.__class__(self._attrs, self._qnames) def _test(): XMLReader() IncrementalParser() Locator() if __name__ == "__main__": _test() PKi#]C[[sax/_exceptions.pynu["""Different kinds of SAX Exceptions""" # ===== SAXEXCEPTION ===== class SAXException(Exception): """Encapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.""" def __init__(self, msg, exception=None): """Creates an exception. The message is required, but the exception is optional.""" self._msg = msg self._exception = exception Exception.__init__(self, msg) def getMessage(self): "Return a message for this exception." return self._msg def getException(self): "Return the embedded exception, or None if there was none." return self._exception def __str__(self): "Create a string representation of the exception." return self._msg def __getitem__(self, ix): """Avoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.""" raise AttributeError("__getitem__") # ===== SAXPARSEEXCEPTION ===== class SAXParseException(SAXException): """Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.""" def __init__(self, msg, exception, locator): "Creates the exception. The exception parameter is allowed to be None." SAXException.__init__(self, msg, exception) self._locator = locator # We need to cache this stuff at construction time. # If this exception is raised, the objects through which we must # traverse to get this information may be deleted by the time # it gets caught. self._systemId = self._locator.getSystemId() self._colnum = self._locator.getColumnNumber() self._linenum = self._locator.getLineNumber() def getColumnNumber(self): """The column number of the end of the text where the exception occurred.""" return self._colnum def getLineNumber(self): "The line number of the end of the text where the exception occurred." return self._linenum def getPublicId(self): "Get the public identifier of the entity where the exception occurred." return self._locator.getPublicId() def getSystemId(self): "Get the system identifier of the entity where the exception occurred." return self._systemId def __str__(self): "Create a string representation of the exception." sysid = self.getSystemId() if sysid is None: sysid = "" linenum = self.getLineNumber() if linenum is None: linenum = "?" colnum = self.getColumnNumber() if colnum is None: colnum = "?" return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) # ===== SAXNOTRECOGNIZEDEXCEPTION ===== class SAXNotRecognizedException(SAXException): """Exception class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.""" # ===== SAXNOTSUPPORTEDEXCEPTION ===== class SAXNotSupportedException(SAXException): """Exception class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.""" # ===== SAXNOTSUPPORTEDEXCEPTION ===== class SAXReaderNotAvailable(SAXNotSupportedException): """Exception class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.""" PKi#]deq22sax/handler.pycnu[ {fc@sdZdZdddYZdddYZdddYZddd YZd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS(s0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ s2.0betat ErrorHandlercBs)eZdZdZdZdZRS(sBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs |dS(sHandle a recoverable error.N((tselft exception((s'/usr/lib64/python2.7/xml/sax/handler.pyterror scCs |dS(sHandle a non-recoverable error.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt fatalError$scCs |GHdS(sHandle a warning.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytwarning(s(t__name__t __module__t__doc__RRR(((s'/usr/lib64/python2.7/xml/sax/handler.pyRs  tContentHandlercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZRS(sInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS(N(tNonet_locator(R((s'/usr/lib64/python2.7/xml/sax/handler.pyt__init__6scCs ||_dS(s#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N(R (Rtlocator((s'/usr/lib64/python2.7/xml/sax/handler.pytsetDocumentLocator9scCsdS(sReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt startDocumentPtcCsdS(sQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.N((R((s'/usr/lib64/python2.7/xml/sax/handler.pyt endDocumentWRcCsdS(sBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.N((Rtprefixturi((s'/usr/lib64/python2.7/xml/sax/handler.pytstartPrefixMapping`RcCsdS(sEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pytendPrefixMappingwRcCsdS(sSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.N((Rtnametattrs((s'/usr/lib64/python2.7/xml/sax/handler.pyt startElement~RcCsdS(sSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementRcCsdS(sSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.N((RRtqnameR((s'/usr/lib64/python2.7/xml/sax/handler.pytstartElementNSRcCsdS(sSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.N((RRR((s'/usr/lib64/python2.7/xml/sax/handler.pyt endElementNSRcCsdS(sReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.N((Rtcontent((s'/usr/lib64/python2.7/xml/sax/handler.pyt charactersRcCsdS(swReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.N((Rt whitespace((s'/usr/lib64/python2.7/xml/sax/handler.pytignorableWhitespaceRcCsdS(sReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.N((Rttargettdata((s'/usr/lib64/python2.7/xml/sax/handler.pytprocessingInstructionRcCsdS(sReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.N((RR((s'/usr/lib64/python2.7/xml/sax/handler.pyt skippedEntityR(RRRR RRRRRRRRRRR R#R$(((s'/usr/lib64/python2.7/xml/sax/handler.pyR /s          t DTDHandlercBs eZdZdZdZRS(sHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS(s$Handle a notation declaration event.N((RRtpublicIdtsystemId((s'/usr/lib64/python2.7/xml/sax/handler.pyt notationDeclRcCsdS(s,Handle an unparsed entity declaration event.N((RRR&R'tndata((s'/usr/lib64/python2.7/xml/sax/handler.pytunparsedEntityDeclR(RRRR(R*(((s'/usr/lib64/python2.7/xml/sax/handler.pyR%s tEntityResolvercBseZdZdZRS(s7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S(sResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.((RR&R'((s'/usr/lib64/python2.7/xml/sax/handler.pyt resolveEntitys(RRRR,(((s'/usr/lib64/python2.7/xml/sax/handler.pyR+ss&http://xml.org/sax/features/namespacess.http://xml.org/sax/features/namespace-prefixess,http://xml.org/sax/features/string-internings&http://xml.org/sax/features/validations5http://xml.org/sax/features/external-general-entitiess7http://xml.org/sax/features/external-parameter-entitiess-http://xml.org/sax/properties/lexical-handlers1http://xml.org/sax/properties/declaration-handlers&http://xml.org/sax/properties/dom-nodes(http://xml.org/sax/properties/xml-strings-http://www.python.org/sax/properties/encodings3http://www.python.org/sax/properties/interning-dictN(((((RtversionRR R%R+tfeature_namespacestfeature_namespace_prefixestfeature_string_interningtfeature_validationtfeature_external_gestfeature_external_pest all_featurestproperty_lexical_handlertproperty_declaration_handlertproperty_dom_nodetproperty_xml_stringtproperty_encodingtproperty_interning_dicttall_properties(((s'/usr/lib64/python2.7/xml/sax/handler.pyt s:   PKi#]|.x sax/__init__.pynu["""Simple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. """ from .xmlreader import InputSource from .handler import ContentHandler, ErrorHandler from ._exceptions import SAXException, SAXNotRecognizedException, \ SAXParseException, SAXNotSupportedException, \ SAXReaderNotAvailable def parse(source, handler, errorHandler=ErrorHandler()): parser = make_parser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) parser.parse(source) def parseString(string, handler, errorHandler=ErrorHandler()): import io if errorHandler is None: errorHandler = ErrorHandler() parser = make_parser() parser.setContentHandler(handler) parser.setErrorHandler(errorHandler) inpsrc = InputSource() if isinstance(string, str): inpsrc.setCharacterStream(io.StringIO(string)) else: inpsrc.setByteStream(io.BytesIO(string)) parser.parse(inpsrc) # this is the parser list used by the make_parser function if no # alternatives are given as parameters to the function default_parser_list = ["xml.sax.expatreader"] # tell modulefinder that importing sax potentially imports expatreader _false = 0 if _false: import xml.sax.expatreader import os, sys if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ: default_parser_list = os.environ["PY_SAX_PARSER"].split(",") del os, sys def make_parser(parser_list=()): """Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser function.""" for parser_name in list(parser_list) + default_parser_list: try: return _create_parser(parser_name) except ImportError: import sys if parser_name in sys.modules: # The parser module was found, but importing it # failed unexpectedly, pass this exception through raise except SAXReaderNotAvailable: # The parser module detected that it won't work properly, # so try the next one pass raise SAXReaderNotAvailable("No parsers found", None) # --- Internal utility methods used by make_parser def _create_parser(parser_name): drv_module = __import__(parser_name,{},{},['create_parser']) return drv_module.create_parser() PKi#]R>>sax/expatreader.pynu[""" SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. """ version = "0.20" from xml.sax._exceptions import * from xml.sax.handler import feature_validation, feature_namespaces from xml.sax.handler import feature_namespace_prefixes from xml.sax.handler import feature_external_ges, feature_external_pes from xml.sax.handler import feature_string_interning from xml.sax.handler import property_xml_string, property_interning_dict try: from xml.parsers import expat except ImportError: raise SAXReaderNotAvailable("expat not supported", None) else: if not hasattr(expat, "ParserCreate"): raise SAXReaderNotAvailable("expat not supported", None) from xml.sax import xmlreader, saxutils, handler AttributesImpl = xmlreader.AttributesImpl AttributesNSImpl = xmlreader.AttributesNSImpl # If we're using a sufficiently recent version of Python, we can use # weak references to avoid cycles between the parser and content # handler, otherwise we'll just have to pretend. try: import _weakref except ImportError: def _mkproxy(o): return o else: import weakref _mkproxy = weakref.proxy del weakref, _weakref class _ClosedParser: pass # --- ExpatLocator class ExpatLocator(xmlreader.Locator): """Locator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. """ def __init__(self, parser): self._ref = _mkproxy(parser) def getColumnNumber(self): parser = self._ref if parser._parser is None: return None return parser._parser.ErrorColumnNumber def getLineNumber(self): parser = self._ref if parser._parser is None: return 1 return parser._parser.ErrorLineNumber def getPublicId(self): parser = self._ref if parser is None: return None return parser._source.getPublicId() def getSystemId(self): parser = self._ref if parser is None: return None return parser._source.getSystemId() # --- ExpatParser class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): """SAX driver for the pyexpat C module.""" def __init__(self, namespaceHandling=0, bufsize=2**16-20): xmlreader.IncrementalParser.__init__(self, bufsize) self._source = xmlreader.InputSource() self._parser = None self._namespaces = namespaceHandling self._lex_handler_prop = None self._parsing = False self._entity_stack = [] self._external_ges = 0 self._interning = None # XMLReader methods def parse(self, source): "Parse an XML document from a URL or an InputSource." source = saxutils.prepare_input_source(source) self._source = source try: self.reset() self._cont_handler.setDocumentLocator(ExpatLocator(self)) xmlreader.IncrementalParser.parse(self, source) except: # bpo-30264: Close the source on error to not leak resources: # xml.sax.parse() doesn't give access to the underlying parser # to the caller self._close_source() raise def prepareParser(self, source): if source.getSystemId() is not None: self._parser.SetBase(source.getSystemId()) # Redefined setContentHandler to allow changing handlers during parsing def setContentHandler(self, handler): xmlreader.IncrementalParser.setContentHandler(self, handler) if self._parsing: self._reset_cont_handler() def getFeature(self, name): if name == feature_namespaces: return self._namespaces elif name == feature_string_interning: return self._interning is not None elif name in (feature_validation, feature_external_pes, feature_namespace_prefixes): return 0 elif name == feature_external_ges: return self._external_ges raise SAXNotRecognizedException("Feature '%s' not recognized" % name) def setFeature(self, name, state): if self._parsing: raise SAXNotSupportedException("Cannot set features while parsing") if name == feature_namespaces: self._namespaces = state elif name == feature_external_ges: self._external_ges = state elif name == feature_string_interning: if state: if self._interning is None: self._interning = {} else: self._interning = None elif name == feature_validation: if state: raise SAXNotSupportedException( "expat does not support validation") elif name == feature_external_pes: if state: raise SAXNotSupportedException( "expat does not read external parameter entities") elif name == feature_namespace_prefixes: if state: raise SAXNotSupportedException( "expat does not report namespace prefixes") else: raise SAXNotRecognizedException( "Feature '%s' not recognized" % name) def getProperty(self, name): if name == handler.property_lexical_handler: return self._lex_handler_prop elif name == property_interning_dict: return self._interning elif name == property_xml_string: if self._parser: if hasattr(self._parser, "GetInputContext"): return self._parser.GetInputContext() else: raise SAXNotRecognizedException( "This version of expat does not support getting" " the XML string") else: raise SAXNotSupportedException( "XML string cannot be returned when not parsing") raise SAXNotRecognizedException("Property '%s' not recognized" % name) def setProperty(self, name, value): if name == handler.property_lexical_handler: self._lex_handler_prop = value if self._parsing: self._reset_lex_handler_prop() elif name == property_interning_dict: self._interning = value elif name == property_xml_string: raise SAXNotSupportedException("Property '%s' cannot be set" % name) else: raise SAXNotRecognizedException("Property '%s' not recognized" % name) # IncrementalParser methods def feed(self, data, isFinal=False): if not self._parsing: self.reset() self._parsing = True self._cont_handler.startDocument() try: # The isFinal parameter is internal to the expat reader. # If it is set to true, expat will check validity of the entire # document. When feeding chunks, they are not normally final - # except when invoked from close. self._parser.Parse(data, isFinal) except expat.error as e: exc = SAXParseException(expat.ErrorString(e.code), e, self) # FIXME: when to invoke error()? self._err_handler.fatalError(exc) def flush(self): if self._parser is None: return was_enabled = self._parser.GetReparseDeferralEnabled() try: self._parser.SetReparseDeferralEnabled(False) self._parser.Parse(b"", False) except expat.error as e: exc = SAXParseException(expat.ErrorString(e.code), e, self) self._err_handler.fatalError(exc) finally: self._parser.SetReparseDeferralEnabled(was_enabled) def _close_source(self): source = self._source try: file = source.getCharacterStream() if file is not None: file.close() finally: file = source.getByteStream() if file is not None: file.close() def close(self): if (self._entity_stack or self._parser is None or isinstance(self._parser, _ClosedParser)): # If we are completing an external entity, do nothing here return try: self.feed(b"", isFinal=True) self._cont_handler.endDocument() self._parsing = False # break cycle created by expat handlers pointing to our methods self._parser = None finally: self._parsing = False if self._parser is not None: # Keep ErrorColumnNumber and ErrorLineNumber after closing. parser = _ClosedParser() parser.ErrorColumnNumber = self._parser.ErrorColumnNumber parser.ErrorLineNumber = self._parser.ErrorLineNumber self._parser = parser self._close_source() def _reset_cont_handler(self): self._parser.ProcessingInstructionHandler = \ self._cont_handler.processingInstruction self._parser.CharacterDataHandler = self._cont_handler.characters def _reset_lex_handler_prop(self): lex = self._lex_handler_prop parser = self._parser if lex is None: parser.CommentHandler = None parser.StartCdataSectionHandler = None parser.EndCdataSectionHandler = None parser.StartDoctypeDeclHandler = None parser.EndDoctypeDeclHandler = None else: parser.CommentHandler = lex.comment parser.StartCdataSectionHandler = lex.startCDATA parser.EndCdataSectionHandler = lex.endCDATA parser.StartDoctypeDeclHandler = self.start_doctype_decl parser.EndDoctypeDeclHandler = lex.endDTD def reset(self): if self._namespaces: self._parser = expat.ParserCreate(self._source.getEncoding(), " ", intern=self._interning) self._parser.namespace_prefixes = 1 self._parser.StartElementHandler = self.start_element_ns self._parser.EndElementHandler = self.end_element_ns else: self._parser = expat.ParserCreate(self._source.getEncoding(), intern = self._interning) self._parser.StartElementHandler = self.start_element self._parser.EndElementHandler = self.end_element self._reset_cont_handler() self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl self._parser.NotationDeclHandler = self.notation_decl self._parser.StartNamespaceDeclHandler = self.start_namespace_decl self._parser.EndNamespaceDeclHandler = self.end_namespace_decl self._decl_handler_prop = None if self._lex_handler_prop: self._reset_lex_handler_prop() # self._parser.DefaultHandler = # self._parser.DefaultHandlerExpand = # self._parser.NotStandaloneHandler = self._parser.ExternalEntityRefHandler = self.external_entity_ref try: self._parser.SkippedEntityHandler = self.skipped_entity_handler except AttributeError: # This pyexpat does not support SkippedEntity pass self._parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) self._parsing = False self._entity_stack = [] # Locator methods def getColumnNumber(self): if self._parser is None: return None return self._parser.ErrorColumnNumber def getLineNumber(self): if self._parser is None: return 1 return self._parser.ErrorLineNumber def getPublicId(self): return self._source.getPublicId() def getSystemId(self): return self._source.getSystemId() # event handlers def start_element(self, name, attrs): self._cont_handler.startElement(name, AttributesImpl(attrs)) def end_element(self, name): self._cont_handler.endElement(name) def start_element_ns(self, name, attrs): pair = name.split() if len(pair) == 1: # no namespace pair = (None, name) elif len(pair) == 3: pair = pair[0], pair[1] else: # default namespace pair = tuple(pair) newattrs = {} qnames = {} for (aname, value) in attrs.items(): parts = aname.split() length = len(parts) if length == 1: # no namespace qname = aname apair = (None, aname) elif length == 3: qname = "%s:%s" % (parts[2], parts[1]) apair = parts[0], parts[1] else: # default namespace qname = parts[1] apair = tuple(parts) newattrs[apair] = value qnames[apair] = qname self._cont_handler.startElementNS(pair, None, AttributesNSImpl(newattrs, qnames)) def end_element_ns(self, name): pair = name.split() if len(pair) == 1: pair = (None, name) elif len(pair) == 3: pair = pair[0], pair[1] else: pair = tuple(pair) self._cont_handler.endElementNS(pair, None) # this is not used (call directly to ContentHandler) def processing_instruction(self, target, data): self._cont_handler.processingInstruction(target, data) # this is not used (call directly to ContentHandler) def character_data(self, data): self._cont_handler.characters(data) def start_namespace_decl(self, prefix, uri): self._cont_handler.startPrefixMapping(prefix, uri) def end_namespace_decl(self, prefix): self._cont_handler.endPrefixMapping(prefix) def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): self._lex_handler_prop.startDTD(name, pubid, sysid) def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name) def notation_decl(self, name, base, sysid, pubid): self._dtd_handler.notationDecl(name, pubid, sysid) def external_entity_ref(self, context, base, sysid, pubid): if not self._external_ges: return 1 source = self._ent_handler.resolveEntity(pubid, sysid) source = saxutils.prepare_input_source(source, self._source.getSystemId() or "") self._entity_stack.append((self._parser, self._source)) self._parser = self._parser.ExternalEntityParserCreate(context) self._source = source try: xmlreader.IncrementalParser.parse(self, source) except: return 0 # FIXME: save error info here? (self._parser, self._source) = self._entity_stack[-1] del self._entity_stack[-1] return 1 def skipped_entity_handler(self, name, is_pe): if is_pe: # The SAX spec requires to report skipped PEs with a '%' name = '%'+name self._cont_handler.skippedEntity(name) # --- def create_parser(*args, **kwargs): return ExpatParser(*args, **kwargs) # --- if __name__ == "__main__": import xml.sax.saxutils p = create_parser() p.setContentHandler(xml.sax.saxutils.XMLGenerator()) p.setErrorHandler(xml.sax.ErrorHandler()) p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") PKi#]//sax/saxutils.pynu["""\ A library of useful helper classes to the SAX classes, for the convenience of application and driver writers. """ import os, urllib.parse, urllib.request import io import codecs from . import handler from . import xmlreader def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" for key, value in d.items(): s = s.replace(key, value) return s def escape(data, entities={}): """Escape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ # must do ampersand first data = data.replace("&", "&") data = data.replace(">", ">") data = data.replace("<", "<") if entities: data = __dict_replace(data, entities) return data def unescape(data, entities={}): """Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ data = data.replace("<", "<") data = data.replace(">", ">") if entities: data = __dict_replace(data, entities) # must do ampersand last return data.replace("&", "&") def quoteattr(data, entities={}): """Escape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The \" character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. """ entities = {**entities, '\n': ' ', '\r': ' ', '\t':' '} data = escape(data, entities) if '"' in data: if "'" in data: data = '"%s"' % data.replace('"', """) else: data = "'%s'" % data else: data = '"%s"' % data return data def _gettextwriter(out, encoding): if out is None: import sys return sys.stdout if isinstance(out, io.TextIOBase): # use a text writer as is return out if isinstance(out, (codecs.StreamWriter, codecs.StreamReaderWriter)): # use a codecs stream writer as is return out # wrap a binary writer with TextIOWrapper if isinstance(out, io.RawIOBase): # Keep the original file open when the TextIOWrapper is # destroyed class _wrapper: __class__ = out.__class__ def __getattr__(self, name): return getattr(out, name) buffer = _wrapper() buffer.close = lambda: None else: # This is to handle passed objects that aren't in the # IOBase hierarchy, but just have a write method buffer = io.BufferedIOBase() buffer.writable = lambda: True buffer.write = out.write try: # TextIOWrapper uses this methods to determine # if BOM (for UTF-16, etc) should be added buffer.seekable = out.seekable buffer.tell = out.tell except AttributeError: pass return io.TextIOWrapper(buffer, encoding=encoding, errors='xmlcharrefreplace', newline='\n', write_through=True) class XMLGenerator(handler.ContentHandler): def __init__(self, out=None, encoding="iso-8859-1", short_empty_elements=False): handler.ContentHandler.__init__(self) out = _gettextwriter(out, encoding) self._write = out.write self._flush = out.flush self._ns_contexts = [{}] # contains uri -> prefix dicts self._current_context = self._ns_contexts[-1] self._undeclared_ns_maps = [] self._encoding = encoding self._short_empty_elements = short_empty_elements self._pending_start_element = False def _qname(self, name): """Builds a qualified name from a (ns_url, localname) pair""" if name[0]: # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is # bound by definition to http://www.w3.org/XML/1998/namespace. It # does not need to be declared and will not usually be found in # self._current_context. if 'http://www.w3.org/XML/1998/namespace' == name[0]: return 'xml:' + name[1] # The name is in a non-empty namespace prefix = self._current_context[name[0]] if prefix: # If it is not the default namespace, prepend the prefix return prefix + ":" + name[1] # Return the unqualified name return name[1] def _finish_pending_start_element(self,endElement=False): if self._pending_start_element: self._write('>') self._pending_start_element = False # ContentHandler methods def startDocument(self): self._write('\n' % self._encoding) def endDocument(self): self._flush() def startPrefixMapping(self, prefix, uri): self._ns_contexts.append(self._current_context.copy()) self._current_context[uri] = prefix self._undeclared_ns_maps.append((prefix, uri)) def endPrefixMapping(self, prefix): self._current_context = self._ns_contexts[-1] del self._ns_contexts[-1] def startElement(self, name, attrs): self._finish_pending_start_element() self._write('<' + name) for (name, value) in attrs.items(): self._write(' %s=%s' % (name, quoteattr(value))) if self._short_empty_elements: self._pending_start_element = True else: self._write(">") def endElement(self, name): if self._pending_start_element: self._write('/>') self._pending_start_element = False else: self._write('' % name) def startElementNS(self, name, qname, attrs): self._finish_pending_start_element() self._write('<' + self._qname(name)) for prefix, uri in self._undeclared_ns_maps: if prefix: self._write(' xmlns:%s="%s"' % (prefix, uri)) else: self._write(' xmlns="%s"' % uri) self._undeclared_ns_maps = [] for (name, value) in attrs.items(): self._write(' %s=%s' % (self._qname(name), quoteattr(value))) if self._short_empty_elements: self._pending_start_element = True else: self._write(">") def endElementNS(self, name, qname): if self._pending_start_element: self._write('/>') self._pending_start_element = False else: self._write('' % self._qname(name)) def characters(self, content): if content: self._finish_pending_start_element() if not isinstance(content, str): content = str(content, self._encoding) self._write(escape(content)) def ignorableWhitespace(self, content): if content: self._finish_pending_start_element() if not isinstance(content, str): content = str(content, self._encoding) self._write(content) def processingInstruction(self, target, data): self._finish_pending_start_element() self._write('' % (target, data)) class XMLFilterBase(xmlreader.XMLReader): """This class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.""" def __init__(self, parent = None): xmlreader.XMLReader.__init__(self) self._parent = parent # ErrorHandler methods def error(self, exception): self._err_handler.error(exception) def fatalError(self, exception): self._err_handler.fatalError(exception) def warning(self, exception): self._err_handler.warning(exception) # ContentHandler methods def setDocumentLocator(self, locator): self._cont_handler.setDocumentLocator(locator) def startDocument(self): self._cont_handler.startDocument() def endDocument(self): self._cont_handler.endDocument() def startPrefixMapping(self, prefix, uri): self._cont_handler.startPrefixMapping(prefix, uri) def endPrefixMapping(self, prefix): self._cont_handler.endPrefixMapping(prefix) def startElement(self, name, attrs): self._cont_handler.startElement(name, attrs) def endElement(self, name): self._cont_handler.endElement(name) def startElementNS(self, name, qname, attrs): self._cont_handler.startElementNS(name, qname, attrs) def endElementNS(self, name, qname): self._cont_handler.endElementNS(name, qname) def characters(self, content): self._cont_handler.characters(content) def ignorableWhitespace(self, chars): self._cont_handler.ignorableWhitespace(chars) def processingInstruction(self, target, data): self._cont_handler.processingInstruction(target, data) def skippedEntity(self, name): self._cont_handler.skippedEntity(name) # DTDHandler methods def notationDecl(self, name, publicId, systemId): self._dtd_handler.notationDecl(name, publicId, systemId) def unparsedEntityDecl(self, name, publicId, systemId, ndata): self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata) # EntityResolver methods def resolveEntity(self, publicId, systemId): return self._ent_handler.resolveEntity(publicId, systemId) # XMLReader methods def parse(self, source): self._parent.setContentHandler(self) self._parent.setErrorHandler(self) self._parent.setEntityResolver(self) self._parent.setDTDHandler(self) self._parent.parse(source) def setLocale(self, locale): self._parent.setLocale(locale) def getFeature(self, name): return self._parent.getFeature(name) def setFeature(self, name, state): self._parent.setFeature(name, state) def getProperty(self, name): return self._parent.getProperty(name) def setProperty(self, name, value): self._parent.setProperty(name, value) # XMLFilter methods def getParent(self): return self._parent def setParent(self, parent): self._parent = parent # --- Utility functions def prepare_input_source(source, base=""): """This function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.""" if isinstance(source, os.PathLike): source = os.fspath(source) if isinstance(source, str): source = xmlreader.InputSource(source) elif hasattr(source, "read"): f = source source = xmlreader.InputSource() if isinstance(f.read(0), str): source.setCharacterStream(f) else: source.setByteStream(f) if hasattr(f, "name") and isinstance(f.name, str): source.setSystemId(f.name) if source.getCharacterStream() is None and source.getByteStream() is None: sysid = source.getSystemId() basehead = os.path.dirname(os.path.normpath(base)) sysidfilename = os.path.join(basehead, sysid) if os.path.isfile(sysidfilename): source.setSystemId(sysidfilename) f = open(sysidfilename, "rb") else: source.setSystemId(urllib.parse.urljoin(base, sysid)) f = urllib.request.urlopen(source.getSystemId()) source.setByteStream(f) return source PKi#]/sax/_exceptions.pyonu[ {fc@sdZddlZejd dkr8ddlmZn[defdYZdefd YZd efd YZd efd YZdefdYZ dS(s!Different kinds of SAX ExceptionsiNitjava(t Exceptiont SAXExceptioncBs>eZdZddZdZdZdZdZRS(sEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.cCs&||_||_tj||dS(sUCreates an exception. The message is required, but the exception is optional.N(t_msgt _exceptionRt__init__(tselftmsgt exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs  cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstddS(svAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.t __getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR &sN( t__name__t __module__t__doc__tNoneRR R R R (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR s     tSAXParseExceptioncBsDeZdZdZdZdZdZdZdZRS(s#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCsVtj|||||_|jj|_|jj|_|jj|_dS(sECreates the exception. The exception parameter is allowed to be None.N( RRt_locatort getSystemIdt _systemIdtgetColumnNumbert_colnumt getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s  cCs|jS(sNThe column number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs |jjS(sEGet the public identifier of the entity where the exception occurred.(Rt getPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j}|dkr!d}n|j}|dkrBd}n|j}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s t?s %s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR Ys         ( RRRRRRRRR (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s     tSAXNotRecognizedExceptioncBseZdZRS(sException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s( Rtsystplatformt java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyts %;  PKi#]'ZE;E;sax/expatreader.pycnu[ {fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d kred en[ ydd lmZWn ek reden#Xeed redenddlmZmZmZejZejZydd lZWnek r_dZnXdd lZejZ[[dfdYZdejfdYZ dej!ejfdYZ"dZ#e$dkr/dd l%Z&e#Z'e'j(e&j)jj*e'j+e&j)j,e'j-dnd S(s] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. s0.20i(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedt ParserCreate(t xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st _ClosedParsercBseZRS((t__name__t __module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.st ExpatLocatorcBs;eZdZdZdZdZdZdZRS(sLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getLineNumberBs cCs&|j}|dkrdS|jjS(N(RRt_sourcet getPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs  cCs&|j}|dkrdS|jjS(N(RRRt getSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns  (RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     t ExpatParsercBs.eZdZdd%dZdZdZdZd Zd Zd Z d Z dd Z dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Z d#Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||tj|_d|_||_d|_d|_ g|_ d|_ d|_ dS(Nii( R tIncrementalParserRt InputSourceRRRt _namespacest_lex_handler_propt_parsingt _entity_stackt _external_gest _interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs      cCsjtj|}||_y7|j|jjt|tjj ||Wn|j nXdS(s3Parse an XML document from a URL or an InputSource.N( R tprepare_input_sourceRtresett _cont_handlertsetDocumentLocatorRR R$tparset _close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs   cCsV|jdk rR|j}t|tr?|jd}n|jj|ndS(Nsutf-8(R!Rt isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt prepareParserws  cCs-tjj|||jr)|jndS(N(R R$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;s cCsl|tkr|jS|tkr,|jdk S|tttfkrEdS|tkrX|j St d|dS(NisFeature '%s' not recognized( RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getFeatures      cCs|jrtdn|tkr0||_n|tkrH||_n|tkr|rx|jdkri|_qqd|_n||t kr|rtdqnX|t kr|rtdqn4|t kr|rtdqnt d|dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized( R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setFeatures2          cCs|tjkr|jS|tkr)|jS|tkr{|jrlt|jdr]|jjSt dq{t dnt d|dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized( Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getPropertys      cCs||tjkr1||_|jrx|jqxnG|tkrI||_n/|tkrhtd|nt d|dS(NsProperty '%s' cannot be setsProperty '%s' not recognized( RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setPropertys      cCs|js,|jd|_|jjny|jj||WnDtjk r}ttj |j ||}|j j |nXdS(Ni( R(R/R0t startDocumentRtParseR terrortSAXParseExceptiont ErrorStringtcodet _err_handlert fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeeds   cCs_|j}z)|j}|dk r1|jnWd|j}|dk rZ|jnXdS(N(RtgetCharacterStreamRtcloset getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     cCs|js*|jdks*t|jtr.dSz6|jddd|jjd|_d|_Wdd|_|jdk rt}|jj |_ |jj |_ ||_n|j XdS(NtRSii( R)RRR5RRVR0t endDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRXs      cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j |_|j |_|j |_|j |_dS(N( R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs            cCsc|jr]tj|jjdd|j|_d|j_|j|j_ |j |j_ nBtj|jjd|j|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|jn|j|j_y|j|j_Wntk r9nX|jj tj!d|_"g|_#dS(Nt tinternii($R&R R Rt getEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert start_elementt end_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6          cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs |jjS(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs |jjS(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|dS(N(R0t startElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|dS(N(R0t endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRsc CsL|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}i}i}x|jD]\}}|j}t|} | dkr|} d|f} nQ| dkrd|d|df} |d|df} n|d} t|} ||| <| || RtpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.         cCsy|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}|jj|ddS(Niii(RRRRR0t endElementNS(RR>R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrws  cCs|jj||dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instructionscCs|jj|dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_datascCs|jj||dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRzscCs|jj|dS(N(R0tendPrefixMapping(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|scCs|jj|||dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRiscCs|jj||||dS(N(t _dtd_handlertunparsedEntityDecl(RR>R9RRt notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRvscCs|jj|||dS(N(Rt notationDecl(RR>R9RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRxscCs|js dS|jj||}tj||jjp=d}|jj|j |jf|j j ||_ ||_yt j j ||WndSX|jd\|_ |_|jd=dS(NiR[ii(R*t _ent_handlert resolveEntityR R.RR!R)tappendRtExternalEntityParserCreateR R$R2(RtcontextR9RRR4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs      cCs'|rd|}n|jj|dS(Nt%(R0t skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs ii("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrRRRzR|RiRvRxRR(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@          '       "        cOs t||S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt create_parserst__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRt xml.parsersR t ImportErrorREtxml.saxR R RRRt_weakrefRtweakreftproxyRtLocatorRR$R#RRtxml.sax.saxutilstxmltpR;tsaxt XMLGeneratortsetErrorHandlert ErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsL         $a    PKi#]hjsax/__init__.pycnu[ {fc@sjdZddlmZddlmZmZddlmZmZm Z m Z m Z edZ edZ dgZdZerdd lZndd lZdd lZejj rd ejkrejd jd Zn[d Zejd dkr/ejjer/ejjejd ZngdZejd dkrZdZn dZ[d S(sSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. i(t InputSource(tContentHandlert ErrorHandler(t SAXExceptiontSAXNotRecognizedExceptiontSAXParseExceptiontSAXNotSupportedExceptiontSAXReaderNotAvailablecCs4t}|j||j||j|dS(N(t make_parsertsetContentHandlertsetErrorHandlertparse(tsourcethandlert errorHandlertparser((s(/usr/lib64/python2.7/xml/sax/__init__.pyR s   cCsyddlm}Wn!tk r7ddlm}nX|dkrPt}nt}|j||j|t}|j |||j |dS(Ni(tStringIO( t cStringIORt ImportErrortNoneRRR R Rt setByteStreamR (tstringR RRRtinpsrc((s(/usr/lib64/python2.7/xml/sax/__init__.pyt parseString#s       sxml.sax.expatreaderiNt PY_SAX_PARSERt,spython.xml.sax.parseritjavacCs}xg|tD][}yt|SWq tk rU}ddl}||jkrfqfq tk req Xq WtdddS(s&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.iNsNo parsers found(tdefault_parser_listt_create_parserRtsystmodulesRR(t parser_listt parser_nameteR((s(/usr/lib64/python2.7/xml/sax/__init__.pyRGs   cCs2ddlm}|j|dt}|jS(Ni(timpi(torg.python.coreR"t importNametglobalst create_parser(R R"t drv_module((s(/usr/lib64/python2.7/xml/sax/__init__.pyRbscCs"t|iidg}|jS(NR&(t __import__R&(R R'((s(/usr/lib64/python2.7/xml/sax/__init__.pyRhs(t__doc__t xmlreaderRR RRt _exceptionsRRRRRR RRt_falsetxml.sax.expatreadertxmltosRtflagstignore_environmenttenvirontsplitt_keytplatformtregistryt containsKeyt getPropertyRR(((s(/usr/lib64/python2.7/xml/sax/__init__.pyts*( %   PKi#]'ZE;E;sax/expatreader.pyonu[ {fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d kred en[ ydd lmZWn ek reden#Xeed redenddlmZmZmZejZejZydd lZWnek r_dZnXdd lZejZ[[dfdYZdejfdYZ dej!ejfdYZ"dZ#e$dkr/dd l%Z&e#Z'e'j(e&j)jj*e'j+e&j)j,e'j-dnd S(s] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. s0.20i(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedt ParserCreate(t xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st _ClosedParsercBseZRS((t__name__t __module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.st ExpatLocatorcBs;eZdZdZdZdZdZdZRS(sLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getLineNumberBs cCs&|j}|dkrdS|jjS(N(RRt_sourcet getPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs  cCs&|j}|dkrdS|jjS(N(RRRt getSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns  (RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     t ExpatParsercBs.eZdZdd%dZdZdZdZd Zd Zd Z d Z dd Z dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Z d#Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||tj|_d|_||_d|_d|_ g|_ d|_ d|_ dS(Nii( R tIncrementalParserRt InputSourceRRRt _namespacest_lex_handler_propt_parsingt _entity_stackt _external_gest _interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs      cCsjtj|}||_y7|j|jjt|tjj ||Wn|j nXdS(s3Parse an XML document from a URL or an InputSource.N( R tprepare_input_sourceRtresett _cont_handlertsetDocumentLocatorRR R$tparset _close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs   cCsV|jdk rR|j}t|tr?|jd}n|jj|ndS(Nsutf-8(R!Rt isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt prepareParserws  cCs-tjj|||jr)|jndS(N(R R$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;s cCsl|tkr|jS|tkr,|jdk S|tttfkrEdS|tkrX|j St d|dS(NisFeature '%s' not recognized( RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getFeatures      cCs|jrtdn|tkr0||_n|tkrH||_n|tkr|rx|jdkri|_qqd|_n||t kr|rtdqnX|t kr|rtdqn4|t kr|rtdqnt d|dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized( R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setFeatures2          cCs|tjkr|jS|tkr)|jS|tkr{|jrlt|jdr]|jjSt dq{t dnt d|dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized( Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getPropertys      cCs||tjkr1||_|jrx|jqxnG|tkrI||_n/|tkrhtd|nt d|dS(NsProperty '%s' cannot be setsProperty '%s' not recognized( RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setPropertys      cCs|js,|jd|_|jjny|jj||WnDtjk r}ttj |j ||}|j j |nXdS(Ni( R(R/R0t startDocumentRtParseR terrortSAXParseExceptiont ErrorStringtcodet _err_handlert fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeeds   cCs_|j}z)|j}|dk r1|jnWd|j}|dk rZ|jnXdS(N(RtgetCharacterStreamRtcloset getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s     cCs|js*|jdks*t|jtr.dSz6|jddd|jjd|_d|_Wdd|_|jdk rt}|jj |_ |jj |_ ||_n|j XdS(NtRSii( R)RRR5RRVR0t endDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRXs      cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j |_|j |_|j |_|j |_dS(N( R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs            cCsc|jr]tj|jjdd|j|_d|j_|j|j_ |j |j_ nBtj|jjd|j|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|jn|j|j_y|j|j_Wntk r9nX|jj tj!d|_"g|_#dS(Nt tinternii($R&R R Rt getEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert start_elementt end_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6          cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs |jjS(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs |jjS(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|dS(N(R0t startElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|dS(N(R0t endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRsc CsL|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}i}i}x|jD]\}}|j}t|} | dkr|} d|f} nQ| dkrd|d|df} |d|df} n|d} t|} ||| <| || RtpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.         cCsy|j}t|dkr-d|f}n5t|dkrV|d|df}n t|}|jj|ddS(Niii(RRRRR0t endElementNS(RR>R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrws  cCs|jj||dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instructionscCs|jj|dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_datascCs|jj||dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRzscCs|jj|dS(N(R0tendPrefixMapping(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|scCs|jj|||dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRiscCs|jj||||dS(N(t _dtd_handlertunparsedEntityDecl(RR>R9RRt notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRvscCs|jj|||dS(N(Rt notationDecl(RR>R9RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRxscCs|js dS|jj||}tj||jjp=d}|jj|j |jf|j j ||_ ||_yt j j ||WndSX|jd\|_ |_|jd=dS(NiR[ii(R*t _ent_handlert resolveEntityR R.RR!R)tappendRtExternalEntityParserCreateR R$R2(RtcontextR9RRR4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs      cCs'|rd|}n|jj|dS(Nt%(R0t skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRs ii("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrRRRzR|RiRvRxRR(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@          '       "        cOs t||S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt create_parserst__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRt xml.parsersR t ImportErrorREtxml.saxR R RRRt_weakrefRtweakreftproxyRtLocatorRR$R#RRtxml.sax.saxutilstxmltpR;tsaxt XMLGeneratortsetErrorHandlert ErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsL         $a    PKi#]ȳKKsax/xmlreader.pyonu[ {fc@sdZddlZddlmZmZdddYZdefdYZddd YZd dd YZd dd YZ de fdYZ dZ e dkre ndS(s]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. iN(tSAXNotSupportedExceptiontSAXNotRecognizedExceptiont XMLReadercBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs@tj|_tj|_tj|_tj|_dS(N( thandlertContentHandlert _cont_handlert DTDHandlert _dtd_handlertEntityResolvert _ent_handlert ErrorHandlert _err_handler(tself((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__init__scCstddS(sAParse an XML document from a system identifier or an InputSource.s This method must be implemented!N(tNotImplementedError(R tsource((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytparsescCs|jS(s#Returns the current ContentHandler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetContentHandler"scCs ||_dS(s:Registers a new object to receive document content events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetContentHandler&scCs|jS(s Returns the current DTD handler.(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getDTDHandler*scCs ||_dS(s7Register an object to receive basic DTD-related events.N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setDTDHandler.scCs|jS(s#Returns the current EntityResolver.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetEntityResolver2scCs ||_dS(s0Register an object to resolve external entities.N(R (R tresolver((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetEntityResolver6scCs|jS(s!Returns the current ErrorHandler.(R (R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetErrorHandler:scCs ||_dS(s3Register an object to receive error-message events.N(R (R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetErrorHandler>scCstddS(sHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.sLocale support not implementedN(R(R tlocale((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setLocaleBscCstd|dS(s1Looks up and returns the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R tname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getFeatureKscCstd|dS(s!Sets the state of a SAX2 feature.sFeature '%s' not recognizedN(R(R Rtstate((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setFeatureOscCstd|dS(s2Looks up and returns the value of a SAX2 property.sProperty '%s' not recognizedN(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPropertySscCstd|dS(s"Sets the value of a SAX2 property.sProperty '%s' not recognizedN(R(R Rtvalue((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPropertyWs(t__name__t __module__t__doc__R RRRRRRRRRRRRR R"(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s               tIncrementalParsercBsGeZdZd dZdZdZdZdZdZRS( ssThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.iicCs||_tj|dS(N(t_bufsizeRR (R tbufsize((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR os cCsddl}|j|}|j||j}|j|j}x/|dkrw|j||j|j}qIW|jdS(Nit(tsaxutilstprepare_input_sourcet prepareParsert getByteStreamtreadR'tfeedtclose(R RR*tfiletbuffer((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRss    cCstddS(sThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.s This method must be implemented!N(R(R tdata((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR/scCstddS(stThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(R(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR,scCstddS(sThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR0s cCstddS(sThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.s This method must be implemented!N(R(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytresetsi( R#R$R%R RR/R,R0R4(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR&[s   tLocatorcBs2eZdZdZdZdZdZRS(sInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS(s6Return the column number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetColumnNumberscCsdS(s4Return the line number where the current event ends.i((R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLineNumberscCsdS(s3Return the public identifier for the current event.N(tNone(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getPublicIdscCsdS(s3Return the system identifier for the current event.N(R8(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getSystemIds(R#R$R%R6R7R9R:(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR5s    t InputSourcecBsteZdZd dZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( snEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.cCs1||_d|_d|_d|_d|_dS(N(t_InputSource__system_idR8t_InputSource__public_idt_InputSource__encodingt_InputSource__bytefilet_InputSource__charfile(R t system_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR s     cCs ||_dS(s/Sets the public identifier of this InputSource.N(R=(R t public_id((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setPublicIdscCs|jS(s2Returns the public identifier of this InputSource.(R=(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR9scCs ||_dS(s/Sets the system identifier of this InputSource.N(R<(R RA((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setSystemIdscCs|jS(s2Returns the system identifier of this InputSource.(R<(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR:scCs ||_dS(s4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N(R>(R tencoding((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setEncodingscCs|jS(s/Get the character encoding of this InputSource.(R>(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getEncodingscCs ||_dS(sSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N(R?(R tbytefile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt setByteStreams cCs|jS(sGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.(R?(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR-scCs ||_dS(s^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N(R@(R tcharfile((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytsetCharacterStreamscCs|jS(s/Get the character stream for this input source.(R@(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetCharacterStreamsN(R#R$R%R8R RCR9RDR:RFRGRIR-RKRL(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR;s        tAttributesImplcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZRS(cCs ||_dS(sQNon-NS-aware implementation. attrs should be of the form {name : value}.N(t_attrs(R tattrs((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR scCs t|jS(N(tlenRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getLengthscCsdS(NtCDATA((R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetTypescCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValue"scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetValueByQName%scCs||jkrt|n|S(N(RNtKeyError(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNameByQName(s cCs||jkrt|n|S(N(RNRV(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetQNameByName-s cCs |jjS(N(RNtkeys(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytgetNames2scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt getQNames5scCs t|jS(N(RPRN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt__len__8scCs |j|S(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __getitem__;scCs |jjS(N(RNRY(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRY>scCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pythas_keyAscCs ||jkS(N(RN(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt __contains__DscCs|jj||S(N(RNtget(R Rt alternative((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR`GscCs|j|jS(N(t __class__RN(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pytcopyJscCs |jjS(N(RNtitems(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRdMscCs |jjS(N(RNtvalues(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRePsN(R#R$R RQRSRTRURWRXRZR[R\R]RYR^R_R8R`RcRdRe(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRMs$                 tAttributesNSImplcBs>eZdZdZdZdZdZdZRS(cCs||_||_dS(sNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N(RNt_qnames(R ROtqnames((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR Ws cCsDx4|jjD]#\}}||kr|j|SqWt|dS(N(RgRdRNRV(R Rtnsnametqname((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRU_s cCs=x-|jjD]\}}||kr|SqWt|dS(N(RgRdRV(R RRiRj((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRWfs cCs |j|S(N(Rg(R R((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRXmscCs |jjS(N(RgRe(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyR[pscCs|j|j|jS(N(RbRNRg(R ((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRcss(R#R$R RURWRXR[Rc(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyRfUs      cCstttdS(N(RR&R5(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyt_testwst__main__((((( R%Rt _exceptionsRRRR&R5R;RMRfRkR#(((s)/usr/lib64/python2.7/xml/sax/xmlreader.pyts PHYA"  PKi#]/sax/_exceptions.pycnu[ {fc@sdZddlZejd dkr8ddlmZn[defdYZdefd YZd efd YZd efd YZdefdYZ dS(s!Different kinds of SAX ExceptionsiNitjava(t Exceptiont SAXExceptioncBs>eZdZddZdZdZdZdZRS(sEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.cCs&||_||_tj||dS(sUCreates an exception. The message is required, but the exception is optional.N(t_msgt _exceptionRt__init__(tselftmsgt exception((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRs  cCs|jS(s$Return a message for this exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getMessagescCs|jS(s9Return the embedded exception, or None if there was none.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt getExceptionscCs|jS(s0Create a string representation of the exception.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyt__str__"scCstddS(svAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined.t __getitem__N(tAttributeError(Rtix((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR &sN( t__name__t __module__t__doc__tNoneRR R R R (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR s     tSAXParseExceptioncBsDeZdZdZdZdZdZdZdZRS(s#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCsVtj|||||_|jj|_|jj|_|jj|_dS(sECreates the exception. The exception parameter is allowed to be None.N( RRt_locatort getSystemIdt _systemIdtgetColumnNumbert_colnumt getLineNumbert_linenum(RRRtlocator((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR;s  cCs|jS(sNThe column number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRHscCs|jS(sDThe line number of the end of the text where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRMscCs |jjS(sEGet the public identifier of the entity where the exception occurred.(Rt getPublicId(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRQscCs|jS(sEGet the system identifier of the entity where the exception occurred.(R(R((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyRUscCsz|j}|dkr!d}n|j}|dkrBd}n|j}|dkrcd}nd||||jfS(s0Create a string representation of the exception.s t?s %s:%s:%s: %sN(RRRRR(Rtsysidtlinenumtcolnum((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR Ys         ( RRRRRRRRR (((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR.s     tSAXNotRecognizedExceptioncBseZdZRS(sException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR!istSAXNotSupportedExceptioncBseZdZRS(sException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR"sstSAXReaderNotAvailablecBseZdZRS(sException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.(RRR(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyR#}s( Rtsystplatformt java.langRRRR!R"R#(((s+/usr/lib64/python2.7/xml/sax/_exceptions.pyts %;  PKi#]@ X-- __init__.pynu["""Core XML support for Python. This package contains four sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Megginson and ported to Python by Lars Marius Garshol. This supports the SAX 2 API. etree -- The ElementTree XML library. This is a subset of the full ElementTree XML release. """ __all__ = ["dom", "parsers", "sax", "etree"] PKi#]=p66 __init__.pycnu[ {fc@sdZddddgZd Zydd lZWnek rAn]Xy ejZWnek rbn<Xeekrdd lZej j e eej e s     PKi#]-l::parsers/__init__.pyonu[ {fc@s dZdS(sPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N(t__doc__(((s,/usr/lib64/python2.7/xml/parsers/__init__.pyttPKi#]0parsers/expat.pyonu[ {fc@sdZdZddlTdS(s1Interface to the Expat non-validating XML parser.s$Revision: 17640 $i(t*N(t__doc__t __version__tpyexpat(((s)/usr/lib64/python2.7/xml/parsers/expat.pytsPKi#]0parsers/expat.pycnu[ {fc@sdZdZddlTdS(s1Interface to the Expat non-validating XML parser.s$Revision: 17640 $i(t*N(t__doc__t __version__tpyexpat(((s)/usr/lib64/python2.7/xml/parsers/expat.pytsPKi#];c}parsers/expat.pynu["""Interface to the Expat non-validating XML parser.""" import sys from pyexpat import * # provide pyexpat submodules as xml.parsers.expat submodules sys.modules['xml.parsers.expat.model'] = model sys.modules['xml.parsers.expat.errors'] = errors PKi#];|parsers/__init__.pynu["""Python interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. """ PKi#]-l::parsers/__init__.pycnu[ {fc@s dZdS(sPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N(t__doc__(((s,/usr/lib64/python2.7/xml/parsers/__init__.pyttPKi#]#}P3etree/__pycache__/cElementTree.cpython-36.opt-2.pycnu[3 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pysPKi#]M휺,etree/__pycache__/ElementTree.cpython-36.pycnu[3 \@sHdZddddddddd d d d d ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl m Z Gdd d e Z ddZ GdddZifd dZd^d!dZd_d"d ZeZGd#d d ZGd$ddZejd%d&Zd`d'd(Zd)d*ZdaZy eeZWnek r"YnXd8d9Zd:d;Zeeed<Zd=dZd>d?d@dAdBdCdDdEZ e e_ dFdGZ!dHdIZ"dJdKZ#dLdMZ$dbdNdOdPdZ%GdQdRdRej&Z'dcdNdOdSdZ(dTdZ)dddUd Z*dedVdZ+GdWddZ,dfdXdZ-dgdYdZ.e-Z/dhdZdZ0Gd[ddZ1Gd\ddZ2yeZ3dd]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. CommentdumpElement ElementTree fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@seZdZdZdS)r zAn 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|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elementrrr rvsc@s eZdZdZdZdZdZdZifddZddZ ddZ d d Z d d Z d dZ ddZddZddZddZddZddZddZddZdd Zd9d!d"Zd:d#d$Zd;d%d&Zdd3d4Z d?d5d6Z!d7d8Z"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: text...tail NcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater!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)zCreate 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 makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. N)r1r!r*texttail)r,elemrrr r(s  z Element.copycCs t|jS)N)lenr+)r,rrr __len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn 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 rBs 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 rDs zElement.extendcCs|j||jj||dS)z(Insert *subelement* at position *index*.N)rAr+insert)r,r=rCrrr rFs zElement.insertcCs t|tstdt|jdS)Nzexpected an Element, not %s)r$ _Element_Pyr&typer)r,errr rAs zElement._assert_is_elementcCs|jj|dS)aRemove 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. )rfind)r,path namespacesrrr rM!s z Element.findcCstj||||S)aFind 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. )rfindtext)r,rNdefaultrOrrr 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. )rfindall)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. )riterfind)r,rNrOrrr rSEs zElement.iterfindcCs |jjg|_d|_|_dS)zReset 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[s z Element.getcCs||j|<dS)zSet 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,rVvaluerrr sethsz Element.setcCs |jjS)zGet 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 |jjS)zGet 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.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:PendingDeprecationWarninglistr\)r,r!rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r!r$strr2itertextr3)r,r!trIrrr ras 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)aSubelement 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 rs    cCstt}||_|S)zComment 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 rs 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@sZeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)r aQualified 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,Z text_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|jS)N)hashr2)r,rrr __hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,otherrrr __le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __eq__s  z QName.__eq__)N) rrrrr.rfr0rhrjrkrlrmrnrrrr r s  c@seZdZdZdddZddZddZdd d Zdd d Zd d dZ d!ddZ d"ddZ d#ddZ d$ddZ d%ddddZddZdS)&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)zReplace 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 Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)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. FreadrbTN _parse_wholei)r"openrrurorsfeedclose)r,sourceparser close_sourcedatarrr r =s&       zElementTree.parsecCs |jj|S)zCreate 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.itercCstjdtddt|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:|dddkr,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/.zThis 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<|dddkr,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~zThis 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 rPs  zElementTree.findtextcCs:|dddkr,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~zThis 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 rRs  zElementTree.findallcCs:|dddkr,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~zThis 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 rSs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d | f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) aWrite 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 %rc14nutf-8us-asciiNunicoderz$ r2)r)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textro _namespaces)r,file_or_filenameencodingZxml_declarationdefault_namespacemethodrZ enc_lowerwriteZdeclared_encodingrqnamesrOZ serializerrr rs2     zElementTree.writecCs|j|ddS)Nr)r)r)r,rprrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr r\r_rMrPrRrSrrrrrr rs"   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr 3sz_get_writer.. )rrnewline)rAttributeErrorrv contextlib ExitStackr$ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrpstackrrr rs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r\r!r$r r2r`rr rrZ)r4rrr!rVrWr2r)rrOrr rEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r.)rV:z xmlns%s="%s"z %s="%s">z)r!r2rr _escape_cdata_serialize_xmlr^rZsorted_escape_attribr$r r5r3) rr4rrOrkwargsr!r2rIrZvkrrr rsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrr rsz!_serialize_html..)rVrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer&rr)r2rrr r$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr&rr)r2rrr r4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr&rr)r2rrr rPs   rT)rcCs6|dkrtjntj}t|j||||d|jS)aGenerate 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)rr)rStringIOBytesIOrrgetvalue)r#rrrstreamrrr r_sc@s8eZdZdZddZddZddZdd Zd d Zd S) _ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs ||_dS)N)lst)r,rrrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr rwsz_ListDataStream.writablecCsdS)NTr)r,rrr rzsz_ListDataStream.seekablecCs|jj|dS)N)rrB)r,brrr r}sz_ListDataStream.writecCs t|jS)N)r5r)r,rrr rsz_ListDataStream.tellN) rrrrr.rrrrrrrr rrs rcCs&g}t|}t|j||||d|S)N)rr)rrr)r#rrrrrrrr rs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)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)rrrN)r$rrsysstdoutrqr3)r4r3rrr rs  cCst}|j|||S)zParse 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 )ryrztreerrr r s  csdt||dfddGfdddtj}|d_~dtds`td 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,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrsrw_close_and_return_rootrootrx)r|r)r{it pullparserryrr iterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrr IterParseIteratorsrNFrsrtT)r collectionsIteratorrr"rv)ryrrzrr)r{rrrryr rs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)reend)r)rdeque _events_queuerrr _setevents)r,rrrrr 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)rrrw SyntaxErrorrrB)r,r|excrrr rws zXMLPullParser.feedcCs|jj}d|_|S)N)rrx)r,rrrr rs z$XMLPullParser._close_and_return_rootcCs |jdS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)r)r,rrr rxszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)zReturn an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)rpopleftr$ Exception)r,reventrrr rs  zXMLPullParser.read_events)N)rrrr.rwrrxrrrrr rs   cCs"|sttd}|j||jS)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|sttd}|j||j}i}x&|jD]}|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)r2rzrZidsr4r/rrr r&s     cCs0|sttd}x|D]}|j|qW|jS)zParse 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@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)raGeneric 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|jdkstd|jdk s(td|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagsNzmissing toplevel element)r5rAssertionErrorr)r,rrr rxfszTreeBuilder.closecCsf|jrb|jdk r\dj|j}|jr@|jjdks6td||j_n|jjdksTtd||j_g|_dS)Nrzinternal error (tail)zinternal error (text))rrjoinrr3rr2)r,r2rrr _flushls   zTreeBuilder._flushcCs|jj|dS)zAdd text to current element.N)rrB)r,r|rrr r|xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rrr)rrrrrBr)r,r!attrsr4rrr start|s zTreeBuilder.startcCs@|j|jj|_|jj|ks4td|jj|fd|_|jS)zOClose and return current Element. *tag* is the element name. z&end tag mismatch (expected %s, got %s)r)rrpoprr!rr)r,r!rrr rs zTreeBuilder.end)N) rrrrr.rxrr|rrrrrr rPs   c@sfeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ e Z ddZ ddZdS)raElement 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 rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr|commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterrzrre_targeterror_error_names_defaultZDefaultHandlerExpandr"_startStartElementHandler_endEndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r,rrerrrzrrr 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) NrrcSs|||||fdS)Nr)r!Z attrib_inrrBrrrr handlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r!rrBrrrr rszstart-nscSs|||p d|pdffdS)Nrr)rrrrBrrr rszend-nscSs||dfdS)Nr)rrrBrrr rszunknown event %r) rrBrrr r r rZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r,Z events_queueZevents_to_reportrzrBZ event_namerrrr rs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r,rWerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)r KeyError)r,rVnamerrr _fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr7r)rranger5rer)r,r!Z attr_listZfixnamer*irrr r szXMLParser._startcCs|jj|j|S)N)rerr)r,r!rrr r szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z "s) A   0t4 =2 2  05   KU PKi#]A3}})etree/__pycache__/__init__.cpython-36.pycnu[3 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pysPKi#]A3}}/etree/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pysPKi#]Ib}2etree/__pycache__/ElementPath.cpython-36.opt-2.pycnu[3 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  PKi#]tH2etree/__pycache__/ElementTree.cpython-36.opt-1.pycnu[3 \@sHdZddddddddd d d d d ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl m Z Gdd d e Z ddZ GdddZifd dZd^d!dZd_d"d ZeZGd#d d ZGd$ddZejd%d&Zd`d'd(Zd)d*ZdaZy eeZWnek r"YnXd8d9Zd:d;Zeeed<Zd=dZd>d?d@dAdBdCdDdEZ e e_ dFdGZ!dHdIZ"dJdKZ#dLdMZ$dbdNdOdPdZ%GdQdRdRej&Z'dcdNdOdSdZ(dTdZ)dddUd Z*dedVdZ+GdWddZ,dfdXdZ-dgdYdZ.e-Z/dhdZdZ0Gd[ddZ1Gd\ddZ2yeZ3dd]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. CommentdumpElement ElementTree fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@seZdZdZdS)r zAn 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|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elementrrr rvsc@s eZdZdZdZdZdZdZifddZddZ ddZ d d Z d d Z d dZ ddZddZddZddZddZddZddZddZdd Zd9d!d"Zd:d#d$Zd;d%d&Zdd3d4Z d?d5d6Z!d7d8Z"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: text...tail NcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater!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)zCreate 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 makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)zReturn copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. N)r1r!r*texttail)r,elemrrr r(s  z Element.copycCs t|jS)N)lenr+)r,rrr __len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn 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 rBs 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 rDs zElement.extendcCs|j||jj||dS)z(Insert *subelement* at position *index*.N)rAr+insert)r,r=rCrrr rFs zElement.insertcCs t|tstdt|jdS)Nzexpected an Element, not %s)r$ _Element_Pyr&typer)r,errr rAs zElement._assert_is_elementcCs|jj|dS)aRemove 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. )rfind)r,path namespacesrrr rM!s z Element.findcCstj||||S)aFind 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. )rfindtext)r,rNdefaultrOrrr 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. )rfindall)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. )riterfind)r,rNrOrrr rSEs zElement.iterfindcCs |jjg|_d|_|_dS)zReset 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[s z Element.getcCs||j|<dS)zSet 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,rVvaluerrr sethsz Element.setcCs |jjS)zGet 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 |jjS)zGet 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.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:PendingDeprecationWarninglistr\)r,r!rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r!r$strr2itertextr3)r,r!trIrrr ras 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)aSubelement 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 rs    cCstt}||_|S)zComment 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 rs 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@sZeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)r aQualified 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,Z text_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|jS)N)hashr2)r,rrr __hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,otherrrr __le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r$r r2)r,rirrr __eq__s  z QName.__eq__)N) rrrrr.rfr0rhrjrkrlrmrnrrrr r s  c@seZdZdZdddZddZddZdd d Zdd d Zd d dZ d!ddZ d"ddZ d#ddZ d$ddZ d%ddddZddZdS)&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)zReplace 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 Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)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. FreadrbTN _parse_wholei)r"openrrurorsfeedclose)r,sourceparser close_sourcedatarrr r =s&       zElementTree.parsecCs |jj|S)zCreate 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.itercCstjdtddt|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:|dddkr,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/.zThis 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<|dddkr,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~zThis 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 rPs  zElementTree.findtextcCs:|dddkr,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~zThis 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 rRs  zElementTree.findallcCs:|dddkr,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~zThis 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 rSs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d | f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) aWrite 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 %rc14nutf-8us-asciiNunicoderz$ r2)r)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textro _namespaces)r,file_or_filenameencodingZxml_declarationdefault_namespacemethodrZ enc_lowerwriteZdeclared_encodingrqnamesrOZ serializerrr rs2     zElementTree.writecCs|j|ddS)Nr)r)r)r,rprrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr r\r_rMrPrRrSrrrrrr rs"   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr 3sz_get_writer.. )rrnewline)rAttributeErrorrv contextlib ExitStackr$ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrpstackrrr rs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r\r!r$r r2r`rr rrZ)r4rrr!rVrWr2r)rrOrr rEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r.)rV:z xmlns%s="%s"z %s="%s">z)r!r2rr _escape_cdata_serialize_xmlr^rZsorted_escape_attribr$r r5r3) rr4rrOrkwargsr!r2rIrZvkrrr rsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrr rsz!_serialize_html..)rVrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer&rr)r2rrr r$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr&rr)r2rrr r4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr&rr)r2rrr rPs   rT)rcCs6|dkrtjntj}t|j||||d|jS)aGenerate 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)rr)rStringIOBytesIOrrgetvalue)r#rrrstreamrrr r_sc@s8eZdZdZddZddZddZdd Zd d Zd S) _ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs ||_dS)N)lst)r,rrrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr rwsz_ListDataStream.writablecCsdS)NTr)r,rrr rzsz_ListDataStream.seekablecCs|jj|dS)N)rrB)r,brrr r}sz_ListDataStream.writecCs t|jS)N)r5r)r,rrr rsz_ListDataStream.tellN) rrrrr.rrrrrrrr rrs rcCs&g}t|}t|j||||d|S)N)rr)rrr)r#rrrrrrrr rs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)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)rrrN)r$rrsysstdoutrqr3)r4r3rrr rs  cCst}|j|||S)zParse 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 )ryrztreerrr r s  csdt||dfddGfdddtj}|d_~dtds`td 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,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrsrw_close_and_return_rootrootrx)r|r)r{it pullparserryrr iterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrr IterParseIteratorsrNFrsrtT)r collectionsIteratorrr"rv)ryrrzrr)r{rrrryr rs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)reend)r)rdeque _events_queuerrr _setevents)r,rrrrr 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)rrrw SyntaxErrorrrB)r,r|excrrr rws zXMLPullParser.feedcCs|jj}d|_|S)N)rrx)r,rrrr rs z$XMLPullParser._close_and_return_rootcCs |jdS)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)r)r,rrr rxszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)zReturn an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)rpopleftr$ Exception)r,reventrrr rs  zXMLPullParser.read_events)N)rrrr.rwrrxrrrrr rs   cCs"|sttd}|j||jS)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|sttd}|j||j}i}x&|jD]}|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)r2rzrZidsr4r/rrr r&s     cCs0|sttd}x|D]}|j|qW|jS)zParse 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@sBeZdZdZdddZddZddZd d Zd d Zd dZ dS)raGeneric 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)rrjoinrr3r2)r,r2rrr _flushls   zTreeBuilder._flushcCs|jj|dS)zAdd text to current element.N)rrB)r,r|rrr r|xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rrr)rrrrrBr)r,r!Zattrsr4rrr start|s zTreeBuilder.startcCs |j|jj|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)rrpoprr)r,r!rrr rs zTreeBuilder.end)N) rrrrr.rxrr|rrrrrr rPs   c@sfeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ e Z ddZ ddZdS)raElement 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 rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr|commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterrzrre_targeterror_error_names_defaultZDefaultHandlerExpandr"_startStartElementHandler_endEndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r,rrerrrzrrr 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) NrrcSs|||||fdS)Nr)r!Z attrib_inrrBrrrr handlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r!rrBrrrr rszstart-nscSs|||p d|pdffdS)Nrr)rrrrBrrr rszend-nscSs||dfdS)Nr)rrrBrrr rszunknown event %r) rrBr rr r r r ZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r,Z events_queueZevents_to_reportrzrBZ event_namerrrr rs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r,rWerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)rKeyError)r,rVnamerrr _fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr7r)rranger5rer)r,r!Z attr_listZfixnamer*irrr r szXMLParser._startcCs|jj|j|S)N)rerr)r,r!rrr r szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z "s) A   0t4 =2 2  05   KU PKi#]#}P-etree/__pycache__/cElementTree.cpython-36.pycnu[3 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pysPKi#]#}P3etree/__pycache__/cElementTree.cpython-36.opt-1.pycnu[3 \R@s ddlTdS))*N)Zxml.etree.ElementTreerr./usr/lib64/python3.6/xml/etree/cElementTree.pysPKi#]A3}}/etree/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \D@sdS)Nrrr*/usr/lib64/python3.6/xml/etree/__init__.pysPKi#]1bmm2etree/__pycache__/ElementTree.cpython-36.opt-2.pycnu[3 \@sDdddddddddd d d d d dddddddddgZdZddlZddlZddlZddlZddlZddlZddlm Z Gdd d e Z ddZ GdddZ ifdd Zd]d dZd^d!d ZeZGd"d d ZGd#ddZejd$d%Zd_d&d'Zd(d)Zd`Zy eeZWnek rYnXd7d8Zd9d:Zeeed;Zdd?d@dAdBdCdDZee_dEdFZ dGdHZ!dIdJZ"dKdLZ#dadMdNdOdZ$GdPdQdQej%Z&dbdMdNdRdZ'dSdZ(dcdTdZ)dddUdZ*GdVddZ+dedWdZ,dfdXdZ-e,Z.dgdYdZ/GdZddZ0Gd[ddZ1ye Z2dd\l3TWne4k r>YnXdS)hCommentdumpElement ElementTree fromstringfromstringlist iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespacez1.3.0N) ElementPathc@s eZdZdS)r N)__name__ __module__ __qualname__rr-/usr/lib64/python3.6/xml/etree/ElementTree.pyr hs cCs t|dS)Ntag)hasattr)elementrrrrvsc@seZdZdZdZdZdZifddZddZddZ dd Z d d Z d d Z ddZ ddZddZddZddZddZddZddZddZd8d d!Zd9d"d#Zd:d$d%Zd;d&d'Zd(d)Zdd4d5Z d6d7Z!dS)?rNcKsDt|tstd|jjf|j}|j|||_||_g|_ dS)Nzattrib must be dict, not %s) isinstancedict TypeError __class__rcopyupdater 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 makeelements zElement.makeelementcCs0|j|j|j}|j|_|j|_||dd<|S)N)r0r r)texttail)r+elemrrrr's  z Element.copycCs t|jS)N)lenr*)r+rrr__len__szElement.__len__cCstjdtddt|jdkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.) stacklevelr)warningswarn 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+ subelementrrrrAs zElement.appendcCs(x|D]}|j|qW|jj|dS)N)r@r*extend)r+elementsr"rrrrCs zElement.extendcCs|j||jj||dS)N)r@r*insert)r+r<rBrrrrEs zElement.insertcCs t|tstdt|jdS)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)r8r9DeprecationWarningr*)r+rrr getchildrens zElement.getchildrencCstj|||S)N)rfind)r+path namespacesrrrrL!s z Element.findcCstj||||S)N)rfindtext)r+rMdefaultrNrrrrO,s zElement.findtextcCstj|||S)N)rfindall)r+rMrNrrrrQ:s zElement.findallcCstj|||S)N)riterfind)r+rMrNrrrrREs zElement.iterfindcCs |jjg|_d|_|_dS)N)r)clearr*r1r2)r+rrrrSPs z Element.clearcCs|jj||S)N)r)get)r+keyrPrrrrT[s z Element.getcCs||j|<dS)N)r))r+rUvaluerrrsethsz Element.setcCs |jjS)N)r)keys)r+rrrrXrsz Element.keyscCs |jjS)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.itercCstjdtddt|j|S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r6)r7)r8r9PendingDeprecationWarninglistr[)r+r rrr getiterators zElement.getiteratorccs^|j}t|t r|dk rdS|j}|r.|Vx*|D]"}|jEdH|j}|r4|Vq4WdS)N)r r#strr1itertextr2)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"rrrrs    cCstt}||_|S)N)rrr1)r1r"rrrrs cCs&tt}||_|r"|jd||_|S)N )rr r1)targetr1r"rrrr s c@sVeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ dS)r NcCs|rd||f}||_dS)Nz{%s}%s)r1)r+Z text_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|jS)N)hashr1)r+rrr__hash__szQName.__hash__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+otherrrr__le__s  z QName.__le__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__lt__ s  z QName.__lt__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__ge__s  z QName.__ge__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__gt__s  z QName.__gt__cCs t|tr|j|jkS|j|kS)N)r#r r1)r+rhrrr__eq__s  z QName.__eq__)N) rrrr-rer/rgrirjrkrlrmrrrrr s c@seZdZdddZddZddZddd Zdd d Zdd d Zd ddZ d!ddZ d"ddZ d#ddZ d$ddddZ ddZdS)%rNcCs||_|r|j|dS)N)_rootr )r+r"filerrrr-)szElementTree.__init__cCs|jS)N)rn)r+rrrgetroot/szElementTree.getrootcCs ||_dS)N)rn)r+r"rrr_setroot3szElementTree._setrootc Csd}t|dst|d}d}zZ|dkrHt}t|drH|j||_|jSx|jd}|sZP|j|qJW|j|_|jS|r|jXdS)NFreadrbT _parse_wholei)r!openrrtrnrrfeedclose)r+sourceparser close_sourcedatarrrr =s&       zElementTree.parsecCs |jj|S)N)rnr[)r+r rrrr[bs zElementTree.itercCstjdtddt|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:|dddkr,d|}tjd|tdd|jj||S)Nr/.zThis 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<|dddkr,d|}tjd|tdd|jj|||S)Nrr|r}zThis 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+rMrPrNrrrrOs  zElementTree.findtextcCs:|dddkr,d|}tjd|tdd|jj||S)Nrr|r}zThis 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+rMrNrrrrQs  zElementTree.findallcCs:|dddkr,d|}tjd|tdd|jj||S)Nrr|r}zThis 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+rMrNrrrrRs  zElementTree.iterfindT)short_empty_elementscCs|s d}n|tkrtd||s4|dkr0d}nd}|j}t||}|dkr|sd|dkr|d kr|} |dkrddl} | j} |d| f|d krt||jn,t|j|\} } t|} | ||j| | |d WdQRXdS) Nxmlzunknown method %rc14nutf-8us-asciiunicoderz$ r1)r~)rrr) _serialize ValueErrorlower _get_writerlocalegetpreferredencoding_serialize_textrn _namespaces)r+file_or_filenameencodingZxml_declarationdefault_namespacemethodr~Z enc_lowerwriteZdeclared_encodingrqnamesrNZ serializerrrrs2     zElementTree.writecCs|j|ddS)Nr)r)r)r+rorrr write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrr-rprqr r[r^rLrOrQrRrrrrrrrs   %    5ccs"y |j}WnPtk rZ|dkr.t|d}nt|d|dd}||jVWdQRXYnX|dkrl|Vntj}t|tjr|}nft|tjrtj |}|j |j nBtj}dd|_ ||_y|j |_ |j|_Wntk rYnXtj||ddd}|j |j |jVWdQRXdS) Nrwxmlcharrefreplace)rerrorscSsdS)NTrrrrr3sz_get_writer.. )rrnewline)rAttributeErrorru contextlib ExitStackr#ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletell TextIOWrapper)rrrrostackrrrrs>         rcsddiird<fdd}x|jD]}|j}t|tr\|jkr||jn.add_qname) r[r r#r r1r_rr rrY)r3rrr rUrVr1r)rrNrrrEs4      rc Ks|j}|j}|tkr$|d|n|tkr<|d|nv||}|dkr|r\|t|x|D]}t|||d|dqbWn2|d|t|j} | s|rD|rx@t|jdddD](\} } | rd| } |d | t | fqWxZt| D]N\} } t | t r | j} t | t r$|| j} nt | } |d || | fqW|s\t |s\| r|d |rv|t|x |D]}t|||d|dq|W|d |d n|d |j r|t|j dS)Nz z)r~.)rU:z xmlns%s="%s"z %s="%s">z)r r1rr _escape_cdata_serialize_xmlr]rYsorted_escape_attribr#r r4r2) rr3rrNr~kwargsr r1rHrYvkrrrrsT             rareabasebasefontbrcolframehrimginputisindexlinkmetaparamc Ks|j}|j}|tkr(|dt|n|tkrD|dt|n|||}|dkr|rd|t|x|D]}t|||dqjWn<|d|t|j}|s|rH|rx@t|jdddD](\} } | rd| } |d| t | fqWxZt|D]N\} } t | t r| j} t | t r(|| j} nt | } |d || | fqW|d |j } |r| d ksr| d kr|||n |t|x|D]}t|||dqW| tkr|d |d |jr|t|jdS)Nz zrcSs|dS)Nrr)rrrrrsz!_serialize_html..)rUrz xmlns%s="%s"z %s="%s"rZscriptZstylez|jdd}|Sttfk r`t|YnXdS)N&z&rz<rz>)replacer%rr)r1rrrr$s   rc Csyd|kr|jdd}d|kr*|jdd}d|kr>|jdd}d|krR|jdd}d |krf|jd d }d |krz|jd d }d |kr|jd d }d |kr|jd d}|Sttfk rt|YnXdS)Nrz&rz<rz>"z"z r z  z )rr%rr)r1rrrr4s(        rc Csfy@d|kr|jdd}d|kr*|jdd}d|kr>|jdd}|Sttfk r`t|YnXdS)Nrz&rz>rz")rr%rr)r1rrrrPs   rT)r~cCs6|dkrtjntj}t|j||||d|jS)Nr)rr~)rStringIOBytesIOrrgetvalue)r"rrr~streamrrrr_sc@s4eZdZddZddZddZddZd d Zd S) _ListDataStreamcCs ||_dS)N)lst)r+rrrrr-tsz_ListDataStream.__init__cCsdS)NTr)r+rrrrwsz_ListDataStream.writablecCsdS)NTr)r+rrrrzsz_ListDataStream.seekablecCs|jj|dS)N)rrA)r+brrrr}sz_ListDataStream.writecCs t|jS)N)r4r)r+rrrrsz_ListDataStream.tellN)rrrr-rrrrrrrrrrs rcCs&g}t|}t|j||||d|S)N)rr~)rrr)r"rrr~rrrrrrs cCsNt|tst|}|jtjdd|jj}| s>|ddkrJtjjddS)Nr)rrr)r#rrsysstdoutrpr2)r3r2rrrrs  cCst}|j|||S)N)rr )rxrytreerrrr s  csdt||dfddGfdddtj}|d_~dtds`tdd S) N)events_parserc 3sbzNx,jEdHjd}|s"Pj|qWj}jEdH|_Wdr\jXdS)Nii@) read_eventsrrrv_close_and_return_rootrootrw)r{r)rzit pullparserrxrriterators  ziterparse..iteratorcseZdZjZdS)z$iterparse..IterParseIteratorN)rrr__next__r)rrrIterParseIteratorsrFrrrsT)r collectionsIteratorrr!ru)rxrryrr)rzrrrrxrrs   c@s<eZdZd ddddZddZddZd d Zd d ZdS)rN)rcCs<tj|_|pttd|_|dkr(d}|jj|j|dS)N)rdend)r)rdeque _events_queuerrr _setevents)r+rrrrrr-s  zXMLPullParser.__init__cCsZ|jdkrtd|rVy|jj|Wn.tk rT}z|jj|WYdd}~XnXdS)Nz!feed() called after end of stream)rrrv SyntaxErrorrrA)r+r{excrrrrvs zXMLPullParser.feedcCs|jj}d|_|S)N)rrw)r+rrrrrs z$XMLPullParser._close_and_return_rootcCs |jdS)N)r)r+rrrrwszXMLPullParser.closeccs2|j}x&|r,|j}t|tr$|q|VqWdS)N)rpopleftr# Exception)r+reventrrrrs  zXMLPullParser.read_events)N)rrrr-rvrrwrrrrrrs   cCs"|sttd}|j||jS)N)rd)rrrvrw)r1ryrrrrs   cCsV|sttd}|j||j}i}x&|jD]}|jd}|r0|||<q0W||fS)N)rdr.)rrrvrwr[rT)r1ryrZidsr3r.rrrr&s     cCs0|sttd}x|D]}|j|qW|jS)N)rd)rrrvrw)Zsequenceryr1rrrr>s   c@s>eZdZdddZddZddZdd 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)rrjoinrr2r1)r+r1rrr_flushls   zTreeBuilder._flushcCs|jj|dS)N)rrA)r+r{rrrr{xszTreeBuilder.datacCsF|j|j|||_}|jr0|jdj||jj|d|_|S)Nrrr)rrrrrAr)r+r Zattrsr3rrrstart|s zTreeBuilder.startcCs |j|jj|_d|_|jS)Nr)rrpoprr)r+r rrrrs zTreeBuilder.end)N) rrrr-rwrr{rrrrrrrPs   c@sbeZdZdddZddZddZd d Zd d Zd dZddZ ddZ e Z ddZ ddZ dS)rrNcCs<yddlm}Wn>tk rNy ddl}Wntk rHtdYnXYnX|j|d}|dkrjt}||_|_||_|_ |j |_ i|_ |j |_t|dr|j|_t|dr|j|_t|dr|j|_t|dr|j|_t|d r|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k r6YnXdS) Nr)expatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrr{commentpirzExpat %d.%d.%d)" xml.parsersr ImportErrorZpyexpatZ ParserCreaterryrrd_targeterror_error_names_defaultZDefaultHandlerExpandr!_startStartElementHandler_endEndElementHandlerr{ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_textordered_attributesspecified_attributes_doctypeentity version_infoversionr)r+rrdrrryrrrr-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) NrrcSs|||||fdS)Nr)r Z attrib_inrrArrrrhandlersz%XMLParser._setevents..handlerrcSs||||fdS)Nr)r rrArrrrrszstart-nscSs|||p d|pdffdS)Nrr)rrrrArrrrszend-nscSs||dfdS)Nr)rrrArrrrszunknown event %r) rrAr r rr r r ZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr)r+Z events_queueZevents_to_reportryrAZ event_namerrrrrs( zXMLParser._seteventscCs&t|}|j|_|j|jf|_|dS)N)r codelinenooffsetZposition)r+rVerrrrr _raiseerrorszXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nrr)rKeyError)r+rUnamerrr_fixnameszXMLParser._fixnamecCsV|j}||}i}|rHx0tdt|dD]}||d||||<q(W|jj||S)Nrr6r)rranger4rdr)r+r Z attr_listZfixnamer)irrrrszXMLParser._startcCs|jj|j|S)N)rdrr)r+r rrrr szXMLParser._endc Cs|dd}|dkry |jj}Wntk r4dSXy||j|ddWnZtk rddlm}|jd||jj |jj f}d|_ |jj |_ |jj |_ |YnXnD|dkr|ddd krg|_n"|jdk r|d krd|_dS|j}|sdS|jj|t|j}|d kr|jd}|d krb|d krb|j\}}} } | r| dd} n*|dkr|dkr|j\}}} d} ndSt|jdr|jj|| | ddn:|j|jkr|j|| | dd|j|| | ddd|_dS)Nrrr)rz'undefined entity %s: line %d, column %d r z Ks A   0t4 =2 2  05   KU PKi#]xr5etree/__pycache__/ElementInclude.cpython-36.opt-1.pycnu[3 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ 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)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  PKi#]Ib}2etree/__pycache__/ElementPath.cpython-36.opt-1.pycnu[3 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  PKi#]xr5etree/__pycache__/ElementInclude.cpython-36.opt-2.pycnu[3 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ 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)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  PKi#]xr/etree/__pycache__/ElementInclude.cpython-36.pycnu[3 \@sPddlZddlmZdZedZedZGdddeZd d d Zd d dZ 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)NxmlrbzUTF-8r)encoding)openrparseZgetrootread)hrefrrfiledatar r r default_loaderMs rcCsp|dkr t}d}xX|t|krj||}|jtkr:|jd}|jdd}|dkr|||}|dkrvtd||ftj|}|jr|jpd|j|_|||<n|dkr,||||jd}|dkrtd||f|r||d }|jpd||jpd|_n|jpd||jpd|_||=qn td |n&|jt krVtd |jn t |||d }qWdS) Nrrrr zcannot load %r as %rtextrrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r)) rlentagXINCLUDE_INCLUDEgetrcopytailrXINCLUDE_FALLBACKr)elemloaderierrZnoderr r r rcsF           )N)N) rrrZXINCLUDErr SyntaxErrorrrrr r r r 3s  PKi#]Ib},etree/__pycache__/ElementPath.cpython-36.pycnu[3 \&@sddlZejdZdddZddZddZd d Zd d Zd dZddZ ddZ eeee ee dZ iZ GdddZ dddZd ddZd!ddZd"ddZdS)#Nz\('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|\s+c csxtj|D]}|d}|r|ddkrd|kry6|jdd\}}|sJt|dd|||ffVWqtk rtd|YqXq |Vq WdS)Nr{:z{%s}%sz!prefix %r not found in prefix map)xpath_tokenizer_refindallsplitKeyError SyntaxError)pattern namespacestokentagprefixZurir-/usr/lib64/python3.6/xml/etree/ElementPath.pyxpath_tokenizerIsrcCsF|j}|dkrBi|_}x(|jjD]}x|D] }|||<q.Wq$W|S)N) parent_maprootiter)contextrperrrget_parent_mapWs  rcs|dfdd}|S)Nrc3s0x*|D]"}x|D]}|jkr|VqWqWdS)N)r )rresultelemr)r rrselectbs   zprepare_child..selectr)nextr rr)r r prepare_child`s rcCs dd}|S)Ncssx|D]}|EdHqWdS)Nr)rrrrrrrjs zprepare_star..selectr)rr rrrr prepare_starisrcCs dd}|S)Ncss|EdHdS)Nr)rrrrrrpszprepare_self..selectr)rr rrrr prepare_selfosrc s\y |}Wntk rdSX|ddkr2dn|dsD|dntdfdd}|S)Nr*rzinvalid descendantc3s4x.|D]&}x |jD]}||k r|VqWqWdS)N)r)rrrr)r rrrs z"prepare_descendant..select) StopIterationr )rr rr)r rprepare_descendantts    r"cCs dd}|S)NcssDt|}i}x2|D]*}||kr||}||krd||<|VqWdS)N)r)rrrZ result_maprparentrrrrs zprepare_parent..selectr)rr rrrrprepare_parents r$c s*g}g}xy |}Wntk r(dSX|ddkr8P|drh|ddddkrhd|dddf}|j|dpvd|j|dq Wdj|}|dkr|dfd d }|S|d kr|d|dfd d }|S|dkrtjd |d r|dfdd }|S|dkrVtjd |d rV|d|dfdd }|S|dkst|dkst|dkr|dkrt|dddkrtdnl|ddkrtd|dkr yt|ddWntk rtdYnXdkrtdndfdd }|StddS) Nr]rz'"'-z@-c3s&x |D]}|jdk r|VqWdS)N)get)rrr)keyrrrs z!prepare_predicate..selectz@-='c3s&x |D]}|jkr|VqWdS)N)r))rrr)r*valuerrrs z\-?\d+$c3s&x |D]}|jdk r|VqWdS)N)find)rrr)r rrrs z-='c3s@x:|D]2}x,|jD]}dj|jkr|VPqWqWdS)Nr()rjoinZitertext)rrrr)r r+rrrs  z-()z-()-zXPath position >= 1 expectedZlastzunsupported functionzunsupported expressionz)XPath offset from last() must be negativec 3sbt|}xT|D]L}y.||}t|j|j}||kr>|VWqttfk rXYqXqWdS)N)rlistrr IndexErrorr)rrrrr#Zelems)indexrrrs   zinvalid predicater2r2r2)r!appendr-rematchintr ValueError)rr Z signatureZ predicaterr)r1r*r r+rprepare_predicatesd            r9)r(r .z..z//[c@seZdZdZddZdS)_SelectorContextNcCs ||_dS)N)r)selfrrrr__init__sz_SelectorContext.__init__)__name__ __module__ __qualname__rr>rrrrr<sr<c !Csh||dkrdntt|jf}|dddkr8|d}y t|}Wntk r:ttdkrjtj|dddkrtdtt ||j }y |}Wnt k rdSXg}xvy|j t |d||Wnt k rtdYnXy|}|ddkr|}Wqt k r(PYqXqW|t|<YnX|g}t|}x|D]} | ||}qPW|S) Nr/r dz#cannot use absolute path on elementrz invalid pathr2)tuplesorteditems_cacherlenclearr rr__next__r!r4opsr<) rpathr Z cache_keyZselectorrr rrrrrriterfindsD      rMcCstt|||dS)N)rrM)rrLr rrrr,)sr,cCstt|||S)N)r/rM)rrLr rrrr/src Cs4ytt|||}|jpdStk r.|SXdS)Nr()rrMtextr!)rrLdefaultr rrrfindtext5s  rP)N)N)N)N)NN)r5compilerrrrrrr"r$r9rKrGr<rMr,rrPrrrr;s,    Y )  PKi#]ɵ /dom/__pycache__/minicompat.cpython-36.opt-1.pycnu[3 \' @sJdZddddgZddlZefZGdddeZGdddeZ d dZ dS) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. NodeList EmptyNodeList StringTypes defpropertyNc@s>eZdZfZddZddZddZeeeddZd d Z d S) rcCs(d|kot|knr$||SdS)Nr)len)selfindexr */usr/lib64/python3.6/xml/dom/minicompat.pyitem5sz NodeList.itemcCst|S)N)r)rr r r _get_length9szNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')xmldomNoModificationAllowedErr)rvaluer r r _set_length<szNodeList._set_lengthz$The number of nodes in the NodeList.)doccCs|dkr g}||dd<dS)Nr )rstater r r __setstate__DszNodeList.__setstate__N) __name__ __module__ __qualname__ __slots__r r rpropertylengthrr r r r r2sc@sFeZdZfZddZddZddZddZd d Ze eed d Z d S)rcCst}|j||S)N)rextend)rotherNLr r r __add__Ms zEmptyNodeList.__add__cCst}|j||S)N)rr)rrrr r r __radd__Rs zEmptyNodeList.__radd__cCsdS)Nr )rrr r r r WszEmptyNodeList.itemcCsdS)Nrr )rr r r r ZszEmptyNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')r rr)rrr r r r]szEmptyNodeList._set_lengthz$The number of nodes in the NodeList.)rN) rrrrrrr r rrrr r r r rJscCs8t|d|}|fdd}t|||d}t|||dS)NZ_get_cSstjjdt|dS)Nz&attempt to modify read-only attribute )r rrrepr)rrnamer r r setgszdefproperty..set)r)getattrrsetattr)klassr!rgetr"Zpropr r r res ) __doc____all__Zxml.domr strrlistrtuplerrr r r r s & PKi#]$YG j j+dom/__pycache__/expatbuilder.cpython-36.pycnu[3 \ @sdZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZejZejZejjZejjZejjZejjZejZejddejdd ejdd ejdd ejdd ejdd ejddejddejddd ZGdddeZddZddZGdddZeeefZ GdddeZ!GdddeZ"Gddde"Z#Gd d!d!e"Z$d"Z%d#e%Z&Gd$d%d%eZ'Gd&d'd'Z(Gd(d)d)e(eZ)Gd*d+d+e(e'Z*Gd,d-d-e+Z,Gd.d/d/eZ-d;d1d2Z.dd7d8Z1d9d:Z2dS)?zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNZcdata enumerationentityentitiesidZidrefZidrefsZnmtokenZnmtokens) ZCDATAENUMZENTITYZENTITIESIDZIDREFZIDREFSZNMTOKENZNMTOKENSc@sZeZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) ElementInfo _attr_info_modeltagNameNcCs||_g|_||_dS)N)rrr)selfrmodelr,/usr/lib64/python3.6/xml/dom/expatbuilder.py__init__?szElementInfo.__init__cCs|j|j|jfS)N)rrr)rrrr __getstate__DszElementInfo.__getstate__cCs|\|_|_|_dS)N)rrr)rstaterrr __setstate__GszElementInfo.__setstate__cCsJxB|jD]8}|d|kr|d}|ddkr4tdSt|dSqWtjS)Nr(rr!)r _typeinfo_mapr_no_type)ranameinfotrrrgetAttributeTypeJs   zElementInfo.getAttributeTypecCstjS)N)rr#)r namespaceURI localNamerrrgetAttributeTypeNSTszElementInfo.getAttributeTypeNScCs,|jr$|jd}|tjjtjjfkSdSdS)NrF)rrrZ XML_CTYPE_ANYZXML_CTYPE_MIXED)rtyperrrisElementContentWs   zElementInfo.isElementContentcCs |jr|jdtjjkSdSdS)NrF)rrrZXML_CTYPE_EMPTY)rrrrisEmpty_szElementInfo.isEmptycCs,x&|jD]}|d|kr|ddkSqWdS)NrrrFr!)r)rr$r%rrrisIdes  zElementInfo.isIdcCs|j||fS)N)r.)rZeuriZenameZaurir$rrrisIdNSkszElementInfo.isIdNS)rrr)N) __name__ __module__ __qualname__ __slots__rrrr'r*r,r-r.r/rrrrr<s  rcCs |j||S)N)_intern_setdefault)buildersrrr_internosr7cCsd|ks t|jd}|j}t|dkr^|\}}}|||}d||f}|||}|||}n4t|dkr|\}}t}|||}}n td|||||||fS)N z%s:%srz4Unsupported syntax: spaces in URIs not supported: %r)AssertionErrorsplitr4lenr ValueError)r5namepartsinternuri localnameprefixqnamerrr_parse_ns_namers          rEc@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.NcCsP|dkrtj}||_|jjdk r2t|jj|_n d|_t|_d|_|j dS)N) rZOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)roptionsrrrrs zExpatBuilder.__init__cCstjS)zCreate a new parser object.)r ParserCreate)rrrr createParserszExpatBuilder.createParsercCsF|js@|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rLrPr@ setdefaultr4Z buffer_textZordered_attributesZspecified_attributesinstall)rrrr getParsers   zExpatBuilder.getParsercCs,tjtdd|_|j|_|jj|_d|_dS)z6Free all data structures used during DOM construction.NF)theDOMImplementationZcreateDocumentrdocumentcurNode _elem_info_cdata)rrrrrMs   zExpatBuilder.resetcCs|j|_|j|_|j|_|j|_|jj r0|j |_ |j |_ |jjrH|j|_|jjrj|j|_|j|_|j|_n|j|_|j|_|j|_|j|_|j|_ dS)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrGrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlerZcdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerZXmlDeclHandlerelement_decl_handlerZElementDeclHandlerattlist_decl_handlerZAttlistDeclHandler)rparserrrrrRs$ zExpatBuilder.installc Cs|j}d}yLx:|jd}|s P|j|d|rB|jjrB|j|d}qW|jddWntk rlYnX|j}|jd|_|S) zIParse a document from a file object, returning the document node.TirFNi@) rSreadParserUdocumentElement _setup_subset ParseEscaperMrL)rfilertZ first_bufferbufferdocrrr parseFiles$    zExpatBuilder.parseFilec CsP|j}y|j|d|j|Wntk r6YnX|j}|jd|_|S)z|jj|}t|j||jr:|jj|tkr:|jj|dS)N)rUZ createCommentr rVrJrrr)rrrrrrrfIs  zExpatBuilder.comment_handlercCsd|_d|_dS)NTF)rXr)rrrrrhOsz(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS)NF)rXr)rrrrrjSsz&ExpatBuilder.end_cdata_section_handlercCsdS)Nrr)rcontextrrrrrrroWsz(ExpatBuilder.external_entity_ref_handlercCs4|jdkr|j rt|_|j|j_|j||dS)N)rJrWrrstart_element_handlerrSr\)rr> attributesrrrr[Zs z"ExpatBuilder.first_element_handlercCs|jj|}t|j|||_|rtxPtdt|dD]<}tj||tdt }||d}||_ |j|_ t ||q4W||jj k r|j|dS)Nrrr)rUZ createElementr rVranger<rAttrrrrrr ryrK)rr>rriarrrrr`s     z"ExpatBuilder.start_element_handlercCsj|jrf||jjkrdS|jj|}|tkr4t|n|tkrFt|ndS|j|_ |jj ||j dS)N) rJrUrystartContainerrRejecter FILTER_SKIPSkipper parentNoderVrunlink)rrZfiltrrrrKqs     z"ExpatBuilder._finish_start_elementcCs|j}|j|_|j|dS)N)rVrr)rr>rVrrrr]sz ExpatBuilder.end_element_handlercCs\|jj|j}|r|j|||jrX||jjkr4dS|jj|tkrX|j j ||j dS)N) rWgetr_handle_white_text_nodesrJrUryrrrVrr)rrVr%rrrrs   z ExpatBuilder._finish_end_elementcCsf|jjs|j rdSg}x.|jD]$}|jtkr"|jj r"|j|q"Wx|D]}|j |qPWdS)N) rGZwhitespace_in_element_contentr,rrrrstriprr)rrr%Lrrrrrs   z%ExpatBuilder._handle_white_text_nodescCs>|jj|}|dkr&t|||j|<n|jdks4t||_dS)N)rWrrrr:)rr>rr%rrrrrs  z!ExpatBuilder.element_decl_handlerc CsF|jj|}|dkr&t|}||j|<|jjd|dd|d||gdS)Nr)rWrrrr)relemr>r+defaultZrequiredr%rrrrss   z!ExpatBuilder.attlist_decl_handlercCs2||j_||j_|dkr.|r&d|j_nd|j_dS)NrTF)rUversionencoding standalone)rrrrrrrrqs  zExpatBuilder.xml_decl_handler)N) r0r1r2__doc__rrPrSrMrRrrrzrYrr_rlrnrarcrfrhrjror[rrKr]rrrrrsrqrrrrrFs:     rFc@seZdZdZd ZddZddZddZej e j ej e j eje jeje jeje jeje jeje jeje jeje jeje jeje jej e j!i Z"d S) rIzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.rHcCs ||_dS)N)rH)rrHrrrrsz#FilterVisibilityController.__init__cCsT|j|j}|jj|@rL|jj|}|tkr0t|tkrHtdt ||St SdS)Nz)startContainer() returned illegal value: ) _nodetype_maskrrH whatToShowrFILTER_INTERRUPTr{_ALLOWED_FILTER_RETURNSr=reprr)rrmaskvalrrrrs   z)FilterVisibilityController.startContainercCs|j|j}|jj|@r|jj|}|tkr0t|tkrd|j}x |j ddD]}|j |qNWt S|t kr|t dt||StSdS)Nz%acceptNode() returned illegal value: )rrrHrrrr{rrrZ appendChildrrr=rr)rrrrparentrrrrrs   z%FilterVisibilityController.acceptNodeN)rH)#r0r1r2rr3rrrrZ ELEMENT_NODEr Z SHOW_ELEMENTZATTRIBUTE_NODEZSHOW_ATTRIBUTErZ SHOW_TEXTrZSHOW_CDATA_SECTIONZENTITY_REFERENCE_NODEZSHOW_ENTITY_REFERENCEZ ENTITY_NODEZ SHOW_ENTITYZPROCESSING_INSTRUCTION_NODEZSHOW_PROCESSING_INSTRUCTIONZ COMMENT_NODEZ SHOW_COMMENT DOCUMENT_NODEZ SHOW_DOCUMENTZDOCUMENT_TYPE_NODEZSHOW_DOCUMENT_TYPEZDOCUMENT_FRAGMENT_NODEZSHOW_DOCUMENT_FRAGMENTZ NOTATION_NODEZ SHOW_NOTATIONrrrrrrIs" rIc@seZdZdZddZdS) FilterCrutch_builder_level _old_start_old_endcCs6d|_||_|j}|j|_|j|_|j|_|j|_dS)Nr) rrrLr\rr^rrr])rr5rtrrrrszFilterCrutch.__init__N)rrrr)r0r1r2r3rrrrrrsrc@s(eZdZfZddZddZddZdS)rcCs0tj|||j}xdD]}t||dqWdS)Nr`rgrmrirkrp)r`rgrmrirkrp)rrrLsetattr)rr5rtr>rrrrs zRejecter.__init__cGs|jd|_dS)Nr)r)rargsrrrrszRejecter.start_element_handlercGs@|jdkr0|jj}|jj||j|_|j|_n |jd|_dS)Nrr)rrrLrRrr\rr^)rrrtrrrr] s    zRejecter.end_element_handlerN)r0r1r2r3rrr]rrrrrs rc@s eZdZfZddZddZdS)rcGs.|jj}|j||jj|k r*|jd|_dS)Nr)rrVrr)rrrrrrr-s  zSkipper.start_element_handlercGsD|jdkr*|j|jj_|j|jj_d|_n|jd|_|j|dS)Nrr)rrrrLr\rr^)rrrrrr]3s     zSkipper.end_element_handlerN)r0r1r2r3rr]rrrrr*srz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c@sJeZdZdZdddZddZddZd d Zd d Zd dZ ddZ dS)FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. NcCs6|jtkr||_||_n|j|_||_tj||dS)N)rroriginalDocumentrrrFr)rrrNrrrr[s  zFragmentBuilder.__init__cCstj|d|_dS)N)rFrMfragment)rrrrrMds zFragmentBuilder.resetcCs|j|jS)zRParse a document fragment from a file object, returning the fragment node.)rrw)rr|rrrrhszFragmentBuilder.parseFilec Cs||_|j}|jj}d}|rV|jp*|j}|jrDd|j|jf}qZ|jrZd|j}nd}|j}t |||f}y|j |dWn|j YnX|j }|j |S)zMParse a document fragment from a string, returning the fragment node.rvzPUBLIC "%s" "%s"z SYSTEM "%s"r) _sourcerSrrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErxrMr) rrrtrZidentrZnsattrsrUrrrrrms, zFragmentBuilder.parseStringcCs|jjj}d}|rxbt|jjD]R}|jj|}|r>|d}d||jf}|jrfd||j|j f}q"d||j f}q"Wxt|j jD]}|j j|}|r|d}d||jf}|jrd||j|j f}n&|j rd||j f}nd ||j j f}|j rd ||j f}|d }qW|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rvz z%sz%s SYSTEM "%s">z %s)rrrrrZlengthitemnodeNamerrrZ firstChildrr)rrr6rZnotationr rrrrs6    z FragmentBuilder._getDeclarationscCsdS)Nrvr)rrrrrszFragmentBuilder._getNSattrsc Cs~|tkrh|j}|j}|jj|}|j|_|jj|_|j|_z|j|j dWd||_||_d|_ XdSt j |||||SdS)Nrr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrUrVrLZExternalEntityParserCreaterZcreateDocumentFragmentrrxrrFro)rrrrrZ old_documentZ old_cur_nodertrrrros  z+FragmentBuilder.external_entity_ref_handler)N) r0r1r2rrrMrrrrrorrrrrRs $rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS) Namespacesz7Mix-in class for builders; adds support for namespaces.cCs g|_dS)N)_ns_ordered_prefixes)rrrr_initNamespacesszNamespaces._initNamespacescCstjdd}d|_|S)z'Create a new namespace-handling parser.r8)Znamespace_separatorT)rrOZnamespace_prefixes)rrtrrrrPs zNamespaces.createParsercCs tj|||jjr|j|_dS)z.Insert the namespace-handlers onto the parser.N)rFrRrGZnamespace_declarationsstart_namespace_decl_handlerZStartNamespaceDeclHandler)rrtrrrrRs zNamespaces.installcCs|jj||fdS)z/Push this namespace declaration on our storage.N)rr)rrCrArrrrsz'Namespaces.start_namespace_decl_handlercCsd|krt||\}}}}nt}|}d}t}tj||||}|j|_t|j|||_|j rxZ|j D]P\}}|rtj t |d|t |d}ntj dt dt}||_ |j|_t||qdW|j dd=|r|j|j} |j} xtdt|dD]} || } || d} d| krJt|| \}}}}tj ||||}|| |<|| ||f<n$tj | t| t}|| | <|| t| f<|j|_| |_ ||_qWdS)Nr8zxmlns:xmlnsrrr)rErrrZElementrUrr rVrrr7rrr Z_ensure_attributes_attrs_attrsNSrr<Z ownerElement)rr>rrArBrCrDrrrrrr$rrrrrsP      z Namespaces.start_element_handlercCs|j}d|krHt||\}}}}|j|kr>|j|kr>|j|ksltdn$|j|ksZtd|jtksltd|j|_|j |dS)Nr8z$element stack messed up! (namespace)z&element stack messed up - bad nodeNamez*element stack messed up - bad namespaceURI) rVrEr(r)rCr:rrrr)rr>rVrArBrCrDrrrr]s     zNamespaces.end_element_handlerN) r0r1r2rrrPrRrrr]rrrrrs5rc@seZdZdZddZdS)ExpatBuilderNSz*Document builder that supports namespaces.cCstj||jdS)N)rFrMr)rrrrrM)s zExpatBuilderNS.resetN)r0r1r2rrMrrrrr&src@s eZdZdZddZddZdS)FragmentBuilderNSz*Fragment builder that supports namespaces.cCstj||jdS)N)rrMr)rrrrrM1s zFragmentBuilderNS.resetcCsd}|j}g}xv|rt|dr|x\|jjD]N\}}||krrrrrtrrrrYps   z2InternalSubsetExtractor.start_doctype_decl_handlercCs,dj|jjddjdd}||_tdS)Nrvz   )joinrreplacer{)rr6rrrrzsz0InternalSubsetExtractor.end_doctype_decl_handlercCs tdS)N)r{)rr>rrrrrsz-InternalSubsetExtractor.start_element_handler) r0r1r2rrrrrrRrYrrrrrrrWs rTc CsL|r t}nt}t|tr>t|d}|j|}WdQRXn |j|}|S)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrF isinstancestropenr)r| namespacesr5fpresultrrrparses   rcCs|r t}nt}|j|S)zOParse a document from a string, returning the resulting Document node. )rrFr)rrr5rrrrsrc CsP|rt|}nt|}t|trBt|d}|j|}WdQRXn |j|}|S)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrrrrr)r|rrr5rrrrr parseFragments    rcCs |rt|}nt|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrr)rrrr5rrrparseFragmentStrings rcCs|jrt|St|SdS)z,Create a builder based on an Options object.N)rrrF)rNrrr makeBuildersr)T)T)T)T)3rZxml.domrrrrrrZ xml.parsersrZxml.dom.minidomr r Zxml.dom.NodeFilterr rrrZDOMBuilderFilterrrrrZgetDOMImplementationrTZTypeInfor"objectrr7rErFrrIrrrrrrrrr Exceptionr{rrrrrrrrrrs^          3C :  u_%,   PKi#]H^)dom/__pycache__/NodeFilter.cpython-36.pycnu[3 \@sGdddZdS)c@sXeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZddZdS) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiicCstdS)N)NotImplementedError)selfZnoder*/usr/lib64/python3.6/xml/dom/NodeFilter.py acceptNodeszNodeFilter.acceptNodeN)__name__ __module__ __qualname____doc__Z FILTER_ACCEPTZ FILTER_REJECTZ FILTER_SKIPZSHOW_ALLZ SHOW_ELEMENTZSHOW_ATTRIBUTEZ SHOW_TEXTZSHOW_CDATA_SECTIONZSHOW_ENTITY_REFERENCEZ SHOW_ENTITYZSHOW_PROCESSING_INSTRUCTIONZ SHOW_COMMENTZ SHOW_DOCUMENTZSHOW_DOCUMENT_TYPEZSHOW_DOCUMENT_FRAGMENTZ SHOW_NOTATIONrrrrrrs$rN)rrrrrsPKi#]99'dom/__pycache__/__init__.cpython-36.pycnu[3 \@sdZGdddZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eZ Gd/d0d0eZ!Gd1d2d2eZ"Gd3d4d4eZ#Gd5d6d6Z$d7Z%d8Z&d9Z'd:Z(d:Z)dd;l*m+Z+m,Z,d:S)src@seZdZeZdS) IndexSizeErrN)rrrINDEX_SIZE_ERRr!rrrrr#Lsr#c@seZdZeZdS)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr!rrrrr%Osr%c@seZdZeZdS)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr!rrrrr'Rsr'c@seZdZeZdS)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr!rrrrr)Usr)c@seZdZeZdS)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr!rrrrr+Xsr+c@seZdZeZdS)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr!rrrrr-[sr-c@seZdZeZdS)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr!rrrrr/^sr/c@seZdZeZdS) NotFoundErrN)rrr NOT_FOUND_ERRr!rrrrr1asr1c@seZdZeZdS)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr!rrrrr3dsr3c@seZdZeZdS)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr!rrrrr5gsr5c@seZdZeZdS)InvalidStateErrN)rrrINVALID_STATE_ERRr!rrrrr7jsr7c@seZdZeZdS) SyntaxErrN)rrr SYNTAX_ERRr!rrrrr9msr9c@seZdZeZdS)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr!rrrrr;psr;c@seZdZeZdS) NamespaceErrN)rrr NAMESPACE_ERRr!rrrrr=ssr=c@seZdZeZdS)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr!rrrrr?vsr?c@seZdZeZdS) ValidationErrN)rrrVALIDATION_ERRr!rrrrrAysrAc@s eZdZdZdZdZdZdZdS)UserDataHandlerzBClass giving the operation constants for UserDataHandler.handle().rrrrN)rrrrZ NODE_CLONEDZ NODE_IMPORTEDZ NODE_DELETEDZ NODE_RENAMEDrrrrrC|s rCz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation)-rrr$r&r(r*r,r.r0r2r4r6r8r:r<r>r@rBrrr#r%r'r)r+r-r/r1r3r5r7r9r;r=r?rArCZ XML_NAMESPACEZXMLNS_NAMESPACEZXHTML_NAMESPACEZEMPTY_NAMESPACEZ EMPTY_PREFIXZdomregrDrErrrrsR PKi#] 944)dom/__pycache__/xmlbuilder.cpython-36.pycnu[3 \2@sdZddlZddlZddlZddlmZdddgZGdddZGd ddZ d d Z Gd dde Z Gd dde Z GdddZ[GdddZGdddZ[GdddZdS)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter DOMBuilderDOMEntityResolverDOMInputSourcec@s\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZdS)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesZexternal_dtd_subsetvalidate_if_schemaZvalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilterrr*/usr/lib64/python3.6/xml/dom/xmlbuilder.pyr s(rc5@sVeZdZdZdZdZdZdZdZdZ eeee fZ ddZ dd Z d d Z d d ZddZddZddZddZddZddZd4d5gd6d7gd8d9gd:d;gdd?gd@dAgdBdCgdDdEgdFdGgdHdIdJgdKdLgdMdNgdOdPgdQdRgdSdTgdUdVgdWdXgdYdZgd[d\gd]gd^d_d`dadbdcdddedfdgg dhdigdjdkgdldmgiZd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS)nrNrcCs t|_dS)N)r_options)selfrrr__init__:szDOMBuilder.__init__cCs|jS)N)entityResolver)r#rrr_get_entityResolver=szDOMBuilder._get_entityResolvercCs ||_dS)N)r%)r#r%rrr_set_entityResolver?szDOMBuilder._set_entityResolvercCs|jS)N)r)r#rrr_get_errorHandlerBszDOMBuilder._get_errorHandlercCs ||_dS)N)r)r#rrrr_set_errorHandlerDszDOMBuilder._set_errorHandlercCs|jS)N)r)r#rrr _get_filterGszDOMBuilder._get_filtercCs ||_dS)N)r)r#rrrr _set_filterIszDOMBuilder._set_filterc Cs|j|rv|rdpd}y|jt||f}Wn&tk rRtjjd|fYqXx4|D]\}}t|j||qZWntjj dt |dS)Nrrzunsupported feature: %rzunknown feature: ) supportsFeature _settings _name_xformKeyErrorxmldomNotSupportedErrsetattrr" NotFoundErrrepr)r#namestateZsettingsvaluerrr setFeatureLs  zDOMBuilder.setFeaturecCst|jt|S)N)hasattrr"r.)r#r6rrrr,ZszDOMBuilder.supportsFeaturecCst||rdpdf}||jkS)Nrr)r.r-)r#r6r7keyrrr canSetFeature]szDOMBuilder.canSetFeaturer rrrrrrrrrrrrrrr c Cst|}y t|j|Stk r|dkrj|j}|joh|joh|joh|joh|jpf|j pf|j pf|j pf|j St jjdt|YnXdS)Nrzfeature %s not known)r.getattrr"AttributeErrorrrrrr rrrrr0r1r4r5)r#r6Zxnameoptionsrrr getFeatures  zDOMBuilder.getFeaturecCs.|jr|jjd|}ntjd|}|j|S)N)r% resolveEntityrparse)r#uriinputrrrparseURIszDOMBuilder.parseURIcCsRtj|j}|j|_|j|_|j}|dkrF|jrFddl}|jj|j}|j ||S)Nr) copyr"rr byteStreamsystemIdurllib.requestrequestZurlopen_parse_bytestream)r#rDr?fpurllibrrrrBs zDOMBuilder.parsecCs||jkrtdtddS)Nznot a legal actionzHaven't written this yet...)_legal_actions ValueErrorNotImplementedError)r#rDZcnodeactionrrrparseWithContexts zDOMBuilder.parseWithContextcCs ddl}|jjj|}|j|S)Nr)Zxml.dom.expatbuilderr1Z expatbuilderZ makeBuilderZ parseFile)r#streamr?r0ZbuilderrrrrKszDOMBuilder._parse_bytestream)r r)r r)r r)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)r r)r r)r r)rr r r%rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErNr$r&r'r(r)r*r+r9r,r<r-r@rErBrRrKrrrrr-s  cCs|jjddS)N-_)lowerreplace)r6rrrr.sr.c@s0eZdZd ZddZddZddZdd Zd S) r_openerc Cs|dk s tt}||_||_|jj||_|j||_ddl }ddl }|j j |}|\}}} } } } | r| j d r|j| d} ||| | | | f}|j j||_|S)Nr/)AssertionErrorrpublicIdrH _get_openeropenrG_guess_media_encodingencoding posixpathZ urllib.parserBZurlparseendswithdirnameZ urlunparsebaseURI) r#r[rHsourcer`rMpartsschemeZnetlocpathZparamsZqueryZfragmentrrrrAs   zDOMEntityResolver.resolveEntityc Cs,y|jStk r&|j|_|jSXdS)N)rXr>_create_opener)r#rrrr\s  zDOMEntityResolver._get_openercCsddl}|jjS)Nr)rIrJZ build_opener)r#rMrrrrhsz DOMEntityResolver._create_openercCsF|jj}d|krBx.|jD]"}|jdr|jdddjSqWdS)Nz Content-Typezcharset==r)rGinfoZgetplist startswithsplitrV)r#rdrjZparamrrrr^s   z'DOMEntityResolver._guess_media_encodingN)rX)rr r __slots__rAr\rhr^rrrrrs c@seZdZd'Zdd Zd d Zd d ZddZddZddZ ddZ ddZ ddZ ddZ ddZddZd d!Zd"d#Zd$d%Zd&S)(rrGcharacterStream stringDatar_r[rHrccCs.d|_d|_d|_d|_d|_d|_d|_dS)N)rGrnror_r[rHrc)r#rrrr$szDOMInputSource.__init__cCs|jS)N)rG)r#rrr_get_byteStreamszDOMInputSource._get_byteStreamcCs ||_dS)N)rG)r#rGrrr_set_byteStreamszDOMInputSource._set_byteStreamcCs|jS)N)rn)r#rrr_get_characterStreamsz#DOMInputSource._get_characterStreamcCs ||_dS)N)rn)r#rnrrr_set_characterStreamsz#DOMInputSource._set_characterStreamcCs|jS)N)ro)r#rrr_get_stringDataszDOMInputSource._get_stringDatacCs ||_dS)N)ro)r#datarrr_set_stringDataszDOMInputSource._set_stringDatacCs|jS)N)r_)r#rrr _get_encodingszDOMInputSource._get_encodingcCs ||_dS)N)r_)r#r_rrr _set_encodingszDOMInputSource._set_encodingcCs|jS)N)r[)r#rrr _get_publicId"szDOMInputSource._get_publicIdcCs ||_dS)N)r[)r#r[rrr _set_publicId$szDOMInputSource._set_publicIdcCs|jS)N)rH)r#rrr _get_systemId'szDOMInputSource._get_systemIdcCs ||_dS)N)rH)r#rHrrr _set_systemId)szDOMInputSource._set_systemIdcCs|jS)N)rc)r#rrr _get_baseURI,szDOMInputSource._get_baseURIcCs ||_dS)N)rc)r#rCrrr _set_baseURI.szDOMInputSource._set_baseURIN)rGrnror_r[rHrc)rr r rmr$rprqrrrsrtrvrwrxryrzr{r|r}r~rrrrrs" c@s>eZdZdZdZdZdZdZej Z ddZ dd Z d d Z d S) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. rrr r!cCs|jS)N) whatToShow)r#rrr_get_whatToShowCsz DOMBuilderFilter._get_whatToShowcCs|jS)N) FILTER_ACCEPT)r#elementrrr acceptNodeFszDOMBuilderFilter.acceptNodecCs|jS)N)r)r#rrrrstartContainerIszDOMBuilderFilter.startContainerN)rr r r rZ FILTER_REJECTZ FILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLrrrrrrrrr2src@s$eZdZddZddZddZdS)_AsyncDeprecatedPropertycCs|j}tjdj|dtdS)Nz+{cls}.async is deprecated; use {cls}.async_)cls)rwarningswarnformatDeprecationWarning)r#rZclsnamerrrrPs z_AsyncDeprecatedProperty.warncCs|j||dk r|jSdS)NF)rasync_)r#instancerrrr__get__Vs z _AsyncDeprecatedProperty.__get__cCs|jt|t|d|dS)Nr)rtyper3)r#rr8rrr__set__\sz _AsyncDeprecatedProperty.__set__N)rr r rrrrrrrrOsrc@sPeZdZdZdZeed<ddZddZdd Z d d Z d d Z ddZ dS) DocumentLSz=Mixin to create documents that conform to the load/save spec.FasynccCsdS)NFr)r#rrr _get_asyncgszDocumentLS._get_asynccCs|rtjjddS)Nz.asynchronous document loading is not supported)r0r1r2)r#flagrrr _set_asyncjszDocumentLS._set_asynccCs tddS)Nz'haven't figured out what this means yet)rP)r#rrrabortoszDocumentLS.abortcCs tddS)Nzhaven't written this yet)rP)r#rCrrrloaduszDocumentLS.loadcCs tddS)Nzhaven't written this yet)rP)r#rdrrrloadXMLxszDocumentLS.loadXMLcCs*|dkr|}n|j|k r"tjj|jS)N)Z ownerDocumentr0r1ZWrongDocumentErrZtoxml)r#ZsnoderrrsaveXML{s   zDocumentLS.saveXMLN) rr r r rrlocalsrrrrrrrrrrras rc@s,eZdZdZdZddZddZddZd S) DOMImplementationLSrrcCsF|dk rtjjd||jkr$tS||jkr:tjjdtddS)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r0r1r2MODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrO)r#modeZ schemaTyperrrcreateDOMBuilders  z$DOMImplementationLS.createDOMBuildercCs tddS)Nz-the writer interface hasn't been written yet!)rP)r#rrrcreateDOMWritersz#DOMImplementationLS.createDOMWritercCstS)N)r)r#rrrcreateDOMInputSourcesz(DOMImplementationLS.createDOMInputSourceN)rr r rrrrrrrrrrs  r)r rFrZxml.domr0Zxml.dom.NodeFilterr__all__rrr.objectrrrrrrrrrrs"   %,1"PKi#]))))&dom/__pycache__/pulldom.cpython-36.pycnu[3 \-@sddlZddlZdZdZdZdZdZdZdZ d Z Gd d d ej j Z Gd d d ZGdddZGddde ZdZdddZdddZdS)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc@seZdZdZdZd$ddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#ZdS)%PullDOMNc Cszddlm}||_ddg|_|j|_g|_|jj|_y|jj|_Wnt k rVYnX|dig|_ |j d|_ g|_ dS)Nr) XML_NAMESPACExml) Zxml.domr documentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrr r'/usr/lib64/python3.6/xml/dom/pulldom.py__init__s     zPullDOM.__init__cCs|jd}|jd=|S)Nr rr)r)rresultrrrr!s z PullDOM.popcCs ||_dS)N)_locator)rZlocatorrrrsetDocumentLocator&szPullDOM.setDocumentLocatorcCsHt|dsg|_|jj|pd|f|jj|jj|px|D]\}}||j||f<qWg|_|\}} |r|dkrr|j|} | rn| d| }n| }|jr|jj||} q|j||} n |jr|jj| } n |jd| } x|jD]\}}|\} } | |kr | dkr| }nd| }|jj | |}| j |nX| rL|j| } | r.| d| }n| }|jj | |}| j |n|jj | }| j |||_ qWt| fdg|jd<|jd|_|j| dS)Nzhttp://www.w3.org/2000/xmlns/r!:r"zxmlns:r )getattr_attrsr!rdocumentZcreateElementNS buildDocument createElementitemsZcreateAttributeNSZsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrsZ xmlns_uriZ xmlns_attrsanamer2r&Z localnamer%nodeZa_uriZ a_localnameZqnameattrrrrstartElementNS3sP           zPullDOM.startElementNScCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr3r4rrr endElementNSlszPullDOM.endElementNScCs~|jr|jj|}n |jd|}x0|jD]$\}}|jj|}||_|j|q*Wt|fdg|jd<|jd|_|j |dS)Nr ) r,r.r-r/r0r2r1rrr)rr3r5r7r6r2r8rrr startElementps   zPullDOM.startElementcCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr3rrr endElementszPullDOM.endElementcCsN|jr2|jj|}t|fdg|jd<|jd|_nt|fdg}|jj|dS)Nr )r, createCommentrrrr)rsr7eventrrrcomments   zPullDOM.commentcCsR|jr4|jj||}t|fdg|jd<|jd|_nt||fdg}|jj|dS)Nr )r,createProcessingInstructionrrrr)rtargetdatar7r?rrrprocessingInstructions zPullDOM.processingInstructioncCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r,createTextNoderr)rcharsr7rrrignorableWhitespaces zPullDOM.ignorableWhitespacecCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r,rEr r)rrFr7rrr characterss zPullDOM.characterscCs$|jdkr ddl}|jjjj|_dS)Nr)rZxml.dom.minidomZdomZminidomZDocumentimplementation)rr rrr startDocuments zPullDOM.startDocumentc Cs|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj||}t|f|d<nD|ddt kr|jj |dd}t |f|d<nt d|dd||jd<||_qFWd|_|j S)Nr rzUnknown pending event ) rZcreateDocumentr,rrrrrrArr=AssertionErrorZ firstChild) rr&Ztagnamer7e_rBrCnrrrr-s$     zPullDOM.buildDocumentcCs t|jfdg|jd<|jdS)Nr )rr,rr)rrrr endDocumentszPullDOM.endDocumentcCs d|_dS)z.clear(): Explicitly release parsing structuresN)r,)rrrrclearsz PullDOM.clear)N)__name__ __module__ __qualname__rr,rrr r'r(r9r:r;r<r@rDrGrHrJr-rOrPrrrrr s& 9  r c@s$eZdZddZddZddZdS) ErrorHandlercCs t|dS)N)print)r exceptionrrrwarningszErrorHandler.warningcCs|dS)Nr)rrVrrrerrorszErrorHandler.errorcCs|dS)Nr)rrVrrr fatalErrorszErrorHandler.fatalErrorN)rQrRrSrWrXrYrrrrrTsrTc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)DOMEventStreamcCs2||_||_||_t|jds&|j|_|jdS)Nfeed)streamparserbufsizer#_slurpgetEventreset)rr\r]r^rrrrs  zDOMEventStream.__init__cCs.t|_|jjtjjjd|jj|jdS)Nr ) r pulldomr]Z setFeaturer saxZhandlerZfeature_namespacesZsetContentHandler)rrrrraszDOMEventStream.resetcCs|j}|r|StdS)N)r` IndexError)rposrcrrr __getitem__szDOMEventStream.__getitem__cCs|j}|r|StdS)N)r` StopIteration)rrfrrr__next__szDOMEventStream.__next__cCs|S)Nr)rrrr__iter__szDOMEventStream.__iter__cCsp|j}|g}x\|rj|\}}||kr(dS|tkr>|dj||tkrR|j|n|tkr`|d=|j}qWdS)Nr rr)r`r appendChildrr)rr7r?parentstokenZcur_noderrr expandNodes zDOMEventStream.expandNodecCs|jjds|jj|j_x<|jjdsT|jj|j}|sF|jjdS|jj|qW|jjdd}|jjdd|jjd<|S)Nr r) rbrrr\readr^r]closer[)rbufrfrrrr`s   zDOMEventStream.getEventcCs|jj|j|j|_|jS)z Fallback replacement for getEvent() using the standard SAX2 interface, which means we slurp the SAX events into memory (no performance gain, but we are compatible to all SAX parsers). )r]parser\_emitr`)rrrrr_szDOMEventStream._slurpcCs,|jjdd}|jjdd|jjd<|S)zn Fallback replacement for getEvent() that emits the events that _slurp() read previously. r r)rbr)rrfrrrrsszDOMEventStream._emitcCs|jj|`d|_d|_dS)z+clear(): Explicitly release parsing objectsN)rbrPr]r\)rrrrrPs zDOMEventStream.clearN) rQrRrSrrargrirjrnr`r_rsrPrrrrrZs rZc@s4eZdZddZddZddZddZd d Zd S) SAX2DOMcCs2tj|||||jd}|jd}|j|dS)Nr r)r r9rrk)rr3r4r5curNode parentNoderrrr9#s  zSAX2DOM.startElementNScCs0tj||||jd}|jd}|j|dS)Nr rurrv)r r;rrk)rr3r5rwrxrrrr;)s  zSAX2DOM.startElementcCs4tj||||jdd}|jd}|j|dS)Nrr r)r rDrrrk)rrBrCr7rxrrrrD/s zSAX2DOM.processingInstructioncCs2tj|||jdd}|jd}|j|dS)Nrr r)r rGrrrk)rrFr7rxrrrrG5s  zSAX2DOM.ignorableWhitespacecCs2tj|||jdd}|jd}|j|dS)Nrr r)r rHrrrk)rrFr7rxrrrrH;s  zSAX2DOM.charactersN)rQrRrSr9r;rDrGrHrrrrrt!s rtrucCs@|dkr t}t|tr"t|d}n|}|s4tjj}t|||S)Nrb)default_bufsize isinstancestropenr rc make_parserrZ)Zstream_or_stringr]r^r\rrrrrDs   rrcCs6ddlm}t|}||}|s*tjj}t|||S)Nr)StringIO)iorlenr rcrrZ)stringr]rr^rqrrr parseStringOs   ri@i?)NN)N)Zxml.saxr Zxml.sax.handlerrrrrrrrr rcZContentHandlerr rTrZrtr|rrrrrrrs"8U! PKi#]H^/dom/__pycache__/NodeFilter.cpython-36.opt-1.pycnu[3 \@sGdddZdS)c@sXeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZddZdS) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiicCstdS)N)NotImplementedError)selfZnoder*/usr/lib64/python3.6/xml/dom/NodeFilter.py acceptNodeszNodeFilter.acceptNodeN)__name__ __module__ __qualname____doc__Z FILTER_ACCEPTZ FILTER_REJECTZ FILTER_SKIPZSHOW_ALLZ SHOW_ELEMENTZSHOW_ATTRIBUTEZ SHOW_TEXTZSHOW_CDATA_SECTIONZSHOW_ENTITY_REFERENCEZ SHOW_ENTITYZSHOW_PROCESSING_INSTRUCTIONZ SHOW_COMMENTZ SHOW_DOCUMENTZSHOW_DOCUMENT_TYPEZSHOW_DOCUMENT_FRAGMENTZ SHOW_NOTATIONrrrrrrs$rN)rrrrrsPKi#]99-dom/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \@sdZGdddZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*eZGd+d,d,eZGd-d.d.eZ Gd/d0d0eZ!Gd1d2d2eZ"Gd3d4d4eZ#Gd5d6d6Z$d7Z%d8Z&d9Z'd:Z(d:Z)dd;l*m+Z+m,Z,d:S)src@seZdZeZdS) IndexSizeErrN)rrrINDEX_SIZE_ERRr!rrrrr#Lsr#c@seZdZeZdS)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr!rrrrr%Osr%c@seZdZeZdS)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr!rrrrr'Rsr'c@seZdZeZdS)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr!rrrrr)Usr)c@seZdZeZdS)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr!rrrrr+Xsr+c@seZdZeZdS)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr!rrrrr-[sr-c@seZdZeZdS)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr!rrrrr/^sr/c@seZdZeZdS) NotFoundErrN)rrr NOT_FOUND_ERRr!rrrrr1asr1c@seZdZeZdS)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr!rrrrr3dsr3c@seZdZeZdS)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr!rrrrr5gsr5c@seZdZeZdS)InvalidStateErrN)rrrINVALID_STATE_ERRr!rrrrr7jsr7c@seZdZeZdS) SyntaxErrN)rrr SYNTAX_ERRr!rrrrr9msr9c@seZdZeZdS)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr!rrrrr;psr;c@seZdZeZdS) NamespaceErrN)rrr NAMESPACE_ERRr!rrrrr=ssr=c@seZdZeZdS)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr!rrrrr?vsr?c@seZdZeZdS) ValidationErrN)rrrVALIDATION_ERRr!rrrrrAysrAc@s eZdZdZdZdZdZdZdS)UserDataHandlerzBClass giving the operation constants for UserDataHandler.handle().rrrrN)rrrrZ NODE_CLONEDZ NODE_IMPORTEDZ NODE_DELETEDZ NODE_RENAMEDrrrrrC|s rCz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation)-rrr$r&r(r*r,r.r0r2r4r6r8r:r<r>r@rBrrr#r%r'r)r+r-r/r1r3r5r7r9r;r=r?rArCZ XML_NAMESPACEZXMLNS_NAMESPACEZXHTML_NAMESPACEZEMPTY_NAMESPACEZ EMPTY_PREFIXZdomregrDrErrrrsR PKi#]{ΑUU+dom/__pycache__/domreg.cpython-36.opt-2.pycnu[3 \{ @s@ddlZdddZiZddZddZdffd d Zd d ZdS) Nzxml.dom.minidomzxml.dom.DOMImplementation)ZminidomZ4DOMcCs |t|<dS)N) registered)namefactoryr&/usr/lib64/python3.6/xml/dom/domreg.pyregisterDOMImplementations rcCs&x |D]\}}|j||sdSqWdS)Nr)Z hasFeature)domfeaturesfvrrr _good_enough s r c Csddl}d}tj|}|r2t|iidg}|jS|r@t|Stjj rdd|j krdt|j ddSt |t rvt |}x$tj D]}|}t||r|SqWxDtjD]8}yt|d}Wntk rwYnXt||r|SqWtddS)NrgetDOMImplementationZ PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesr keys Exception ImportError)rr rZcreatormodr rrrr's0      rcCsg}|j}d}t|}xp||kr||}|ddkrDtd|f|d}d}||krx||}|ddkrx|d}|}|j||fqWt|S)Nr 0123456789zbad feature name: %rr)splitlen ValueErrorappendtuple)sr partsiZlengthZfeatureversionr rrrrRs"   r)rrrrr rrrrrr s +PKi#]|6 )dom/__pycache__/minicompat.cpython-36.pycnu[3 \' @sJdZddddgZddlZefZGdddeZGdddeZ d dZ dS) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. NodeList EmptyNodeList StringTypes defpropertyNc@s>eZdZfZddZddZddZeeeddZd d Z d S) rcCs(d|kot|knr$||SdS)Nr)len)selfindexr */usr/lib64/python3.6/xml/dom/minicompat.pyitem5sz NodeList.itemcCst|S)N)r)rr r r _get_length9szNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')xmldomNoModificationAllowedErr)rvaluer r r _set_length<szNodeList._set_lengthz$The number of nodes in the NodeList.)doccCs|dkr g}||dd<dS)Nr )rstater r r __setstate__DszNodeList.__setstate__N) __name__ __module__ __qualname__ __slots__r r rpropertylengthrr r r r r2sc@sFeZdZfZddZddZddZddZd d Ze eed d Z d S)rcCst}|j||S)N)rextend)rotherNLr r r __add__Ms zEmptyNodeList.__add__cCst}|j||S)N)rr)rrrr r r __radd__Rs zEmptyNodeList.__radd__cCsdS)Nr )rrr r r r WszEmptyNodeList.itemcCsdS)Nrr )rr r r r ZszEmptyNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')r rr)rrr r r r]szEmptyNodeList._set_lengthz$The number of nodes in the NodeList.)rN) rrrrrrr r rrrr r r r rJscCsTt|d|}|fdd}t|d| s6td|t|||d}t|||dS)NZ_get_cSstjjdt|dS)Nz&attempt to modify read-only attribute )r rrrepr)rrnamer r r setgszdefproperty..setZ_set_zexpected not to find _set_)r)getattrhasattrAssertionErrorrsetattr)klassr!rgetr"Zpropr r r res   ) __doc____all__Zxml.domr strrlistrtuplerrr r r r s & PKi#]Wd!)))),dom/__pycache__/pulldom.cpython-36.opt-1.pycnu[3 \-@sddlZddlZdZdZdZdZdZdZdZ d Z Gd d d ej j Z Gd d d ZGdddZGddde ZdZdddZdddZdS)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc@seZdZdZdZd$ddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#ZdS)%PullDOMNc Cszddlm}||_ddg|_|j|_g|_|jj|_y|jj|_Wnt k rVYnX|dig|_ |j d|_ g|_ dS)Nr) XML_NAMESPACExml) Zxml.domr documentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrr r'/usr/lib64/python3.6/xml/dom/pulldom.py__init__s     zPullDOM.__init__cCs|jd}|jd=|S)Nr rr)r)rresultrrrr!s z PullDOM.popcCs ||_dS)N)_locator)rZlocatorrrrsetDocumentLocator&szPullDOM.setDocumentLocatorcCsHt|dsg|_|jj|pd|f|jj|jj|px|D]\}}||j||f<qWg|_|\}} |r|dkrr|j|} | rn| d| }n| }|jr|jj||} q|j||} n |jr|jj| } n |jd| } x|jD]\}}|\} } | |kr | dkr| }nd| }|jj | |}| j |nX| rL|j| } | r.| d| }n| }|jj | |}| j |n|jj | }| j |||_ qWt| fdg|jd<|jd|_|j| dS)Nzhttp://www.w3.org/2000/xmlns/r!:r"zxmlns:r )getattrZ_attrsr!rdocumentZcreateElementNS buildDocument createElementitemsZcreateAttributeNSZsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrsZ xmlns_uriZ xmlns_attrsanamer1r&Z localnamer%nodeZa_uriZ a_localnameZqnameattrrrrstartElementNS3sP           zPullDOM.startElementNScCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr2r3rrr endElementNSlszPullDOM.endElementNScCs~|jr|jj|}n |jd|}x0|jD]$\}}|jj|}||_|j|q*Wt|fdg|jd<|jd|_|j |dS)Nr ) r+r-r,r.r/r1r0rrr)rr2r4r6r5r1r7rrr startElementps   zPullDOM.startElementcCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr2rrr endElementszPullDOM.endElementcCsN|jr2|jj|}t|fdg|jd<|jd|_nt|fdg}|jj|dS)Nr )r+ createCommentrrrr)rsr6eventrrrcomments   zPullDOM.commentcCsR|jr4|jj||}t|fdg|jd<|jd|_nt||fdg}|jj|dS)Nr )r+createProcessingInstructionrrrr)rtargetdatar6r>rrrprocessingInstructions zPullDOM.processingInstructioncCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r+createTextNoderr)rcharsr6rrrignorableWhitespaces zPullDOM.ignorableWhitespacecCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r+rDr r)rrEr6rrr characterss zPullDOM.characterscCs$|jdkr ddl}|jjjj|_dS)Nr)rZxml.dom.minidomZdomZminidomZDocumentimplementation)rr rrr startDocuments zPullDOM.startDocumentc Cs|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj||}t|f|d<nD|ddt kr|jj |dd}t |f|d<nt d|dd||jd<||_qFWd|_|j S)Nr rzUnknown pending event ) rZcreateDocumentr+rrrrrr@rr<AssertionErrorZ firstChild) rr&Ztagnamer6e_rArBnrrrr,s$     zPullDOM.buildDocumentcCs t|jfdg|jd<|jdS)Nr )rr+rr)rrrr endDocumentszPullDOM.endDocumentcCs d|_dS)z.clear(): Explicitly release parsing structuresN)r+)rrrrclearsz PullDOM.clear)N)__name__ __module__ __qualname__rr+rrr r'r(r8r9r:r;r?rCrFrGrIr,rNrOrrrrr s& 9  r c@s$eZdZddZddZddZdS) ErrorHandlercCs t|dS)N)print)r exceptionrrrwarningszErrorHandler.warningcCs|dS)Nr)rrUrrrerrorszErrorHandler.errorcCs|dS)Nr)rrUrrr fatalErrorszErrorHandler.fatalErrorN)rPrQrRrVrWrXrrrrrSsrSc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)DOMEventStreamcCs2||_||_||_t|jds&|j|_|jdS)Nfeed)streamparserbufsizer#_slurpgetEventreset)rr[r\r]rrrrs  zDOMEventStream.__init__cCs.t|_|jjtjjjd|jj|jdS)Nr ) r pulldomr\Z setFeaturer saxZhandlerZfeature_namespacesZsetContentHandler)rrrrr`szDOMEventStream.resetcCs|j}|r|StdS)N)r_ IndexError)rposrcrrr __getitem__szDOMEventStream.__getitem__cCs|j}|r|StdS)N)r_ StopIteration)rrerrr__next__szDOMEventStream.__next__cCs|S)Nr)rrrr__iter__szDOMEventStream.__iter__cCsp|j}|g}x\|rj|\}}||kr(dS|tkr>|dj||tkrR|j|n|tkr`|d=|j}qWdS)Nr rr)r_r appendChildrr)rr6r>parentstokenZcur_noderrr expandNodes zDOMEventStream.expandNodecCs|jjds|jj|j_x<|jjdsT|jj|j}|sF|jjdS|jj|qW|jjdd}|jjdd|jjd<|S)Nr r) rarrr[readr]r\closerZ)rbufrerrrr_s   zDOMEventStream.getEventcCs|jj|j|j|_|jS)z Fallback replacement for getEvent() using the standard SAX2 interface, which means we slurp the SAX events into memory (no performance gain, but we are compatible to all SAX parsers). )r\parser[_emitr_)rrrrr^szDOMEventStream._slurpcCs,|jjdd}|jjdd|jjd<|S)zn Fallback replacement for getEvent() that emits the events that _slurp() read previously. r r)rar)rrerrrrrszDOMEventStream._emitcCs|jj|`d|_d|_dS)z+clear(): Explicitly release parsing objectsN)rarOr\r[)rrrrrOs zDOMEventStream.clearN) rPrQrRrr`rfrhrirmr_r^rrrOrrrrrYs rYc@s4eZdZddZddZddZddZd d Zd S) SAX2DOMcCs2tj|||||jd}|jd}|j|dS)Nr r)r r8rrj)rr2r3r4curNode parentNoderrrr8#s  zSAX2DOM.startElementNScCs0tj||||jd}|jd}|j|dS)Nr rtrru)r r:rrj)rr2r4rvrwrrrr:)s  zSAX2DOM.startElementcCs4tj||||jdd}|jd}|j|dS)Nrr r)r rCrrrj)rrArBr6rwrrrrC/s zSAX2DOM.processingInstructioncCs2tj|||jdd}|jd}|j|dS)Nrr r)r rFrrrj)rrEr6rwrrrrF5s  zSAX2DOM.ignorableWhitespacecCs2tj|||jdd}|jd}|j|dS)Nrr r)r rGrrrj)rrEr6rwrrrrG;s  zSAX2DOM.charactersN)rPrQrRr8r:rCrFrGrrrrrs!s rsrtcCs@|dkr t}t|tr"t|d}n|}|s4tjj}t|||S)Nrb)default_bufsize isinstancestropenr rb make_parserrY)Zstream_or_stringr\r]r[rrrrqDs   rqcCs6ddlm}t|}||}|s*tjj}t|||S)Nr)StringIO)iorlenr rbrrY)stringr\rr]rprrr parseStringOs   ri@i?)NN)N)Zxml.saxr Zxml.sax.handlerrrrrrrrr rbZContentHandlerr rSrYrsr{rqrrrrrs"8U! PKi#]>Mpw'w',dom/__pycache__/pulldom.cpython-36.opt-2.pycnu[3 \-@sddlZddlZdZdZdZdZdZdZdZ d Z Gd d d ej j Z Gd d d ZGdddZGddde ZdZdddZdddZdS)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc@seZdZdZdZd$ddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!Zd"d#ZdS)%PullDOMNc Cszddlm}||_ddg|_|j|_g|_|jj|_y|jj|_Wnt k rVYnX|dig|_ |j d|_ g|_ dS)Nr) XML_NAMESPACExml) Zxml.domr documentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrr r'/usr/lib64/python3.6/xml/dom/pulldom.py__init__s     zPullDOM.__init__cCs|jd}|jd=|S)Nr rr)r)rresultrrrr!s z PullDOM.popcCs ||_dS)N)_locator)rZlocatorrrrsetDocumentLocator&szPullDOM.setDocumentLocatorcCsHt|dsg|_|jj|pd|f|jj|jj|px|D]\}}||j||f<qWg|_|\}} |r|dkrr|j|} | rn| d| }n| }|jr|jj||} q|j||} n |jr|jj| } n |jd| } x|jD]\}}|\} } | |kr | dkr| }nd| }|jj | |}| j |nX| rL|j| } | r.| d| }n| }|jj | |}| j |n|jj | }| j |||_ qWt| fdg|jd<|jd|_|j| dS)Nzhttp://www.w3.org/2000/xmlns/r!:r"zxmlns:r )getattrZ_attrsr!rdocumentZcreateElementNS buildDocument createElementitemsZcreateAttributeNSZsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrsZ xmlns_uriZ xmlns_attrsanamer1r&Z localnamer%nodeZa_uriZ a_localnameZqnameattrrrrstartElementNS3sP           zPullDOM.startElementNScCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr2r3rrr endElementNSlszPullDOM.endElementNScCs~|jr|jj|}n |jd|}x0|jD]$\}}|jj|}||_|j|q*Wt|fdg|jd<|jd|_|j |dS)Nr ) r+r-r,r.r/r1r0rrr)rr2r4r6r5r1r7rrr startElementps   zPullDOM.startElementcCs&t|jfdg|jd<|jd|_dS)Nr )rrr)rr2rrr endElementszPullDOM.endElementcCsN|jr2|jj|}t|fdg|jd<|jd|_nt|fdg}|jj|dS)Nr )r+ createCommentrrrr)rsr6eventrrrcomments   zPullDOM.commentcCsR|jr4|jj||}t|fdg|jd<|jd|_nt||fdg}|jj|dS)Nr )r+createProcessingInstructionrrrr)rtargetdatar6r>rrrprocessingInstructions zPullDOM.processingInstructioncCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r+createTextNoderr)rcharsr6rrrignorableWhitespaces zPullDOM.ignorableWhitespacecCs.|jj|}t|fdg|jd<|jd|_dS)Nr )r+rDr r)rrEr6rrr characterss zPullDOM.characterscCs$|jdkr ddl}|jjjj|_dS)Nr)rZxml.dom.minidomZdomZminidomZDocumentimplementation)rr rrr startDocuments zPullDOM.startDocumentc Cs|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj||}t|f|d<nD|ddt kr|jj |dd}t |f|d<nt d|dd||jd<||_qFWd|_|j S)Nr rzUnknown pending event ) rZcreateDocumentr+rrrrrr@rr<AssertionErrorZ firstChild) rr&Ztagnamer6e_rArBnrrrr,s$     zPullDOM.buildDocumentcCs t|jfdg|jd<|jdS)Nr )rr+rr)rrrr endDocumentszPullDOM.endDocumentcCs d|_dS)N)r+)rrrrclearsz PullDOM.clear)N)__name__ __module__ __qualname__rr+rrr r'r(r8r9r:r;r?rCrFrGrIr,rNrOrrrrr s& 9  r c@s$eZdZddZddZddZdS) ErrorHandlercCs t|dS)N)print)r exceptionrrrwarningszErrorHandler.warningcCs|dS)Nr)rrUrrrerrorszErrorHandler.errorcCs|dS)Nr)rrUrrr fatalErrorszErrorHandler.fatalErrorN)rPrQrRrVrWrXrrrrrSsrSc@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)DOMEventStreamcCs2||_||_||_t|jds&|j|_|jdS)Nfeed)streamparserbufsizer#_slurpgetEventreset)rr[r\r]rrrrs  zDOMEventStream.__init__cCs.t|_|jjtjjjd|jj|jdS)Nr ) r pulldomr\Z setFeaturer saxZhandlerZfeature_namespacesZsetContentHandler)rrrrr`szDOMEventStream.resetcCs|j}|r|StdS)N)r_ IndexError)rposrcrrr __getitem__szDOMEventStream.__getitem__cCs|j}|r|StdS)N)r_ StopIteration)rrerrr__next__szDOMEventStream.__next__cCs|S)Nr)rrrr__iter__szDOMEventStream.__iter__cCsp|j}|g}x\|rj|\}}||kr(dS|tkr>|dj||tkrR|j|n|tkr`|d=|j}qWdS)Nr rr)r_r appendChildrr)rr6r>parentstokenZcur_noderrr expandNodes zDOMEventStream.expandNodecCs|jjds|jj|j_x<|jjdsT|jj|j}|sF|jjdS|jj|qW|jjdd}|jjdd|jjd<|S)Nr r) rarrr[readr]r\closerZ)rbufrerrrr_s   zDOMEventStream.getEventcCs|jj|j|j|_|jS)N)r\parser[_emitr_)rrrrr^szDOMEventStream._slurpcCs,|jjdd}|jjdd|jjd<|S)Nr r)rar)rrerrrrrszDOMEventStream._emitcCs|jj|`d|_d|_dS)N)rarOr\r[)rrrrrOs zDOMEventStream.clearN) rPrQrRrr`rfrhrirmr_r^rrrOrrrrrYs rYc@s4eZdZddZddZddZddZd d Zd S) SAX2DOMcCs2tj|||||jd}|jd}|j|dS)Nr r)r r8rrj)rr2r3r4curNode parentNoderrrr8#s  zSAX2DOM.startElementNScCs0tj||||jd}|jd}|j|dS)Nr rtrru)r r:rrj)rr2r4rvrwrrrr:)s  zSAX2DOM.startElementcCs4tj||||jdd}|jd}|j|dS)Nrr r)r rCrrrj)rrArBr6rwrrrrC/s zSAX2DOM.processingInstructioncCs2tj|||jdd}|jd}|j|dS)Nrr r)r rFrrrj)rrEr6rwrrrrF5s  zSAX2DOM.ignorableWhitespacecCs2tj|||jdd}|jd}|j|dS)Nrr r)r rGrrrj)rrEr6rwrrrrG;s  zSAX2DOM.charactersN)rPrQrRr8r:rCrFrGrrrrrs!s rsrtcCs@|dkr t}t|tr"t|d}n|}|s4tjj}t|||S)Nrb)default_bufsize isinstancestropenr rb make_parserrY)Zstream_or_stringr\r]r[rrrrqDs   rqcCs6ddlm}t|}||}|s*tjj}t|||S)Nr)StringIO)iorlenr rbrrY)stringr\rr]rprrr parseStringOs   ri@i?)NN)N)Zxml.saxr Zxml.sax.handlerrrrrrrrr rbZContentHandlerr rSrYrsr{rqrrrrrs"8U! PKi#]a44/dom/__pycache__/xmlbuilder.cpython-36.opt-1.pycnu[3 \2@sdZddlZddlZddlZddlmZdddgZGdddZGd ddZ d d Z Gd dde Z Gd dde Z GdddZ[GdddZGdddZ[GdddZdS)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter DOMBuilderDOMEntityResolverDOMInputSourcec@s\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZdS)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesZexternal_dtd_subsetvalidate_if_schemaZvalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilterrr*/usr/lib64/python3.6/xml/dom/xmlbuilder.pyr s(rc5@sVeZdZdZdZdZdZdZdZdZ eeee fZ ddZ dd Z d d Z d d ZddZddZddZddZddZddZd4d5gd6d7gd8d9gd:d;gdd?gd@dAgdBdCgdDdEgdFdGgdHdIdJgdKdLgdMdNgdOdPgdQdRgdSdTgdUdVgdWdXgdYdZgd[d\gd]gd^d_d`dadbdcdddedfdgg dhdigdjdkgdldmgiZd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS)nrNrcCs t|_dS)N)r_options)selfrrr__init__:szDOMBuilder.__init__cCs|jS)N)entityResolver)r#rrr_get_entityResolver=szDOMBuilder._get_entityResolvercCs ||_dS)N)r%)r#r%rrr_set_entityResolver?szDOMBuilder._set_entityResolvercCs|jS)N)r)r#rrr_get_errorHandlerBszDOMBuilder._get_errorHandlercCs ||_dS)N)r)r#rrrr_set_errorHandlerDszDOMBuilder._set_errorHandlercCs|jS)N)r)r#rrr _get_filterGszDOMBuilder._get_filtercCs ||_dS)N)r)r#rrrr _set_filterIszDOMBuilder._set_filterc Cs|j|rv|rdpd}y|jt||f}Wn&tk rRtjjd|fYqXx4|D]\}}t|j||qZWntjj dt |dS)Nrrzunsupported feature: %rzunknown feature: ) supportsFeature _settings _name_xformKeyErrorxmldomNotSupportedErrsetattrr" NotFoundErrrepr)r#namestateZsettingsvaluerrr setFeatureLs  zDOMBuilder.setFeaturecCst|jt|S)N)hasattrr"r.)r#r6rrrr,ZszDOMBuilder.supportsFeaturecCst||rdpdf}||jkS)Nrr)r.r-)r#r6r7keyrrr canSetFeature]szDOMBuilder.canSetFeaturer rrrrrrrrrrrrrrr c Cst|}y t|j|Stk r|dkrj|j}|joh|joh|joh|joh|jpf|j pf|j pf|j pf|j St jjdt|YnXdS)Nrzfeature %s not known)r.getattrr"AttributeErrorrrrrr rrrrr0r1r4r5)r#r6Zxnameoptionsrrr getFeatures  zDOMBuilder.getFeaturecCs.|jr|jjd|}ntjd|}|j|S)N)r% resolveEntityrparse)r#uriinputrrrparseURIszDOMBuilder.parseURIcCsRtj|j}|j|_|j|_|j}|dkrF|jrFddl}|jj|j}|j ||S)Nr) copyr"rr byteStreamsystemIdurllib.requestrequestZurlopen_parse_bytestream)r#rDr?fpurllibrrrrBs zDOMBuilder.parsecCs||jkrtdtddS)Nznot a legal actionzHaven't written this yet...)_legal_actions ValueErrorNotImplementedError)r#rDZcnodeactionrrrparseWithContexts zDOMBuilder.parseWithContextcCs ddl}|jjj|}|j|S)Nr)Zxml.dom.expatbuilderr1Z expatbuilderZ makeBuilderZ parseFile)r#streamr?r0ZbuilderrrrrKszDOMBuilder._parse_bytestream)r r)r r)r r)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)r r)r r)r r)rr r r%rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErNr$r&r'r(r)r*r+r9r,r<r-r@rErBrRrKrrrrr-s  cCs|jjddS)N-_)lowerreplace)r6rrrr.sr.c@s0eZdZd ZddZddZddZdd Zd S) r_openerc Cst}||_||_|jj||_|j||_ddl}ddl }|j j |}|\}}} } } } | r| j d r|j | d} ||| | | | f}|j j||_|S)Nr/)rpublicIdrH _get_openeropenrG_guess_media_encodingencoding posixpathZ urllib.parserBZurlparseendswithdirnameZ urlunparsebaseURI) r#rZrHsourcer_rMpartsschemeZnetlocpathZparamsZqueryZfragmentrrrrAs  zDOMEntityResolver.resolveEntityc Cs,y|jStk r&|j|_|jSXdS)N)rXr>_create_opener)r#rrrr[s  zDOMEntityResolver._get_openercCsddl}|jjS)Nr)rIrJZ build_opener)r#rMrrrrgsz DOMEntityResolver._create_openercCsF|jj}d|krBx.|jD]"}|jdr|jdddjSqWdS)Nz Content-Typezcharset==r)rGinfoZgetplist startswithsplitrV)r#rcriZparamrrrr]s   z'DOMEntityResolver._guess_media_encodingN)rX)rr r __slots__rAr[rgr]rrrrrs c@seZdZd'Zdd Zd d Zd d ZddZddZddZ ddZ ddZ ddZ ddZ ddZddZd d!Zd"d#Zd$d%Zd&S)(rrGcharacterStream stringDatar^rZrHrbcCs.d|_d|_d|_d|_d|_d|_d|_dS)N)rGrmrnr^rZrHrb)r#rrrr$szDOMInputSource.__init__cCs|jS)N)rG)r#rrr_get_byteStreamszDOMInputSource._get_byteStreamcCs ||_dS)N)rG)r#rGrrr_set_byteStreamszDOMInputSource._set_byteStreamcCs|jS)N)rm)r#rrr_get_characterStreamsz#DOMInputSource._get_characterStreamcCs ||_dS)N)rm)r#rmrrr_set_characterStreamsz#DOMInputSource._set_characterStreamcCs|jS)N)rn)r#rrr_get_stringDataszDOMInputSource._get_stringDatacCs ||_dS)N)rn)r#datarrr_set_stringDataszDOMInputSource._set_stringDatacCs|jS)N)r^)r#rrr _get_encodingszDOMInputSource._get_encodingcCs ||_dS)N)r^)r#r^rrr _set_encodingszDOMInputSource._set_encodingcCs|jS)N)rZ)r#rrr _get_publicId"szDOMInputSource._get_publicIdcCs ||_dS)N)rZ)r#rZrrr _set_publicId$szDOMInputSource._set_publicIdcCs|jS)N)rH)r#rrr _get_systemId'szDOMInputSource._get_systemIdcCs ||_dS)N)rH)r#rHrrr _set_systemId)szDOMInputSource._set_systemIdcCs|jS)N)rb)r#rrr _get_baseURI,szDOMInputSource._get_baseURIcCs ||_dS)N)rb)r#rCrrr _set_baseURI.szDOMInputSource._set_baseURIN)rGrmrnr^rZrHrb)rr r rlr$rorprqrrrsrurvrwrxryrzr{r|r}rrrrrs" c@s>eZdZdZdZdZdZdZej Z ddZ dd Z d d Z d S) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. rrr r!cCs|jS)N) whatToShow)r#rrr_get_whatToShowCsz DOMBuilderFilter._get_whatToShowcCs|jS)N) FILTER_ACCEPT)r#elementrrr acceptNodeFszDOMBuilderFilter.acceptNodecCs|jS)N)r)r#rrrrstartContainerIszDOMBuilderFilter.startContainerN)rr r r rZ FILTER_REJECTZ FILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLrrrrrrrrr~2sr~c@s$eZdZddZddZddZdS)_AsyncDeprecatedPropertycCs|j}tjdj|dtdS)Nz+{cls}.async is deprecated; use {cls}.async_)cls)rwarningswarnformatDeprecationWarning)r#rZclsnamerrrrPs z_AsyncDeprecatedProperty.warncCs|j||dk r|jSdS)NF)rasync_)r#instancerrrr__get__Vs z _AsyncDeprecatedProperty.__get__cCs|jt|t|d|dS)Nr)rtyper3)r#rr8rrr__set__\sz _AsyncDeprecatedProperty.__set__N)rr r rrrrrrrrOsrc@sPeZdZdZdZeed<ddZddZdd Z d d Z d d Z ddZ dS) DocumentLSz=Mixin to create documents that conform to the load/save spec.FasynccCsdS)NFr)r#rrr _get_asyncgszDocumentLS._get_asynccCs|rtjjddS)Nz.asynchronous document loading is not supported)r0r1r2)r#flagrrr _set_asyncjszDocumentLS._set_asynccCs tddS)Nz'haven't figured out what this means yet)rP)r#rrrabortoszDocumentLS.abortcCs tddS)Nzhaven't written this yet)rP)r#rCrrrloaduszDocumentLS.loadcCs tddS)Nzhaven't written this yet)rP)r#rcrrrloadXMLxszDocumentLS.loadXMLcCs*|dkr|}n|j|k r"tjj|jS)N)Z ownerDocumentr0r1ZWrongDocumentErrZtoxml)r#ZsnoderrrsaveXML{s   zDocumentLS.saveXMLN) rr r r rrlocalsrrrrrrrrrrras rc@s,eZdZdZdZddZddZddZd S) DOMImplementationLSrrcCsF|dk rtjjd||jkr$tS||jkr:tjjdtddS)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r0r1r2MODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrO)r#modeZ schemaTyperrrcreateDOMBuilders  z$DOMImplementationLS.createDOMBuildercCs tddS)Nz-the writer interface hasn't been written yet!)rP)r#rrrcreateDOMWritersz#DOMImplementationLS.createDOMWritercCstS)N)r)r#rrrcreateDOMInputSourcesz(DOMImplementationLS.createDOMInputSourceN)rr r rrrrrrrrrrs  r)r rFrZxml.domr0Zxml.dom.NodeFilterr__all__rrr.objectrrr~rrrrrrrs"   %,1"PKi#])<*-dom/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \@sGdddZdZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGd d!d!eZGd"d#d#eZGd$d%d%eZGd&d'd'eZGd(d)d)eZGd*d+d+eZGd,d-d-eZGd.d/d/eZ Gd0d1d1eZ!Gd2d3d3eZ"Gd4d5d5Z#d6Z$d7Z%d8Z&d9Z'd9Z(dd:l)m*Z*m+Z+d9S);c@s@eZdZfZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd S)Node N)__name__ __module__ __qualname__ __slots__Z ELEMENT_NODEZATTRIBUTE_NODEZ TEXT_NODEZCDATA_SECTION_NODEZENTITY_REFERENCE_NODEZ ENTITY_NODEZPROCESSING_INSTRUCTION_NODEZ COMMENT_NODEZ DOCUMENT_NODEZDOCUMENT_TYPE_NODEZDOCUMENT_FRAGMENT_NODEZ NOTATION_NODErr(/usr/lib64/python3.6/xml/dom/__init__.pyrs rrrrrrrrr r r r r c@seZdZddZddZdS) DOMExceptioncOs(|jtkrtdtj|f||dS)Nz0DOMException should not be instantiated directly) __class__r RuntimeError Exception__init__)selfargskwrrrrBs zDOMException.__init__cCs|jS)N)code)rrrr _get_codeHszDOMException._get_codeN)rrrrr!rrrrr>src@seZdZeZdS) IndexSizeErrN)rrrINDEX_SIZE_ERRr rrrrr"Lsr"c@seZdZeZdS)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr rrrrr$Osr$c@seZdZeZdS)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr rrrrr&Rsr&c@seZdZeZdS)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr rrrrr(Usr(c@seZdZeZdS)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr rrrrr*Xsr*c@seZdZeZdS)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr rrrrr,[sr,c@seZdZeZdS)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr rrrrr.^sr.c@seZdZeZdS) NotFoundErrN)rrr NOT_FOUND_ERRr rrrrr0asr0c@seZdZeZdS)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr rrrrr2dsr2c@seZdZeZdS)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr rrrrr4gsr4c@seZdZeZdS)InvalidStateErrN)rrrINVALID_STATE_ERRr rrrrr6jsr6c@seZdZeZdS) SyntaxErrN)rrr SYNTAX_ERRr rrrrr8msr8c@seZdZeZdS)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr rrrrr:psr:c@seZdZeZdS) NamespaceErrN)rrr NAMESPACE_ERRr rrrrr<ssr<c@seZdZeZdS)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr rrrrr>vsr>c@seZdZeZdS) ValidationErrN)rrrVALIDATION_ERRr rrrrr@ysr@c@seZdZdZdZdZdZdS)UserDataHandlerrrrrN)rrrZ NODE_CLONEDZ NODE_IMPORTEDZ NODE_DELETEDZ NODE_RENAMEDrrrrrB|srBz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation),rr#r%r'r)r+r-r/r1r3r5r7r9r;r=r?rArrr"r$r&r(r*r,r.r0r2r4r6r8r:r<r>r@rBZ XML_NAMESPACEZXMLNS_NAMESPACEZXHTML_NAMESPACEZEMPTY_NAMESPACEZ EMPTY_PREFIXZdomregrCrDrrrrsP PKi#]Jꃺ]]1dom/__pycache__/expatbuilder.cpython-36.opt-2.pycnu[3 \ @sddlmZmZmZddlmZmZmZddlmZddl m Z m Z ddl m Z ejZejZejZejjZejjZejjZejjZejZejddejddejdd ejdd ejdd ejdd ejdd ejddejddd ZGdddeZddZddZGdddZeeefZGdddeZ GdddeZ!Gddde!Z"Gdd d e!Z#d!Z$d"e$Z%Gd#d$d$eZ&Gd%d&d&Z'Gd'd(d(e'eZ(Gd)d*d*e'e&Z)Gd+d,d,e*Z+Gd-d.d.eZ,d:d0d1Z-d;d2d3Z.d) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNZcdata enumerationentityentitiesidZidrefZidrefsZnmtokenZnmtokens) ZCDATAENUMZENTITYZENTITIESIDZIDREFZIDREFSZNMTOKENZNMTOKENSc@sZeZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) ElementInfo _attr_info_modeltagNameNcCs||_g|_||_dS)N)rrr)selfrmodelr,/usr/lib64/python3.6/xml/dom/expatbuilder.py__init__?szElementInfo.__init__cCs|j|j|jfS)N)rrr)rrrr __getstate__DszElementInfo.__getstate__cCs|\|_|_|_dS)N)rrr)rstaterrr __setstate__GszElementInfo.__setstate__cCsJxB|jD]8}|d|kr|d}|ddkr4tdSt|dSqWtjS)Nr(rr!)r _typeinfo_mapr_no_type)ranameinfotrrrgetAttributeTypeJs   zElementInfo.getAttributeTypecCstjS)N)rr#)rZ namespaceURIZ localNamerrrgetAttributeTypeNSTszElementInfo.getAttributeTypeNScCs,|jr$|jd}|tjjtjjfkSdSdS)NrF)rrrZ XML_CTYPE_ANYZXML_CTYPE_MIXED)rtyperrrisElementContentWs   zElementInfo.isElementContentcCs |jr|jdtjjkSdSdS)NrF)rrrZXML_CTYPE_EMPTY)rrrrisEmpty_szElementInfo.isEmptycCs,x&|jD]}|d|kr|ddkSqWdS)NrrrFr!)r)rr$r%rrrisIdes  zElementInfo.isIdcCs|j||fS)N)r,)rZeuriZenameZaurir$rrrisIdNSkszElementInfo.isIdNS)rrr)N) __name__ __module__ __qualname__ __slots__rrrr'r(r*r+r,r-rrrrr<s  rcCs |j||S)N)_intern_setdefault)buildersrrr_internosr5cCs|jd}|j}t|dkrR|\}}}|||}d||f}|||}|||}n4t|dkrz|\}}t}|||}}n td|||||||fS)N z%s:%srz4Unsupported syntax: spaces in URIs not supported: %r)splitr2lenr ValueError)r3namepartsinternuri localnameprefixqnamerrr_parse_ns_namers         rBc@seZdZd:ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9ZdS); ExpatBuilderNcCsP|dkrtj}||_|jjdk r2t|jj|_n d|_t|_d|_|j dS)N) rZOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)roptionsrrrrs zExpatBuilder.__init__cCstjS)N)r ParserCreate)rrrr createParserszExpatBuilder.createParsercCsF|js@|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)NT) rIrMr= setdefaultr2Z buffer_textZordered_attributesZspecified_attributesinstall)rrrr getParsers   zExpatBuilder.getParsercCs,tjtdd|_|j|_|jj|_d|_dS)NF)theDOMImplementationZcreateDocumentrdocumentcurNode _elem_info_cdata)rrrrrJs   zExpatBuilder.resetcCs|j|_|j|_|j|_|j|_|jj r0|j |_ |j |_ |jjrH|j|_|jjrj|j|_|j|_|j|_n|j|_|j|_|j|_|j|_|j|_ dS)N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrDrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlerZcdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerZXmlDeclHandlerelement_decl_handlerZElementDeclHandlerattlist_decl_handlerZAttlistDeclHandler)rparserrrrrOs$ zExpatBuilder.installc Cs|j}d}yLx:|jd}|s P|j|d|rB|jjrB|j|d}qW|jddWntk rlYnX|j}|jd|_|S)NTirFi@) rPreadParserRdocumentElement _setup_subset ParseEscaperJrI)rfilerqZ first_bufferbufferdocrrr parseFiles$    zExpatBuilder.parseFilec CsP|j}y|j|d|j|Wntk r6YnX|j}|jd|_|S)NT)rPrurwrxrRrJrI)rstringrqr{rrr parseStrings zExpatBuilder.parseStringcCs.|jjr*t}|j||j}||jj_dS)N)rRdoctypeInternalSubsetExtractorr~ getSubsetinternalSubset)rrzZ extractorsubsetrrrrws  zExpatBuilder._setup_subsetcCs|jjj|||}|j|_t|j|||j_|jrj|jj|tkrjd|j_|jj d=d}d|j _ d|j _ |r|dk rg|j _g|j_d|j _d|j _|j|j _dS)Nr)rRimplementationZcreateDocumentType ownerDocumentr rrG acceptNode FILTER_REJECT childNodesrIr_rar_seq notationsrdr]end_doctype_decl_handlerEndDoctypeDeclHandler)rZ doctypeNamesystemIdpublicIdhas_internal_subsetrrrrrVs$   z'ExpatBuilder.start_doctype_decl_handlercCs2|jjr|j|j_|j|j_|jp&|js.t |_ dS)N) rDrbrcrIrdr\r]rTrGr_finish_end_element)rrrrrs    z%ExpatBuilder.end_doctype_decl_handlercCs@|jj||}t|j||jr<|jj|tkr<|jj|dS)N)rRZcreateProcessingInstructionr rSrGrr removeChild)rtargetdatanoderrrr\ s zExpatBuilder.pi_handlercCs|jj}|jrH|jr4|djtkr4|dj|dS|jj|}d|_nD|rv|djt krv|d}|j |}||_ dSt j }||_ |j|_ t|j|dS)NrTrrrr)rSrrU_cdata_continuenodeTypeCDATA_SECTION_NODEZ appendDatarRZcreateCDATASection TEXT_NODErrTextrr )rrrrvaluerrrris"  z)ExpatBuilder.character_data_handler_cdatacCs^|jj}|r2|djtkr2|d}|j||_dStj}|j||_|j|_t |j|dS)Nrrr) rSrrrrrrrRrr )rrrrrrrrk&s  z#ExpatBuilder.character_data_handlerc Cs|rdS|jjsdS|jj||||}|dk rF|jj|} |jj| |jjjjj||j r||j j |t kr||jjjjd=dS)Nrr) rDrrRZ_create_entityZcreateTextNoderappendrrrGrr) rZ entityNameZis_parameter_entityrbaserr notationNamerchildrrrr^1s   z ExpatBuilder.entity_decl_handlercCsJ|jj|||}|jjjjj||jrF|jj|tkrF|jjjjd=dS)Nrr) rRZ_create_notationrrrrrGr FILTER_ACCEPT)rrrrrrrrrr`Csz"ExpatBuilder.notation_decl_handlercCs>|jj|}t|j||jr:|jj|tkr:|jj|dS)N)rRZ createCommentr rSrGrrr)rrrrrrrcIs  zExpatBuilder.comment_handlercCsd|_d|_dS)NTF)rUr)rrrrreOsz(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS)NF)rUr)rrrrrgSsz&ExpatBuilder.end_cdata_section_handlercCsdS)Nrr)rcontextrrrrrrrlWsz(ExpatBuilder.external_entity_ref_handlercCs4|jdkr|j rt|_|j|j_|j||dS)N)rGrTrrstart_element_handlerrPrY)rr; attributesrrrrXZs z"ExpatBuilder.first_element_handlercCs|jj|}t|j|||_|rtxPtdt|dD]<}tj||tdt }||d}||_ |j|_ t ||q4W||jj k r|j|dS)Nrrr)rRZ createElementr rSranger9rAttrrrrrr rvrH)rr;rriarrrrr`s     z"ExpatBuilder.start_element_handlercCsj|jrf||jjkrdS|jj|}|tkr4t|n|tkrFt|ndS|j|_ |jj ||j dS)N) rGrRrvstartContainerrRejecter FILTER_SKIPSkipper parentNoderSrunlink)rrZfiltrrrrHqs     z"ExpatBuilder._finish_start_elementcCs|j}|j|_|j|dS)N)rSrr)rr;rSrrrrZsz ExpatBuilder.end_element_handlercCs\|jj|j}|r|j|||jrX||jjkr4dS|jj|tkrX|j j ||j dS)N) rTgetr_handle_white_text_nodesrGrRrvrrrSrr)rrSr%rrrrs   z ExpatBuilder._finish_end_elementcCsf|jjs|j rdSg}x.|jD]$}|jtkr"|jj r"|j|q"Wx|D]}|j |qPWdS)N) rDZwhitespace_in_element_contentr*rrrrstriprr)rrr%Lrrrrrs   z%ExpatBuilder._handle_white_text_nodescCs0|jj|}|dkr&t|||j|<n||_dS)N)rTrrr)rr;rr%rrrros z!ExpatBuilder.element_decl_handlerc CsF|jj|}|dkr&t|}||j|<|jjd|dd|d||gdS)Nr)rTrrrr)relemr;r)defaultZrequiredr%rrrrps   z!ExpatBuilder.attlist_decl_handlercCs2||j_||j_|dkr.|r&d|j_nd|j_dS)NrTF)rRversionencoding standalone)rrrrrrrrns  zExpatBuilder.xml_decl_handler)N)r.r/r0rrMrPrJrOr|r~rwrVrr\rirkr^r`rcrergrlrXrrHrZrrrorprnrrrrrCs8     rCc@seZdZd ZddZddZddZeje j ej e j ej e jeje jeje jeje jeje jeje jeje jeje jeje jeje j i Z!dS) rFrEcCs ||_dS)N)rE)rrErrrrsz#FilterVisibilityController.__init__cCsT|j|j}|jj|@rL|jj|}|tkr0t|tkrHtdt ||St SdS)Nz)startContainer() returned illegal value: ) _nodetype_maskrrE whatToShowrFILTER_INTERRUPTrx_ALLOWED_FILTER_RETURNSr:reprr)rrmaskvalrrrrs   z)FilterVisibilityController.startContainercCs|j|j}|jj|@r|jj|}|tkr0t|tkrd|j}x |j ddD]}|j |qNWt S|t kr|t dt||StSdS)Nz%acceptNode() returned illegal value: )rrrErrrrxrrrZ appendChildrrr:rr)rrrrparentrrrrrs   z%FilterVisibilityController.acceptNodeN)rE)"r.r/r0r1rrrrZ ELEMENT_NODEr Z SHOW_ELEMENTZATTRIBUTE_NODEZSHOW_ATTRIBUTErZ SHOW_TEXTrZSHOW_CDATA_SECTIONZENTITY_REFERENCE_NODEZSHOW_ENTITY_REFERENCEZ ENTITY_NODEZ SHOW_ENTITYZPROCESSING_INSTRUCTION_NODEZSHOW_PROCESSING_INSTRUCTIONZ COMMENT_NODEZ SHOW_COMMENT DOCUMENT_NODEZ SHOW_DOCUMENTZDOCUMENT_TYPE_NODEZSHOW_DOCUMENT_TYPEZDOCUMENT_FRAGMENT_NODEZSHOW_DOCUMENT_FRAGMENTZ NOTATION_NODEZ SHOW_NOTATIONrrrrrrFs  rFc@seZdZdZddZdS) FilterCrutch_builder_level _old_start_old_endcCs6d|_||_|j}|j|_|j|_|j|_|j|_dS)Nr) rrrIrYrr[rrrZ)rr3rqrrrrszFilterCrutch.__init__N)rrrr)r.r/r0r1rrrrrrsrc@s(eZdZfZddZddZddZdS)rcCs0tj|||j}xdD]}t||dqWdS)Nr]rdrjrfrhrm)r]rdrjrfrhrm)rrrIsetattr)rr3rqr;rrrrs zRejecter.__init__cGs|jd|_dS)Nr)r)rargsrrrrszRejecter.start_element_handlercGs@|jdkr0|jj}|jj||j|_|j|_n |jd|_dS)Nrr)rrrIrOrrYrr[)rrrqrrrrZ s    zRejecter.end_element_handlerN)r.r/r0r1rrrZrrrrrs rc@s eZdZfZddZddZdS)rcGs.|jj}|j||jj|k r*|jd|_dS)Nr)rrSrr)rrrrrrr-s  zSkipper.start_element_handlercGsD|jdkr*|j|jj_|j|jj_d|_n|jd|_|j|dS)Nrr)rrrrIrYrr[)rrrrrrZ3s     zSkipper.end_element_handlerN)r.r/r0r1rrZrrrrr*srz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c@sFeZdZdddZddZddZdd Zd d Zd d ZddZ dS)FragmentBuilderNcCs6|jtkr||_||_n|j|_||_tj||dS)N)rroriginalDocumentrrrCr)rrrKrrrr[s  zFragmentBuilder.__init__cCstj|d|_dS)N)rCrJfragment)rrrrrJds zFragmentBuilder.resetcCs|j|jS)N)r~rt)rryrrrr|hszFragmentBuilder.parseFilec Cs||_|j}|jj}d}|rV|jp*|j}|jrDd|j|jf}qZ|jrZd|j}nd}|j}t |||f}y|j |dWn|j YnX|j }|j |S)NrszPUBLIC "%s" "%s"z SYSTEM "%s"r) _sourcerPrrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErurJr) rr}rqrZidentrZnsattrsrRrrrrr~ms, zFragmentBuilder.parseStringcCs|jjj}d}|rxbt|jjD]R}|jj|}|r>|d}d||jf}|jrfd||j|j f}q"d||j f}q"Wxt|j jD]}|j j|}|r|d}d||jf}|jrd||j|j f}n&|j rd||j f}nd ||j j f}|j rd ||j f}|d }qW|S) Nrsz z%sz%s SYSTEM "%s">z %s)rrrrrZlengthitemZnodeNamerrrZ firstChildrr)rrr4rZnotationr rrrrs6    z FragmentBuilder._getDeclarationscCsdS)Nrsr)rrrrrszFragmentBuilder._getNSattrsc Cs~|tkrh|j}|j}|jj|}|j|_|jj|_|j|_z|j|j dWd||_||_d|_ XdSt j |||||SdS)Nrr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrRrSrIZExternalEntityParserCreaterZcreateDocumentFragmentrrurrCrl)rrrrrZ old_documentZ old_cur_noderqrrrrls  z+FragmentBuilder.external_entity_ref_handler)N) r.r/r0rrJr|r~rrrlrrrrrRs $rc@s4eZdZddZddZddZddZd d Zd S) NamespacescCs g|_dS)N)_ns_ordered_prefixes)rrrr_initNamespacesszNamespaces._initNamespacescCstjdd}d|_|S)Nr6)Znamespace_separatorT)rrLZnamespace_prefixes)rrqrrrrMs zNamespaces.createParsercCs tj|||jjr|j|_dS)N)rCrOrDZnamespace_declarationsstart_namespace_decl_handlerZStartNamespaceDeclHandler)rrqrrrrOs zNamespaces.installcCs|jj||fdS)N)rr)rr@r>rrrrsz'Namespaces.start_namespace_decl_handlercCsd|krt||\}}}}nt}|}d}t}tj||||}|j|_t|j|||_|j rxZ|j D]P\}}|rtj t |d|t |d}ntj dt dt}||_ |j|_t||qdW|j dd=|r|j|j} |j} xtdt|dD]} || } || d} d| krJt|| \}}}}tj ||||}|| |<|| ||f<n$tj | t| t}|| | <|| t| f<|j|_| |_ ||_qWdS)Nr6zxmlns:xmlnsrrr)rBrrrZElementrRrr rSrrr5rrr Z_ensure_attributes_attrs_attrsNSrr9Z ownerElement)rr;rr>r?r@rArrrrrr$rrrrrsP      z Namespaces.start_element_handlerN)r.r/r0rrMrOrrrrrrrs /rc@seZdZddZdS)ExpatBuilderNScCstj||jdS)N)rCrJr)rrrrrJ)s zExpatBuilderNS.resetN)r.r/r0rJrrrrr&src@seZdZddZddZdS)FragmentBuilderNScCstj||jdS)N)rrJr)rrrrrJ1s zFragmentBuilderNS.resetcCsd}|j}g}xv|rt|dr|x\|jjD]N\}}||krZdeclnamerrrr5s"    zFragmentBuilderNS._getNSattrsN)r.r/r0rJrrrrrr.src@s eZdZdS)rxN)r.r/r0rrrrrxSsrxc@sHeZdZdZddZddZddZdd Zd d Zd d Z ddZ dS)rNcCs|jS)N)r)rrrrr\sz!InternalSubsetExtractor.getSubsetc Cs*ytj||Wntk r$YnXdS)N)rCr|rx)rryrrrr|`sz!InternalSubsetExtractor.parseFilec Cs*ytj||Wntk r$YnXdS)N)rCr~rx)rr}rrrr~fsz#InternalSubsetExtractor.parseStringcCs|j|_|j|_dS)N)rVrWrrY)rrqrrrrOlszInternalSubsetExtractor.installcCs0|r&|j}g|_|jj|_|j|_ntdS)N)rPrrZDefaultHandlerrrrx)rr;rrrrqrrrrVps   z2InternalSubsetExtractor.start_doctype_decl_handlercCs,dj|jjddjdd}||_tdS)Nrsz   )joinrreplacerx)rr4rrrrzsz0InternalSubsetExtractor.end_doctype_decl_handlercCs tdS)N)rx)rr;rrrrrsz-InternalSubsetExtractor.start_element_handler) r.r/r0rrr|r~rOrVrrrrrrrWs rTc CsL|r t}nt}t|tr>t|d}|j|}WdQRXn |j|}|S)Nrb)rrC isinstancestropenr|)ry namespacesr3fpresultrrrparses   rcCs|r t}nt}|j|S)N)rrCr~)r}rr3rrrr~sr~c CsP|rt|}nt|}t|trBt|d}|j|}WdQRXn |j|}|S)Nr)rrrrrr|)ryrrr3rrrrr parseFragments    rcCs |rt|}nt|}|j|S)N)rrr~)r}rrr3rrrparseFragmentStrings rcCs|jrt|St|SdS)N)rrrC)rKrrr makeBuildersr)T)T)T)T)2Zxml.domrrrrrrZ xml.parsersrZxml.dom.minidomr r Zxml.dom.NodeFilterr rrrZDOMBuilderFilterrrrrZgetDOMImplementationrQZTypeInfor"objectrr5rBrCrrFrrrrrrrrr Exceptionrxrrr~rrrrrrrs\          3C :  u_%,   PKi#]AP /dom/__pycache__/minicompat.cpython-36.opt-2.pycnu[3 \' @sFddddgZddlZefZGdddeZGdddeZddZ dS) NodeList EmptyNodeList StringTypes defpropertyNc@s>eZdZfZddZddZddZeeeddZd d Z d S) rcCs(d|kot|knr$||SdS)Nr)len)selfindexr */usr/lib64/python3.6/xml/dom/minicompat.pyitem5sz NodeList.itemcCst|S)N)r)rr r r _get_length9szNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')xmldomNoModificationAllowedErr)rvaluer r r _set_length<szNodeList._set_lengthz$The number of nodes in the NodeList.)doccCs|dkr g}||dd<dS)Nr )rstater r r __setstate__DszNodeList.__setstate__N) __name__ __module__ __qualname__ __slots__r r rpropertylengthrr r r r r2sc@sFeZdZfZddZddZddZddZd d Ze eed d Z d S)rcCst}|j||S)N)rextend)rotherNLr r r __add__Ms zEmptyNodeList.__add__cCst}|j||S)N)rr)rrrr r r __radd__Rs zEmptyNodeList.__radd__cCsdS)Nr )rrr r r r WszEmptyNodeList.itemcCsdS)Nrr )rr r r r ZszEmptyNodeList._get_lengthcCstjjddS)Nz.attempt to modify read-only attribute 'length')r rr)rrr r r r]szEmptyNodeList._set_lengthz$The number of nodes in the NodeList.)rN) rrrrrrr r rrrr r r r rJscCs8t|d|}|fdd}t|||d}t|||dS)NZ_get_cSstjjdt|dS)Nz&attempt to modify read-only attribute )r rrrepr)rrnamer r r setgszdefproperty..set)r)getattrrsetattr)klassr!rgetr"Zpropr r r res ) __all__Zxml.domr strrlistrtuplerrr r r r +s PKi#]  +dom/__pycache__/domreg.cpython-36.opt-1.pycnu[3 \{ @sDdZddlZdddZiZddZdd Zdffd d Zd d ZdS)zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)ZminidomZ4DOMcCs |t|<dS)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactoryr&/usr/lib64/python3.6/xml/dom/domreg.pyregisterDOMImplementations rcCs&x |D]\}}|j||sdSqWdS)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr)Z hasFeature)domfeaturesfvrrr _good_enough s r c Csddl}d}tj|}|r2t|iidg}|jS|r@t|Stjj rdd|j krdt|j ddSt |t rvt |}x$tj D]}|}t||r|SqWxDtjD]8}yt|d}Wntk rwYnXt||r|SqWtddS)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementationZ PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesr keys Exception ImportError)rr rZcreatormodr rrrr's0      rcCsg}|j}d}t|}xp||kr||}|ddkrDtd|f|d}d}||krx||}|ddkrx|d}|}|j||fqWt|S)Nr 0123456789zbad feature name: %rr)splitlen ValueErrorappendtuple)sr partsiZlengthZfeatureversionr rrrrRs"   r)__doc__rrrrr rrrrrrs +PKi#]=&3&3/dom/__pycache__/xmlbuilder.cpython-36.opt-2.pycnu[3 \2@sddlZddlZddlZddlmZdddgZGdddZGdddZd d Z Gd dde Z Gd dde Z Gd ddZ [GdddZGdddZ[GdddZdS)N) NodeFilter DOMBuilderDOMEntityResolverDOMInputSourcec@sXeZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdS)OptionsTFN)__name__ __module__ __qualname__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesZexternal_dtd_subsetvalidate_if_schemaZvalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilterrr*/usr/lib64/python3.6/xml/dom/xmlbuilder.pyr s& rc5@sVeZdZdZdZdZdZdZdZdZ eeee fZ ddZ dd Z d d Z d d ZddZddZddZddZddZddZd4d5gd6d7gd8d9gd:d;gdd?gd@dAgdBdCgdDdEgdFdGgdHdIdJgdKdLgdMdNgdOdPgdQdRgdSdTgdUdVgdWdXgdYdZgd[d\gd]gd^d_d`dadbdcdddedfdgg dhdigdjdkgdldmgiZd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS)nrNrcCs t|_dS)N)r_options)selfrrr__init__:szDOMBuilder.__init__cCs|jS)N)entityResolver)r"rrr_get_entityResolver=szDOMBuilder._get_entityResolvercCs ||_dS)N)r$)r"r$rrr_set_entityResolver?szDOMBuilder._set_entityResolvercCs|jS)N)r)r"rrr_get_errorHandlerBszDOMBuilder._get_errorHandlercCs ||_dS)N)r)r"rrrr_set_errorHandlerDszDOMBuilder._set_errorHandlercCs|jS)N)r)r"rrr _get_filterGszDOMBuilder._get_filtercCs ||_dS)N)r)r"rrrr _set_filterIszDOMBuilder._set_filterc Cs|j|rv|rdpd}y|jt||f}Wn&tk rRtjjd|fYqXx4|D]\}}t|j||qZWntjj dt |dS)Nrrzunsupported feature: %rzunknown feature: ) supportsFeature _settings _name_xformKeyErrorxmldomNotSupportedErrsetattrr! NotFoundErrrepr)r"namestateZsettingsvaluerrr setFeatureLs  zDOMBuilder.setFeaturecCst|jt|S)N)hasattrr!r-)r"r5rrrr+ZszDOMBuilder.supportsFeaturecCst||rdpdf}||jkS)Nrr)r-r,)r"r5r6keyrrr canSetFeature]szDOMBuilder.canSetFeaturer rr rrrrrrrrrrrrr c Cst|}y t|j|Stk r|dkrj|j}|joh|joh|joh|joh|jpf|j pf|j pf|j pf|j St jjdt|YnXdS)Nrzfeature %s not known)r-getattrr!AttributeErrorrrrrr rrrrr/r0r3r4)r"r5Zxnameoptionsrrr getFeatures  zDOMBuilder.getFeaturecCs.|jr|jjd|}ntjd|}|j|S)N)r$ resolveEntityrparse)r"uriinputrrrparseURIszDOMBuilder.parseURIcCsRtj|j}|j|_|j|_|j}|dkrF|jrFddl}|jj|j}|j ||S)Nr) copyr!rr byteStreamsystemIdurllib.requestrequestZurlopen_parse_bytestream)r"rCr>fpurllibrrrrAs zDOMBuilder.parsecCs||jkrtdtddS)Nznot a legal actionzHaven't written this yet...)_legal_actions ValueErrorNotImplementedError)r"rCZcnodeactionrrrparseWithContexts zDOMBuilder.parseWithContextcCs ddl}|jjj|}|j|S)Nr)Zxml.dom.expatbuilderr0Z expatbuilderZ makeBuilderZ parseFile)r"streamr>r/ZbuilderrrrrJszDOMBuilder._parse_bytestream)r r)r r)r r)r r)r r)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)r r)r r)r r)r r)rr r r$rrZACTION_REPLACEZACTION_APPEND_AS_CHILDRENZACTION_INSERT_AFTERZACTION_INSERT_BEFORErMr#r%r&r'r(r)r*r8r+r;r,r?rDrArQrJrrrrr-s  cCs|jjddS)N-_)lowerreplace)r5rrrr-sr-c@s0eZdZd ZddZddZddZdd Zd S) r_openerc Cst}||_||_|jj||_|j||_ddl}ddl }|j j |}|\}}} } } } | r| j d r|j | d} ||| | | | f}|j j||_|S)Nr/)rpublicIdrG _get_openeropenrF_guess_media_encodingencoding posixpathZ urllib.parserAZurlparseendswithdirnameZ urlunparsebaseURI) r"rYrGsourcer^rLpartsschemeZnetlocpathZparamsZqueryZfragmentrrrr@s  zDOMEntityResolver.resolveEntityc Cs,y|jStk r&|j|_|jSXdS)N)rWr=_create_opener)r"rrrrZs  zDOMEntityResolver._get_openercCsddl}|jjS)Nr)rHrIZ build_opener)r"rLrrrrfsz DOMEntityResolver._create_openercCsF|jj}d|krBx.|jD]"}|jdr|jdddjSqWdS)Nz Content-Typezcharset==r)rFinfoZgetplist startswithsplitrU)r"rbrhZparamrrrr\s   z'DOMEntityResolver._guess_media_encodingN)rW)rr r __slots__r@rZrfr\rrrrrs c@seZdZd'Zdd Zd d Zd d ZddZddZddZ ddZ ddZ ddZ ddZ ddZddZd d!Zd"d#Zd$d%Zd&S)(rrFcharacterStream stringDatar]rYrGracCs.d|_d|_d|_d|_d|_d|_d|_dS)N)rFrlrmr]rYrGra)r"rrrr#szDOMInputSource.__init__cCs|jS)N)rF)r"rrr_get_byteStreamszDOMInputSource._get_byteStreamcCs ||_dS)N)rF)r"rFrrr_set_byteStreamszDOMInputSource._set_byteStreamcCs|jS)N)rl)r"rrr_get_characterStreamsz#DOMInputSource._get_characterStreamcCs ||_dS)N)rl)r"rlrrr_set_characterStreamsz#DOMInputSource._set_characterStreamcCs|jS)N)rm)r"rrr_get_stringDataszDOMInputSource._get_stringDatacCs ||_dS)N)rm)r"datarrr_set_stringDataszDOMInputSource._set_stringDatacCs|jS)N)r])r"rrr _get_encodingszDOMInputSource._get_encodingcCs ||_dS)N)r])r"r]rrr _set_encodingszDOMInputSource._set_encodingcCs|jS)N)rY)r"rrr _get_publicId"szDOMInputSource._get_publicIdcCs ||_dS)N)rY)r"rYrrr _set_publicId$szDOMInputSource._set_publicIdcCs|jS)N)rG)r"rrr _get_systemId'szDOMInputSource._get_systemIdcCs ||_dS)N)rG)r"rGrrr _set_systemId)szDOMInputSource._set_systemIdcCs|jS)N)ra)r"rrr _get_baseURI,szDOMInputSource._get_baseURIcCs ||_dS)N)ra)r"rBrrr _set_baseURI.szDOMInputSource._set_baseURIN)rFrlrmr]rYrGra)rr r rkr#rnrorprqrrrtrurvrwrxryrzr{r|rrrrrs" c@s:eZdZdZdZdZdZejZ ddZ ddZ d d Z d S) DOMBuilderFilterrrrr cCs|jS)N) whatToShow)r"rrr_get_whatToShowCsz DOMBuilderFilter._get_whatToShowcCs|jS)N) FILTER_ACCEPT)r"elementrrr acceptNodeFszDOMBuilderFilter.acceptNodecCs|jS)N)r)r"rrrrstartContainerIszDOMBuilderFilter.startContainerN) rr r rZ FILTER_REJECTZ FILTER_SKIPZFILTER_INTERRUPTrZSHOW_ALLr~rrrrrrrr}2s r}c@s$eZdZddZddZddZdS)_AsyncDeprecatedPropertycCs|j}tjdj|dtdS)Nz+{cls}.async is deprecated; use {cls}.async_)cls)rwarningswarnformatDeprecationWarning)r"rZclsnamerrrrPs z_AsyncDeprecatedProperty.warncCs|j||dk r|jSdS)NF)rasync_)r"instancerrrr__get__Vs z _AsyncDeprecatedProperty.__get__cCs|jt|t|d|dS)Nr)rtyper2)r"rr7rrr__set__\sz _AsyncDeprecatedProperty.__set__N)rr r rrrrrrrrOsrc@sLeZdZdZeed<ddZddZddZd d Z d d Z d dZ dS) DocumentLSFasynccCsdS)NFr)r"rrr _get_asyncgszDocumentLS._get_asynccCs|rtjjddS)Nz.asynchronous document loading is not supported)r/r0r1)r"flagrrr _set_asyncjszDocumentLS._set_asynccCs tddS)Nz'haven't figured out what this means yet)rO)r"rrrabortoszDocumentLS.abortcCs tddS)Nzhaven't written this yet)rO)r"rBrrrloaduszDocumentLS.loadcCs tddS)Nzhaven't written this yet)rO)r"rbrrrloadXMLxszDocumentLS.loadXMLcCs*|dkr|}n|j|k r"tjj|jS)N)Z ownerDocumentr/r0ZWrongDocumentErrZtoxml)r"ZsnoderrrsaveXML{s   zDocumentLS.saveXMLN) rr r rrlocalsrrrrrrrrrrras rc@s,eZdZdZdZddZddZddZd S) DOMImplementationLSrrcCsF|dk rtjjd||jkr$tS||jkr:tjjdtddS)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)r/r0r1MODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrN)r"modeZ schemaTyperrrcreateDOMBuilders  z$DOMImplementationLS.createDOMBuildercCs tddS)Nz-the writer interface hasn't been written yet!)rO)r"rrrcreateDOMWritersz#DOMImplementationLS.createDOMWritercCstS)N)r)r"rrrcreateDOMInputSourcesz(DOMImplementationLS.createDOMInputSourceN)rr r rrrrrrrrrrs  r)rErZxml.domr/Zxml.dom.NodeFilterr__all__rrr-objectrrr}rrrrrrrs    %,1"PKi#]  %dom/__pycache__/domreg.cpython-36.pycnu[3 \{ @sDdZddlZdddZiZddZdd Zdffd d Zd d ZdS)zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)ZminidomZ4DOMcCs |t|<dS)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactoryr&/usr/lib64/python3.6/xml/dom/domreg.pyregisterDOMImplementations rcCs&x |D]\}}|j||sdSqWdS)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr)Z hasFeature)domfeaturesfvrrr _good_enough s r c Csddl}d}tj|}|r2t|iidg}|jS|r@t|Stjj rdd|j krdt|j ddSt |t rvt |}x$tj D]}|}t||r|SqWxDtjD]8}yt|d}Wntk rwYnXt||r|SqWtddS)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementationZ PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesr keys Exception ImportError)rr rZcreatormodr rrrr's0      rcCsg}|j}d}t|}xp||kr||}|ddkrDtd|f|d}d}||krx||}|ddkrx|d}|}|j||fqWt|S)Nr 0123456789zbad feature name: %rr)splitlen ValueErrorappendtuple)sr partsiZlengthZfeatureversionr rrrrRs"   r)__doc__rrrrr rrrrrrs +PKi#]t,dom/__pycache__/minidom.cpython-36.opt-2.pycnu[3 ie@sddlZddlZddlmZmZmZmZddlTddlm Z m Z ej j j ej j jfZGdddej j Z ee ddd ee d d d ee d d d ddZddZddZddZGddde ZGddde Zeeddd eed dd eeddd Gdd d eZeed!d"d eZGd#d$d$eZeddZGd%d&d&e Zeed'd(d eed d)d d*d+ZGd,d-d-ZGd.d/d/ee ZGd0d1d1ee Z ee d!d2d Gd3d4d4e Z!ee!d5d6d ee!d7d8d d9d:Z"d;d<Z#Gd=d>d>e Z$Gd?d@d@e!Z%GdAdBdBeZ&ee&d!dCd GdDdEdEZ'GdFdGdGe'ee Z(GdHdIdIe'e Z)GdJdKdKe'ee Z*GdLdMdMe Z+GdNdOdOeZ,dPdQZ-GdRdSdSe e Z.ee.dTdUd dVdWZ/dXdYZ0dZd[Z1dbd\d]Z2dcd^d_Z3ddd`daZ4dS)eN)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSc@seZdZdZdZdZdZdZeZ ddZ d2ddZ d3dd Z d d Z d d ZddZddZddZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Z dS)4NodeNcCsdS)NT)selfr r '/usr/lib64/python3.6/xml/dom/minidom.py__bool__+sz Node.__bool__cCs|jdd|S)N) toprettyxml)r encodingr r r toxml.sz Node.toxml  cCsx|dkrtj}ntjtj|ddd}|jtjkrH|j|d|||n|j|d|||dkrh|jS|j jSdS)Nxmlcharrefreplacer)rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)r indentnewlrwriterr r r r1s   zNode.toprettyxmlcCs t|jS)N)bool childNodes)r r r r hasChildNodesCszNode.hasChildNodescCs|jS)N)r$)r r r r _get_childNodesFszNode._get_childNodescCs|jr|jdSdS)Nr)r$)r r r r _get_firstChildIszNode._get_firstChildcCs|jr|jdSdS)N)r$)r r r r _get_lastChildMszNode._get_lastChildc Cs|j|jkr0xt|jD]}|j||qW|S|j|jkrXtjjdt |t |f|j dk rn|j j ||dkr|j |ny|jj |}Wntk rtjjYnX|jtkrt||jj||||_||_|r|j|d}||_||_nd|_||_ |S)Nz%s cannot be child of %sr()rDOCUMENT_FRAGMENT_NODEtupler$ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)r newChildrefChildcr6noder r r r-Qs6      zNode.insertBeforecCs|j|jkr.xt|jD]}|j|qW|S|j|jkrXtjjdt |t |fn|jt krjt ||j dk r|j j |t||d|_|S)Nz%s cannot be child of %s)rr+r,r$r5r.r/r0r1r2r9r:r3r4 _append_childr<)r rAr@r r r r5qs      zNode.appendChildc Cs|j|jkr(|j}|j||j||S|j|jkrPtjjdt |t |f||kr\dS|j dk rr|j j|y|j j |}Wnt k rtjjYnX||j |<||_ d|_ |jtks|jtkrt||j|_|j|_d|_d|_|jr||j_|jr||j_|S)Nz%s cannot be child of %s)rr+r<r4r-r.r/r0r1r2r3r$r6r7r8r9r:r=)r r>oldChildr?r6r r r replaceChilds<         zNode.replaceChildc Csy|jj|Wntk r.tjjYnX|jdk rD|j|j_|jdk rX|j|j_d|_|_|jt krvt |d|_ |S)N) r$remover7r/r0r8r<r=rr9r:r3)r rCr r r r4s      zNode.removeChildcCsg}x|jD]}|jtjkr|jsL|r2|j|d_|jrB|j|j_|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_|jq|j|q |j||jtj kr |j q W||jdd<dS)Nr(r)r)r)) r$rr TEXT_NODEdatar<r=unlinkappend ELEMENT_NODE normalize)r LchildrAr r r rKs*          zNode.normalizecCst|||jp|S)N) _clone_node ownerDocument)r deepr r r cloneNodeszNode.cloneNodecCs|jjj||S)N)rOimplementation hasFeature)r featureversionr r r isSupportedszNode.isSupportedcCsdS)Nr )r r r r _get_localNameszNode._get_localNamecCs||kS)Nr )r otherr r r isSameNodeszNode.isSameNodecCs|j|dr|SdSdS)N)rV)r rTr r r getInterfaces zNode.getInterfacec Cs,y|j|dSttfk r&dSXdS)Nr) _user_dataAttributeErrorKeyError)r keyr r r getUserDataszNode.getUserDatac Csnd}y |j}Wntk r,i}||_YnX||krB||d}|dkr^d}|dk rj||=n ||f||<|S)Nr)r[r\)r r^rGhandlerolddr r r setUserDatas    zNode.setUserDatacCsHt|drDx8t|jjD]&\}\}}|dk r|j|||||qWdS)Nr[)hasattrlistr[itemsZhandle)r operationsrcdstr^rGr`r r r _call_user_data_handlers zNode._call_user_data_handlercCsBd|_|_|jr2x|jD] }|jqWt|_d|_d|_dS)N)r3rOr$rHNodeListr=r<)r rMr r r rHs   z Node.unlinkcCs|S)Nr )r r r r __enter__szNode.__enter__cCs |jdS)N)rH)r ZetZevtbr r r __exit__sz Node.__exit__)N)rrN)!__name__ __module__ __qualname__ namespaceURIr3rOr<r=rprefixr rrr%r&r'r*r-r5rDr4rKrQrVrWrYrZr_rcrjrHrlrnr r r r r "s:      r firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cCs2|j}|r|d}||_||_|j|||_dS)Nr(r))r$r=r<rIr3)r rAr$Zlastr r r rBs rBcCs6|r2|jddjddjddjdd}|j|dS) N&z&z>)replacewrite)r"rGr r r _write_data'sr~cCsHxB|jD]8}|jtjkr4|dks*|j|kr4|j|t|||qW|S)Nr)r$rr rJtagNamerI_get_elements_by_tagName_helper)parentnamercrAr r r r.s    rcCs\xV|jD]L}|jtjkr|dks*|j|krF|dks<|j|krF|j|t||||qW|S)Nr)r$rr rJrwrrrI"_get_elements_by_tagName_ns_helper)rZnsURIrwrrAr r r r6s   rc@sJeZdZejZdZdZdZdZ ej ej ej ej ejejejfZddZdS)DocumentFragmentz#document-fragmentNcCs t|_dS)N)rkr$)r r r r __init__MszDocumentFragment.__init__)rorprqr r+rnodeName nodeValue attributesr3rJrFCDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODEr.rr r r r r?src@seZdZd#ZejZd Zd Zd Z ej ej fZ e d d fd d Zd dZddZddZddZeeeZZddZddZeeeZZddZddZeeeZddZdd Zd!d"Zd S)$Attr_name_valuerr_prefixr$ _localNamerO ownerElementNFcCs8d|_d|_||_||_||_t|_|jjtdS)N) rrOrrrrrkr$rIText)r qNamerrrwrsr r r r[sz Attr.__init__c Cs.y|jStk r(|jjdddSXdS)N:r(r))rr\rsplit)r r r r rWiszAttr._get_localNamecCs|jS)N) specified)r r r r _get_specifiedoszAttr._get_specifiedcCs|jS)N)r)r r r r _get_namerszAttr._get_namecCs||_|jdk rt|jdS)N)rrr:)r valuer r r _set_nameus zAttr._set_namecCs|jS)N)r)r r r r _get_value|szAttr._get_valuecCs6||_||jd_|jdk r&t|j||jd_dS)Nr)rr$rGrr:)r rr r r _set_values    zAttr._set_valuecCs|jS)N)r)r r r r _get_prefixszAttr._get_prefixcCsd|j}|dkr&|r&|tkr&tjjd||_|dkr<|j}nd||jf}|jrZt|j||_ dS)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s) rrrr/r0 NamespaceErrrrwrr:r)r rsZnsuriZnewNamer r r _set_prefixs  zAttr._set_prefixcCsz|j}|dk rR|j|j=|j|j|jf=|jrRd|_|jd8_|jj d8_ x|j D] }|j qZW|j dd=dS)NFr() r_attrsr_attrsNSrrrw_is_id_magic_id_nodesrO_magic_id_countr$rH)r elemrMr r r rHs   z Attr.unlinkcCsf|jr dS|j}|j}|dks&|dkr*dS|j|}|dkr@dS|jrV|j|j|jS|j|jSdS)NTF) rrOr_get_elem_inforrisIdNSrwisIdr)r rurinfor r r _get_isIds zAttr._get_isIdcCs\|j}|j}|dks|dkr tS|j|}|dkr6tS|jrL|j|j|jS|j|jSdS)N) rOr_no_typerrrgetAttributeTypeNSrwgetAttributeTyper)r rurrr r r _get_schemaTypes zAttr._get_schemaType)rrrrrr$rrOr) rorprq __slots__r ATTRIBUTE_NODErrrrrFrr.rrrWrrrpropertyrrrrrrrrrsrHrrr r r r rQs.   rrz True if this attribute is an ID.z'Namespace-local name of this attribute. schemaTypezSchema type for this attribute.c@seZdZd;ZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dz<%s %r>)r __class__ror)r r r r __repr__s  zTypeInfo.__repr__cCs|jS)N)r)r r r r rszTypeInfo._get_namecCs|jS)N)r)r r r r _get_namespaceszTypeInfo._get_namespaceN)rr)rorprqrrrrrr r r r rys rc @s eZdZdDZejZd ZeZ dZ ejej ej ej ejejfZed d fddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Z d+d,Z!e!Z"d-d.Z#d/d0Z$d1d2Z%d3d4Z&d5d6Z'dEd8d9Z(d:d;Z)dd?Z+d@dAZ,dBdCZ-d S)FElementrOr3rrrsrrrr$rrr<r=NrcCsHd|_d|_||_|_||_||_t|_d|_|_ d|_ d|_ dS)N) rOr3rrrsrrrkr$r<r=rr)r rrrrsrwr r r rs  zElement.__init__cCs|jdkri|_i|_dS)N)rr)r r r r _ensure_attributess zElement._ensure_attributesc Cs.y|jStk r(|jjdddSXdS)Nrr(r))rr\rr)r r r r rWszElement._get_localNamecCs|jS)N)r)r r r r _get_tagNameszElement._get_tagNamecCsD|jdk r*xt|jjD] }|jqWd|_d|_tj|dS)N)rrerrHrr )r attrr r r rHs   zElement.unlinkc Cs4|jdkrdSy |j|jStk r.dSXdS)Nr)rrr])r rr r r getAttributes   zElement.getAttributec Cs8|jdkrdSy|j||fjStk r2dSXdS)Nr)rrr])r rrrwr r r getAttributeNSs  zElement.getAttributeNScCsV|j|}|dkr4t|}||_|j|_|j|n||jkrR||_|jrRt|dS)N)getAttributeNoderrrOsetAttributeNoderr:)r rrrr r r setAttributes   zElement.setAttributecCst|\}}|j||}|dkrHt||||}||_|j|_|j|n4||jkrf||_|jrft||j|kr|||_||_ dS)N) _nssplitgetAttributeNodeNSrrrOrrr:rsr)r rr qualifiedNamerrs localnamerr r r setAttributeNSs     zElement.setAttributeNScCs|jdkrdS|jj|S)N)rr)r Zattrnamer r r rs zElement.getAttributeNodecCs|jdkrdS|jj||fS)N)rr)r rrrwr r r rs zElement.getAttributeNodeNScCs|jd|fkrtjjd|j|jj|jd}|dk rD|j||j j|j |j fd}|dk rt||k rt|j|t ||||k r|S||k r|SdS)Nzattribute node already owned) rr/r0ZInuseAttributeErrrrrrremoveAttributeNoderrrrw_set_attribute_node)r rZold1Zold2r r r rs    zElement.setAttributeNodec CsP|jdkrtjjy|j|}Wntk r@tjjYnX|j|dS)N)rr/r0r8rr]r)r rrr r r removeAttributes  zElement.removeAttributec CsT|jdkrtjjy|j||f}Wntk rDtjjYnX|j|dS)N)rr/r0r8r]r)r rrrwrr r r removeAttributeNS s  zElement.removeAttributeNSc Cs^|dkrtjjy|j|jWntk r@tjjYnXt||j|j|_dS)N) r/r0r8rrr]r:rHrO)r rAr r r r)s zElement.removeAttributeNodecCs|jdkrdS||jkS)NF)r)r rr r r hasAttribute8s zElement.hasAttributecCs|jdkrdS||f|jkS)NF)r)r rrrwr r r hasAttributeNS=s zElement.hasAttributeNScCst||tS)N)rrk)r rr r r getElementsByTagNameBszElement.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r getElementsByTagNameNSEszElement.getElementsByTagNameNScCsd|jt|fS)Nz)rr)r r r r rIszElement.__repr__rc Cs|j|d|j|j}t|j}x4|D],}|jd|t|||j|jdq.W|jr|jdt|jdkr|jdj t j kr|jdj |dddn8|j|x"|jD]}|j |||||qW|j||jd|j|fn|jd |dS) Nryz %s="rzr{r(rrz%sz/>%s) r}r_get_attributessortedrr~rr$rrr rFr) r r"r addindentr!rZa_namesZa_namerAr r r rLs$      zElement.writexmlcCs|jt|j|j|S)N)rrrr)r r r r rgszElement._get_attributescCs|jr dSdSdS)NTF)r)r r r r hasAttributeskszElement.hasAttributescCs|j|}|j|dS)N)rsetIdAttributeNode)r ridAttrr r r setIdAttributess zElement.setIdAttributecCs|j||}|j|dS)N)rr)r rrrwrr r r setIdAttributeNSws zElement.setIdAttributeNScCsl|dks|j|j r tjjt|dk r6tjj|jshd|_|jd7_|j j d7_ t |dS)NTr() rYrr/r0r8_get_containing_entrefNoModificationAllowedErrrrrOrr:)r rr r r r{s   zElement.setIdAttributeNode) rOr3rrrsrrrr$rrr<r=)rrr).rorprqrr rJrrrrrrrrFrrr.rrrrWrrHrrrrrrrZsetAttributeNodeNSrrrZremoveAttributeNodeNSrrrrrrrrrrrr r r r rsT      rrz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCs8t||j||j|j<||j|j|jf<||_dS)N)r:rrrrrrrwr)elementrr r r rs  rc@sbeZdZfZdZeZdZdZddZ ddZ ddZ dd Z d d Z d d ZddZddZdS) ChildlessNcCsdS)Nr )r r r r r'szChildless._get_firstChildcCsdS)Nr )r r r r r*szChildless._get_lastChildcCstjj|jddS)Nz nodes cannot have children)r/r0r1r)r rAr r r r5szChildless.appendChildcCsdS)NFr )r r r r r%szChildless.hasChildNodescCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>r?r r r r-szChildless.insertBeforecCstjj|jddS)Nz nodes do not have children)r/r0r8r)r rCr r r r4szChildless.removeChildcCsdS)Nr )r r r r rKszChildless.normalizecCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>rCr r r rDszChildless.replaceChild)rorprqrrZ EmptyNodeListr$rtrvr'r*r5r%r-r4rKrDr r r r rsrc@s\eZdZejZdZddZddZddZ e ee Z d d Z d d Z e e e ZdddZdS)ProcessingInstructiontargetrGcCs||_||_dS)N)rrG)r rrGr r r rszProcessingInstruction.__init__cCs|jS)N)rG)r r r r _get_nodeValuesz$ProcessingInstruction._get_nodeValuecCs ||_dS)N)rG)r rr r r _set_nodeValuesz$ProcessingInstruction._set_nodeValuecCs|jS)N)r)r r r r _get_nodeNamesz#ProcessingInstruction._get_nodeNamecCs ||_dS)N)r)r rr r r _set_nodeNamesz#ProcessingInstruction._set_nodeNamercCs|jd||j|j|fdS)Nz %s%s)r}rrG)r r"r rr!r r r rszProcessingInstruction.writexmlN)rrG)rrr)rorprqr rrrrrr rrr r rrr r r r rs  rc@sreZdZdZddZdd ZeZd d Zd d Ze eeZ Z ddZ ddZ ddZddZddZddZdS) CharacterData_datarOr3r=r<cCs,d|_|_d|_|_d|_tj|dS)Nr)rOr3r=r<r r r)r r r r rs  zCharacterData.__init__cCs t|jS)N)rrG)r r r r rszCharacterData._get_lengthcCs|jS)N)r )r r r r _get_dataszCharacterData._get_datacCs ||_dS)N)r )r rGr r r _set_dataszCharacterData._set_datacCs6|j}t|dkrd}nd}d|jj|dd|fS)N z...rzr)rGrrro)r rGZ dotdotdotr r r rs  zCharacterData.__repr__cCsT|dkrtjjd|t|jkr.tjjd|dkrBtjjd|j|||S)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0 IndexSizeErrrrG)r offsetcountr r r substringDatas   zCharacterData.substringDatacCs|j||_dS)N)rG)r argr r r appendDataszCharacterData.appendDatacCsZ|dkrtjjd|t|jkr.tjjd|rVd|jd|||j|df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of dataz%s%s%s)r/r0rrrG)r rrr r r insertDatas  zCharacterData.insertDatacCsl|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rh|jd||j||d|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0rrrG)r rrr r r deleteData s   zCharacterData.deleteDatacCsr|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rnd|jd|||j||df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negativez%s%s%s)r/r0rrrG)r rrrr r r replaceDatas   zCharacterData.replaceDataN)r rOr3r=r<)rorprqrrrrrrrrGrrrrrrrr r r r r s    r zLength of the string data.c@sHeZdZfZejZdZdZddZ dddZ dd Z d d Z d d Z dS)rz#textNcCs|dks|t|jkr"tjjd|j}|j|d|_|j|_|j}|jr~||jj kr~|dkrp|jj |n|jj |||jd||_|S)Nrzillegal offset value) rrGr/r0rrrOr<r3r$r5r-)r rZnewTextnextr r r splitText+s zText.splitTextrcCst|d||j|fdS)Nz%s%s%s)r~rG)r r"r rr!r r r r:sz Text.writexmlcCs|jg}|j}x6|dk rD|jtjtjfkr@|jd|j|j}qPqW|j}x4|dk r|jtjtjfkr||j|j|j}qNPqNWdj |S)Nrr) rGr=rr rFrr;r<rIjoin)r rLrr r r _get_wholeText?s   zText._get_wholeTextcCs|j}|j}x6|dk rB|jtjtjfkr>|j}|j||}qPqW|j}|sX|j|x6|dk r|jtjtjfkr|j}|j||}qZPqZW|r||_|SdSdS)N) r3r=rr rFrr4r<rG)r Zcontentrrrr r r replaceWholeTextQs*     zText.replaceWholeTextcCsF|jjrdSt|}|dkr"dS|jj|}|dkr:dS|jSdS)NF)rGstrip_get_containing_elementrOrisElementContent)r rrr r r !_get_isWhitespaceInElementContentms  z&Text._get_isWhitespaceInElementContent)rrr)rorprqrr rFrrrrrrrr"r r r r r$s rZisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content.Z wholeTextz.The text of all logically-adjacent text nodes.cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr rJ)rAr@r r r r s    r cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr r)rAr@r r r rs    rc@s(eZdZejZdZddZdddZdS) Commentz#commentcCstj|||_dS)N)r rr )r rGr r r rs zComment.__init__rcCs,d|jkrtd|jd||j|fdS)Nz--z%'--' is not allowed in a comment nodez %s%s)rGr7r})r r"r rr!r r r rs zComment.writexmlN)rrr) rorprqr rrrrrr r r r r#sr#c@s$eZdZfZejZdZdddZdS) CDATASectionz#cdata-sectionrcCs,|jjddkrtd|jd|jdS)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rGfindr7r})r r"r rr!r r r rszCDATASection.writexmlN)rrr) rorprqrr rrrrr r r r r$sr$c@s|eZdZdZffddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZdS)ReadOnlySequentialNamedNodeMap_seqcCs ||_dS)N)r')r seqr r r rsz'ReadOnlySequentialNamedNodeMap.__init__cCs t|jS)N)rr')r r r r rsz&ReadOnlySequentialNamedNodeMap.__len__cCs t|jS)N)rr')r r r r rsz*ReadOnlySequentialNamedNodeMap._get_lengthcCs"x|jD]}|j|kr|SqWdS)N)r'r)r rrr r r rs  z+ReadOnlySequentialNamedNodeMap.getNamedItemcCs,x&|jD]}|j|kr|j|kr|SqWdS)N)r'rrrw)r rrrwrr r r rs z-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|tr|j|}n |j|}|dkr0t||S)N)rr,rrr])r Z name_or_tuplerAr r r rs    z*ReadOnlySequentialNamedNodeMap.__getitem__c Cs0|dkr dSy |j|Stk r*dSXdS)Nr)r'r)r r6r r r rs  z#ReadOnlySequentialNamedNodeMap.itemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rr r r rsz.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rrrwr r r rsz0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz+ReadOnlySequentialNamedNodeMap.setNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz-ReadOnlySequentialNamedNodeMap.setNamedItemNScCs|jgS)N)r')r r r r rsz+ReadOnlySequentialNamedNodeMap.__getstate__cCs|d|_dS)Nr)r')r rr r r rsz+ReadOnlySequentialNamedNodeMap.__setstate__N)r')rorprqrrrrrrrrrrrrrrr r r r r&s  r&z&Number of entries in the NamedNodeMap.c@s(eZdZd ZddZddZddZd S) IdentifiedpublicIdsystemIdcCs||_||_dS)N)r*r+)r r*r+r r r _identified_mixin_initsz!Identified._identified_mixin_initcCs|jS)N)r*)r r r r _get_publicIdszIdentified._get_publicIdcCs|jS)N)r+)r r r r _get_systemIdszIdentified._get_systemIdN)r*r+)rorprqrr,r-r.r r r r r)sr)c@sHeZdZejZdZdZdZdZ dZ ddZ ddZ ddZ d d d ZdS) DocumentTypeNcCs2t|_t|_|r&t|\}}||_|j|_dS)N)r&entities notationsrrr)r rrsrr r r rs  zDocumentType.__init__cCs|jS)N)internalSubset)r r r r _get_internalSubset sz DocumentType._get_internalSubsetcCs|jdkrtd}|j|_|j|_tjjj}|rg|j_ g|j _ x>|j j D]2}t |j|j |j }|j j j||j|||qJWxZ|jj D]N}t|j|j |j |j}|j|_|j|_|j|_|jj j||j|||qW|j||||SdSdS)N)rOr/rrr/r0UserDataHandler NODE_CLONEDr0r'r1Notationr*r+rIrjEntity notationNameactualEncodingrrU)r rPclonergrnotationeentityr r r rQs.  zDocumentType.cloneNodercCs|jd|j|j|jr8|jd||j||jfn|jrR|jd||jf|jdk r||jd|j|j|jd|jd|dS)Nz r r r r5PszEntity.appendChildcCstjjddS)Nz+cannot insert children below an entity node)r/r0r1)r r>r?r r r r-TszEntity.insertBeforecCstjjddS)Nz*cannot remove children from an entity node)r/r0r1)r rCr r r r4XszEntity.removeChildcCstjjddS)Nz)cannot replace children of an entity node)r/r0r1)r r>rCr r r rD\szEntity.replaceChild)rorprqrr Z ENTITY_NODErrr9rrUrr@rArBr5r-r4rDr r r r r78sr7c@seZdZejZdZddZdS)r6NcCs||_|j||dS)N)rr,)r rr*r+r r r rdszNotation.__init__)rorprqr rrrrr r r r r6`sr6c @sHeZdZddddddddgZdd Zd d Zd d ZddZddZdS)DOMImplementationcore1.02.0Nr/ls-load3.0cCs|dkr d}|j|f|jkS)Nr)lower _features)r rTrUr r r rStszDOMImplementation.hasFeaturec Cs|r|jdk rtjjd|j}|dko8|dko8|dk }| rR|rRtjjd|rt|\}}|dkr~|dkr~tjjd|r| rtjjd|j||}|r|j ||j ||r||_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namer/z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) r3r/r0WrongDocumentErr_create_documentZInvalidCharacterErrrrcreateElementNSr5rOdoctyperR) r rrrrNruZadd_root_elementrsrrr r r createDocumentys4         z DOMImplementation.createDocumentcCst|}||_||_|S)N)r/r*r+)r rr*r+rNr r r createDocumentTypesz$DOMImplementation.createDocumentTypecCs|j|dr|SdSdS)N)rS)r rTr r r rZs zDOMImplementation.getInterfacecCstS)N)Document)r r r r rLsz"DOMImplementation._create_document)rDrE)rDrF)rDN)r/rE)r/rF)r/N)rGrH)rGN) rorprqrJrSrOrPrZrLr r r r rCis-rCc@sXeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ dS) ElementInforcCs ||_dS)N)r)r rr r r rszElementInfo.__init__cCstS)N)r)r anamer r r rszElementInfo.getAttributeTypecCstS)N)r)r rrrwr r r rszElementInfo.getAttributeTypeNScCsdS)NFr )r r r r r!szElementInfo.isElementContentcCsdS)NFr )r r r r isEmptyszElementInfo.isEmptycCsdS)NFr )r rSr r r rszElementInfo.isIdcCsdS)NFr )r rrrwr r r rszElementInfo.isIdNScCs|jS)N)r)r r r r rszElementInfo.__getstate__cCs ||_dS)N)r)r rr r r rszElementInfo.__setstate__N)r) rorprqrrrrr!rTrrrrr r r r rRs rRcCs<|jtjkr|jjd|_n|jr8|jjjd|j_dS)N)rr r _id_cacheclear_id_search_stackrO)rAr r r r:s    r:c@sreZdZdMZejejejejfZ e Z ej Z dZdZdZdZdZZdZdZdZdZdZdZdZd Zd d Zd d ZddZddZddZ ddZ!ddZ"ddZ#ddZ$ddZ%ddZ&d d!Z'd"d#Z(d$d%Z)d&d'Z*d(d)Z+d*d+Z,d,d-Z-d.d/Z.d0d1Z/d2d3Z0d4d5Z1d6d7Z2d8d9Z3d:d;Z4dd?Z6d@dAZ7dBdCZ8dDdEZ9dFdGZ:dNdIdJZ;dKdLZ|jj||jtj kr^|j r^tjjdtj ||S)Nz%s cannot be child of %sz two document elements disallowed) rr.r/r0r1r2r3r4r rJ_get_documentElementr5)r rAr r r r5-s    zDocument.appendChildc CsVy|jj|Wntk r.tjjYnXd|_|_d|_|j |krRd|_ |S)N) r$rEr7r/r0r8r<r=r3documentElement)r rCr r r r4=s  zDocument.removeChildcCs$x|jD]}|jtjkr|SqWdS)N)r$rr rJ)r rAr r r rbIs  zDocument._get_documentElementcCs(|jdk r|jjd|_tj|dS)N)rNrHr )r r r r rHNs  zDocument.unlinkcCs|sdS|jjddd}|j|_|j|_|j|_xL|jD]B}t|||}|jj||jt j krbn|jt j krt||_ ||_ q8W|jtjjj|||S)N)rRrOrr^rUr$rNrIrr rr?rNr3rjr/r0r4r5)r rPr:rZ childcloner r r rQTs"       zDocument.cloneNodecCst}||_|S)N)rrO)r rbr r r createDocumentFragmentiszDocument.createDocumentFragmentcCst|}||_|S)N)rrO)r rr<r r r createElementnszDocument.createElementcCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrrrGrO)r rGtr r r createTextNodess  zDocument.createTextNodecCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrr$rGrO)r rGr@r r r createCDATASection{s  zDocument.createCDATASectioncCst|}||_|S)N)r#rO)r rGr@r r r createCommentszDocument.createCommentcCst||}||_|S)N)rrO)r rrGpr r r createProcessingInstructions z$Document.createProcessingInstructioncCst|}||_d|_|S)Nr)rrOr)r rar r r createAttributeszDocument.createAttributecCs"t|\}}t|||}||_|S)N)rrrO)r rrrrsrwr<r r r rMs  zDocument.createElementNScCs*t|\}}t||||}||_d|_|S)Nr)rrrOr)r rrrrsrwrlr r r createAttributeNSs  zDocument.createAttributeNScCst||||}||_|S)N)r7rO)r rr*r+r8r<r r r _create_entityszDocument._create_entitycCst|||}||_|S)N)r6rO)r rr*r+rr r r _create_notations zDocument._create_notationcCs||jkr|j|S|jp|js$dS|j}|dkrB|jg}||_n|sJdSd}x>|r|j}|jdd|jD|j|}|r@x|j j D]}|j r|j |j |j r||j|j<|j|kr|}n|jsPq|j|jr ||j|j<|j|kr|}n |js:Pq|jr||j|j<|j|kr.|}q|jdkrPqWnB|jrx8|j j D]*}|jrT||j|j<|j|krT|}qTW|dk rRPqRW|S)NcSsg|]}|jtkr|qSr )rr9).0rMr r r sz+Document.getElementById..r()rUrXrrWrcpopextendr$rrrrrrrwrrrrr)r rstackresultrArrr r r getElementByIdsZ               zDocument.getElementByIdcCst||tS)N)rrk)r rr r r rszDocument.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r rszDocument.getElementsByTagNameNScCs|jj||S)N)rRrS)r rTrUr r r rVszDocument.isSupportedcCs>|jtjkrtjjdn|jtjkr2tjjdt|||S)Nzcannot import document nodesz!cannot import document type nodes)rr rr/r0NotSupportedErrr?rN)r rArPr r r importNodes    zDocument.importNodercCsN|dkr|jd|n|jd||fx|jD]}|j||||q2WdS)Nzz%%s)r}r$r)r r"r rr!rrAr r r rs   zDocument.writexmlcCsJ|j|k r tjjd||jf|jtjtjfkr>tjjd|t krd|kr|j dd\}}|dkr|tjj krtjj dq|dkr|tjj kr|jtjkrtjj dd}|}nd}d}|jtjkr|j }|dk r|j}|j|nd}||_||_||_||_|jtjkr||_n*||_|dk rF|j||rF|j||S)Nz?cannot rename nodes from other documents; expected %s, found %sz8renameNode() only applies to element and attribute nodesrr(rzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rOr/r0rKrr rJrrxrrrrrrrrsrrrrrrrr)r rrrrrsrwrZis_idr r r renameNodesR         zDocument.renameNode)rXrNrWr$rU)rrrN)=rorprqrr rJrrr?r.rCrRrrrrrr3r=r<r9rr^rUr`r\rZrrrr@rYr[rAr]r_rarBr5r4rbrHrQrdrergrhrirkrmrMrnrorprwrrrVryrrzr r r r rQsh    : rQrcz#Top-level element of this document.c Cs|jj|rtjjj}n tjjj}|jtj kr|j |j |j }x>|j jD]0}|j|j |j |j|j|j |j}|j|_qJW|rx$|jD]}t|||}|j|qWn|jtjkr|j}|rx$|jD]}t|||}|j|qWn|jtjkr |j|j}n|jtjkr*|j|j}n|jtjkrL|j|j |j}nr|jtj!krj|j"|j}nT|jtj#kr|j$|j |j }d|_|j|_n$|jtj%krtjjj}|j&j'|j(|j)|j*}||_|rg|j+_,g|j-_,xR|j-j,D]F} t.| j | j)| j*} || _|j-j,j/| t0| dr| j1|| | qWx|j+j,D]b} t2| j | j)| j*| j3} | j4| _4| j5| _5| j6| _6|| _|j+j,j/| t0| drB| j1|| | qBWntjj7dt8|t0|dr|j1||||S)NTrjzCannot clone node %s)9rOrYr/r0r4r5Z NODE_IMPORTEDrr rJrMrrrrrrrrrwrr$rNr5r+rdrFrgrGrrhrrkrrrirrnr?rRrPrr*r+r0r'r1r6rIrdrjr7r8r9rrUrxr2) rArPZnewOwnerDocumentrgr:rrlrMr@rr;r<r=r r r rN<s|                rNcCs,|jdd}t|dkr|Sd|dfSdS)Nrr(r)rr)rZfieldsr r r rs  rcCs,|||}|j\}}|j||j|S)N)ZgetEventZ expandNoderV)funcargskwargsZeventsZtoktypeZrootNoder r r _do_pulldom_parses    rcCsJ|dkr$| r$ddlm}|j|Sddlm}t|j|f||dSdS)Nr) expatbuilder)pulldom)parserbufsize)xml.domrparserr)filerrrrr r r rs     rcCsB|dkrddlm}|j|Sddlm}t|j|fd|iSdS)Nr)r)rr)rr parseStringrr)stringrrrr r r rs     rcCsB|rs v  z$ x )GU  ><( O*PR PKi#].o\\/dom/__pycache__/NodeFilter.cpython-36.opt-2.pycnu[3 \@sGdddZdS)c@sTeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZddZdS) NodeFilterl @iiicCstdS)N)NotImplementedError)selfZnoder*/usr/lib64/python3.6/xml/dom/NodeFilter.py acceptNodeszNodeFilter.acceptNodeN)__name__ __module__ __qualname__Z FILTER_ACCEPTZ FILTER_REJECTZ FILTER_SKIPZSHOW_ALLZ SHOW_ELEMENTZSHOW_ATTRIBUTEZ SHOW_TEXTZSHOW_CDATA_SECTIONZSHOW_ENTITY_REFERENCEZ SHOW_ENTITYZSHOW_PROCESSING_INSTRUCTIONZ SHOW_COMMENTZ SHOW_DOCUMENTZSHOW_DOCUMENT_TYPEZSHOW_DOCUMENT_FRAGMENTZ SHOW_NOTATIONrrrrrrs"rN)rrrrrsPKi#]㣓&dom/__pycache__/minidom.cpython-36.pycnu[3 ie@sdZddlZddlZddlmZmZmZmZddlTddl m Z m Z ej j jej j jfZGdddej j Z ee dd d ee d d d ee d dd ddZddZddZddZGddde ZGddde Zeeddd eed dd eeddd Gd d!d!eZeed"d#d eZGd$d%d%eZeddZGd&d'd'e Zeed(d)d eed d*d d+d,ZGd-d.d.ZGd/d0d0ee Z Gd1d2d2ee Z!ee!d"d3d Gd4d5d5e!Z"ee"d6d7d ee"d8d9d d:d;Z#dd?d?e!Z%Gd@dAdAe"Z&GdBdCdCeZ'ee'd"dDd GdEdFdFZ(GdGdHdHe(ee Z)GdIdJdJe(e Z*GdKdLdLe(ee Z+GdMdNdNe Z,GdOdPdPeZ-dQdRZ.GdSdTdTe e Z/ee/dUdVd dWdXZ0dYdZZ1d[d\Z2dcd]d^Z3ddd_d`Z4dedadbZ5dS)facSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSc@seZdZdZdZdZdZdZeZ ddZ d2ddZ d3dd Z d d Z d d ZddZddZddZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Z dS)4NodeNcCsdS)NT)selfr r '/usr/lib64/python3.6/xml/dom/minidom.py__bool__+sz Node.__bool__cCs|jdd|S)N) toprettyxml)r encodingr r r toxml.sz Node.toxml  cCsx|dkrtj}ntjtj|ddd}|jtjkrH|j|d|||n|j|d|||dkrh|jS|j jSdS)Nxmlcharrefreplacer)rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)r indentnewlrwriterr r r r1s   zNode.toprettyxmlcCs t|jS)N)bool childNodes)r r r r hasChildNodesCszNode.hasChildNodescCs|jS)N)r$)r r r r _get_childNodesFszNode._get_childNodescCs|jr|jdSdS)Nr)r$)r r r r _get_firstChildIszNode._get_firstChildcCs|jr|jdSdS)N)r$)r r r r _get_lastChildMszNode._get_lastChildc Cs|j|jkr0xt|jD]}|j||qW|S|j|jkrXtjjdt |t |f|j dk rn|j j ||dkr|j |ny|jj |}Wntk rtjjYnX|jtkrt||jj||||_||_|r|j|d}||_||_nd|_||_ |S)Nz%s cannot be child of %sr()rDOCUMENT_FRAGMENT_NODEtupler$ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)r newChildrefChildcr6noder r r r-Qs6      zNode.insertBeforecCs|j|jkr.xt|jD]}|j|qW|S|j|jkrXtjjdt |t |fn|jt krjt ||j dk r|j j |t||d|_|S)Nz%s cannot be child of %s)rr+r,r$r5r.r/r0r1r2r9r:r3r4 _append_childr<)r rAr@r r r r5qs      zNode.appendChildc Cs|j|jkr(|j}|j||j||S|j|jkrPtjjdt |t |f||kr\dS|j dk rr|j j|y|j j |}Wnt k rtjjYnX||j |<||_ d|_ |jtks|jtkrt||j|_|j|_d|_d|_|jr||j_|jr||j_|S)Nz%s cannot be child of %s)rr+r<r4r-r.r/r0r1r2r3r$r6r7r8r9r:r=)r r>oldChildr?r6r r r replaceChilds<         zNode.replaceChildc Csy|jj|Wntk r.tjjYnX|jdk rD|j|j_|jdk rX|j|j_d|_|_|jt krvt |d|_ |S)N) r$remover7r/r0r8r<r=rr9r:r3)r rCr r r r4s      zNode.removeChildcCsg}x|jD]}|jtjkr|jsL|r2|j|d_|jrB|j|j_|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_|jq|j|q |j||jtj kr |j q W||jdd<dS)Nr(r)r)r)) r$rr TEXT_NODEdatar<r=unlinkappend ELEMENT_NODE normalize)r LchildrAr r r rKs*          zNode.normalizecCst|||jp|S)N) _clone_node ownerDocument)r deepr r r cloneNodeszNode.cloneNodecCs|jjj||S)N)rOimplementation hasFeature)r featureversionr r r isSupportedszNode.isSupportedcCsdS)Nr )r r r r _get_localNameszNode._get_localNamecCs||kS)Nr )r otherr r r isSameNodeszNode.isSameNodecCs|j|dr|SdSdS)N)rV)r rTr r r getInterfaces zNode.getInterfacec Cs,y|j|dSttfk r&dSXdS)Nr) _user_dataAttributeErrorKeyError)r keyr r r getUserDataszNode.getUserDatac Csnd}y |j}Wntk r,i}||_YnX||krB||d}|dkr^d}|dk rj||=n ||f||<|S)Nr)r[r\)r r^rGhandlerolddr r r setUserDatas    zNode.setUserDatacCsHt|drDx8t|jjD]&\}\}}|dk r|j|||||qWdS)Nr[)hasattrlistr[itemsZhandle)r operationsrcdstr^rGr`r r r _call_user_data_handlers zNode._call_user_data_handlercCsBd|_|_|jr2x|jD] }|jqWt|_d|_d|_dS)N)r3rOr$rHNodeListr=r<)r rMr r r rHs   z Node.unlinkcCs|S)Nr )r r r r __enter__szNode.__enter__cCs |jdS)N)rH)r ZetZevtbr r r __exit__sz Node.__exit__)N)rrN)!__name__ __module__ __qualname__ namespaceURIr3rOr<r=rprefixr rrr%r&r'r*r-r5rDr4rKrQrVrWrYrZr_rcrjrHrlrnr r r r r "s:      r firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cCs2|j}|r|d}||_||_|j|||_dS)Nr(r))r$r=r<rIr3)r rAr$Zlastr r r rBs rBcCs6|r2|jddjddjddjdd}|j|d S) zWrites datachars to writer.&z&z>N)replacewrite)r"rGr r r _write_data'sr~cCsHxB|jD]8}|jtjkr4|dks*|j|kr4|j|t|||qW|S)Nr)r$rr rJtagNamerI_get_elements_by_tagName_helper)parentnamercrAr r r r.s    rcCs\xV|jD]L}|jtjkr|dks*|j|krF|dks<|j|krF|j|t||||qW|S)Nr)r$rr rJrwrrrI"_get_elements_by_tagName_ns_helper)rZnsURIrwrrAr r r r6s   rc@sJeZdZejZdZdZdZdZ ej ej ej ej ejejejfZddZdS)DocumentFragmentz#document-fragmentNcCs t|_dS)N)rkr$)r r r r __init__MszDocumentFragment.__init__)rorprqr r+rnodeName nodeValue attributesr3rJrFCDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODEr.rr r r r r?src@seZdZd#ZejZd Zd Zd Z ej ej fZ e d d fd d Zd dZddZddZddZeeeZZddZddZeeeZZddZddZeeeZddZdd Zd!d"Zd S)$Attr_name_valuerr_prefixr$ _localNamerO ownerElementNFcCs8d|_d|_||_||_||_t|_|jjtdS)N) rrOrrrrrkr$rIText)r qNamerrrwrsr r r r[sz Attr.__init__c Cs.y|jStk r(|jjdddSXdS)N:r(r))rr\rsplit)r r r r rWiszAttr._get_localNamecCs|jS)N) specified)r r r r _get_specifiedoszAttr._get_specifiedcCs|jS)N)r)r r r r _get_namerszAttr._get_namecCs||_|jdk rt|jdS)N)rrr:)r valuer r r _set_nameus zAttr._set_namecCs|jS)N)r)r r r r _get_value|szAttr._get_valuecCs6||_||jd_|jdk r&t|j||jd_dS)Nr)rr$rGrr:)r rr r r _set_values    zAttr._set_valuecCs|jS)N)r)r r r r _get_prefixszAttr._get_prefixcCsd|j}|dkr&|r&|tkr&tjjd||_|dkr<|j}nd||jf}|jrZt|j||_ dS)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s) rrrr/r0 NamespaceErrrrwrr:r)r rsZnsuriZnewNamer r r _set_prefixs  zAttr._set_prefixcCsz|j}|dk rR|j|j=|j|j|jf=|jrRd|_|jd8_|jj d8_ x|j D] }|j qZW|j dd=dS)NFr() r_attrsr_attrsNSrrrw_is_id_magic_id_nodesrO_magic_id_countr$rH)r elemrMr r r rHs   z Attr.unlinkcCsf|jr dS|j}|j}|dks&|dkr*dS|j|}|dkr@dS|jrV|j|j|jS|j|jSdS)NTF) rrOr_get_elem_inforrisIdNSrwisIdr)r rurinfor r r _get_isIds zAttr._get_isIdcCs\|j}|j}|dks|dkr tS|j|}|dkr6tS|jrL|j|j|jS|j|jSdS)N) rOr_no_typerrrgetAttributeTypeNSrwgetAttributeTyper)r rurrr r r _get_schemaTypes zAttr._get_schemaType)rrrrrr$rrOr) rorprq __slots__r ATTRIBUTE_NODErrrrrFrr.rrrWrrrpropertyrrrrrrrrrsrHrrr r r r rQs.   rrz True if this attribute is an ID.z'Namespace-local name of this attribute. schemaTypezSchema type for this attribute.c@seZdZdZd NamedNodeMapaThe attribute list is a transient interface to the underlying dictionaries. Mutations here will change the underlying element's dictionary. Ordering is imposed artificially and does not reflect the order of attributes as found in an input document. rr _ownerElementcCs||_||_||_dS)N)rrr)r attrsZattrsNSrr r r rszNamedNodeMap.__init__cCs t|jS)N)lenr)r r r r _get_lengthszNamedNodeMap._get_lengthc Cs0y|t|jj|Stk r*dSXdS)N)rerkeys IndexError)r r6r r r itemszNamedNodeMap.itemcCs.g}x$|jjD]}|j|j|jfqW|S)N)rvaluesrIrr)r rLrAr r r rfszNamedNodeMap.itemscCs4g}x*|jjD]}|j|j|jf|jfqW|S)N)rrrIrrrwr)r rLrAr r r itemsNSszNamedNodeMap.itemsNScCs"t|tr||jkS||jkSdS)N) isinstancestrrr)r r^r r r __contains__s  zNamedNodeMap.__contains__cCs |jjS)N)rr)r r r r rszNamedNodeMap.keyscCs |jjS)N)rr)r r r r keysNSszNamedNodeMap.keysNScCs |jjS)N)rr)r r r r rszNamedNodeMap.valuesNcCs|jj||S)N)rget)r rrr r r rszNamedNodeMap.getcCs:|jt|ddkrdSt|t|kt|t|kSdS)Nrr)rgetattrid)r rXr r r _cmp szNamedNodeMap._cmpcCs|j|dkS)Nr)r)r rXr r r __eq__szNamedNodeMap.__eq__cCs|j|dkS)Nr)r)r rXr r r __ge__szNamedNodeMap.__ge__cCs|j|dkS)Nr)r)r rXr r r __gt__szNamedNodeMap.__gt__cCs|j|dkS)Nr)r)r rXr r r __le__szNamedNodeMap.__le__cCs|j|dkS)Nr)r)r rXr r r __lt__szNamedNodeMap.__lt__cCs"t|tr|j|S|j|SdS)N)rr,rr)r attname_or_tupler r r __getitem__s  zNamedNodeMap.__getitem__c Csvt|trRy|j|}Wn0tk rHt|}|jj|_|j|YnX||_n t|tsdt d|}|j|dS)Nz%value must be a string or Attr object) rrrr]rrrO setNamedItemr TypeError)r attnamerrAr r r __setitem__%s   zNamedNodeMap.__setitem__c Cs$y |j|Stk rdSXdS)N)rr])r rr r r getNamedItem4s zNamedNodeMap.getNamedItemc Cs(y|j||fStk r"dSXdS)N)rr])r rrrwr r r getNamedItemNS:szNamedNodeMap.getNamedItemNScCsX|j|}|dk rJt|j|j|j=|j|j|jf=t|drFd|_ |St j j dS)Nr) rr:rrrrrrrwrdrr/r0r8)r rnr r r removeNamedItem@s    zNamedNodeMap.removeNamedItemcCsZ|j||}|dk rLt|j|j|j|jf=|j|j=t|drHd|_ |St j j dS)Nr) rr:rrrrrwrrrdrr/r0r8)r rrrwrr r r removeNamedItemNSLs    zNamedNodeMap.removeNamedItemNScCstt|ts&tjjdt|t|f|jj|j}|r@|j ||j|j<||j |j |j f<|j |_t|j|S)Nz%s cannot be child of %s)rrr/r0r1r2rrrrHrrrrwrrr:)r rArar r r rXs   zNamedNodeMap.setNamedItemcCs |j|S)N)r)r rAr r r setNamedItemNSeszNamedNodeMap.setNamedItemNScCs||}t|j|jdS)N)r:rrH)r rrAr r r __delitem__hs zNamedNodeMap.__delitem__cCs|j|j|jfS)N)rrr)r r r r __getstate__mszNamedNodeMap.__getstate__cCs|\|_|_|_dS)N)rrr)r stater r r __setstate__pszNamedNodeMap.__setstate__)rrr)N)!rorprq__doc__rrrrrfrrrrrr__len__rrrrrrrrrrrrrrrrrr r r r rs<    rZlengthz$Number of nodes in the NamedNodeMap.c@s0eZdZd ZddZddZddZd d Zd S) TypeInfo namespacercCs||_||_dS)N)rr)r rrr r r r|szTypeInfo.__init__cCs2|jrd|jj|j|jfSd|jj|jfSdS)Nz<%s %r (from %r)>z<%s %r>)r __class__ror)r r r r __repr__s  zTypeInfo.__repr__cCs|jS)N)r)r r r r rszTypeInfo._get_namecCs|jS)N)r)r r r r _get_namespaceszTypeInfo._get_namespaceN)rr)rorprqrrrrrr r r r rys rc @s eZdZdDZejZd ZeZ dZ ejej ej ej ejejfZed d fddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Z d+d,Z!e!Z"d-d.Z#d/d0Z$d1d2Z%d3d4Z&d5d6Z'dEd8d9Z(d:d;Z)dd?Z+d@dAZ,dBdCZ-d S)FElementrOr3rrrsrrrr$rrr<r=NrcCsHd|_d|_||_|_||_||_t|_d|_|_ d|_ d|_ dS)N) rOr3rrrsrrrkr$r<r=rr)r rrrrsrwr r r rs  zElement.__init__cCs|jdkri|_i|_dS)N)rr)r r r r _ensure_attributess zElement._ensure_attributesc Cs.y|jStk r(|jjdddSXdS)Nrr(r))rr\rr)r r r r rWszElement._get_localNamecCs|jS)N)r)r r r r _get_tagNameszElement._get_tagNamecCsD|jdk r*xt|jjD] }|jqWd|_d|_tj|dS)N)rrerrHrr )r attrr r r rHs   zElement.unlinkc Cs4|jdkrdSy |j|jStk r.dSXdS)Nr)rrr])r rr r r getAttributes   zElement.getAttributec Cs8|jdkrdSy|j||fjStk r2dSXdS)Nr)rrr])r rrrwr r r getAttributeNSs  zElement.getAttributeNScCsV|j|}|dkr4t|}||_|j|_|j|n||jkrR||_|jrRt|dS)N)getAttributeNoderrrOsetAttributeNoderr:)r rrrr r r setAttributes   zElement.setAttributecCst|\}}|j||}|dkrHt||||}||_|j|_|j|n4||jkrf||_|jrft||j|kr|||_||_ dS)N) _nssplitgetAttributeNodeNSrrrOrrr:rsr)r rr qualifiedNamerrs localnamerr r r setAttributeNSs     zElement.setAttributeNScCs|jdkrdS|jj|S)N)rr)r Zattrnamer r r rs zElement.getAttributeNodecCs|jdkrdS|jj||fS)N)rr)r rrrwr r r rs zElement.getAttributeNodeNScCs|jd|fkrtjjd|j|jj|jd}|dk rD|j||j j|j |j fd}|dk rt||k rt|j|t ||||k r|S||k r|SdS)Nzattribute node already owned) rr/r0ZInuseAttributeErrrrrrremoveAttributeNoderrrrw_set_attribute_node)r rZold1Zold2r r r rs    zElement.setAttributeNodec CsP|jdkrtjjy|j|}Wntk r@tjjYnX|j|dS)N)rr/r0r8rr]r)r rrr r r removeAttributes  zElement.removeAttributec CsT|jdkrtjjy|j||f}Wntk rDtjjYnX|j|dS)N)rr/r0r8r]r)r rrrwrr r r removeAttributeNS s  zElement.removeAttributeNSc Cs^|dkrtjjy|j|jWntk r@tjjYnXt||j|j|_dS)N) r/r0r8rrr]r:rHrO)r rAr r r r)s zElement.removeAttributeNodecCs|jdkrdS||jkS)NF)r)r rr r r hasAttribute8s zElement.hasAttributecCs|jdkrdS||f|jkS)NF)r)r rrrwr r r hasAttributeNS=s zElement.hasAttributeNScCst||tS)N)rrk)r rr r r getElementsByTagNameBszElement.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r getElementsByTagNameNSEszElement.getElementsByTagNameNScCsd|jt|fS)Nz)rr)r r r r rIszElement.__repr__rc Cs|j|d|j|j}t|j}x4|D],}|jd|t|||j|jdq.W|jr|jdt|jdkr|jdj t j kr|jdj |dddn8|j|x"|jD]}|j |||||qW|j||jd|j|fn|jd |dS) Nryz %s="rzr{r(rrz%sz/>%s) r}r_get_attributessortedrr~rr$rrr rFr) r r"r addindentr!rZa_namesZa_namerAr r r rLs$      zElement.writexmlcCs|jt|j|j|S)N)rrrr)r r r r rgszElement._get_attributescCs|jr dSdSdS)NTF)r)r r r r hasAttributeskszElement.hasAttributescCs|j|}|j|dS)N)rsetIdAttributeNode)r ridAttrr r r setIdAttributess zElement.setIdAttributecCs|j||}|j|dS)N)rr)r rrrwrr r r setIdAttributeNSws zElement.setIdAttributeNScCsl|dks|j|j r tjjt|dk r6tjj|jshd|_|jd7_|j j d7_ t |dS)NTr() rYrr/r0r8_get_containing_entrefNoModificationAllowedErrrrrOrr:)r rr r r r{s   zElement.setIdAttributeNode) rOr3rrrsrrrr$rrr<r=)rrr).rorprqrr rJrrrrrrrrFrrr.rrrrWrrHrrrrrrrZsetAttributeNodeNSrrrZremoveAttributeNodeNSrrrrrrrrrrrr r r r rsT      rrz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCs8t||j||j|j<||j|j|jf<||_dS)N)r:rrrrrrrwr)elementrr r r rs  rc@sfeZdZdZfZdZeZdZdZ ddZ ddZ ddZ d d Z d d Zd dZddZddZdS) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. NcCsdS)Nr )r r r r r'szChildless._get_firstChildcCsdS)Nr )r r r r r*szChildless._get_lastChildcCstjj|jddS)Nz nodes cannot have children)r/r0r1r)r rAr r r r5szChildless.appendChildcCsdS)NFr )r r r r r%szChildless.hasChildNodescCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>r?r r r r-szChildless.insertBeforecCstjj|jddS)Nz nodes do not have children)r/r0r8r)r rCr r r r4szChildless.removeChildcCsdS)Nr )r r r r rKszChildless.normalizecCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>rCr r r rDszChildless.replaceChild)rorprqrrrZ EmptyNodeListr$rtrvr'r*r5r%r-r4rKrDr r r r rsrc@s\eZdZejZdZddZddZddZ e ee Z d d Z d d Z e e e ZdddZdS)ProcessingInstructiontargetrGcCs||_||_dS)N)rrG)r rrGr r r rszProcessingInstruction.__init__cCs|jS)N)rG)r r r r _get_nodeValuesz$ProcessingInstruction._get_nodeValuecCs ||_dS)N)rG)r rr r r _set_nodeValuesz$ProcessingInstruction._set_nodeValuecCs|jS)N)r)r r r r _get_nodeNamesz#ProcessingInstruction._get_nodeNamecCs ||_dS)N)r)r rr r r _set_nodeNamesz#ProcessingInstruction._set_nodeNamercCs|jd||j|j|fdS)Nz %s%s)r}rrG)r r"r rr!r r r rszProcessingInstruction.writexmlN)rrG)rrr)rorprqr rrrrr r rrr r rrr r r r rs  rc@sreZdZdZddZdd ZeZd d Zd d Ze eeZ Z ddZ ddZ ddZddZddZddZdS) CharacterData_datarOr3r=r<cCs,d|_|_d|_|_d|_tj|dS)Nr)rOr3r=r<rr r)r r r r rs  zCharacterData.__init__cCs t|jS)N)rrG)r r r r rszCharacterData._get_lengthcCs|jS)N)r)r r r r _get_dataszCharacterData._get_datacCs ||_dS)N)r)r rGr r r _set_dataszCharacterData._set_datacCs6|j}t|dkrd}nd}d|jj|dd|fS)N z...rzr)rGrrro)r rGZ dotdotdotr r r rs  zCharacterData.__repr__cCsT|dkrtjjd|t|jkr.tjjd|dkrBtjjd|j|||S)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0 IndexSizeErrrrG)r offsetcountr r r substringDatas   zCharacterData.substringDatacCs|j||_dS)N)rG)r argr r r appendDataszCharacterData.appendDatacCsZ|dkrtjjd|t|jkr.tjjd|rVd|jd|||j|df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of dataz%s%s%s)r/r0rrrG)r rrr r r insertDatas  zCharacterData.insertDatacCsl|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rh|jd||j||d|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0rrrG)r rrr r r deleteData s   zCharacterData.deleteDatacCsr|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rnd|jd|||j||df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negativez%s%s%s)r/r0rrrG)r rrrr r r replaceDatas   zCharacterData.replaceDataN)rrOr3r=r<)rorprqrrrrrrrrGrrrrrrrr r r r r s    r zLength of the string data.c@sHeZdZfZejZdZdZddZ dddZ dd Z d d Z d d Z dS)rz#textNcCs|dks|t|jkr"tjjd|j}|j|d|_|j|_|j}|jr~||jj kr~|dkrp|jj |n|jj |||jd||_|S)Nrzillegal offset value) rrGr/r0rrrOr<r3r$r5r-)r rZnewTextnextr r r splitText+s zText.splitTextrcCst|d||j|fdS)Nz%s%s%s)r~rG)r r"r rr!r r r r:sz Text.writexmlcCs|jg}|j}x6|dk rD|jtjtjfkr@|jd|j|j}qPqW|j}x4|dk r|jtjtjfkr||j|j|j}qNPqNWdj |S)Nrr) rGr=rr rFrr;r<rIjoin)r rLrr r r _get_wholeText?s   zText._get_wholeTextcCs|j}|j}x6|dk rB|jtjtjfkr>|j}|j||}qPqW|j}|sX|j|x6|dk r|jtjtjfkr|j}|j||}qZPqZW|r||_|SdSdS)N) r3r=rr rFrr4r<rG)r Zcontentrrrr r r replaceWholeTextQs*     zText.replaceWholeTextcCsF|jjrdSt|}|dkr"dS|jj|}|dkr:dS|jSdS)NF)rGstrip_get_containing_elementrOrisElementContent)r rrr r r !_get_isWhitespaceInElementContentms  z&Text._get_isWhitespaceInElementContent)rrr)rorprqrr rFrrrrrrrr#r r r r r$s rZisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content.Z wholeTextz.The text of all logically-adjacent text nodes.cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr rJ)rAr@r r r r!s    r!cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr r)rAr@r r r rs    rc@s(eZdZejZdZddZdddZdS) Commentz#commentcCstj|||_dS)N)r rr)r rGr r r rs zComment.__init__rcCs,d|jkrtd|jd||j|fdS)Nz--z%'--' is not allowed in a comment nodez %s%s)rGr7r})r r"r rr!r r r rs zComment.writexmlN)rrr) rorprqr rrrrrr r r r r$sr$c@s$eZdZfZejZdZdddZdS) CDATASectionz#cdata-sectionrcCs,|jjddkrtd|jd|jdS)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rGfindr7r})r r"r rr!r r r rszCDATASection.writexmlN)rrr) rorprqrr rrrrr r r r r%sr%c@s|eZdZdZffddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZdS)ReadOnlySequentialNamedNodeMap_seqcCs ||_dS)N)r()r seqr r r rsz'ReadOnlySequentialNamedNodeMap.__init__cCs t|jS)N)rr()r r r r rsz&ReadOnlySequentialNamedNodeMap.__len__cCs t|jS)N)rr()r r r r rsz*ReadOnlySequentialNamedNodeMap._get_lengthcCs"x|jD]}|j|kr|SqWdS)N)r(r)r rrr r r rs  z+ReadOnlySequentialNamedNodeMap.getNamedItemcCs,x&|jD]}|j|kr|j|kr|SqWdS)N)r(rrrw)r rrrwrr r r rs z-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|tr|j|}n |j|}|dkr0t||S)N)rr,rrr])r Z name_or_tuplerAr r r rs    z*ReadOnlySequentialNamedNodeMap.__getitem__c Cs0|dkr dSy |j|Stk r*dSXdS)Nr)r(r)r r6r r r rs  z#ReadOnlySequentialNamedNodeMap.itemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rr r r rsz.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rrrwr r r rsz0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz+ReadOnlySequentialNamedNodeMap.setNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz-ReadOnlySequentialNamedNodeMap.setNamedItemNScCs|jgS)N)r()r r r r rsz+ReadOnlySequentialNamedNodeMap.__getstate__cCs|d|_dS)Nr)r()r rr r r rsz+ReadOnlySequentialNamedNodeMap.__setstate__N)r()rorprqrrrrrrrrrrrrrrr r r r r's  r'z&Number of entries in the NamedNodeMap.c@s,eZdZdZd ZddZddZdd Zd S) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdcCs||_||_dS)N)r+r,)r r+r,r r r _identified_mixin_initsz!Identified._identified_mixin_initcCs|jS)N)r+)r r r r _get_publicIdszIdentified._get_publicIdcCs|jS)N)r,)r r r r _get_systemIdszIdentified._get_systemIdN)r+r,)rorprqrrr-r.r/r r r r r*s r*c@sHeZdZejZdZdZdZdZ dZ ddZ ddZ ddZ d d d ZdS) DocumentTypeNcCs2t|_t|_|r&t|\}}||_|j|_dS)N)r'entities notationsrrr)r rrsrr r r rs  zDocumentType.__init__cCs|jS)N)internalSubset)r r r r _get_internalSubset sz DocumentType._get_internalSubsetcCs|jdkrtd}|j|_|j|_tjjj}|rg|j_ g|j _ x>|j j D]2}t |j|j |j }|j j j||j|||qJWxZ|jj D]N}t|j|j |j |j}|j|_|j|_|j|_|jj j||j|||qW|j||||SdSdS)N)rOr0rrr/r0UserDataHandler NODE_CLONEDr1r(r2Notationr+r,rIrjEntity notationNameactualEncodingrrU)r rPclonergrnotationeentityr r r rQs.  zDocumentType.cloneNodercCs|jd|j|j|jr8|jd||j||jfn|jrR|jd||jf|jdk r||jd|j|j|jd|jd|dS)Nz r r r r5PszEntity.appendChildcCstjjddS)Nz+cannot insert children below an entity node)r/r0r1)r r>r?r r r r-TszEntity.insertBeforecCstjjddS)Nz*cannot remove children from an entity node)r/r0r1)r rCr r r r4XszEntity.removeChildcCstjjddS)Nz)cannot replace children of an entity node)r/r0r1)r r>rCr r r rD\szEntity.replaceChild)rorprqrr Z ENTITY_NODErrr:rrUrrArBrCr5r-r4rDr r r r r88sr8c@seZdZejZdZddZdS)r7NcCs||_|j||dS)N)rr-)r rr+r,r r r rdszNotation.__init__)rorprqr rrrrr r r r r7`sr7c @sHeZdZddddddddgZdd Zd d Zd d ZddZddZdS)DOMImplementationcore1.02.0Nr/ls-load3.0cCs|dkr d}|j|f|jkS)Nr)lower _features)r rTrUr r r rStszDOMImplementation.hasFeaturec Cs|r|jdk rtjjd|j}|dko8|dko8|dk }| rR|rRtjjd|rt|\}}|dkr~|dkr~tjjd|r| rtjjd|j||}|r|j ||j ||r||_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namer/z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) r3r/r0WrongDocumentErr_create_documentZInvalidCharacterErrrrcreateElementNSr5rOdoctyperR) r rrrrOruZadd_root_elementrsrrr r r createDocumentys4         z DOMImplementation.createDocumentcCst|}||_||_|S)N)r0r+r,)r rr+r,rOr r r createDocumentTypesz$DOMImplementation.createDocumentTypecCs|j|dr|SdSdS)N)rS)r rTr r r rZs zDOMImplementation.getInterfacecCstS)N)Document)r r r r rMsz"DOMImplementation._create_document)rErF)rErG)rEN)r/rF)r/rG)r/N)rHrI)rHN) rorprqrKrSrPrQrZrMr r r r rDis-rDc@s\eZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS) ElementInfozObject that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. rcCs ||_dS)N)r)r rr r r rszElementInfo.__init__cCstS)N)r)r anamer r r rszElementInfo.getAttributeTypecCstS)N)r)r rrrwr r r rszElementInfo.getAttributeTypeNScCsdS)NFr )r r r r r"szElementInfo.isElementContentcCsdS)zQReturns true iff this element is declared to have an EMPTY content model.Fr )r r r r isEmptyszElementInfo.isEmptycCsdS)z7Returns true iff the named attribute is a DTD-style ID.Fr )r rTr r r rszElementInfo.isIdcCsdS)zd?Z6d@dAZ7dBdCZ8dDdEZ9dFdGZ:dNdIdJZ;dKdLZ|jj||jtj kr^|j r^tjjdtj ||S)Nz%s cannot be child of %sz two document elements disallowed) rr.r/r0r1r2r3r4r rJ_get_documentElementr5)r rAr r r r5-s    zDocument.appendChildc CsVy|jj|Wntk r.tjjYnXd|_|_d|_|j |krRd|_ |S)N) r$rEr7r/r0r8r<r=r3documentElement)r rCr r r r4=s  zDocument.removeChildcCs$x|jD]}|jtjkr|SqWdS)N)r$rr rJ)r rAr r r rcIs  zDocument._get_documentElementcCs(|jdk r|jjd|_tj|dS)N)rOrHr )r r r r rHNs  zDocument.unlinkcCs|sdS|jjddd}|j|_|j|_|j|_xx|jD]n}t|||}|jj|sXt |jj ||j t j kr|jdkst n |j t jkr|jdkst ||_||_q8W|jtjjj|||S)N)rRrPrr_rUr$rNrOrYAssertionErrorrIrr rrdr@rOr3rjr/r0r5r6)r rPr;rZ childcloner r r rQTs&       zDocument.cloneNodecCst}||_|S)N)rrO)r rbr r r createDocumentFragmentiszDocument.createDocumentFragmentcCst|}||_|S)N)rrO)r rr=r r r createElementnszDocument.createElementcCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrrrGrO)r rGtr r r createTextNodess  zDocument.createTextNodecCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrr%rGrO)r rGr@r r r createCDATASection{s  zDocument.createCDATASectioncCst|}||_|S)N)r$rO)r rGr@r r r createCommentszDocument.createCommentcCst||}||_|S)N)rrO)r rrGpr r r createProcessingInstructions z$Document.createProcessingInstructioncCst|}||_d|_|S)Nr)rrOr)r rar r r createAttributeszDocument.createAttributecCs"t|\}}t|||}||_|S)N)rrrO)r rrrrsrwr=r r r rNs  zDocument.createElementNScCs*t|\}}t||||}||_d|_|S)Nr)rrrOr)r rrrrsrwrnr r r createAttributeNSs  zDocument.createAttributeNScCst||||}||_|S)N)r8rO)r rr+r,r9r=r r r _create_entityszDocument._create_entitycCst|||}||_|S)N)r7rO)r rr+r,rr r r _create_notations zDocument._create_notationcCs||jkr|j|S|jp|js$dS|j}|dkrB|jg}||_n|sJdSd}x>|r|j}|jdd|jD|j|}|r@x|j j D]}|j r|j |j |j r||j|j<|j|kr|}n|jsPq|j|jr ||j|j<|j|kr|}n |js:Pq|jr||j|j<|j|kr.|}q|jdkrPqWnB|jrx8|j j D]*}|jrT||j|j<|j|krT|}qTW|dk rRPqRW|S)NcSsg|]}|jtkr|qSr )rr9).0rMr r r sz+Document.getElementById..r()rVrYrrXrdpopextendr$rrrrrrrwrrrrr)r rstackresultrArrr r r getElementByIdsZ               zDocument.getElementByIdcCst||tS)N)rrk)r rr r r rszDocument.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r rszDocument.getElementsByTagNameNScCs|jj||S)N)rRrS)r rTrUr r r rVszDocument.isSupportedcCs>|jtjkrtjjdn|jtjkr2tjjdt|||S)Nzcannot import document nodesz!cannot import document type nodes)rr rr/r0NotSupportedErrr@rN)r rArPr r r importNodes    zDocument.importNodercCsN|dkr|jd|n|jd||fx|jD]}|j||||q2WdS)Nzz%%s)r}r$r)r r"r rr!rrAr r r rs   zDocument.writexmlcCsJ|j|k r tjjd||jf|jtjtjfkr>tjjd|t krd|kr|j dd\}}|dkr|tjj krtjj dq|dkr|tjj kr|jtjkrtjj dd}|}nd}d}|jtjkr|j }|dk r|j}|j|nd}||_||_||_||_|jtjkr||_n*||_|dk rF|j||rF|j||S)Nz?cannot rename nodes from other documents; expected %s, found %sz8renameNode() only applies to element and attribute nodesrr(rzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rOr/r0rLrr rJrrzrrrrrrrrsrrrrrrrr)r rrrrrsrwrZis_idr r r renameNodesR         zDocument.renameNode)rYrOrXr$rV)rrrN)=rorprqrr rJrrr@r.rDrRrrrrrr3r=r<r:rr_rUrar]r[rrrrArZr\rBr^r`rbrCr5r4rcrHrQrfrgrirjrkrmrorNrprqrrryrrrVr{rr|r r r r rRsh    : rRrdz#Top-level element of this document.c Cs|jj|rtjjj}n tjjj}|jtj kr|j |j |j }x>|j jD]0}|j|j |j |j|j|j |j}|j|_qJW|rx$|jD]}t|||}|j|qWn"|jtjkr|j}|rx$|jD]}t|||}|j|qWn|jtjkr |j|j}n|jtjkr*|j|j}n|jtjkrL|j|j |j}n|jtj!krj|j"|j}nd|jtj#kr|j$|j |j }d|_|j|_n4|jtj%kr|j|k st&tjjj}|j'j(|j)|j*|j+}||_|rg|j,_-g|j._-xR|j.j-D]F} t/| j | j*| j+} || _|j.j-j0| t1| dr| j2|| | qWx|j,j-D]b} t3| j | j*| j+| j4} | j5| _5| j6| _6| j7| _7|| _|j,j-j0| t1| drR| j2|| | qRWntjj8dt9|t1|dr|j2||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrjzCannot clone node %s):rOrYr/r0r5r6Z NODE_IMPORTEDrr rJrNrrrrrrrrrwrr$rNr5r+rfrFrirGrrjrrmrrrkrrpr@rerRrQrr+r,r1r(r2r7rIrdrjr8r9r:rrUrzr2) rArPZnewOwnerDocumentrgr;rrnrMr@rr<r=r>r r r rN<s~                rNcCs,|jdd}t|dkr|Sd|dfSdS)Nrr(r)rr)rZfieldsr r r rs  rcCs,|||}|j\}}|j||j|S)N)ZgetEventZ expandNoderW)funcargskwargsZeventsZtoktypeZrootNoder r r _do_pulldom_parses    rcCsJ|dkr$| r$ddlm}|j|Sddlm}t|j|f||dSdS)z3Parse a file into a DOM by filename or file object.Nr) expatbuilder)pulldom)parserbufsize)xml.domrparserr)filerrrrr r r rs     rcCsB|dkrddlm}|j|Sddlm}t|j|fd|iSdS)z&Parse a file into a DOM from a string.Nr)r)rr)rr parseStringrr)stringrrrr r r rs     rcCsB|rs v  z$ x )GU  ><( O*PR PKi#]--,dom/__pycache__/minidom.cpython-36.opt-1.pycnu[3 ie@sdZddlZddlZddlmZmZmZmZddlTddl m Z m Z ej j jej j jfZGdddej j Z ee dd d ee d d d ee d dd ddZddZddZddZGddde ZGddde Zeeddd eed dd eeddd Gd d!d!eZeed"d#d eZGd$d%d%eZeddZGd&d'd'e Zeed(d)d eed d*d d+d,ZGd-d.d.ZGd/d0d0ee Z Gd1d2d2ee Z!ee!d"d3d Gd4d5d5e!Z"ee"d6d7d ee"d8d9d d:d;Z#dd?d?e!Z%Gd@dAdAe"Z&GdBdCdCeZ'ee'd"dDd GdEdFdFZ(GdGdHdHe(ee Z)GdIdJdJe(e Z*GdKdLdLe(ee Z+GdMdNdNe Z,GdOdPdPeZ-dQdRZ.GdSdTdTe e Z/ee/dUdVd dWdXZ0dYdZZ1d[d\Z2dcd]d^Z3ddd_d`Z4dedadbZ5dS)facSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSc@seZdZdZdZdZdZdZeZ ddZ d2ddZ d3dd Z d d Z d d ZddZddZddZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Z dS)4NodeNcCsdS)NT)selfr r '/usr/lib64/python3.6/xml/dom/minidom.py__bool__+sz Node.__bool__cCs|jdd|S)N) toprettyxml)r encodingr r r toxml.sz Node.toxml  cCsx|dkrtj}ntjtj|ddd}|jtjkrH|j|d|||n|j|d|||dkrh|jS|j jSdS)Nxmlcharrefreplacer)rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)r indentnewlrwriterr r r r1s   zNode.toprettyxmlcCs t|jS)N)bool childNodes)r r r r hasChildNodesCszNode.hasChildNodescCs|jS)N)r$)r r r r _get_childNodesFszNode._get_childNodescCs|jr|jdSdS)Nr)r$)r r r r _get_firstChildIszNode._get_firstChildcCs|jr|jdSdS)N)r$)r r r r _get_lastChildMszNode._get_lastChildc Cs|j|jkr0xt|jD]}|j||qW|S|j|jkrXtjjdt |t |f|j dk rn|j j ||dkr|j |ny|jj |}Wntk rtjjYnX|jtkrt||jj||||_||_|r|j|d}||_||_nd|_||_ |S)Nz%s cannot be child of %sr()rDOCUMENT_FRAGMENT_NODEtupler$ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)r newChildrefChildcr6noder r r r-Qs6      zNode.insertBeforecCs|j|jkr.xt|jD]}|j|qW|S|j|jkrXtjjdt |t |fn|jt krjt ||j dk r|j j |t||d|_|S)Nz%s cannot be child of %s)rr+r,r$r5r.r/r0r1r2r9r:r3r4 _append_childr<)r rAr@r r r r5qs      zNode.appendChildc Cs|j|jkr(|j}|j||j||S|j|jkrPtjjdt |t |f||kr\dS|j dk rr|j j|y|j j |}Wnt k rtjjYnX||j |<||_ d|_ |jtks|jtkrt||j|_|j|_d|_d|_|jr||j_|jr||j_|S)Nz%s cannot be child of %s)rr+r<r4r-r.r/r0r1r2r3r$r6r7r8r9r:r=)r r>oldChildr?r6r r r replaceChilds<         zNode.replaceChildc Csy|jj|Wntk r.tjjYnX|jdk rD|j|j_|jdk rX|j|j_d|_|_|jt krvt |d|_ |S)N) r$remover7r/r0r8r<r=rr9r:r3)r rCr r r r4s      zNode.removeChildcCsg}x|jD]}|jtjkr|jsL|r2|j|d_|jrB|j|j_|jq|r|dj|jkr|d}|j|j|_|j|_|jr||j_|jq|j|q |j||jtj kr |j q W||jdd<dS)Nr(r)r)r)) r$rr TEXT_NODEdatar<r=unlinkappend ELEMENT_NODE normalize)r LchildrAr r r rKs*          zNode.normalizecCst|||jp|S)N) _clone_node ownerDocument)r deepr r r cloneNodeszNode.cloneNodecCs|jjj||S)N)rOimplementation hasFeature)r featureversionr r r isSupportedszNode.isSupportedcCsdS)Nr )r r r r _get_localNameszNode._get_localNamecCs||kS)Nr )r otherr r r isSameNodeszNode.isSameNodecCs|j|dr|SdSdS)N)rV)r rTr r r getInterfaces zNode.getInterfacec Cs,y|j|dSttfk r&dSXdS)Nr) _user_dataAttributeErrorKeyError)r keyr r r getUserDataszNode.getUserDatac Csnd}y |j}Wntk r,i}||_YnX||krB||d}|dkr^d}|dk rj||=n ||f||<|S)Nr)r[r\)r r^rGhandlerolddr r r setUserDatas    zNode.setUserDatacCsHt|drDx8t|jjD]&\}\}}|dk r|j|||||qWdS)Nr[)hasattrlistr[itemsZhandle)r operationsrcdstr^rGr`r r r _call_user_data_handlers zNode._call_user_data_handlercCsBd|_|_|jr2x|jD] }|jqWt|_d|_d|_dS)N)r3rOr$rHNodeListr=r<)r rMr r r rHs   z Node.unlinkcCs|S)Nr )r r r r __enter__szNode.__enter__cCs |jdS)N)rH)r ZetZevtbr r r __exit__sz Node.__exit__)N)rrN)!__name__ __module__ __qualname__ namespaceURIr3rOr<r=rprefixr rrr%r&r'r*r-r5rDr4rKrQrVrWrYrZr_rcrjrHrlrnr r r r r "s:      r firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cCs2|j}|r|d}||_||_|j|||_dS)Nr(r))r$r=r<rIr3)r rAr$Zlastr r r rBs rBcCs6|r2|jddjddjddjdd}|j|d S) zWrites datachars to writer.&z&z>N)replacewrite)r"rGr r r _write_data'sr~cCsHxB|jD]8}|jtjkr4|dks*|j|kr4|j|t|||qW|S)Nr)r$rr rJtagNamerI_get_elements_by_tagName_helper)parentnamercrAr r r r.s    rcCs\xV|jD]L}|jtjkr|dks*|j|krF|dks<|j|krF|j|t||||qW|S)Nr)r$rr rJrwrrrI"_get_elements_by_tagName_ns_helper)rZnsURIrwrrAr r r r6s   rc@sJeZdZejZdZdZdZdZ ej ej ej ej ejejejfZddZdS)DocumentFragmentz#document-fragmentNcCs t|_dS)N)rkr$)r r r r __init__MszDocumentFragment.__init__)rorprqr r+rnodeName nodeValue attributesr3rJrFCDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODEr.rr r r r r?src@seZdZd#ZejZd Zd Zd Z ej ej fZ e d d fd d Zd dZddZddZddZeeeZZddZddZeeeZZddZddZeeeZddZdd Zd!d"Zd S)$Attr_name_valuerr_prefixr$ _localNamerO ownerElementNFcCs8d|_d|_||_||_||_t|_|jjtdS)N) rrOrrrrrkr$rIText)r qNamerrrwrsr r r r[sz Attr.__init__c Cs.y|jStk r(|jjdddSXdS)N:r(r))rr\rsplit)r r r r rWiszAttr._get_localNamecCs|jS)N) specified)r r r r _get_specifiedoszAttr._get_specifiedcCs|jS)N)r)r r r r _get_namerszAttr._get_namecCs||_|jdk rt|jdS)N)rrr:)r valuer r r _set_nameus zAttr._set_namecCs|jS)N)r)r r r r _get_value|szAttr._get_valuecCs6||_||jd_|jdk r&t|j||jd_dS)Nr)rr$rGrr:)r rr r r _set_values    zAttr._set_valuecCs|jS)N)r)r r r r _get_prefixszAttr._get_prefixcCsd|j}|dkr&|r&|tkr&tjjd||_|dkr<|j}nd||jf}|jrZt|j||_ dS)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s) rrrr/r0 NamespaceErrrrwrr:r)r rsZnsuriZnewNamer r r _set_prefixs  zAttr._set_prefixcCsz|j}|dk rR|j|j=|j|j|jf=|jrRd|_|jd8_|jj d8_ x|j D] }|j qZW|j dd=dS)NFr() r_attrsr_attrsNSrrrw_is_id_magic_id_nodesrO_magic_id_countr$rH)r elemrMr r r rHs   z Attr.unlinkcCsf|jr dS|j}|j}|dks&|dkr*dS|j|}|dkr@dS|jrV|j|j|jS|j|jSdS)NTF) rrOr_get_elem_inforrisIdNSrwisIdr)r rurinfor r r _get_isIds zAttr._get_isIdcCs\|j}|j}|dks|dkr tS|j|}|dkr6tS|jrL|j|j|jS|j|jSdS)N) rOr_no_typerrrgetAttributeTypeNSrwgetAttributeTyper)r rurrr r r _get_schemaTypes zAttr._get_schemaType)rrrrrr$rrOr) rorprq __slots__r ATTRIBUTE_NODErrrrrFrr.rrrWrrrpropertyrrrrrrrrrsrHrrr r r r rQs.   rrz True if this attribute is an ID.z'Namespace-local name of this attribute. schemaTypezSchema type for this attribute.c@seZdZdZd NamedNodeMapaThe attribute list is a transient interface to the underlying dictionaries. Mutations here will change the underlying element's dictionary. Ordering is imposed artificially and does not reflect the order of attributes as found in an input document. rr _ownerElementcCs||_||_||_dS)N)rrr)r attrsZattrsNSrr r r rszNamedNodeMap.__init__cCs t|jS)N)lenr)r r r r _get_lengthszNamedNodeMap._get_lengthc Cs0y|t|jj|Stk r*dSXdS)N)rerkeys IndexError)r r6r r r itemszNamedNodeMap.itemcCs.g}x$|jjD]}|j|j|jfqW|S)N)rvaluesrIrr)r rLrAr r r rfszNamedNodeMap.itemscCs4g}x*|jjD]}|j|j|jf|jfqW|S)N)rrrIrrrwr)r rLrAr r r itemsNSszNamedNodeMap.itemsNScCs"t|tr||jkS||jkSdS)N) isinstancestrrr)r r^r r r __contains__s  zNamedNodeMap.__contains__cCs |jjS)N)rr)r r r r rszNamedNodeMap.keyscCs |jjS)N)rr)r r r r keysNSszNamedNodeMap.keysNScCs |jjS)N)rr)r r r r rszNamedNodeMap.valuesNcCs|jj||S)N)rget)r rrr r r rszNamedNodeMap.getcCs:|jt|ddkrdSt|t|kt|t|kSdS)Nrr)rgetattrid)r rXr r r _cmp szNamedNodeMap._cmpcCs|j|dkS)Nr)r)r rXr r r __eq__szNamedNodeMap.__eq__cCs|j|dkS)Nr)r)r rXr r r __ge__szNamedNodeMap.__ge__cCs|j|dkS)Nr)r)r rXr r r __gt__szNamedNodeMap.__gt__cCs|j|dkS)Nr)r)r rXr r r __le__szNamedNodeMap.__le__cCs|j|dkS)Nr)r)r rXr r r __lt__szNamedNodeMap.__lt__cCs"t|tr|j|S|j|SdS)N)rr,rr)r attname_or_tupler r r __getitem__s  zNamedNodeMap.__getitem__c Csvt|trRy|j|}Wn0tk rHt|}|jj|_|j|YnX||_n t|tsdt d|}|j|dS)Nz%value must be a string or Attr object) rrrr]rrrO setNamedItemr TypeError)r attnamerrAr r r __setitem__%s   zNamedNodeMap.__setitem__c Cs$y |j|Stk rdSXdS)N)rr])r rr r r getNamedItem4s zNamedNodeMap.getNamedItemc Cs(y|j||fStk r"dSXdS)N)rr])r rrrwr r r getNamedItemNS:szNamedNodeMap.getNamedItemNScCsX|j|}|dk rJt|j|j|j=|j|j|jf=t|drFd|_ |St j j dS)Nr) rr:rrrrrrrwrdrr/r0r8)r rnr r r removeNamedItem@s    zNamedNodeMap.removeNamedItemcCsZ|j||}|dk rLt|j|j|j|jf=|j|j=t|drHd|_ |St j j dS)Nr) rr:rrrrrwrrrdrr/r0r8)r rrrwrr r r removeNamedItemNSLs    zNamedNodeMap.removeNamedItemNScCstt|ts&tjjdt|t|f|jj|j}|r@|j ||j|j<||j |j |j f<|j |_t|j|S)Nz%s cannot be child of %s)rrr/r0r1r2rrrrHrrrrwrrr:)r rArar r r rXs   zNamedNodeMap.setNamedItemcCs |j|S)N)r)r rAr r r setNamedItemNSeszNamedNodeMap.setNamedItemNScCs||}t|j|jdS)N)r:rrH)r rrAr r r __delitem__hs zNamedNodeMap.__delitem__cCs|j|j|jfS)N)rrr)r r r r __getstate__mszNamedNodeMap.__getstate__cCs|\|_|_|_dS)N)rrr)r stater r r __setstate__pszNamedNodeMap.__setstate__)rrr)N)!rorprq__doc__rrrrrfrrrrrr__len__rrrrrrrrrrrrrrrrrr r r r rs<    rZlengthz$Number of nodes in the NamedNodeMap.c@s0eZdZd ZddZddZddZd d Zd S) TypeInfo namespacercCs||_||_dS)N)rr)r rrr r r r|szTypeInfo.__init__cCs2|jrd|jj|j|jfSd|jj|jfSdS)Nz<%s %r (from %r)>z<%s %r>)r __class__ror)r r r r __repr__s  zTypeInfo.__repr__cCs|jS)N)r)r r r r rszTypeInfo._get_namecCs|jS)N)r)r r r r _get_namespaceszTypeInfo._get_namespaceN)rr)rorprqrrrrrr r r r rys rc @s eZdZdDZejZd ZeZ dZ ejej ej ej ejejfZed d fddZddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZeZd'd(Zd)d*Z d+d,Z!e!Z"d-d.Z#d/d0Z$d1d2Z%d3d4Z&d5d6Z'dEd8d9Z(d:d;Z)dd?Z+d@dAZ,dBdCZ-d S)FElementrOr3rrrsrrrr$rrr<r=NrcCsHd|_d|_||_|_||_||_t|_d|_|_ d|_ d|_ dS)N) rOr3rrrsrrrkr$r<r=rr)r rrrrsrwr r r rs  zElement.__init__cCs|jdkri|_i|_dS)N)rr)r r r r _ensure_attributess zElement._ensure_attributesc Cs.y|jStk r(|jjdddSXdS)Nrr(r))rr\rr)r r r r rWszElement._get_localNamecCs|jS)N)r)r r r r _get_tagNameszElement._get_tagNamecCsD|jdk r*xt|jjD] }|jqWd|_d|_tj|dS)N)rrerrHrr )r attrr r r rHs   zElement.unlinkc Cs4|jdkrdSy |j|jStk r.dSXdS)Nr)rrr])r rr r r getAttributes   zElement.getAttributec Cs8|jdkrdSy|j||fjStk r2dSXdS)Nr)rrr])r rrrwr r r getAttributeNSs  zElement.getAttributeNScCsV|j|}|dkr4t|}||_|j|_|j|n||jkrR||_|jrRt|dS)N)getAttributeNoderrrOsetAttributeNoderr:)r rrrr r r setAttributes   zElement.setAttributecCst|\}}|j||}|dkrHt||||}||_|j|_|j|n4||jkrf||_|jrft||j|kr|||_||_ dS)N) _nssplitgetAttributeNodeNSrrrOrrr:rsr)r rr qualifiedNamerrs localnamerr r r setAttributeNSs     zElement.setAttributeNScCs|jdkrdS|jj|S)N)rr)r Zattrnamer r r rs zElement.getAttributeNodecCs|jdkrdS|jj||fS)N)rr)r rrrwr r r rs zElement.getAttributeNodeNScCs|jd|fkrtjjd|j|jj|jd}|dk rD|j||j j|j |j fd}|dk rt||k rt|j|t ||||k r|S||k r|SdS)Nzattribute node already owned) rr/r0ZInuseAttributeErrrrrrremoveAttributeNoderrrrw_set_attribute_node)r rZold1Zold2r r r rs    zElement.setAttributeNodec CsP|jdkrtjjy|j|}Wntk r@tjjYnX|j|dS)N)rr/r0r8rr]r)r rrr r r removeAttributes  zElement.removeAttributec CsT|jdkrtjjy|j||f}Wntk rDtjjYnX|j|dS)N)rr/r0r8r]r)r rrrwrr r r removeAttributeNS s  zElement.removeAttributeNSc Cs^|dkrtjjy|j|jWntk r@tjjYnXt||j|j|_dS)N) r/r0r8rrr]r:rHrO)r rAr r r r)s zElement.removeAttributeNodecCs|jdkrdS||jkS)NF)r)r rr r r hasAttribute8s zElement.hasAttributecCs|jdkrdS||f|jkS)NF)r)r rrrwr r r hasAttributeNS=s zElement.hasAttributeNScCst||tS)N)rrk)r rr r r getElementsByTagNameBszElement.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r getElementsByTagNameNSEszElement.getElementsByTagNameNScCsd|jt|fS)Nz)rr)r r r r rIszElement.__repr__rc Cs|j|d|j|j}t|j}x4|D],}|jd|t|||j|jdq.W|jr|jdt|jdkr|jdj t j kr|jdj |dddn8|j|x"|jD]}|j |||||qW|j||jd|j|fn|jd |dS) Nryz %s="rzr{r(rrz%sz/>%s) r}r_get_attributessortedrr~rr$rrr rFr) r r"r addindentr!rZa_namesZa_namerAr r r rLs$      zElement.writexmlcCs|jt|j|j|S)N)rrrr)r r r r rgszElement._get_attributescCs|jr dSdSdS)NTF)r)r r r r hasAttributeskszElement.hasAttributescCs|j|}|j|dS)N)rsetIdAttributeNode)r ridAttrr r r setIdAttributess zElement.setIdAttributecCs|j||}|j|dS)N)rr)r rrrwrr r r setIdAttributeNSws zElement.setIdAttributeNScCsl|dks|j|j r tjjt|dk r6tjj|jshd|_|jd7_|j j d7_ t |dS)NTr() rYrr/r0r8_get_containing_entrefNoModificationAllowedErrrrrOrr:)r rr r r r{s   zElement.setIdAttributeNode) rOr3rrrsrrrr$rrr<r=)rrr).rorprqrr rJrrrrrrrrFrrr.rrrrWrrHrrrrrrrZsetAttributeNodeNSrrrZremoveAttributeNodeNSrrrrrrrrrrrr r r r rsT      rrz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCs8t||j||j|j<||j|j|jf<||_dS)N)r:rrrrrrrwr)elementrr r r rs  rc@sfeZdZdZfZdZeZdZdZ ddZ ddZ ddZ d d Z d d Zd dZddZddZdS) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. NcCsdS)Nr )r r r r r'szChildless._get_firstChildcCsdS)Nr )r r r r r*szChildless._get_lastChildcCstjj|jddS)Nz nodes cannot have children)r/r0r1r)r rAr r r r5szChildless.appendChildcCsdS)NFr )r r r r r%szChildless.hasChildNodescCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>r?r r r r-szChildless.insertBeforecCstjj|jddS)Nz nodes do not have children)r/r0r8r)r rCr r r r4szChildless.removeChildcCsdS)Nr )r r r r rKszChildless.normalizecCstjj|jddS)Nz nodes do not have children)r/r0r1r)r r>rCr r r rDszChildless.replaceChild)rorprqrrrZ EmptyNodeListr$rtrvr'r*r5r%r-r4rKrDr r r r rsrc@s\eZdZejZdZddZddZddZ e ee Z d d Z d d Z e e e ZdddZdS)ProcessingInstructiontargetrGcCs||_||_dS)N)rrG)r rrGr r r rszProcessingInstruction.__init__cCs|jS)N)rG)r r r r _get_nodeValuesz$ProcessingInstruction._get_nodeValuecCs ||_dS)N)rG)r rr r r _set_nodeValuesz$ProcessingInstruction._set_nodeValuecCs|jS)N)r)r r r r _get_nodeNamesz#ProcessingInstruction._get_nodeNamecCs ||_dS)N)r)r rr r r _set_nodeNamesz#ProcessingInstruction._set_nodeNamercCs|jd||j|j|fdS)Nz %s%s)r}rrG)r r"r rr!r r r rszProcessingInstruction.writexmlN)rrG)rrr)rorprqr rrrrr r rrr r rrr r r r rs  rc@sreZdZdZddZdd ZeZd d Zd d Ze eeZ Z ddZ ddZ ddZddZddZddZdS) CharacterData_datarOr3r=r<cCs,d|_|_d|_|_d|_tj|dS)Nr)rOr3r=r<rr r)r r r r rs  zCharacterData.__init__cCs t|jS)N)rrG)r r r r rszCharacterData._get_lengthcCs|jS)N)r)r r r r _get_dataszCharacterData._get_datacCs ||_dS)N)r)r rGr r r _set_dataszCharacterData._set_datacCs6|j}t|dkrd}nd}d|jj|dd|fS)N z...rzr)rGrrro)r rGZ dotdotdotr r r rs  zCharacterData.__repr__cCsT|dkrtjjd|t|jkr.tjjd|dkrBtjjd|j|||S)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0 IndexSizeErrrrG)r offsetcountr r r substringDatas   zCharacterData.substringDatacCs|j||_dS)N)rG)r argr r r appendDataszCharacterData.appendDatacCsZ|dkrtjjd|t|jkr.tjjd|rVd|jd|||j|df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of dataz%s%s%s)r/r0rrrG)r rrr r r insertDatas  zCharacterData.insertDatacCsl|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rh|jd||j||d|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0rrrG)r rrr r r deleteData s   zCharacterData.deleteDatacCsr|dkrtjjd|t|jkr.tjjd|dkrBtjjd|rnd|jd|||j||df|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negativez%s%s%s)r/r0rrrG)r rrrr r r replaceDatas   zCharacterData.replaceDataN)rrOr3r=r<)rorprqrrrrrrrrGrrrrrrrr r r r r s    r zLength of the string data.c@sHeZdZfZejZdZdZddZ dddZ dd Z d d Z d d Z dS)rz#textNcCs|dks|t|jkr"tjjd|j}|j|d|_|j|_|j}|jr~||jj kr~|dkrp|jj |n|jj |||jd||_|S)Nrzillegal offset value) rrGr/r0rrrOr<r3r$r5r-)r rZnewTextnextr r r splitText+s zText.splitTextrcCst|d||j|fdS)Nz%s%s%s)r~rG)r r"r rr!r r r r:sz Text.writexmlcCs|jg}|j}x6|dk rD|jtjtjfkr@|jd|j|j}qPqW|j}x4|dk r|jtjtjfkr||j|j|j}qNPqNWdj |S)Nrr) rGr=rr rFrr;r<rIjoin)r rLrr r r _get_wholeText?s   zText._get_wholeTextcCs|j}|j}x6|dk rB|jtjtjfkr>|j}|j||}qPqW|j}|sX|j|x6|dk r|jtjtjfkr|j}|j||}qZPqZW|r||_|SdSdS)N) r3r=rr rFrr4r<rG)r Zcontentrrrr r r replaceWholeTextQs*     zText.replaceWholeTextcCsF|jjrdSt|}|dkr"dS|jj|}|dkr:dS|jSdS)NF)rGstrip_get_containing_elementrOrisElementContent)r rrr r r !_get_isWhitespaceInElementContentms  z&Text._get_isWhitespaceInElementContent)rrr)rorprqrr rFrrrrrrrr#r r r r r$s rZisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content.Z wholeTextz.The text of all logically-adjacent text nodes.cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr rJ)rAr@r r r r!s    r!cCs.|j}x"|dk r(|jtjkr |S|j}qWdS)N)r3rr r)rAr@r r r rs    rc@s(eZdZejZdZddZdddZdS) Commentz#commentcCstj|||_dS)N)r rr)r rGr r r rs zComment.__init__rcCs,d|jkrtd|jd||j|fdS)Nz--z%'--' is not allowed in a comment nodez %s%s)rGr7r})r r"r rr!r r r rs zComment.writexmlN)rrr) rorprqr rrrrrr r r r r$sr$c@s$eZdZfZejZdZdddZdS) CDATASectionz#cdata-sectionrcCs,|jjddkrtd|jd|jdS)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rGfindr7r})r r"r rr!r r r rszCDATASection.writexmlN)rrr) rorprqrr rrrrr r r r r%sr%c@s|eZdZdZffddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZdS)ReadOnlySequentialNamedNodeMap_seqcCs ||_dS)N)r()r seqr r r rsz'ReadOnlySequentialNamedNodeMap.__init__cCs t|jS)N)rr()r r r r rsz&ReadOnlySequentialNamedNodeMap.__len__cCs t|jS)N)rr()r r r r rsz*ReadOnlySequentialNamedNodeMap._get_lengthcCs"x|jD]}|j|kr|SqWdS)N)r(r)r rrr r r rs  z+ReadOnlySequentialNamedNodeMap.getNamedItemcCs,x&|jD]}|j|kr|j|kr|SqWdS)N)r(rrrw)r rrrwrr r r rs z-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|tr|j|}n |j|}|dkr0t||S)N)rr,rrr])r Z name_or_tuplerAr r r rs    z*ReadOnlySequentialNamedNodeMap.__getitem__c Cs0|dkr dSy |j|Stk r*dSXdS)Nr)r(r)r r6r r r rs  z#ReadOnlySequentialNamedNodeMap.itemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rr r r rsz.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rrrwr r r rsz0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz+ReadOnlySequentialNamedNodeMap.setNamedItemcCstjjddS)Nz"NamedNodeMap instance is read-only)r/r0r)r rAr r r rsz-ReadOnlySequentialNamedNodeMap.setNamedItemNScCs|jgS)N)r()r r r r rsz+ReadOnlySequentialNamedNodeMap.__getstate__cCs|d|_dS)Nr)r()r rr r r rsz+ReadOnlySequentialNamedNodeMap.__setstate__N)r()rorprqrrrrrrrrrrrrrrr r r r r's  r'z&Number of entries in the NamedNodeMap.c@s,eZdZdZd ZddZddZdd Zd S) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdcCs||_||_dS)N)r+r,)r r+r,r r r _identified_mixin_initsz!Identified._identified_mixin_initcCs|jS)N)r+)r r r r _get_publicIdszIdentified._get_publicIdcCs|jS)N)r,)r r r r _get_systemIdszIdentified._get_systemIdN)r+r,)rorprqrrr-r.r/r r r r r*s r*c@sHeZdZejZdZdZdZdZ dZ ddZ ddZ ddZ d d d ZdS) DocumentTypeNcCs2t|_t|_|r&t|\}}||_|j|_dS)N)r'entities notationsrrr)r rrsrr r r rs  zDocumentType.__init__cCs|jS)N)internalSubset)r r r r _get_internalSubset sz DocumentType._get_internalSubsetcCs|jdkrtd}|j|_|j|_tjjj}|rg|j_ g|j _ x>|j j D]2}t |j|j |j }|j j j||j|||qJWxZ|jj D]N}t|j|j |j |j}|j|_|j|_|j|_|jj j||j|||qW|j||||SdSdS)N)rOr0rrr/r0UserDataHandler NODE_CLONEDr1r(r2Notationr+r,rIrjEntity notationNameactualEncodingrrU)r rPclonergrnotationeentityr r r rQs.  zDocumentType.cloneNodercCs|jd|j|j|jr8|jd||j||jfn|jrR|jd||jf|jdk r||jd|j|j|jd|jd|dS)Nz r r r r5PszEntity.appendChildcCstjjddS)Nz+cannot insert children below an entity node)r/r0r1)r r>r?r r r r-TszEntity.insertBeforecCstjjddS)Nz*cannot remove children from an entity node)r/r0r1)r rCr r r r4XszEntity.removeChildcCstjjddS)Nz)cannot replace children of an entity node)r/r0r1)r r>rCr r r rD\szEntity.replaceChild)rorprqrr Z ENTITY_NODErrr:rrUrrArBrCr5r-r4rDr r r r r88sr8c@seZdZejZdZddZdS)r7NcCs||_|j||dS)N)rr-)r rr+r,r r r rdszNotation.__init__)rorprqr rrrrr r r r r7`sr7c @sHeZdZddddddddgZdd Zd d Zd d ZddZddZdS)DOMImplementationcore1.02.0Nr/ls-load3.0cCs|dkr d}|j|f|jkS)Nr)lower _features)r rTrUr r r rStszDOMImplementation.hasFeaturec Cs|r|jdk rtjjd|j}|dko8|dko8|dk }| rR|rRtjjd|rt|\}}|dkr~|dkr~tjjd|r| rtjjd|j||}|r|j ||j ||r||_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namer/z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) r3r/r0WrongDocumentErr_create_documentZInvalidCharacterErrrrcreateElementNSr5rOdoctyperR) r rrrrOruZadd_root_elementrsrrr r r createDocumentys4         z DOMImplementation.createDocumentcCst|}||_||_|S)N)r0r+r,)r rr+r,rOr r r createDocumentTypesz$DOMImplementation.createDocumentTypecCs|j|dr|SdSdS)N)rS)r rTr r r rZs zDOMImplementation.getInterfacecCstS)N)Document)r r r r rMsz"DOMImplementation._create_document)rErF)rErG)rEN)r/rF)r/rG)r/N)rHrI)rHN) rorprqrKrSrPrQrZrMr r r r rDis-rDc@s\eZdZdZdZddZddZddZd d Zd d Z d dZ ddZ ddZ ddZ dS) ElementInfozObject that represents content-model information for an element. This implementation is not expected to be used in practice; DOM builders should provide implementations which do the right thing using information available to it. rcCs ||_dS)N)r)r rr r r rszElementInfo.__init__cCstS)N)r)r anamer r r rszElementInfo.getAttributeTypecCstS)N)r)r rrrwr r r rszElementInfo.getAttributeTypeNScCsdS)NFr )r r r r r"szElementInfo.isElementContentcCsdS)zQReturns true iff this element is declared to have an EMPTY content model.Fr )r r r r isEmptyszElementInfo.isEmptycCsdS)z7Returns true iff the named attribute is a DTD-style ID.Fr )r rTr r r rszElementInfo.isIdcCsdS)zd?Z6d@dAZ7dBdCZ8dDdEZ9dFdGZ:dNdIdJZ;dKdLZ|jj||jtj kr^|j r^tjjdtj ||S)Nz%s cannot be child of %sz two document elements disallowed) rr.r/r0r1r2r3r4r rJ_get_documentElementr5)r rAr r r r5-s    zDocument.appendChildc CsVy|jj|Wntk r.tjjYnXd|_|_d|_|j |krRd|_ |S)N) r$rEr7r/r0r8r<r=r3documentElement)r rCr r r r4=s  zDocument.removeChildcCs$x|jD]}|jtjkr|SqWdS)N)r$rr rJ)r rAr r r rcIs  zDocument._get_documentElementcCs(|jdk r|jjd|_tj|dS)N)rOrHr )r r r r rHNs  zDocument.unlinkcCs|sdS|jjddd}|j|_|j|_|j|_xL|jD]B}t|||}|jj||jt j krbn|jt j krt||_ ||_ q8W|jtjjj|||S)N)rRrPrr_rUr$rNrIrr rr@rOr3rjr/r0r5r6)r rPr;rZ childcloner r r rQTs"       zDocument.cloneNodecCst}||_|S)N)rrO)r rbr r r createDocumentFragmentiszDocument.createDocumentFragmentcCst|}||_|S)N)rrO)r rr=r r r createElementnszDocument.createElementcCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrrrGrO)r rGtr r r createTextNodess  zDocument.createTextNodecCs(t|tstdt}||_||_|S)Nznode contents must be a string)rrrr%rGrO)r rGr@r r r createCDATASection{s  zDocument.createCDATASectioncCst|}||_|S)N)r$rO)r rGr@r r r createCommentszDocument.createCommentcCst||}||_|S)N)rrO)r rrGpr r r createProcessingInstructions z$Document.createProcessingInstructioncCst|}||_d|_|S)Nr)rrOr)r rar r r createAttributeszDocument.createAttributecCs"t|\}}t|||}||_|S)N)rrrO)r rrrrsrwr=r r r rNs  zDocument.createElementNScCs*t|\}}t||||}||_d|_|S)Nr)rrrOr)r rrrrsrwrmr r r createAttributeNSs  zDocument.createAttributeNScCst||||}||_|S)N)r8rO)r rr+r,r9r=r r r _create_entityszDocument._create_entitycCst|||}||_|S)N)r7rO)r rr+r,rr r r _create_notations zDocument._create_notationcCs||jkr|j|S|jp|js$dS|j}|dkrB|jg}||_n|sJdSd}x>|r|j}|jdd|jD|j|}|r@x|j j D]}|j r|j |j |j r||j|j<|j|kr|}n|jsPq|j|jr ||j|j<|j|kr|}n |js:Pq|jr||j|j<|j|kr.|}q|jdkrPqWnB|jrx8|j j D]*}|jrT||j|j<|j|krT|}qTW|dk rRPqRW|S)NcSsg|]}|jtkr|qSr )rr9).0rMr r r sz+Document.getElementById..r()rVrYrrXrdpopextendr$rrrrrrrwrrrrr)r rstackresultrArrr r r getElementByIdsZ               zDocument.getElementByIdcCst||tS)N)rrk)r rr r r rszDocument.getElementsByTagNamecCst|||tS)N)rrk)r rrrwr r r rszDocument.getElementsByTagNameNScCs|jj||S)N)rRrS)r rTrUr r r rVszDocument.isSupportedcCs>|jtjkrtjjdn|jtjkr2tjjdt|||S)Nzcannot import document nodesz!cannot import document type nodes)rr rr/r0NotSupportedErrr@rN)r rArPr r r importNodes    zDocument.importNodercCsN|dkr|jd|n|jd||fx|jD]}|j||||q2WdS)Nzz%%s)r}r$r)r r"r rr!rrAr r r rs   zDocument.writexmlcCsJ|j|k r tjjd||jf|jtjtjfkr>tjjd|t krd|kr|j dd\}}|dkr|tjj krtjj dq|dkr|tjj kr|jtjkrtjj dd}|}nd}d}|jtjkr|j }|dk r|j}|j|nd}||_||_||_||_|jtjkr||_n*||_|dk rF|j||rF|j||S)Nz?cannot rename nodes from other documents; expected %s, found %sz8renameNode() only applies to element and attribute nodesrr(rzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rOr/r0rLrr rJrryrrrrrrrrsrrrrrrrr)r rrrrrsrwrZis_idr r r renameNodesR         zDocument.renameNode)rYrOrXr$rV)rrrN)=rorprqrr rJrrr@r.rDrRrrrrrr3r=r<r:rr_rUrar]r[rrrrArZr\rBr^r`rbrCr5r4rcrHrQrerfrhrirjrlrnrNrorprqrxrrrVrzrr{r r r r rRsh    : rRrdz#Top-level element of this document.c Cs|jj|rtjjj}n tjjj}|jtj kr|j |j |j }x>|j jD]0}|j|j |j |j|j|j |j}|j|_qJW|rx$|jD]}t|||}|j|qWn|jtjkr|j}|rx$|jD]}t|||}|j|qWn|jtjkr |j|j}n|jtjkr*|j|j}n|jtjkrL|j|j |j}nr|jtj!krj|j"|j}nT|jtj#kr|j$|j |j }d|_|j|_n$|jtj%krtjjj}|j&j'|j(|j)|j*}||_|rg|j+_,g|j-_,xR|j-j,D]F} t.| j | j)| j*} || _|j-j,j/| t0| dr| j1|| | qWx|j+j,D]b} t2| j | j)| j*| j3} | j4| _4| j5| _5| j6| _6|| _|j+j,j/| t0| drB| j1|| | qBWntjj7dt8|t0|dr|j1||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrjzCannot clone node %s)9rOrYr/r0r5r6Z NODE_IMPORTEDrr rJrNrrrrrrrrrwrr$rNr5r+rerFrhrGrrirrlrrrjrror@rRrQrr+r,r1r(r2r7rIrdrjr8r9r:rrUryr2) rArPZnewOwnerDocumentrgr;rrmrMr@rr<r=r>r r r rN<s|                rNcCs,|jdd}t|dkr|Sd|dfSdS)Nrr(r)rr)rZfieldsr r r rs  rcCs,|||}|j\}}|j||j|S)N)ZgetEventZ expandNoderW)funcargskwargsZeventsZtoktypeZrootNoder r r _do_pulldom_parses    rcCsJ|dkr$| r$ddlm}|j|Sddlm}t|j|f||dSdS)z3Parse a file into a DOM by filename or file object.Nr) expatbuilder)pulldom)parserbufsize)xml.domrparserr)filerrrrr r r rs     rcCsB|dkrddlm}|j|Sddlm}t|j|fd|iSdS)z&Parse a file into a DOM from a string.Nr)r)rr)rr parseStringrr)stringrrrr r r rs     rcCsB|rs v  z$ x )GU  ><( O*PR PKi#]M+gg1dom/__pycache__/expatbuilder.cpython-36.opt-1.pycnu[3 \ @sdZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZejZejZejjZejjZejjZejjZejZejddejdd ejdd ejdd ejdd ejdd ejddejddejddd ZGdddeZddZddZGdddZeeefZ GdddeZ!GdddeZ"Gddde"Z#Gd d!d!e"Z$d"Z%d#e%Z&Gd$d%d%eZ'Gd&d'd'Z(Gd(d)d)e(eZ)Gd*d+d+e(e'Z*Gd,d-d-e+Z,Gd.d/d/eZ-d;d1d2Z.dd7d8Z1d9d:Z2dS)?zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNZcdata enumerationentityentitiesidZidrefZidrefsZnmtokenZnmtokens) ZCDATAENUMZENTITYZENTITIESIDZIDREFZIDREFSZNMTOKENZNMTOKENSc@sZeZdZdZdddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ dS) ElementInfo _attr_info_modeltagNameNcCs||_g|_||_dS)N)rrr)selfrmodelr,/usr/lib64/python3.6/xml/dom/expatbuilder.py__init__?szElementInfo.__init__cCs|j|j|jfS)N)rrr)rrrr __getstate__DszElementInfo.__getstate__cCs|\|_|_|_dS)N)rrr)rstaterrr __setstate__GszElementInfo.__setstate__cCsJxB|jD]8}|d|kr|d}|ddkr4tdSt|dSqWtjS)Nr(rr!)r _typeinfo_mapr_no_type)ranameinfotrrrgetAttributeTypeJs   zElementInfo.getAttributeTypecCstjS)N)rr#)rZ namespaceURIZ localNamerrrgetAttributeTypeNSTszElementInfo.getAttributeTypeNScCs,|jr$|jd}|tjjtjjfkSdSdS)NrF)rrrZ XML_CTYPE_ANYZXML_CTYPE_MIXED)rtyperrrisElementContentWs   zElementInfo.isElementContentcCs |jr|jdtjjkSdSdS)NrF)rrrZXML_CTYPE_EMPTY)rrrrisEmpty_szElementInfo.isEmptycCs,x&|jD]}|d|kr|ddkSqWdS)NrrrFr!)r)rr$r%rrrisIdes  zElementInfo.isIdcCs|j||fS)N)r,)rZeuriZenameZaurir$rrrisIdNSkszElementInfo.isIdNS)rrr)N) __name__ __module__ __qualname__ __slots__rrrr'r(r*r+r,r-rrrrr<s  rcCs |j||S)N)_intern_setdefault)buildersrrr_internosr5cCs|jd}|j}t|dkrR|\}}}|||}d||f}|||}|||}n4t|dkrz|\}}t}|||}}n td|||||||fS)N z%s:%srz4Unsupported syntax: spaces in URIs not supported: %r)splitr2lenr ValueError)r3namepartsinternuri localnameprefixqnamerrr_parse_ns_namers         rBc@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.NcCsP|dkrtj}||_|jjdk r2t|jj|_n d|_t|_d|_|j dS)N) rZOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)roptionsrrrrs zExpatBuilder.__init__cCstjS)zCreate a new parser object.)r ParserCreate)rrrr createParserszExpatBuilder.createParsercCsF|js@|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rIrMr= setdefaultr2Z buffer_textZordered_attributesZspecified_attributesinstall)rrrr getParsers   zExpatBuilder.getParsercCs,tjtdd|_|j|_|jj|_d|_dS)z6Free all data structures used during DOM construction.NF)theDOMImplementationZcreateDocumentrdocumentcurNode _elem_info_cdata)rrrrrJs   zExpatBuilder.resetcCs|j|_|j|_|j|_|j|_|jj r0|j |_ |j |_ |jjrH|j|_|jjrj|j|_|j|_|j|_n|j|_|j|_|j|_|j|_|j|_ dS)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrDrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlerZcdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerZXmlDeclHandlerelement_decl_handlerZElementDeclHandlerattlist_decl_handlerZAttlistDeclHandler)rparserrrrrOs$ zExpatBuilder.installc Cs|j}d}yLx:|jd}|s P|j|d|rB|jjrB|j|d}qW|jddWntk rlYnX|j}|jd|_|S) zIParse a document from a file object, returning the document node.TirFNi@) rPreadParserRdocumentElement _setup_subset ParseEscaperJrI)rfilerqZ first_bufferbufferdocrrr parseFiles$    zExpatBuilder.parseFilec CsP|j}y|j|d|j|Wntk r6YnX|j}|jd|_|S)z|jj|}t|j||jr:|jj|tkr:|jj|dS)N)rRZ createCommentr rSrGrrr)rrrrrrrcIs  zExpatBuilder.comment_handlercCsd|_d|_dS)NTF)rUr)rrrrreOsz(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS)NF)rUr)rrrrrgSsz&ExpatBuilder.end_cdata_section_handlercCsdS)Nrr)rcontextrrrrrrrlWsz(ExpatBuilder.external_entity_ref_handlercCs4|jdkr|j rt|_|j|j_|j||dS)N)rGrTrrstart_element_handlerrPrY)rr; attributesrrrrXZs z"ExpatBuilder.first_element_handlercCs|jj|}t|j|||_|rtxPtdt|dD]<}tj||tdt }||d}||_ |j|_ t ||q4W||jj k r|j|dS)Nrrr)rRZ createElementr rSranger9rAttrrrrrr rvrH)rr;rriarrrrr`s     z"ExpatBuilder.start_element_handlercCsj|jrf||jjkrdS|jj|}|tkr4t|n|tkrFt|ndS|j|_ |jj ||j dS)N) rGrRrvstartContainerrRejecter FILTER_SKIPSkipper parentNoderSrunlink)rrZfiltrrrrHqs     z"ExpatBuilder._finish_start_elementcCs|j}|j|_|j|dS)N)rSrr)rr;rSrrrrZsz ExpatBuilder.end_element_handlercCs\|jj|j}|r|j|||jrX||jjkr4dS|jj|tkrX|j j ||j dS)N) rTgetr_handle_white_text_nodesrGrRrvrrrSrr)rrSr%rrrrs   z ExpatBuilder._finish_end_elementcCsf|jjs|j rdSg}x.|jD]$}|jtkr"|jj r"|j|q"Wx|D]}|j |qPWdS)N) rDZwhitespace_in_element_contentr*rrrrstriprr)rrr%Lrrrrrs   z%ExpatBuilder._handle_white_text_nodescCs0|jj|}|dkr&t|||j|<n||_dS)N)rTrrr)rr;rr%rrrros z!ExpatBuilder.element_decl_handlerc CsF|jj|}|dkr&t|}||j|<|jjd|dd|d||gdS)Nr)rTrrrr)relemr;r)defaultZrequiredr%rrrrps   z!ExpatBuilder.attlist_decl_handlercCs2||j_||j_|dkr.|r&d|j_nd|j_dS)NrTF)rRversionencoding standalone)rrrrrrrrns  zExpatBuilder.xml_decl_handler)N) r.r/r0__doc__rrMrPrJrOr|r~rwrVrr\rirkr^r`rcrergrlrXrrHrZrrrorprnrrrrrCs:     rCc@seZdZdZd ZddZddZddZej e j ej e j eje jeje jeje jeje jeje jeje jeje jeje jeje jej e j!i Z"d S) rFzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.rEcCs ||_dS)N)rE)rrErrrrsz#FilterVisibilityController.__init__cCsT|j|j}|jj|@rL|jj|}|tkr0t|tkrHtdt ||St SdS)Nz)startContainer() returned illegal value: ) _nodetype_maskrrE whatToShowrFILTER_INTERRUPTrx_ALLOWED_FILTER_RETURNSr:reprr)rrmaskvalrrrrs   z)FilterVisibilityController.startContainercCs|j|j}|jj|@r|jj|}|tkr0t|tkrd|j}x |j ddD]}|j |qNWt S|t kr|t dt||StSdS)Nz%acceptNode() returned illegal value: )rrrErrrrxrrrZ appendChildrrr:rr)rrrrparentrrrrrs   z%FilterVisibilityController.acceptNodeN)rE)#r.r/r0rr1rrrrZ ELEMENT_NODEr Z SHOW_ELEMENTZATTRIBUTE_NODEZSHOW_ATTRIBUTErZ SHOW_TEXTrZSHOW_CDATA_SECTIONZENTITY_REFERENCE_NODEZSHOW_ENTITY_REFERENCEZ ENTITY_NODEZ SHOW_ENTITYZPROCESSING_INSTRUCTION_NODEZSHOW_PROCESSING_INSTRUCTIONZ COMMENT_NODEZ SHOW_COMMENT DOCUMENT_NODEZ SHOW_DOCUMENTZDOCUMENT_TYPE_NODEZSHOW_DOCUMENT_TYPEZDOCUMENT_FRAGMENT_NODEZSHOW_DOCUMENT_FRAGMENTZ NOTATION_NODEZ SHOW_NOTATIONrrrrrrFs" rFc@seZdZdZddZdS) FilterCrutch_builder_level _old_start_old_endcCs6d|_||_|j}|j|_|j|_|j|_|j|_dS)Nr) rrrIrYrr[rrrZ)rr3rqrrrrszFilterCrutch.__init__N)rrrr)r.r/r0r1rrrrrrsrc@s(eZdZfZddZddZddZdS)rcCs0tj|||j}xdD]}t||dqWdS)Nr]rdrjrfrhrm)r]rdrjrfrhrm)rrrIsetattr)rr3rqr;rrrrs zRejecter.__init__cGs|jd|_dS)Nr)r)rargsrrrrszRejecter.start_element_handlercGs@|jdkr0|jj}|jj||j|_|j|_n |jd|_dS)Nrr)rrrIrOrrYrr[)rrrqrrrrZ s    zRejecter.end_element_handlerN)r.r/r0r1rrrZrrrrrs rc@s eZdZfZddZddZdS)rcGs.|jj}|j||jj|k r*|jd|_dS)Nr)rrSrr)rrrrrrr-s  zSkipper.start_element_handlercGsD|jdkr*|j|jj_|j|jj_d|_n|jd|_|j|dS)Nrr)rrrrIrYrr[)rrrrrrZ3s     zSkipper.end_element_handlerN)r.r/r0r1rrZrrrrr*srz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c@sJeZdZdZdddZddZddZd d Zd d Zd dZ ddZ dS)FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. NcCs6|jtkr||_||_n|j|_||_tj||dS)N)rroriginalDocumentrrrCr)rrrKrrrr[s  zFragmentBuilder.__init__cCstj|d|_dS)N)rCrJfragment)rrrrrJds zFragmentBuilder.resetcCs|j|jS)zRParse a document fragment from a file object, returning the fragment node.)r~rt)rryrrrr|hszFragmentBuilder.parseFilec Cs||_|j}|jj}d}|rV|jp*|j}|jrDd|j|jf}qZ|jrZd|j}nd}|j}t |||f}y|j |dWn|j YnX|j }|j |S)zMParse a document fragment from a string, returning the fragment node.rszPUBLIC "%s" "%s"z SYSTEM "%s"r) _sourcerPrrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErurJr) rr}rqrZidentrZnsattrsrRrrrrr~ms, zFragmentBuilder.parseStringcCs|jjj}d}|rxbt|jjD]R}|jj|}|r>|d}d||jf}|jrfd||j|j f}q"d||j f}q"Wxt|j jD]}|j j|}|r|d}d||jf}|jrd||j|j f}n&|j rd||j f}nd ||j j f}|j rd ||j f}|d }qW|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rsz z%sz%s SYSTEM "%s">z %s)rrrrrZlengthitemZnodeNamerrrZ firstChildrr)rrr4rZnotationr rrrrs6    z FragmentBuilder._getDeclarationscCsdS)Nrsr)rrrrrszFragmentBuilder._getNSattrsc Cs~|tkrh|j}|j}|jj|}|j|_|jj|_|j|_z|j|j dWd||_||_d|_ XdSt j |||||SdS)Nrr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrRrSrIZExternalEntityParserCreaterZcreateDocumentFragmentrrurrCrl)rrrrrZ old_documentZ old_cur_noderqrrrrls  z+FragmentBuilder.external_entity_ref_handler)N) r.r/r0rrrJr|r~rrrlrrrrrRs $rc@s8eZdZdZddZddZddZdd Zd d Zd S) Namespacesz7Mix-in class for builders; adds support for namespaces.cCs g|_dS)N)_ns_ordered_prefixes)rrrr_initNamespacesszNamespaces._initNamespacescCstjdd}d|_|S)z'Create a new namespace-handling parser.r6)Znamespace_separatorT)rrLZnamespace_prefixes)rrqrrrrMs zNamespaces.createParsercCs tj|||jjr|j|_dS)z.Insert the namespace-handlers onto the parser.N)rCrOrDZnamespace_declarationsstart_namespace_decl_handlerZStartNamespaceDeclHandler)rrqrrrrOs zNamespaces.installcCs|jj||fdS)z/Push this namespace declaration on our storage.N)rr)rr@r>rrrrsz'Namespaces.start_namespace_decl_handlercCsd|krt||\}}}}nt}|}d}t}tj||||}|j|_t|j|||_|j rxZ|j D]P\}}|rtj t |d|t |d}ntj dt dt}||_ |j|_t||qdW|j dd=|r|j|j} |j} xtdt|dD]} || } || d} d| krJt|| \}}}}tj ||||}|| |<|| ||f<n$tj | t| t}|| | <|| t| f<|j|_| |_ ||_qWdS)Nr6zxmlns:xmlnsrrr)rBrrrZElementrRrr rSrrr5rrr Z_ensure_attributes_attrs_attrsNSrr9Z ownerElement)rr;rr>r?r@rArrrrrr$rrrrrsP      z Namespaces.start_element_handlerN) r.r/r0rrrMrOrrrrrrrs/rc@seZdZdZddZdS)ExpatBuilderNSz*Document builder that supports namespaces.cCstj||jdS)N)rCrJr)rrrrrJ)s zExpatBuilderNS.resetN)r.r/r0rrJrrrrr&src@s eZdZdZddZddZdS)FragmentBuilderNSz*Fragment builder that supports namespaces.cCstj||jdS)N)rrJr)rrrrrJ1s zFragmentBuilderNS.resetcCsd}|j}g}xv|rt|dr|x\|jjD]N\}}||krZdeclnamerrrr5s"    zFragmentBuilderNS._getNSattrsN)r.r/r0rrJrrrrrr.src@seZdZdZdS)rxzEException raised to short-circuit parsing in InternalSubsetExtractor.N)r.r/r0rrrrrrxSsrxc@sLeZdZdZdZddZddZddZd d Zd d Z d dZ ddZ dS)rzBXML processor which can rip out the internal document type subset.NcCs|jS)z'Return the internal subset as a string.)r)rrrrr\sz!InternalSubsetExtractor.getSubsetc Cs*ytj||Wntk r$YnXdS)N)rCr|rx)rryrrrr|`sz!InternalSubsetExtractor.parseFilec Cs*ytj||Wntk r$YnXdS)N)rCr~rx)rr}rrrr~fsz#InternalSubsetExtractor.parseStringcCs|j|_|j|_dS)N)rVrWrrY)rrqrrrrOlszInternalSubsetExtractor.installcCs0|r&|j}g|_|jj|_|j|_ntdS)N)rPrrZDefaultHandlerrrrx)rr;rrrrqrrrrVps   z2InternalSubsetExtractor.start_doctype_decl_handlercCs,dj|jjddjdd}||_tdS)Nrsz   )joinrreplacerx)rr4rrrrzsz0InternalSubsetExtractor.end_doctype_decl_handlercCs tdS)N)rx)rr;rrrrrsz-InternalSubsetExtractor.start_element_handler) r.r/r0rrrr|r~rOrVrrrrrrrWs rTc CsL|r t}nt}t|tr>t|d}|j|}WdQRXn |j|}|S)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrC isinstancestropenr|)ry namespacesr3fpresultrrrparses   rcCs|r t}nt}|j|S)zOParse a document from a string, returning the resulting Document node. )rrCr~)r}rr3rrrr~sr~c CsP|rt|}nt|}t|trBt|d}|j|}WdQRXn |j|}|S)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrrrrr|)ryrrr3rrrrr parseFragments    rcCs |rt|}nt|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrr~)r}rrr3rrrparseFragmentStrings rcCs|jrt|St|SdS)z,Create a builder based on an Options object.N)rrrC)rKrrr makeBuildersr)T)T)T)T)3rZxml.domrrrrrrZ xml.parsersrZxml.dom.minidomr r Zxml.dom.NodeFilterr rrrZDOMBuilderFilterrrrrZgetDOMImplementationrQZTypeInfor"objectrr5rBrCrrFrrrrrrrrr Exceptionrxrrr~rrrrrrrs^          3C :  u_%,   PKi#]Šb..0sax/__pycache__/expatreader.cpython-36.opt-2.pycnu[3 \X=@sdZddlTddlmZmZddlmZddlmZmZddlmZddlm Z m Z ddl Z e j dd d krxe d d[ ydd lmZWnek re d dYnXeedse d dddlmZmZmZejZejZy ddlZWnek rddZYnXddlZejZ[[GdddZGdddejZGdddejejZ ddZ!e"dkrddl#Z$e!Z%e%j&e$j'jj(e%j)e$j'j*e%j+ddS)z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s4eZdZddZddZddZddZd d Zd S) ExpatLocatorcCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN)rrrrr!r$r&r'rrrrr3s rc@seZdZdFddZddZd d Zd d Zd dZddZddZ ddZ dGddZ ddZ ddZ ddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Zd=d>Zd?d@Z dAdBZ!dCS)H ExpatParserrcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr,parse _close_source)rsourcerrrr7gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr9rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr,setContentHandlerr/_reset_cont_handler)rrrrrr;}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr-rr2rrrrr1SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r/SAXNotSupportedExceptionrr-rr1rr2rrrr=)rr>staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr.r r2r rhasattrrCr=r@)rr>rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrDr.r/_reset_lex_handler_propr r2r r@r=)rr>valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r/r5r6Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr9filerrrr8s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rMr) r0r isinstancerrPr6Z endDocumentr/r r#r8)rrrrrrQs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r6processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr<s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r.rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrGsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r-r rr%Z getEncodingr2rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr<unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr.rGexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr/r0)rrrrr5s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r6Z startElementAttributesImpl)rr>attrsrrrr\LszExpatParser.start_elementcCs|jj|dS)N)r6Z endElement)rr>rrrr]OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr))splitlentupleitemsr6ZstartElementNSAttributesNSImpl) rr>rfpairZnewattrsZqnamesZanamerHpartsZlengthZqnameZapairrrrrZRs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rgr)rhrirjr6Z endElementNS)rr>rmrrrr[ts   zExpatParser.end_element_nscCs|jj||dS)N)r6rU)rtargetrLrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r6rV)rrLrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r6ZstartPrefixMapping)rprefixZurirrrr`sz ExpatParser.start_namespace_declcCs|jj|dS)N)r6ZendPrefixMapping)rrrrrrraszExpatParser.end_namespace_declcCs|jj|||dS)N)r.ZstartDTD)rr>sysidpubidZhas_internal_subsetrrrrWszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr>basersrtZ notation_namerrrr^sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)ruZ notationDecl)rr>rvrsrtrrrr_szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rSrrw)r1Z _ent_handlerZ resolveEntityrr4r%r'r0appendrZExternalEntityParserCreaterr,r7)rcontextrvrsrtr9rrrrbs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r6Z skippedEntity)rr>Zis_perrrrcsz"ExpatParser.skipped_entity_handlerNi)rr{)r)"rrrrr7r:r;r?rBrFrIrPr8rQr<rGr5r!r$r&r'r\r]rZr[rprqr`rarWr^r_rbrcrrrrr(Ws>    '" r(cOs t||S)N)r()argskwargsrrr create_parsersr~__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrEZxml.saxrrrrerl_weakrefrweakrefproxyrZLocatorrr,r(r~rZxml.sax.saxutilsZxmlpr;ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr7rrrrsL      $_ PKi#]oڐ++-sax/__pycache__/saxutils.cpython-36.opt-2.pycnu[3 \/@sddlZddlZddlZddlZddlZddlmZddlmZddZ ifddZ ifd d Z ifd d Z d dZ GdddejZGdddejZdddZdS)N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)N)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)N&z&>z>._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZd:ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9ZdS); XMLFilterBaseNcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N)r"r#r$rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds8 rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)Nreadrrrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPKi#]VZ Z 'sax/__pycache__/__init__.cpython-36.pycnu[3 \.@sdZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejj rd ejkrejd jd Z[dZejd ddkrejjerejjejd ZgfddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)a&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs*   PKi#]b=n,sax/__pycache__/handler.cpython-36.opt-2.pycnu[3 \b6@sdZGdddZGdddZGdddZGdddZd Zd Zd Zd Zd Z dZ eeeee e gZ dZ dZ dZdZdZdZe ee eeegZdS)z2.0betac@s$eZdZddZddZddZdS) ErrorHandlercCs|dS)N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname__rrr rrrrrs rc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)ContentHandlercCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)Nr)rrrrr endElementszContentHandler.endElementcCsdS)Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r rrrrrrrrrrrrr!r"rrrrr /s    r c@seZdZddZddZdS) DTDHandlercCsdS)Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)Nr)rrr$r%ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r&r'rrrrr#sr#c@seZdZddZdS)EntityResolvercCs|S)Nr)rr$r%rrr resolveEntityszEntityResolver.resolveEntityN)r r r r)rrrrr(sr(z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)versionrr r#r(Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s: "  PKi#]VZ Z -sax/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \.@sdZddlmZddlmZmZddlmZmZm Z m Z m Z efddZ efddZ d gZd Zernd d lZd d lZd d lZejj rd ejkrejd jd Z[dZejd ddkrejjerejjejd ZgfddZejd ddkrddZnddZ[d S)aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)a&Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the list created by doing parser_list + default_parser_list. The lists must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)__doc__Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs*   PKi#]P' 0sax/__pycache__/_exceptions.cpython-36.opt-2.pycnu[3 \@s|ddlZejdddkr&ddlmZ[GdddeZGdddeZGd d d eZGd d d eZGd ddeZdS)Njava) Exceptionc@s6eZdZd ddZddZddZdd Zd d ZdS) SAXExceptionNcCs||_||_tj||dS)N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)N)r)r r r r getMessageszSAXException.getMessagecCs|jS)N)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)N)r)r r r r __str__"szSAXException.__str__cCs tddS)N __getitem__)AttributeError)r Zixr r r r&szSAXException.__getitem__)N)__name__ __module__ __qualname__rrrrrr r r r r s  rc@s<eZdZddZddZddZddZd d Zd d Zd S)SAXParseExceptioncCs<tj|||||_|jj|_|jj|_|jj|_dS)N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)N)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)N)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)N)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)N)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrr r r r r.s   rc@s eZdZdS)SAXNotRecognizedExceptionN)rrrr r r r r isr c@s eZdZdS)SAXNotSupportedExceptionN)rrrr r r r r!ssr!c@s eZdZdS)SAXReaderNotAvailableN)rrrr r r r r"}sr") sysplatformZ java.langrrrr r!r"r r r r s %;  PKi#]_&00,sax/__pycache__/handler.cpython-36.opt-1.pycnu[3 \b6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrsrc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nr)rrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrrrr"r#rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r'r(rrrrr$sr$c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr%r&rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r*rrrrr)sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s< "  PKi#]leBB(sax/__pycache__/xmlreader.cpython-36.pycnu[3 \1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__r rrrrrrrrrrrrrr r r r r r s   rc@sBeZdZdZdddZddZdd Zd d Zd d ZddZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r*Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr(feedclose)r rr*filebufferr r r rss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.z This method must be implemented!N)r)r datar r r r0szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r rr r r r,szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.z This method must be implemented!N)r)r r r r r1s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.z This method must be implemented!N)r)r r r r resetszIncrementalParser.resetN)r6) r!r"r#r$r rr0r,r1r5r r r r r%[s   r%c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.rr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r )r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r$r9r:r;r<r r r r r7s r7c@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.N)r?)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r r r r r;szInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.N)r>)r rCr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r r r r r<szInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N)r@)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N)rA)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.)rA)r r r r r.szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N)rB)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r r r r r-szInputSource.getCharacterStream)N)r!r"r#r$r rDr;rEr<rGrHrIr.rJr-r r r r r=s    r=c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrL)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rL)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rL)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rLKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rLrS)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrLkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rVrLrW)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rNrL)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rL)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rVrLrW)r r r r rW@szAttributesImpl.keyscCs ||jkS)N)rL)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rLget)r r alternativer r r r]FszAttributesImpl.getcCs |j|jS)N) __class__rL)r r r r copyIszAttributesImpl.copycCst|jjS)N)rVrLitems)r r r r raLszAttributesImpl.itemscCst|jjS)N)rVrLvalues)r r r r rbOszAttributesImpl.values)N)r!r"r#r rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbr r r r rKs" rKc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)rL_qnames)r rMZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rdrarLrS)r rnsnameqnamer r r rR^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rdrarS)r rrerfr r r rTeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rd)r rr r r rUlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rVrdrb)r r r r rYoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r_rLrd)r r r r r`rszAttributesNSImpl.copyN) r!r"r#r rRrTrUrYr`r r r r rcTs rccCstttdS)N)rr%r7r r r r _testvsrg__main__N)r$r+r _exceptionsrrrr%r7r=rKrcrgr!r r r r s PJY>"PKi#]+((.sax/__pycache__/xmlreader.cpython-36.opt-2.pycnu[3 \1@sddlmZddlmZmZGdddZGdddeZGdddZGd d d ZGd d d Z Gd dde Z ddZ e dkre dS))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdS) XMLReadercCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)Nz This method must be implemented!)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)N)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)N)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)N)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)N)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)NzLocale support not implemented)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)NzFeature '%s' not recognized)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)NzFeature '%s' not recognized)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)NzProperty '%s' not recognized)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)NzProperty '%s' not recognized)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname__r rrrrrrrrrrrrrr r r r r r s  rc@s>eZdZdddZddZddZd d Zd d Zd dZdS)IncrementalParsercCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r)Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr'feedclose)r rr)filebufferr r r rss     zIncrementalParser.parsecCs tddS)Nz This method must be implemented!)r)r datar r r r/szIncrementalParser.feedcCs tddS)Nz!prepareParser must be overridden!)r)r rr r r r+szIncrementalParser.prepareParsercCs tddS)Nz This method must be implemented!)r)r r r r r0s zIncrementalParser.closecCs tddS)Nz This method must be implemented!)r)r r r r resetszIncrementalParser.resetN)r5) r!r"r#r rr/r+r0r4r r r r r$[s    r$c@s,eZdZddZddZddZddZd S) LocatorcCsdS)Nrr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)Nrr7r )r r r r getLineNumberszLocator.getLineNumbercCsdS)Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r8r9r:r;r r r r r6sr6c@sfeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ dS) InputSourceNcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)N)r>)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)N)r>)r r r r r:szInputSource.getPublicIdcCs ||_dS)N)r=)r rBr r r setSystemIdszInputSource.setSystemIdcCs|jS)N)r=)r r r r r;szInputSource.getSystemIdcCs ||_dS)N)r?)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)N)r?)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)N)r@)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)N)r@)r r r r r-szInputSource.getByteStreamcCs ||_dS)N)rA)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)N)rA)r r r r r,szInputSource.getCharacterStream)N)r!r"r#r rCr:rDr;rFrGrHr-rIr,r r r r r<s    r<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrK)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rK)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rK)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rKKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rKrR)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrKkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rUrKrV)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rMrK)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rK)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rUrKrV)r r r r rV@szAttributesImpl.keyscCs ||jkS)N)rK)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rKget)r r alternativer r r r\FszAttributesImpl.getcCs |j|jS)N) __class__rK)r r r r copyIszAttributesImpl.copycCst|jjS)N)rUrKitems)r r r r r`LszAttributesImpl.itemscCst|jjS)N)rUrKvalues)r r r r raOszAttributesImpl.values)N)r!r"r#r rNrOrPrQrSrTrWrXrYrZrVr[r\r_r`rar r r r rJs" rJc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)N)rK_qnames)r rLZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rcr`rKrR)r rnsnameqnamer r r rQ^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rcr`rR)r rrdrer r r rSeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rc)r rr r r rTlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rUrcra)r r r r rXoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r^rKrc)r r r r r_rszAttributesNSImpl.copyN) r!r"r#r rQrSrTrXr_r r r r rbTs rbcCstttdS)N)rr$r6r r r r _testvsrf__main__N) r*r _exceptionsrrrr$r6r<rJrbrfr!r r r r s PJY>"PKi#])[[0sax/__pycache__/_exceptions.cpython-36.opt-1.pycnu[3 \@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_tj||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r r r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<tj|||||_|jj|_|jj|_|jj|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)zEGet the public identifier of the entity where the exception occurred.)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r!isr!c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r"ssr"c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.N)rrrrr r r r r#}sr#) rsysplatformZ java.langrrrr!r"r#r r r r s %;  PKi#]}>>-sax/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \.@s ddlmZddlmZmZddlmZmZmZm Z m Z efddZ efddZ dgZ d Zerjd d lZd d lZd d lZejj rd ejkrejd jd Z [d Zejd ddkrejjerejjejd Z gfddZejd ddkrddZnddZ[d S)) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablecCs(t}|j||j||j|dS)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparserr(/usr/lib64/python3.6/xml/sax/__init__.pyr s  r cCspddl}|dkrt}t}|j||j|t}t|trR|j|j |n|j |j ||j |dS)N) iorr r r r isinstancestrZsetCharacterStreamStringIOZ setByteStreamBytesIOr )stringrrrrZinpsrcrrr parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSER,zpython.xml.sax.parserjavacCsrxb|tD]V}yt|Stk rL}zddl}||jkr<WYdd}~Xq tk r^Yq Xq WtdddS)NrzNo parsers found)default_parser_list_create_parser ImportErrorsysmodulesr )Z parser_list parser_nameer"rrrr Fs  r cCs$ddlm}|j|dt}|jS)Nr)imp)Zorg.python.corer&Z importNameglobals create_parser)r$r& drv_modulerrrr as r cCst|iidg}|jS)Nr() __import__r()r$r)rrrr gs)Z xmlreaderrrrr _exceptionsrrrrr r rr_falseZxml.sax.expatreaderZxmlosr"flagsignore_environmentenvironsplitZ_keyplatformregistryZ containsKeyZ getPropertyr r rrrrs(   PKi#])[[*sax/__pycache__/_exceptions.cpython-36.pycnu[3 \@sdZddlZejdddkr*ddlmZ[GdddeZGdd d eZGd d d eZGd d d eZGdddeZ dS)z!Different kinds of SAX ExceptionsNjava) Exceptionc@s:eZdZdZd ddZddZddZd d Zd d ZdS) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcCs||_||_tj||dS)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exceptionr__init__)selfmsg exceptionr +/usr/lib64/python3.6/xml/sax/_exceptions.pyrszSAXException.__init__cCs|jS)z$Return a message for this exception.)r)r r r r getMessageszSAXException.getMessagecCs|jS)z9Return the embedded exception, or None if there was none.)r)r r r r getExceptionszSAXException.getExceptioncCs|jS)z0Create a string representation of the exception.)r)r r r r __str__"szSAXException.__str__cCs tddS)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__N)AttributeError)r Zixr r r r&szSAXException.__getitem__)N) __name__ __module__ __qualname____doc__rrrrrr r r r r s  rc@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.cCs<tj|||||_|jj|_|jj|_|jj|_dS)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r Zlocatorr r r r;s   zSAXParseException.__init__cCs|jS)zNThe column number of the end of the text where the exception occurred.)r)r r r r rHsz!SAXParseException.getColumnNumbercCs|jS)zDThe line number of the end of the text where the exception occurred.)r)r r r r rMszSAXParseException.getLineNumbercCs |jjS)zEGet the public identifier of the entity where the exception occurred.)r getPublicId)r r r r rQszSAXParseException.getPublicIdcCs|jS)zEGet the system identifier of the entity where the exception occurred.)r)r r r r rUszSAXParseException.getSystemIdcCsN|j}|dkrd}|j}|dkr(d}|j}|dkr?z %s:%s:%s: %s)rrrr)r ZsysidZlinenumZcolnumr r r rYszSAXParseException.__str__N) rrrrrrrrrrr r r r r.s  rc@seZdZdZdS)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r!isr!c@seZdZdZdS)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.N)rrrrr r r r r"ssr"c@seZdZdZdS)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.N)rrrrr r r r r#}sr#) rsysplatformZ java.langrrrr!r"r#r r r r s %;  PKi#]k0k00sax/__pycache__/expatreader.cpython-36.opt-1.pycnu[3 \X=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ ydd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZy dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&j'e%j(jj)e&j*e%j(j+e&j,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN) rrr__doc__rr!r$r&r'rrrrr3s rc@s eZdZdZdGddZdd Zd d Zd d ZddZddZ ddZ ddZ dHddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDS)I ExpatParserz$SAX driver for the pyexpat C module.rcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr-parse _close_source)rsourcerrrr8gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr:rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr-setContentHandlerr0_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr.rr3rrrrr2SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r0SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr/r r3r rhasattrrDr>rA)rr?rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrEr/r0_reset_lex_handler_propr r3r rAr>)rr?valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r0r6r7Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr:filerrrr9s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rNr) r1r isinstancerrQr7Z endDocumentr0r r#r9)rrrrrrRs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr=s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r.r rr%Z getEncodingr3rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr=unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rHexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r7Z startElementAttributesImpl)rr?attrsrrrr]LszExpatParser.start_elementcCs|jj|dS)N)r7Z endElement)rr?rrrr^OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr*)splitlentupleitemsr7ZstartElementNSAttributesNSImpl) rr?rgpairZnewattrsZqnamesZanamerIpartsZlengthZqnameZapairrrrr[Rs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rhr)rirjrkr7Z endElementNS)rr?rnrrrr\ts   zExpatParser.end_element_nscCs|jj||dS)N)r7rV)rtargetrMrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r7rW)rrMrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r7ZstartPrefixMapping)rprefixZurirrrrasz ExpatParser.start_namespace_declcCs|jj|dS)N)r7ZendPrefixMapping)rrsrrrrbszExpatParser.end_namespace_declcCs|jj|||dS)N)r/ZstartDTD)rr?sysidpubidZhas_internal_subsetrrrrXszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr?basertruZ notation_namerrrr_sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)rvZ notationDecl)rr?rwrtrurrrr`szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rTrrx)r2Z _ent_handlerZ resolveEntityrr5r%r'r1appendrZExternalEntityParserCreaterr-r8)rcontextrwrtrur:rrrrcs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r7Z skippedEntity)rr?Zis_perrrrdsz"ExpatParser.skipped_entity_handlerNi)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@    '" r)cOs t||S)N)r))argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrFZxml.saxrrrrfrm_weakrefrweakrefproxyrZLocatorrr-r)rrZxml.sax.saxutilsZxmlpr<ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr8rrrrsN      $_ PKi#]&y 2 2-sax/__pycache__/saxutils.cpython-36.opt-1.pycnu[3 \/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &z&>z> in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')copyupdaterr)rrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDtj }dd|_ j |_ yj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N) r"r#r$__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds: rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrrNrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rrZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPKi#]&y 2 2'sax/__pycache__/saxutils.cpython-36.pycnu[3 \/@sdZddlZddlZddlZddlZddlZddlmZddlm Z ddZ ifdd Z ifd d Z ifd d Z ddZGdddejZGddde jZdddZdS)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercCs&x |jD]\}}|j||}q W|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvaluer (/usr/lib64/python3.6/xml/sax/saxutils.py__dict_replace sr cCs6|jdd}|jdd}|jdd}|r2t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &z&>z> in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')copyupdaterr)rrr r r quoteattr0s   rcsdkrddl}|jSttjr&Sttjtjfr<SttjrlGfddd}|}dd|_ nDtj }dd|_ j |_ yj |_ j|_Wntk rYnXtj||ddd d S) NrcseZdZjZfddZdS)z _gettextwriter.._wrappercs t|S)N)getattr)selfname)outr r __getattr__[sz,_gettextwriter.._wrapper.__getattr__N)__name__ __module__ __qualname__ __class__r!r )r r r _wrapperYsr&cSsdS)Nr r r r r ^sz _gettextwriter..cSsdS)NTr r r r r r'csxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r r)r-r&bufferr )r r _gettextwriterHs.     r?c@seZdZd ddZddZd!dd Zd d Zd d ZddZddZ ddZ ddZ ddZ ddZ ddZddZddZdS)" XMLGeneratorN iso-8859-1FcCsVtjj|t||}|j|_|j|_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NrF)rContentHandler__init__r?r9_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rr r)Zshort_empty_elementsr r r rDss   zXMLGenerator.__init__cCsJ|drBd|dkr d|dS|j|d}|rB|d|dS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rI)rrprefixr r r _qnames  zXMLGenerator._qnamecCs|jr|jdd|_dS)NrF)rMrE)r endElementr r r _finish_pending_start_elements z*XMLGenerator._finish_pending_start_elementcCs|jd|jdS)Nz$ )rErK)rr r r startDocumentszXMLGenerator.startDocumentcCs |jdS)N)rG)rr r r endDocumentszXMLGenerator.endDocumentcCs0|jj|jj||j|<|jj||fdS)N)rHappendrIrrJ)rrOurir r r startPrefixMappings zXMLGenerator.startPrefixMappingcCs|jd|_|jd=dS)NrrBrB)rHrI)rrOr r r endPrefixMappings zXMLGenerator.endPrefixMappingcCs^|j|jd|x*|jD]\}}|jd|t|fq W|jrPd|_n |jddS)Nrz %s=%sTr)rRrErrrLrM)rrattrsr r r r startElementszXMLGenerator.startElementcCs*|jr|jdd|_n|jd|dS)Nz/>Fz)rMrE)rrr r r rQs zXMLGenerator.endElementcCs|j|jd|j|x8|jD].\}}|rD|jd||fq$|jd|q$Wg|_x0|jD]$\}}|jd|j|t|fqfW|jrd|_n |jddS)Nrz xmlns:%s="%s"z xmlns="%s"z %s=%sTr)rRrErPrJrrrLrM)rrqnamerYrOrVr r r r startElementNSs zXMLGenerator.startElementNScCs0|jr|jdd|_n|jd|j|dS)Nz/>Fz)rMrErP)rrr[r r r endElementNSs zXMLGenerator.endElementNScCs4|r0|jt|ts"t||j}|jt|dS)N)rRr/strrKrEr)rcontentr r r characterss   zXMLGenerator.characterscCs0|r,|jt|ts"t||j}|j|dS)N)rRr/r^rKrE)rr_r r r ignorableWhitespaces   z XMLGenerator.ignorableWhitespacecCs|j|jd||fdS)Nz )rRrE)rtargetrr r r processingInstructionsz"XMLGenerator.processingInstruction)NrAF)F)r"r#r$rDrPrRrSrTrWrXrZrQr\r]r`rarcr r r r r@qs   r@c@seZdZdZd;ddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:ZdS)< XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcCstjj|||_dS)N)r XMLReaderrD_parent)rparentr r r rDs zXMLFilterBase.__init__cCs|jj|dS)N) _err_handlererror)r exceptionr r r riszXMLFilterBase.errorcCs|jj|dS)N)rh fatalError)rrjr r r rkszXMLFilterBase.fatalErrorcCs|jj|dS)N)rhwarning)rrjr r r rlszXMLFilterBase.warningcCs|jj|dS)N) _cont_handlersetDocumentLocator)rZlocatorr r r rnsz XMLFilterBase.setDocumentLocatorcCs|jjdS)N)rmrS)rr r r rSszXMLFilterBase.startDocumentcCs|jjdS)N)rmrT)rr r r rTszXMLFilterBase.endDocumentcCs|jj||dS)N)rmrW)rrOrVr r r rWsz XMLFilterBase.startPrefixMappingcCs|jj|dS)N)rmrX)rrOr r r rX szXMLFilterBase.endPrefixMappingcCs|jj||dS)N)rmrZ)rrrYr r r rZ szXMLFilterBase.startElementcCs|jj|dS)N)rmrQ)rrr r r rQszXMLFilterBase.endElementcCs|jj|||dS)N)rmr\)rrr[rYr r r r\szXMLFilterBase.startElementNScCs|jj||dS)N)rmr])rrr[r r r r]szXMLFilterBase.endElementNScCs|jj|dS)N)rmr`)rr_r r r r`szXMLFilterBase.characterscCs|jj|dS)N)rmra)rcharsr r r rasz!XMLFilterBase.ignorableWhitespacecCs|jj||dS)N)rmrc)rrbrr r r rcsz#XMLFilterBase.processingInstructioncCs|jj|dS)N)rm skippedEntity)rrr r r rp!szXMLFilterBase.skippedEntitycCs|jj|||dS)N) _dtd_handler notationDecl)rrpublicIdsystemIdr r r rr&szXMLFilterBase.notationDeclcCs|jj||||dS)N)rqunparsedEntityDecl)rrrsrtZndatar r r ru)sz XMLFilterBase.unparsedEntityDeclcCs|jj||S)N)Z _ent_handler resolveEntity)rrsrtr r r rv.szXMLFilterBase.resolveEntitycCs@|jj||jj||jj||jj||jj|dS)N)rfZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcer r r rw3s     zXMLFilterBase.parsecCs|jj|dS)N)rf setLocale)rZlocaler r r ry:szXMLFilterBase.setLocalecCs |jj|S)N)rf getFeature)rrr r r rz=szXMLFilterBase.getFeaturecCs|jj||dS)N)rf setFeature)rrstater r r r{@szXMLFilterBase.setFeaturecCs |jj|S)N)rf getProperty)rrr r r r}CszXMLFilterBase.getPropertycCs|jj||dS)N)rf setProperty)rrr r r r r~FszXMLFilterBase.setPropertycCs|jS)N)rf)rr r r getParentKszXMLFilterBase.getParentcCs ||_dS)N)rf)rrgr r r setParentNszXMLFilterBase.setParent)N) r"r#r$__doc__rDrirkrlrnrSrTrWrXrZrQr\r]r`rarcrprrrurvrwryrzr{r}r~rrr r r r rds: rdcCs t|trtj|}n^t|drt|}tj}t|jdtrH|j|n |j|t|drtt|jtrt|j |j|j dko|j dkr|j }t jjt jj|}t jj||}t jj|r|j |t|d}n$|j tjj||tjj|j }|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrrNrb)r/r^rZ InputSourcehasattrrZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdospathdirnamenormpathjoinisfileopenurllibrwZurljoinZrequestZurlopen)rxbasefZsysidZbaseheadZ sysidfilenamer r r prepare_input_sourceSs*          r)r)rrZ urllib.parserZurllib.requestr0r2rrrr rrrr?rCr@rerdrr r r r s     )soPKi#]_&00&sax/__pycache__/handler.cpython-36.pycnu[3 \b6@sdZdZGdddZGdddZGdddZGdd d Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZdS)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac@s(eZdZdZddZddZddZdS) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.cCs|dS)zHandle a recoverable error.N)self exceptionrr'/usr/lib64/python3.6/xml/sax/handler.pyerror szErrorHandler.errorcCs|dS)zHandle a non-recoverable error.Nr)rrrrr fatalError$szErrorHandler.fatalErrorcCs t|dS)zHandle a warning.N)print)rrrrrwarning(szErrorHandler.warningN)__name__ __module__ __qualname____doc__rrr rrrrrsrc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cCs d|_dS)N)_locator)rrrr__init__6szContentHandler.__init__cCs ||_dS)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.N)r)rZlocatorrrrsetDocumentLocator9sz!ContentHandler.setDocumentLocatorcCsdS)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nr)rrrr startDocumentPszContentHandler.startDocumentcCsdS)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nr)rrrr endDocumentWszContentHandler.endDocumentcCsdS)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixZurirrrstartPrefixMapping`sz!ContentHandler.startPrefixMappingcCsdS)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rrrrrendPrefixMappingwszContentHandler.endPrefixMappingcCsdS)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrsrrr startElement~szContentHandler.startElementcCsdS)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nr)rrrrr endElementszContentHandler.endElementcCsdS)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rrqnamerrrrstartElementNSszContentHandler.startElementNScCsdS)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rrrrrr endElementNSszContentHandler.endElementNScCsdS)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nr)rZcontentrrr charactersszContentHandler.characterscCsdS)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)rZ whitespacerrrignorableWhitespacesz"ContentHandler.ignorableWhitespacecCsdS)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatarrrprocessingInstructionsz$ContentHandler.processingInstructioncCsdS)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nr)rrrrr skippedEntityszContentHandler.skippedEntityN)r r r r rrrrrrrrrrrrr"r#rrrrr/s    rc@s eZdZdZddZddZdS) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cCsdS)z$Handle a notation declaration event.Nr)rrpublicIdsystemIdrrr notationDeclszDTDHandler.notationDeclcCsdS)z,Handle an unparsed entity declaration event.Nr)rrr%r&ZndatarrrunparsedEntityDeclszDTDHandler.unparsedEntityDeclN)r r r r r'r(rrrrr$sr$c@seZdZdZddZdS)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.cCs|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rr%r&rrr resolveEntityszEntityResolver.resolveEntityN)r r r r r*rrrrr)sr)z&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictN)r versionrrr$r)Zfeature_namespacesZfeature_namespace_prefixesZfeature_string_interningZfeature_validationZfeature_external_gesZfeature_external_pesZ all_featuresZproperty_lexical_handlerZproperty_declaration_handlerZproperty_dom_nodeZproperty_xml_stringZproperty_encodingZproperty_interning_dictZall_propertiesrrrr s< "  PKi#]k0k0*sax/__pycache__/expatreader.cpython-36.pycnu[3 \X=@sdZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d d kr|ed d [ ydd lmZWnek redd YnXeedsedd ddlmZmZmZejZejZy dd lZWnek r ddZYnXdd lZejZ[[GdddZGdddejZGdddej ejZ!ddZ"e#dkrdd l$Z%e"Z&e&j'e%j(jj)e&j*e%j(j+e&j,dd S)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dictNjavazexpat not available in Java)expatzexpat not supported ParserCreate) xmlreadersaxutilshandlercCs|S)N)orr+/usr/lib64/python3.6/xml/sax/expatreader.py_mkproxy'src@s eZdZdS) _ClosedParserN)__name__ __module__ __qualname__rrrrr.src@s8eZdZdZddZddZddZdd Zd d Zd S) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. cCst||_dS)N)r_ref)selfparserrrr__init__9szExpatLocator.__init__cCs|j}|jdkrdS|jjS)N)r_parserErrorColumnNumber)rrrrrgetColumnNumber<s zExpatLocator.getColumnNumbercCs|j}|jdkrdS|jjS)N)rrErrorLineNumber)rrrrr getLineNumberBs zExpatLocator.getLineNumbercCs|j}|dkrdS|jjS)N)r_source getPublicId)rrrrrr&HszExpatLocator.getPublicIdcCs|j}|dkrdS|jjS)N)rr% getSystemId)rrrrrr'NszExpatLocator.getSystemIdN) rrr__doc__rr!r$r&r'rrrrr3s rc@s eZdZdZdGddZdd Zd d Zd d ZddZddZ ddZ ddZ dHddZ ddZ ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dBdCZ"dDS)I ExpatParserz$SAX driver for the pyexpat C module.rcCsFtjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ dS)Nr) rIncrementalParserrZ InputSourcer%r _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)rZnamespaceHandlingbufsizerrrrZs zExpatParser.__init__c CsVtj|}||_y*|j|jjt|tjj ||Wn|j YnXdS)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer%reset _cont_handlerZsetDocumentLocatorrrr-parse _close_source)rsourcerrrr8gs zExpatParser.parsecCs |jdk r|jj|jdS)N)r'rZSetBase)rr:rrr prepareParserws zExpatParser.prepareParsercCs tjj|||jr|jdS)N)rr-setContentHandlerr0_reset_cont_handler)rrrrrr<}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jdk S|tttfkr2dS|tkr@|jSt d|dS)NrzFeature '%s' not recognized) rr.rr3rrrrr2SAXNotRecognizedException)rnamerrr getFeatures zExpatParser.getFeaturecCs|jrtd|tkr||_n|tkr.||_nt|tkrT|rL|jdkrRi|_qd|_nN|tkrj|rtdn8|t kr|rtdn"|t kr|rtdn t d|dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixeszFeature '%s' not recognized) r0SAXNotSupportedExceptionrr.rr2rr3rrrr>)rr?staterrr setFeatures2 zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jdrB|jjSt dnt dt d|dS)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingzProperty '%s' not recognized) rproperty_lexical_handlerr/r r3r rhasattrrDr>rA)rr?rrr getPropertys   zExpatParser.getPropertycCsV|tjkr ||_|jrR|jn2|tkr0||_n"|tkrFtd|n t d|dS)NzProperty '%s' cannot be setzProperty '%s' not recognized) rrEr/r0_reset_lex_handler_propr r3r rAr>)rr?valuerrr setPropertys   zExpatParser.setPropertycCsz|js|jd|_|jjy|jj||WnDtjk rt}z&ttj |j ||}|j j |WYdd}~XnXdS)Nr") r0r6r7Z startDocumentrZParser errorZSAXParseExceptionZ ErrorStringcodeZ _err_handlerZ fatalError)rdataisFinaleexcrrrfeeds zExpatParser.feedc CsB|j}z|j}|dk r |jWd|j}|dk r<|jXdS)N)r%ZgetCharacterStreamcloseZ getByteStream)rr:filerrrr9s zExpatParser._close_sourcec Cs|js|jdkst|jtr dSz(|jddd|jjd|_d|_Wdd|_|jdk rzt}|jj|_|jj |_ ||_|j XdS)Nr")rNr) r1r isinstancerrQr7Z endDocumentr0r r#r9)rrrrrrRs      zExpatParser.closecCs|jj|j_|jj|j_dS)N)r7processingInstructionrZProcessingInstructionHandler charactersZCharacterDataHandler)rrrrr=s zExpatParser._reset_cont_handlercCs`|j}|j}|dkr4d|_d|_d|_d|_d|_n(|j|_|j|_|j |_|j |_|j |_dS)N) r/rZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ startCDATAZendCDATAstart_doctype_declZendDTD)rZlexrrrrrHsz#ExpatParser._reset_lex_handler_propc Cs|jr>tj|jjd|jd|_d|j_|j|j_ |j |j_ n,tj|jj|jd|_|j |j_ |j |j_ |j|j|j_|j|j_|j|j_|j|j_d|_|jr|j|j|j_y|j|j_Wntk rYnX|jjtj d|_!g|_"dS)N )internr"r)#r.r rr%Z getEncodingr3rZnamespace_prefixesstart_element_nsZStartElementHandlerend_element_nsZEndElementHandler start_element end_elementr=unparsed_entity_declZUnparsedEntityDeclHandler notation_declZNotationDeclHandlerstart_namespace_declZStartNamespaceDeclHandlerend_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rHexternal_entity_refZExternalEntityRefHandlerskipped_entity_handlerZSkippedEntityHandlerAttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1)rrrrr6s6            zExpatParser.resetcCs|jdkrdS|jjS)N)rr )rrrrr!;s zExpatParser.getColumnNumbercCs|jdkrdS|jjS)Nr")rr#)rrrrr$@s zExpatParser.getLineNumbercCs |jjS)N)r%r&)rrrrr&EszExpatParser.getPublicIdcCs |jjS)N)r%r')rrrrr'HszExpatParser.getSystemIdcCs|jj|t|dS)N)r7Z startElementAttributesImpl)rr?attrsrrrr]LszExpatParser.start_elementcCs|jj|dS)N)r7Z endElement)rr?rrrr^OszExpatParser.end_elementc Cs|j}t|dkrd|f}n&t|dkr<|d|df}nt|}i}i}x|jD]|\}}|j}t|} | dkr|} d|f} n>| dkrd|d|df} |d|df} n|d} t|} ||| <| || <qVW|jj|dt||dS)Nr"rz%s:%sr*)splitlentupleitemsr7ZstartElementNSAttributesNSImpl) rr?rgpairZnewattrsZqnamesZanamerIpartsZlengthZqnameZapairrrrr[Rs.      zExpatParser.start_element_nscCsV|j}t|dkrd|f}n&t|dkr<|d|df}nt|}|jj|ddS)Nr"rhr)rirjrkr7Z endElementNS)rr?rnrrrr\ts   zExpatParser.end_element_nscCs|jj||dS)N)r7rV)rtargetrMrrrprocessing_instructionsz"ExpatParser.processing_instructioncCs|jj|dS)N)r7rW)rrMrrrcharacter_dataszExpatParser.character_datacCs|jj||dS)N)r7ZstartPrefixMapping)rprefixZurirrrrasz ExpatParser.start_namespace_declcCs|jj|dS)N)r7ZendPrefixMapping)rrsrrrrbszExpatParser.end_namespace_declcCs|jj|||dS)N)r/ZstartDTD)rr?sysidpubidZhas_internal_subsetrrrrXszExpatParser.start_doctype_declcCs|jj||||dS)N) _dtd_handlerZunparsedEntityDecl)rr?basertruZ notation_namerrrr_sz ExpatParser.unparsed_entity_declcCs|jj|||dS)N)rvZ notationDecl)rr?rwrtrurrrr`szExpatParser.notation_declc Cs|js dS|jj||}tj||jjp*d}|jj|j |jf|j j ||_ ||_yt j j ||Wn dS|jd\|_ |_|jd=dS)Nr"rTrrx)r2Z _ent_handlerZ resolveEntityrr5r%r'r1appendrZExternalEntityParserCreaterr-r8)rcontextrwrtrur:rrrrcs  zExpatParser.external_entity_refcCs|r d|}|jj|dS)N%)r7Z skippedEntity)rr?Zis_perrrrdsz"ExpatParser.skipped_entity_handlerNi)rr|)r)#rrrr(rr8r;r<r@rCrGrJrQr9rRr=rHr6r!r$r&r'r]r^r[r\rqrrrarbrXr_r`rcrdrrrrr)Ws@    '" r)cOs t||S)N)r))argskwargsrrr create_parsersr__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r(versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr r sysplatformZSAXReaderNotAvailableZ xml.parsersr ImportErrorrFZxml.saxrrrrfrm_weakrefrweakrefproxyrZLocatorrr-r)rrZxml.sax.saxutilsZxmlpr<ZsaxZ XMLGeneratorZsetErrorHandlerZ ErrorHandlerr8rrrrsN      $_ PKi#]leBB.sax/__pycache__/xmlreader.cpython-36.opt-1.pycnu[3 \1@sdZddlmZddlmZmZGdddZGdddeZGdd d ZGd d d Z Gd d d Z Gddde Z ddZ e dkre dS)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptionc@seZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZddZd S)! XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.cCs,tj|_tj|_tj|_tj|_dS)N) rZContentHandler _cont_handlerZ DTDHandler _dtd_handlerZEntityResolver _ent_handlerZ ErrorHandler _err_handler)selfr )/usr/lib64/python3.6/xml/sax/xmlreader.py__init__s   zXMLReader.__init__cCs tddS)zAParse an XML document from a system identifier or an InputSource.z This method must be implemented!N)NotImplementedError)r sourcer r r parseszXMLReader.parsecCs|jS)z#Returns the current ContentHandler.)r)r r r r getContentHandler"szXMLReader.getContentHandlercCs ||_dS)z:Registers a new object to receive document content events.N)r)r rr r r setContentHandler&szXMLReader.setContentHandlercCs|jS)z Returns the current DTD handler.)r)r r r r getDTDHandler*szXMLReader.getDTDHandlercCs ||_dS)z7Register an object to receive basic DTD-related events.N)r)r rr r r setDTDHandler.szXMLReader.setDTDHandlercCs|jS)z#Returns the current EntityResolver.)r)r r r r getEntityResolver2szXMLReader.getEntityResolvercCs ||_dS)z0Register an object to resolve external entities.N)r)r Zresolverr r r setEntityResolver6szXMLReader.setEntityResolvercCs|jS)z!Returns the current ErrorHandler.)r )r r r r getErrorHandler:szXMLReader.getErrorHandlercCs ||_dS)z3Register an object to receive error-message events.N)r )r rr r r setErrorHandler>szXMLReader.setErrorHandlercCs tddS)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implementedN)r)r Zlocaler r r setLocaleBszXMLReader.setLocalecCstd|dS)z1Looks up and returns the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r namer r r getFeatureKszXMLReader.getFeaturecCstd|dS)z!Sets the state of a SAX2 feature.zFeature '%s' not recognizedN)r)r rstater r r setFeatureOszXMLReader.setFeaturecCstd|dS)z2Looks up and returns the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rr r r getPropertySszXMLReader.getPropertycCstd|dS)z"Sets the value of a SAX2 property.zProperty '%s' not recognizedN)r)r rvaluer r r setPropertyWszXMLReader.setPropertyN)__name__ __module__ __qualname____doc__r rrrrrrrrrrrrrr r r r r r s   rc@sBeZdZdZdddZddZdd Zd d Zd d ZddZ dS)IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.cCs||_tj|dS)N)_bufsizerr )r bufsizer r r r oszIncrementalParser.__init__cCspddlm}|j|}|j||j}|dkr8|j}|j|j}x|rb|j||j|j}qFW|j dS)Nr)saxutils) r*Zprepare_input_source prepareParsergetCharacterStream getByteStreamreadr(feedclose)r rr*filebufferr r r rss     zIncrementalParser.parsecCs tddS)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.z This method must be implemented!N)r)r datar r r r0szIncrementalParser.feedcCs tddS)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!N)r)r rr r r r,szIncrementalParser.prepareParsercCs tddS)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.z This method must be implemented!N)r)r r r r r1s zIncrementalParser.closecCs tddS)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.z This method must be implemented!N)r)r r r r resetszIncrementalParser.resetN)r6) r!r"r#r$r rr0r,r1r5r r r r r%[s   r%c@s0eZdZdZddZddZddZdd Zd S) LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cCsdS)z6Return the column number where the current event ends.rr )r r r r getColumnNumberszLocator.getColumnNumbercCsdS)z4Return the line number where the current event ends.rr8r )r r r r getLineNumberszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nr )r r r r getPublicIdszLocator.getPublicIdcCsdS)z3Return the system identifier for the current event.Nr )r r r r getSystemIdszLocator.getSystemIdN)r!r"r#r$r9r:r;r<r r r r r7s r7c@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcCs"||_d|_d|_d|_d|_dS)N)_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfile)r system_idr r r r s zInputSource.__init__cCs ||_dS)z/Sets the public identifier of this InputSource.N)r?)r Z public_idr r r setPublicIdszInputSource.setPublicIdcCs|jS)z2Returns the public identifier of this InputSource.)r?)r r r r r;szInputSource.getPublicIdcCs ||_dS)z/Sets the system identifier of this InputSource.N)r>)r rCr r r setSystemIdszInputSource.setSystemIdcCs|jS)z2Returns the system identifier of this InputSource.)r>)r r r r r<szInputSource.getSystemIdcCs ||_dS)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.N)r@)r encodingr r r setEncodingszInputSource.setEncodingcCs|jS)z/Get the character encoding of this InputSource.)r@)r r r r getEncodingszInputSource.getEncodingcCs ||_dS)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.N)rA)r Zbytefiler r r setByteStreams zInputSource.setByteStreamcCs|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.)rA)r r r r r.szInputSource.getByteStreamcCs ||_dS)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.N)rB)r Zcharfiler r r setCharacterStreamszInputSource.setCharacterStreamcCs|jS)z/Get the character stream for this input source.)rB)r r r r r-szInputSource.getCharacterStream)N)r!r"r#r$r rDr;rEr<rGrHrIr.rJr-r r r r r=s    r=c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZd$ddZddZd d!Zd"d#ZdS)%AttributesImplcCs ||_dS)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N)_attrs)r attrsr r r r szAttributesImpl.__init__cCs t|jS)N)lenrL)r r r r getLengthszAttributesImpl.getLengthcCsdS)NZCDATAr )r rr r r getType!szAttributesImpl.getTypecCs |j|S)N)rL)r rr r r getValue$szAttributesImpl.getValuecCs |j|S)N)rL)r rr r r getValueByQName'szAttributesImpl.getValueByQNamecCs||jkrt||S)N)rLKeyError)r rr r r getNameByQName*s zAttributesImpl.getNameByQNamecCs||jkrt||S)N)rLrS)r rr r r getQNameByName/s zAttributesImpl.getQNameByNamecCst|jjS)N)listrLkeys)r r r r getNames4szAttributesImpl.getNamescCst|jjS)N)rVrLrW)r r r r getQNames7szAttributesImpl.getQNamescCs t|jS)N)rNrL)r r r r __len__:szAttributesImpl.__len__cCs |j|S)N)rL)r rr r r __getitem__=szAttributesImpl.__getitem__cCst|jjS)N)rVrLrW)r r r r rW@szAttributesImpl.keyscCs ||jkS)N)rL)r rr r r __contains__CszAttributesImpl.__contains__NcCs|jj||S)N)rLget)r r alternativer r r r]FszAttributesImpl.getcCs |j|jS)N) __class__rL)r r r r copyIszAttributesImpl.copycCst|jjS)N)rVrLitems)r r r r raLszAttributesImpl.itemscCst|jjS)N)rVrLvalues)r r r r rbOszAttributesImpl.values)N)r!r"r#r rOrPrQrRrTrUrXrYrZr[rWr\r]r`rarbr r r r rKs" rKc@s<eZdZddZddZddZddZd d Zd d Zd S)AttributesNSImplcCs||_||_dS)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)rL_qnames)r rMZqnamesr r r r VszAttributesNSImpl.__init__cCs6x(|jjD]\}}||kr |j|Sq Wt|dS)N)rdrarLrS)r rnsnameqnamer r r rR^sz AttributesNSImpl.getValueByQNamecCs0x"|jjD]\}}||kr |Sq Wt|dS)N)rdrarS)r rrerfr r r rTeszAttributesNSImpl.getNameByQNamecCs |j|S)N)rd)r rr r r rUlszAttributesNSImpl.getQNameByNamecCst|jjS)N)rVrdrb)r r r r rYoszAttributesNSImpl.getQNamescCs|j|j|jS)N)r_rLrd)r r r r r`rszAttributesNSImpl.copyN) r!r"r#r rRrTrUrYr`r r r r rcTs rccCstttdS)N)rr%r7r r r r _testvsrg__main__N)r$r+r _exceptionsrrrr%r7r=rKrcrgr!r r r r s PJY>"PKi#]@s+++parsers/__pycache__/__init__.cpython-36.pycnu[3 \@sdZdS)zPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N)__doc__rr,/usr/lib64/python3.6/xml/parsers/__init__.pysPKi#]@s++1parsers/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \@sdZdS)zPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N)__doc__rr,/usr/lib64/python3.6/xml/parsers/__init__.pysPKi#]9:.parsers/__pycache__/expat.cpython-36.opt-2.pycnu[3 \@s(ddlZddlTeejd<eejd<dS)N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)sysZpyexpatZmodelmoduleserrorsrr)/usr/lib64/python3.6/xml/parsers/expat.pys PKi#]P\}(1parsers/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \@sdS)Nrrr,/usr/lib64/python3.6/xml/parsers/__init__.pysPKi#]dGHH(parsers/__pycache__/expat.cpython-36.pycnu[3 \@s,dZddlZddlTeejd<eejd<dS)z1Interface to the Expat non-validating XML parser.N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)__doc__sysZpyexpatZmodelmoduleserrorsrr)/usr/lib64/python3.6/xml/parsers/expat.pys PKi#]dGHH.parsers/__pycache__/expat.cpython-36.opt-1.pycnu[3 \@s,dZddlZddlTeejd<eejd<dS)z1Interface to the Expat non-validating XML parser.N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)__doc__sysZpyexpatZmodelmoduleserrorsrr)/usr/lib64/python3.6/xml/parsers/expat.pys PKi#] J#__pycache__/__init__.cpython-36.pycnu[3 \-@sdZddddgZdS)aCore XML support for Python. This package contains four sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Megginson and ported to Python by Lars Marius Garshol. This supports the SAX 2 API. etree -- The ElementTree XML library. This is a subset of the full ElementTree XML release. ZdomZparsersZsaxZetreeN)__doc____all__rr$/usr/lib64/python3.6/xml/__init__.pysPKi#] J)__pycache__/__init__.cpython-36.opt-1.pycnu[3 \-@sdZddddgZdS)aCore XML support for Python. This package contains four sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Megginson and ported to Python by Lars Marius Garshol. This supports the SAX 2 API. etree -- The ElementTree XML library. This is a subset of the full ElementTree XML release. ZdomZparsersZsaxZetreeN)__doc____all__rr$/usr/lib64/python3.6/xml/__init__.pysPKi#]!)__pycache__/__init__.cpython-36.opt-2.pycnu[3 \-@sddddgZdS)ZdomZparsersZsaxZetreeN)__all__rr$/usr/lib64/python3.6/xml/__init__.pysPKm#]N*etree/__pycache__/__init__.cpython-312.pycnu[ ThEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsrPKm#]>h993etree/__pycache__/ElementPath.cpython-312.opt-1.pycnu[ Th6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]7} ||}t|j|j}||ur|9y#tt f$rYLwxYwwr)r#listr r IndexErrorr)r r/rr0rdelemsindexs rr3z!prepare_predicate..selectEsk'0J'-F !9:EU|t+" #H-s(A!4A  A! AA!AA!zinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR  ) **M   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|hsv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)rr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > n+b        'X8 2 r$PKm#]LN0etree/__pycache__/ElementInclude.cpython-312.pycnu[ Th(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76rPKm#]N0etree/__pycache__/__init__.cpython-312.opt-2.pycnu[ ThEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsrPKm#]؅4etree/__pycache__/cElementTree.cpython-312.opt-1.pycnu[ ThRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $rPKm#]؅4etree/__pycache__/cElementTree.cpython-312.opt-2.pycnu[ ThRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $rPKm#]>h99-etree/__pycache__/ElementPath.cpython-312.pycnu[ Th6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]7} ||}t|j|j}||ur|9y#tt f$rYLwxYwwr)r#listr r IndexErrorr)r r/rr0rdelemsindexs rr3z!prepare_predicate..selectEsk'0J'-F !9:EU|t+" #H-s(A!4A  A! AA!AA!zinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR  ) **M   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|hsv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)rr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > n+b        'X8 2 r$PKm#]>h993etree/__pycache__/ElementPath.cpython-312.opt-2.pycnu[ Th6ddlZejdZddZdZdZdZdZdZd Z d Z d Z d Z eee e e e d Z iZGddZddZddZddZddZy)Nz`('[^']*'|\"[^\"]*\"|::|//?|\.\.|\(\)|!=|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|\s+c#jK|r|jdnd}d}tj|D]d}|\}}|rR|ddk7rJd|vr.|jdd\}} |st|d||d|fn|r|s |d|d|fn|d}\||d k(}fy#t$rt d|zdwxYww) NFr{:}z!prefix %r not found in prefix map@)getxpath_tokenizer_refindallsplitKeyError SyntaxError) pattern namespacesdefault_namespaceparsing_attributetokenttypetagprefixuris ./usr/lib64/python3.12/xml/etree/ElementPath.pyxpath_tokenizerrJs.8 r*d#++G4 s 3q6S=cz!iiQ/ ^%&Z-?!EEE#+<):C@@@ % K % %5 ^%&IF&RSY]]^sAB3B2%B3B00B3c|j}|4ix|_}|jjD]}|D]}|||< |SN) parent_maprootiter)contextrpes rget_parent_mapr#bsR##J*,,Z""$A ! 1 % c&|dddk(xs|dddk(S)N{*}}*rs r_is_wildcard_tagr,ls# r7e  /s23x4//r$c8ttcdk(rfd}|Sdk(rfd}|Sdddk(r+ddtt dddfd}|Sd dd k(r$dd tdtfd }|St d )Nz{*}*c3LK|D]}|js|ywrr+)r resultelem _isinstance_strs rselectz_prepare_tag..selectvs$txx.Js$$z{}*c3bK|D]%}|j}|s|ddk7s"|'yw)Nrrr+)r r/r0el_tagr1r2s rr3z_prepare_tag..select|s4vt,c1AJ ///r&r'c3lK|D]*}|j}|k(s|s|k(s'|,ywrr+) r r/r0r5r1r2no_nssuffixrs rr3z_prepare_tag..selects;S=K$=&-SYBYJs 444r(r)c3bK|D]%}|j}|s|k(s"|'ywrr+)r r/r0r5r1r2nsns_onlys rr3z_prepare_tag..selects4vt,B1FJr6zinternal parser error, got ) isinstancestrslicelen RuntimeError)rr3r1r2r9r=r>r:s` @@@@@@r _prepare_tagrDps"CK f} @ M9  4 M+ RaE QRs6{lD)!"g   M RST  "Xc"g&  M8>??r$cr|dtrtfd}|Sdddk(rddfd}|S)Nrc(d}|||S)Nc32K|D] }|Ed{y7wrr*)r/r0s r select_childz3prepare_child..select..select_childs"D#OO## r*r r/rH select_tags rr3zprepare_child..selects $g|F';< .selects+Auu|s' ')r,rDnextrr3rKrs @@r prepare_childrQsP (C!#&  = M r7d?ab'C Mr$c d}|S)Nc32K|D] }|Ed{y7wrr*)r r/r0s rr3zprepare_star..selectsDOO rIr*rPrr3s r prepare_starrUs Mr$c d}|S)Nc3$K|Ed{y7wrr*)r r/s rr3zprepare_self..selectss r*rTs r prepare_selfrXs  Mr$c |}|ddk(rdn|ds|dn tdtrtfd}|Sdddk(rddfd}|S#t$rYywxYw) Nr*rzinvalid descendantc(d}|||S)Nc3VK|D] }|jD] }||us| "ywrr)r/r0r"s rrHz8prepare_descendant..select..select_childs,"D!YY[D="#G)#s) )r*rJs rr3z"prepare_descendant..selects $ g|F';< .selects/3A}(s+ +) StopIterationrr,rDrOs @@rprepare_descendantr`s Qx3 1XAh.//!#&  = M r7d?ab'C M5 sA A)(A)c d}|S)Nc3dKt|}i}|D]}||vs||}||vsd||<|ywr)r#)r r/r result_mapr0parents rr3zprepare_parent..selectsH#G,  Dz!#D)+)-Jv& L s 0 0 0r*rTs rprepare_parentres ! Mr$c g}g} |}|ddk(rnL|dk(r|dr|ddddvr d|dddf}|j|dxsd|j|d]d j|}|d k(r |dfd }|S|d k(s|d k(r|d|d  fd} fd}d|vr|S|S|dk(r%tjd|ds |dfd}|S|dk(s(|dk(s#|dk(s|dk(rDtjd|ds+|d|d r  fd} fd}n fd} fd}d|vr|S|S|dk(s |dk(s|dk(ri|dk(r!t |ddz dkrGt d|ddk7r t d|dk(r" t |d dz d"kDr t d#dfd$}|St d%#t$rYywxYw#t$r t d!wxYw)&Nrr])rrz'"'r;-rz@-c3HK|D]}|j|ywrr )r r/r0keys rr3z!prepare_predicate..selects$88C=,J""z@-='z@-!='c3NK|D]}|jk(s|ywrrk)r r/r0rlvalues rr3z!prepare_predicate..selects&88C=E)Js%%c3XK|D] }|jx}|k7s|"ywrrk)r r/r0 attr_valuerlros rselect_negatedz)prepare_predicate..select_negateds0"&((3-/J<uATJs ***z!=z\-?\d+$c3HK|D]}|j|ywr)find)r r/r0rs rr3z!prepare_predicate..selects$99S>-Jrmz.='z.!='z-='z-!='c3K|D]@}|jD]*}dj|jk(s&|@BywNr)r joinitertextr r/r0r"rros rr3z!prepare_predicate..selectsC"D!\\#.771::<0E9"&J!/# .select_negated"sC"D!]]3/771::<0E9"&J!0#rzc3jK|D])}dj|jk(s&|+ywrvrwrxr r/r0ros rr3z!prepare_predicate..select)-"Dwwt}}/58" #(33c3jK|D])}dj|jk7s&|+ywrvr~rs rrrz)prepare_predicate..select_negated-rrz-()z-()-zXPath position >= 1 expectedlastzunsupported functionr7zunsupported expressionr(z)XPath offset from last() must be negativec3Kt|}|D]7} ||}t|j|j}||ur|9y#tt f$rYLwxYwwr)r#listr r IndexErrorr)r r/rr0rdelemsindexs rr3z!prepare_predicate..selectEsk'0J'-F !9:EU|t+" #H-s(A!4A  A! AA!AA!zinvalid predicate)r_appendrwrematchintr ValueError) rPr signature predicater3rrrrlrros @@@@rprepare_predicaters|II  FE 8s?  H   8a! -q!B'EqS)q"  "IDl  Fi72l"   "&!2~>>CYq\ Bl  EY&0 % 9#6HHZ16l"   "  " # #"&!2~>>C9-f1D   ! %)Eqy!"@AA|v%!"899F"@ ! -1E2:%&QRR  ) **M   h"@%&>??@sF6G6 GGG)rrZ.z..z//[ceZdZdZdZy)_SelectorContextNc||_yr)r)selfrs r__init__z_SelectorContext.__init__`s  r$)__name__ __module__ __qualname__rrr*r$rrr^s Jr$rc|dddk(r|dz}|f}|r%|tt|jz } t|}|g}t|}|D] } | ||} |S#t$rt tdkDrtj |dddk(r tdtt||j} |}n#t$rYYywxYwg} |jt|d||n#t$r tddwxYw |}|ddk(r|}n#t$rYnwxYwd|t|<Y wxYw) Nr;/rZdrz#cannot use absolute path on elementrz invalid path)tuplesorteditems_cacherrBclearrrr__next__r_ropsr) r0pathr cache_keyselectorrPrr/r r3s rr|r|hsv BCyCczIU6*"2"2"4566 %)$2VFt$G( M9 % v;  LLN 8s?CD DOD*56?? FE    <E!H dE :;  <!.1t; < 8s? FE   %y-%sr A""A!EC  E CECE !DEDED32E3 D?<E>D?? EEc0tt|||dSr)rPr|r0rrs rrtrts tZ0$ 77r$c.tt|||Sr)rr|rs rr r s tZ0 11r$c tt|||}|jy|jS#t$r|cYSwxYwrv)rPr|textr_)r0rdefaultrs rfindtextrsEHT445 99 yy s"1 1 ??r)NN)rcompiler rr#r,rDrQrUrXr`rerrrrr|rtr rr*r$rrsv RZZ   -00&R&  > n+b        'X8 2 r$PKm#]\3etree/__pycache__/ElementTree.cpython-312.opt-2.pycnu[ Th!! gdZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z Gdde Z dZGd d Zifd ZdBd ZdBd ZeZGddZGddZej,dZdBdZdZhdZdZdZeeedZdZddddddd d!Zee_d"Z d#Z!d$Z"d%Z#dCddd&d'd(Z$Gd)d*ejJZ&dCddd&d'd+Z'd,Z(dDd-Z)dBd.Z*dCd/Z+Gd0d1Z,dBd2Z-dBd3Z.e-Z/dBd4Z0Gd5d6Z1Gd7d8Z2dBddd9d:Z3ejhd;ejjjlZ7Gd<d=Z8d>Z9d?Z: eZ;dd@l<ddAl$rYywxYw)E)CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathceZdZ y)r N)__name__ __module__ __qualname__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r$r c t|dS)Ntag)hasattr)elements r%r r ys< 7E ""r$ceZdZ dZ dZ dZ dZ ifdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZddZddZddZddZdZddZdZdZdZddZdZy)rNc t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r'attrib _children)selfr'r0extras r%__init__zElement.__init__sL&$'  )),- -))5) r$c`d|jj|jt|fzS)Nz<%s %r at %#x>)r/r r'idr2s r%__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr$c( |j||SN)r/)r2r'r0s r% makeelementzElement.makeelements ~~c6**r$c|j|j|j}|j|_|j|_||dd|Sr:)r;r'r0texttail)r2elems r%__copy__zElement.__copy__s@$++6II II Q r$c,t|jSr:)lenr1r7s r%__len__zElement.__len__s4>>""r$cjtjdtdt|jdk7S)NzTesting an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)warningswarnDeprecationWarningrBr1r7s r%__bool__zElement.__bool__s1  K 1   4>>"a''r$c |j|Sr:r1r2indexs r% __getitem__zElement.__getitem__s~~e$$r$ct|tr|D]}|j|n|j|||j|<yr:)r,slice_assert_is_elementr1)r2rOr)elts r% __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur$c|j|=yr:rMrNs r% __delitem__zElement.__delitem__s NN5 !r$c^ |j||jj|yr:rSr1appendr2 subelements r%rZzElement.appends)   + j)r$cl |D].}|j||jj|0yr:rY)r2elementsr)s r%extendzElement.extends3  G  # #G , NN ! !' * r$c` |j||jj||yr:)rSr1insert)r2rOr\s r%razElement.inserts'6  + eZ0r$cft|ts!tdt|jzy)Nzexpected an Element, not %s)r, _Element_Pyr.typer )r2es r%rSzElement._assert_is_elements.![)9DGr7s r%rvz Element.clear?s.  $$ DIr$c< |jj||Sr:)r0get)r2keyrps r%rxz Element.getJs {{sG,,r$c$ ||j|<yr:)r0)r2ryvalues r%setz Element.setWs ! Cr$c8 |jjSr:)r0keysr7s r%r~z Element.keysas {{!!r$c8 |jjSr:)r0itemsr7s r%rz Element.itemsjs {{  ""r$c#K |dk(rd}||j|k(r||jD]}|j|Ed{y7w)N*)r'r1iter)r2r'res r%rz Element.iterusO  #:C ;$((c/JAvvc{ " " "sAA A A c#K |j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7wr:)r'r,strr=itertextr>)r2r'tres r%rzElement.itertextse hh#s#  II GAzz| # #A  #sA A* A(A*!A*r:NN) r r!r"r'r0r=r>r4r8r;r@rCrKrPrUrWrZr_rarSrgrirnrrrtrvrxr|r~rrrr#r$r%rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r$rc Z i||}|j||}|j||Sr:)r;rZ)parentr'r0r3r)s r%rrs; ! % F  f-G MM' Nr$c4 tt}||_|Sr:)rrr=)r=r)s r%rrsgGGL Nr$cf tt}||_|r|jdz|z|_|S)N )rrr=)targetr=r)s r%rrs8+,GGL ||c)D0 Nr$cFeZdZ d dZdZdZdZdZdZdZ d Z d Z y) rNc&|rd|d|}||_y)N{}r=)r2 text_or_urir's r%r4zQName.__init__s &137K r$c|jSr:rr7s r%__str__z QName.__str__s yyr$cPd|jjd|jdS)N)r/r r=r7s r%r8zQName.__repr__s NN33TYY??r$c,t|jSr:)hashr=r7s r%__hash__zQName.__hash__sDIIr$crt|tr|j|jkS|j|kSr:r,rr=r2others r%__le__z QName.__le__. eU #99 * *yyE!!r$crt|tr|j|jkS|j|kSr:rrs r%__lt__z QName.__lt__. eU #99uzz) )yy5  r$crt|tr|j|jk\S|j|k\Sr:rrs r%__ge__z QName.__ge__rr$crt|tr|j|jkDS|j|kDSr:rrs r%__gt__z QName.__gt__rr$crt|tr|j|jk(S|j|k(Sr:rrs r%__eq__z QName.__eq__rr$r:) r r!r"r4rr8rrrrrrr#r$r%rrs5  @"!"!"r$rcneZdZ ddZdZdZddZddZddZddZ dd Z dd Z dd d d Z dZ y)rNc:||_|r|j|yyr:)_rootr )r2r)files r%r4zElementTree.__init__ s  JJt  r$c |jSr:rr7s r%getrootzElementTree.getroots/zzr$c ||_yr:r)r2r)s r%_setrootzElementTree._setroots  r$c d}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)NFreadrbT _parse_wholei)r(openrrrcloserfeed)r2sourceparser close_sourcedatas r%r zElementTree.parse!s  vv&&$'FL ~"6>2 "(!4!4V! r=r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r2file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrl serializes r%rzElementTree.writes  .F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r2rs r% write_c14nzElementTree.write_c14nszz$vz..r$rr:)NNNN)r r!r"r4rrr rrirnrrrtrrr#r$r%rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r$rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr#r#r$r%z_get_writer..sDr$xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr,ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r%rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr'r,rr=rrr rr) r?rrr'ryr{r=rlrs ` @@r%rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r$c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr#xs r%rz _serialize_xml..hQqTr$ryr xmlns=""rr)r'r=rr _escape_cdata_serialize_xmllistrsorted_escape_attribr,rrBr>) rr?rrlrkwargsr'r=rervks r%rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r$>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrrrc |dSr r#r s r%rz!_serialize_html..r r$rrrrrrrscriptstyler)r'r=rrr_serialize_htmlrrrrr,r_escape_attrib_htmlr HTML_EMPTYr>) rr?rrlrr'r=rerrrltags r%r/r/s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r$c||jD] }|| |jr||jyyr:)rr>)rr?parts r%rrs1  d   yy diir$)rhtmlr=c tjd|r tdttj D]\}}||k(s||k(st|=|t|<y)Nzns\d+$z'Prefix format reserved for internal use)rematchrrrr)rrrrs r%rrs`  xx 6"BCC^))+,1 8qF{q!-!N3r$rr5rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r.rdr rs r%rrs! +/d1D1DE  r$c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer.rrrs r%rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrBrCrrDrrEr" z rz  z rFrs r%rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrBrCrrErrJrFrs r%r0r0sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rHT)rrrc |dk(rtjntj}t|j |||||||j S)Nrrrrr)rStringIOBytesIOrrgetvalue)r)rrrrrstreams r%rr+s[ ')3R[[]Fvx/>1B&,4H J ?? r$c,eZdZ dZdZdZdZdZy)_ListDataStreamc||_yr:)lst)r2rWs r%r4z_ListDataStream.__init__Es r$cyrr#r7s r%rz_ListDataStream.writableHr$cyrr#r7s r%rz_ListDataStream.seekableKrYr$c:|jj|yr:)rWrZ)r2bs r%rz_ListDataStream.writeNs r$c,t|jSr:)rBrWr7s r%rz_ListDataStream.tellQs488}r$N)r r!r"r4rrrrr#r$r%rUrUCsAr$rUc`g}t|}t|j|||||||S)NrO)rUrr)r)rrrrrrWrSs r%rrTsC C S !Fvx/>1B&,4H J Jr$c t|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)Nr)rr)r,rrsysstdoutrr>)r?r>s r%rrasg dK (4 JJszzIJ. <<>  D 48t# $r$c t|tr|j}|dkrtd|t |syd|zzgfd|dy)Nrz,Initial indentation level must be >= 0, got rc|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorrZr=striprBr>)r?level child_levelchild_indentationchild_indent_children indentationsspaces r%rkz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r,rrrrB)treermrgrkrls ` @@r%rrtsg $ $||~ qyGwOPP t955=()L-,T1r$c@ t}|j|||Sr:)rr )rrrns r%r r s# =DJJvv Kr$c t||tdstddndfdGfddtjj }|}d|_tj||S) N)events_parserrrTFc3\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrvitr pullparserwrs r%iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr:)r)r2rrs r%__del__z,iterparse..IterParseIterator.__del__s r$N)r r!r"__next__r~)rrzrsr%IterParseIteratorr|sF#,, r$r) rr(r collectionsabcIteratorrvweakrefref) rrqrrrwrrzrxrys ` @@@@r%r r sy  ff=J 66 "fd#  $KOO44  BBG RB Ir$c8eZdZd dddZdZdZdZdZdZy) rN)rrctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrr _setevents)r2rqrrs r%r4zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r$c |j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Nz!feed() called after end of stream)rrrr SyntaxErrorrrZ)r2rexcs r%rzXMLPullParser.feedsc* << @A A  / !!$'  /""))#.. /s9 A'A""A'cH|jj}d|_|Sr:)rrr)r2rvs r%ruz$XMLPullParser._close_and_return_roots ||!!#  r$c& |jyr:)rur7s r%rzXMLPullParser.closes ##%r$c#~K |j}|r*|j}t|tr|||r)yywr:)rpopleftr, Exception)r2rqevents r%rtzXMLPullParser.read_eventss@ ##NN$E%+  s8==cf|j td|jjy)Nz"flush() called after end of stream)rrrflushr7s r%rzXMLPullParser.flush$s( << AB B r$r:) r r!r"r4rrurrtrr#r$r%rrs' r$c |stt}|j||j}i}|j D]}|j d}|s|||<||fS)Nrr6)rrrrrrx)r=rrnidsr?r6s r%rr;si +-0 KK <<>D C  XXd^ CG 9r$c |stt}|D]}|j||jSrr)sequencerr=s r%rrSs: +-0 D <<>r$cTeZdZ d ddddddZdZdZdZdZd Zd Z d d Z d Z y)rNF)comment_factory pi_factoryinsert_comments insert_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr:) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r2element_factoryrrrrs r%r4zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r$c |jSr:rr7s r%rzTreeBuilder.closesIzzr$c|jr^|jJdj|j}|jr||j_n||j_g|_yyNr)rrjoinrr>r=r2r=s r%_flushzTreeBuilder._flushsP ::zz%wwtzz*::&*DJJO'+DJJODJ r$c< |jj|yr:)rrZr2rs r%rzTreeBuilder.datas* $r$c |j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)Nr`r)rrrrrZrr)r2r'attrsr?s r%startzTreeBuilder.startsu  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r$c |j|jj|_d|_|jSr )rrpoprrrs r%rzTreeBuilder.ends7 ZZ^^%  zzr$cR |j|j|j|Sr:)_handle_singlerrrs r%commentzTreeBuilder.comments/ ""  ! !4#7#7? ?r$cT |j|j|j||Sr:)rrr)r2rr=s r%pizTreeBuilder.pis/ ""   doovt= =r$c||}|rH|j||_|jr|jdj|d|_|S)Nr`r)rrrrZr)r2factoryraargsr?s r%rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r$r:) r r!r"r4rrrrrrrrr#r$r%rresC&(!%$!&5((  " ?=r$rc^eZdZ ddddZdZdZdZdZdZd Z d Z d Z d Z d Z dZy)rN)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrrr_targeterror_error_names_defaultDefaultHandlerExpandr(_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r2rrrrs r%r4zXMLParser.__init__s  )##Hc2 > ]F%++ dl%++ dlkk  &*mm# 67 #)-F & 65 !'+yyF $ 6: &/3~~F , 68 $-1\\F * 66 "*0++F ' 69 %$*NNF ! 64 28))F /$%!   +e.@.@@DLM  ' !M ( N   s;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr:r#)r' attrib_inrrZrs r%handlerz%XMLParser._setevents..handler"sE5i#89:r$rc$||||fyr:r#)r'rrZrs r%rz%XMLParser._setevents..handler'sE3s8,-r$zstart-nsrc&|||||fyr:r#)rrrrZrs r%rz%XMLParser._setevents..handler.sx'<=>r$c,|||xsd|xsdffyrr#)rrrrZs r%rz%XMLParser._setevents..handler2s "ciR'@ABr$zend-nsrc$||||fyr:r#)rrrZrs r%rz%XMLParser._setevents..handler8svf~67r$c||dfyr:r#)rrrZs r%rz%XMLParser._setevents..handler<st}-r$rcJ|||jj|fyr:)rr)r=rrZr2s r%rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r$rcL|||jj||fyr:)rr) pi_targetrrrZr2s r%rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr$zunknown event %r)rrrZrrrrrr(rrrrrrrr)r2 events_queueevents_to_reportrrZ event_namers r%rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r$cxt|}|j|_|j|jf|_|r:)r codelinenooffsetposition)r2r{errs r% _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r$cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r2rynames r%_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr2rrs r%rzXMLParser._start_ns\s!{{##FLb#)<;B =A>>B Bcx|jj} |jjd|jjdd|jj|y#|j$r}|j |Yd}~Ad}~wwxYw#|jj|wxYw)NFr$)rGetReparseDeferralEnabledSetReparseDeferralEnabledrrr)r2 was_enabledrs r%rzXMLParser.flushskk;;=  ? KK 1 1% 8 KK  c5 ) KK 1 1+ >{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r4rrrrrrrrrrrr#r$r%rrsN"&+Z3Bj =0 .34%l *"?r$r)out from_filec $ | | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)Nz:Either 'xml_data' or 'from_file' must be provided as inputr)r) rrrPrrrrrr rR)xml_datarroptionssiors r%rrs I-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r$z ^\w+:\w+$ceZdZ dddddddddZefdZdZddZdZd jfd Z d Z d Z dd Z dZdZdZy)rFN) with_comments strip_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r>rFr)_writer_with_comments _strip_textr|_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackrZrrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r2rr$r%r&r'r(r)r*s r%r4zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r$c#DK||D]}|s|Ed{y7wr:r#)r2ns_stack _reversedrls r%_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitr@r6r)r2 prefixed_namerrrps r%_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r$c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrr`z Namespace "rB) rr|r@r5addr1r7rBrZr6r)r2rrr' prefixes_seenurs r%_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr$cT|js|jj|yyr:)r<rrZrs r%rzC14NWriterTarget.dataYs""" JJ  d ##r$rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNr`) rr.r8rfr9_looks_like_prefix_namerr:r,_escape_cdata_c14n)r2 _join_textrr qname_texts r%rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r$c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rC)rs r%rz)C14NWriterTarget._start..s!''#q/r$rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserver`rrrrrrT)r/rrFrHr4rOrKrsortrZrxr8r,r_escape_attrib_c14nrPr:r6)r2r'rrUrRrrrresolved_namesrqattrs attr_namer{ parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r%rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r<rrr,rKr8rrBr;r5r6rs r%rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r$c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r-r<r;r,r:rrrPrs r%rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r$c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r<r;r,r:rrrP)r2rrs r%rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r$r:)r r!r"r4reversedr@rFrKrrrrrrrrrr#r$r%rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r$rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrBrCrrDrrErK rFrs r%rPrPs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrBrCrrDrrJrLz rz rKrhrFrs r%r[r[s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr:r)z r)?__all__rrar7rHrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr1r/rrrrrrrr0rrrUrrrr r rrrrrrrrcompileUNICODEr8rOrrPr[rc _elementtreerjrr#r$r%rqs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E++E32E3PKm#]LN6etree/__pycache__/ElementInclude.cpython-312.opt-1.pycnu[ Th(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76rPKm#]LN6etree/__pycache__/ElementInclude.cpython-312.opt-2.pycnu[ Th(ddlZddlmZddlmZdZedzZedzZdZGd d e Z Gd d e Z dd Z ddefdZ dZy)N) ElementTree)urljoinz!{http://www.w3.org/2001/XInclude}includefallbackc eZdZy)FatalIncludeErrorN__name__ __module__ __qualname__1/usr/lib64/python3.12/xml/etree/ElementInclude.pyr r Crr c eZdZy)LimitedRecursiveIncludeErrorNr rrrrrGrrrc|dk(r:t|d5}tj|j}ddd|S|sd}t|d|5}|j }ddd|S#1swYSxYw#1swYSxYw)NxmlrbzUTF-8r)encoding)openrparsegetrootread)hrefrrfiledatas rdefault_loaderr!Ws ~ $ $$T*224D K H $h /499;D0 K K0 Ks$A-A:-A7:Bc|d}n|dkrtd|zt|dr|j}|t}t ||||t y)Nrz;expected non-negative depth or None for 'max_depth', got %rr) ValueErrorhasattrrr!_includeset)elemloaderbase_url max_depths rrrusW QVYbbcctY||~ ~ T68Y6rcd}|t|kr||}|jtk(r|jd}|r t ||}|jdd}|dk(r||vrt d|z|dk(rt d|z|j||||} | t d|d|tj| } t| |||d z ||j||jr"| jxsd |jz| _ | ||<n|d k(r||||jd } | t d|d||jr| |jz } |r!||d z } | jxsd | z| _ n|jxsd | z|_ ||=t d |z|jtk(rt d|jzt||||||d z }|t|kryy)Nrrrrzrecursive include of %sz5maximum xinclude depth reached when including file %sz cannot load z as rtextrz)unknown parse type in xi:include tag (%r)z0xi:fallback tag must be child of xi:include (%r))lentagXINCLUDE_INCLUDEgetrr raddcopyr&removetailr.XINCLUDE_FALLBACK) r(r)r*r+ _parent_hrefsierrnoder.s rr&r&s A c$i- G 55$ $55=Dx.EE'5)E~=(+,E,LMM>6ORVVXX!!$'dE*<+26>yyvtY]MJ$$T*66!%bAFF :DIQ&dE155+<=<+26>66AFFND!9D!%bD 8DI!%bD 8DIG'?%GUU' '#BQUUJ  Q)] C Qg c$i-r)N)r4r-r urllib.parserXINCLUDEr1r7DEFAULT_MAX_INCLUSION_DEPTH SyntaxErrorr rr!rr&rrrr@sff  .i'z)     #4 <1 76rPKm#]؅.etree/__pycache__/cElementTree.cpython-312.pycnu[ ThRddly))*N)xml.etree.ElementTree//usr/lib64/python3.12/xml/etree/cElementTree.pyrs $rPKm#]k7A7A-etree/__pycache__/ElementTree.cpython-312.pycnu[ Th!!dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdCd ZdCdZeZGddZGddZe j.dZdCdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dDddd'd(d)Z%Gd*d+ejLZ'dDddd'd(d,Z(d-Z)dEd.Z*dCd/Z+dDd0Z,Gd1d2Z-dCd3Z.dCd4Z/e.Z0dCd5Z1Gd6d7Z2Gd8d9Z3dCddd:d;Z4ejjdZ9d?Z:d@Z; eZZ>e>eey#e?$rYywxYw)FaLightweight 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. )CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathceZdZdZy)r zAn 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__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r%r ct|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elements r&r r ys 7E ""r%ceZdZdZdZ dZ dZ dZ ifdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZddZddZddZddZdZddZdZdZdZddZdZ y)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: text...tail Nc t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__sL&$'  )),- -))5) r%c`d|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr%c&|j||S)zCreate 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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6**r%c|j|j|j}|j|_|j|_||dd|SN)r;r(r1texttail)r3elems r&__copy__zElement.__copy__s@$++6II II Q r%c,t|jSr=)lenr2r8s r&__len__zElement.__len__s4>>""r%cjtjdtdt|jdk7S)NzTesting an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)warningswarnDeprecationWarningrCr2r8s r&__bool__zElement.__bool__s1  K 1   4>>"a''r%c |j|Sr=r2r3indexs r& __getitem__zElement.__getitem__s~~e$$r%ct|tr|D]}|j|n|j|||j|<yr=)r-slice_assert_is_elementr2)r3rPr*elts r& __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur%c|j|=yr=rNrOs r& __delitem__zElement.__delitem__s NN5 !r%c\|j||jj|y)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. NrTr2appendr3 subelements r&r[zElement.appends$  + j)r%cj|D].}|j||jj|0y)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. NrZ)r3elementsr*s r&extendzElement.extends.  G  # #G , NN ! !' * r%c^|j||jj||y)z(Insert *subelement* at position *index*.N)rTr2insert)r3rPr]s r&rbzElement.inserts$  + eZ0r%cft|ts!tdt|jzy)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rTzElement._assert_is_elements.![)9DGr?r8s r&rwz Element.clear?s)  $$ DIr%c:|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. )r1get)r3keyrqs r&ryz Element.getJs{{sG,,r%c"||j|<y)zSet 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)r1)r3rzvalues r&setz Element.setWs! Cr%c6|jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r1keysr8s r&rz Element.keysas{{!!r%c6|jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r1itemsr8s r&rz Element.itemsjs{{  ""r%c#K|dk(rd}||j|k(r||jD]}|j|Ed{y7w)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(r2iter)r3r(rfs r&rz Element.iterusJ #:C ;$((c/JAvvc{ " " "sAA A A c#K|j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7w)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r(r-strr>itertextr?)r3r(trfs r&rzElement.itertexts`hh#s#  II GAzz| # #A  #sA A) A' A) A)r=NN)!r r!r"r#r(r1r>r?r5r9r;rArDrLrQrVrXr[r`rbrTrhrjrorsrurwryr}rrrrr$r%r&rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r%rc Xi||}|j||}|j||S)aSubelement 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[)parentr(r1r4r*s r&rrs6! % F  f-G MM' Nr%c2tt}||_|S)zComment 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. )rrr>)r>r*s r&rrsgGGL Nr%cdtt}||_|r|jdz|z|_|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.  )rrr>)targetr>r*s r&rrs3+,GGL ||c)D0 Nr%cHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) raQualified 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. Nc&|rd|d|}||_y)N{}r>)r3 text_or_urir(s r&r5zQName.__init__s &137K r%c|jSr=rr8s r&__str__z QName.__str__s yyr%cPd|jjd|jdS)N)r0r r>r8s r&r9zQName.__repr__s NN33TYY??r%c,t|jSr=)hashr>r8s r&__hash__zQName.__hash__sDIIr%crt|tr|j|jkS|j|kSr=r-rr>r3others r&__le__z QName.__le__. eU #99 * *yyE!!r%crt|tr|j|jkS|j|kSr=rrs r&__lt__z QName.__lt__. eU #99uzz) )yy5  r%crt|tr|j|jk\S|j|k\Sr=rrs r&__ge__z QName.__ge__rr%crt|tr|j|jkDS|j|kDSr=rrs r&__gt__z QName.__gt__rr%crt|tr|j|jk(S|j|k(Sr=rrs r&__eq__z QName.__eq__rr%r=) r r!r"r#r5rr9rrrrrrr$r%r&rrs5  @"!"!"r%rcpeZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZy)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. Nc:||_|r|j|yyr=)_rootr )r3r*files r&r5zElementTree.__init__ s  JJt  r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zzr%c||_y)zReplace 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)r3r*s r&_setrootzElementTree._setroots  r%cd}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)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. FreadrbT _parse_wholei)r)openrrrcloserfeed)r3sourceparser close_sourcedatas r&r zElementTree.parse!s vv&&$'FL ~"6>2 "(!4!4V! r>r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrm serializes r&rzElementTree.writes:F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz..r%rr=)NNNN)r r!r"r#r5rrr rrjrorsrurrr$r%r&rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r%rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr(r-rr>rrr rr) r@rrr(rzr|r>rmrs ` @@r&rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r%c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr$xs r&rz _serialize_xml..hQqTr%rzr xmlns=""rr)r(r>rr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrCr?) rr@rrmrkwargsr(r>rfrvks r&rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrr rc |dSr r$r s r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(r>rrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYr?) rr@rrmrr(r>rfrrrltags r&r0r0s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r%c||jD] }|| |jr||jyyr=)rr?)rr@parts r&rrs1  d   yy diir%)rhtmlr>ctjd|r tdttj D]\}}||k(s||k(st|=|t|<y)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)rematchrrrr)rrrrs r&rrs[ xx 6"BCC^))+,1 8qF{q!-!N3r%rr6rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r/rer rs r&rrs! +/d1D1DE  r%c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer/rrrs r&rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrCrDrrErrFr" z rz  z rGrs r&rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrCrDrrFrrKrGrs r&r1r1sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rIT)rrrc|dk(rtjntj}t|j |||||||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", *default_namespace* sets the default XML namespace (for "xmlns"). Returns an (optionally) encoded string containing the XML data. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr+sV ')3R[[]Fvx/>1B&,4H J ?? r%c.eZdZdZdZdZdZdZdZy)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_yr=)lst)r3rXs r&r5z_ListDataStream.__init__Es r%cyrr$r8s r&rz_ListDataStream.writableHr%cyrr$r8s r&rz_ListDataStream.seekableKrZr%c:|jj|yr=)rXr[)r3bs r&rz_ListDataStream.writeNs r%c,t|jSr=)rCrXr8s r&rz_ListDataStream.tellQs488}r%N) r r!r"r#r5rrrrr$r%r&rVrVCsAr%rVc`g}t|}t|j|||||||S)NrP)rVrr)r*rrrrrrXrTs r&rrTsC C S !Fvx/>1B&,4H J Jr%ct|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)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)rrN)r-rrsysstdoutrr?)r@r?s r&rrasb dK (4 JJszzIJ. <<>  D 48t# $r%ct|tr|j}|dkrtd|t |syd|zzgfd|dy)a&Indent an XML document by inserting newlines and indentation space after elements. *tree* is the ElementTree or Element to modify. The (root) element itself will not be changed, but the tail text of all elements in its subtree will be adapted. *space* is the whitespace to insert for each indentation level, two space characters by default. *level* is the initial indentation level. Setting this to a higher value than 0 can be used for indenting subtrees that are more deeply nested inside of a document. rz,Initial indentation level must be >= 0, got Nrc|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorr[r>striprCr?)r@level child_levelchild_indentationchild_indent_children indentationsspaces r&rlz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r-rrrrC)treernrhrlrms ` @@r&rrtsb$ $||~ qyGwOPP t955=()L-,T1r%c>t}|j|||S)zParse 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 )rrros r&r r s =DJJvv Kr%ct||tdstddndfdGfddtjj }|}d |_tj||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_parserrrTFc3\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrwitr pullparserwrs r&iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr=)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s r%N)r r!r"__next__r)rr{rsr&IterParseIteratorr}sF#,, r%rN) rr)r collectionsabcIteratorrwweakrefref) rrrrrrxrr{ryrzs ` @@@@r&r r st"ff=J 66 "fd#  $KOO44  BBG RB Ir%c8eZdZd dddZdZdZdZdZdZy) rN)rsctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrs _setevents)r3rrrss r&r5zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r%c|j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Feed encoded data to parser.Nz!feed() called after end of stream)rsrr SyntaxErrorrr[)r3rexcs r&rzXMLPullParser.feeds` << @A A  / !!$'  /""))#.. /s8 A&A!!A&cH|jj}d|_|Sr=)rsr)r3rws r&rvz$XMLPullParser._close_and_return_roots ||!!#  r%c$|jy)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)rvr8s r&rzXMLPullParser.closes ##%r%c#|K|j}|r*|j}t|tr|||r)yyw)zReturn an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)rpopleftr- Exception)r3rrevents r&ruzXMLPullParser.read_eventss; ##NN$E%+  s7<<cf|j td|jjy)Nz"flush() called after end of stream)rsrflushr8s r&rzXMLPullParser.flush$s( << AB B r%r=) r r!r"r5rrvrrurr$r%r&rrs' rs r&rr*s+ +-0 KK <<>r%c|stt}|j||j}i}|j D]}|j d}|s|||<||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. rr7)rrrrrry)r>rroidsr@r7s r&rr;sd +-0 KK <<>D C  XXd^ CG 9r%c~|stt}|D]}|j||jS)zParse 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. rr)sequencerr>s r&rrSs5 +-0 D <<>r%cVeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z y)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_factoryinsert_comments insert_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr=) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r%c~t|jdk(sJd|jJd|jS)z;Flush builder buffers and return toplevel document Element.rzmissing end tagszmissing toplevel element)rCrrr8s r&rzTreeBuilder.closes>4::!#7%77#zz%A'AA%zzr%cL|jr|jdj|j}|jr/|jjJd||j_n.|jj Jd||j_g|_yy)Nrzinternal error (tail)zinternal error (text))rrjoinrr?r>r3r>s r&_flushzTreeBuilder._flushs ::zz%wwtzz*::::??2K4KK2&*DJJO::??2K4KK2&*DJJODJ r%c:|jj|y)zAdd text to current element.N)rr[r3rs r&rzTreeBuilder.datas $r%c|j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rar)rrrrr[rr)r3r(attrsr@s r&startzTreeBuilder.startsp  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r%c|j|jj|_|jj|k(s"Jd|jjd|dd|_|jS)zOClose and return current Element. *tag* is the element name. zend tag mismatch (expected z, got rAr)rrpoprr(rrs r&rzTreeBuilder.endsa ZZ^^% zz~~$ (::>>3( ($ zzr%cP|j|j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments* ""  ! !4#7#7? ?r%cR|j|j|j||S)zCreate 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 ''. )rrr)r3rr>s r&pizTreeBuilder.pis* ""   doovt= =r%c||}|rH|j||_|jr|jdj|d|_|S)Nrar)rrrr[r)r3factoryrbargsr@s r&rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r%r=) r r!r"r#r5rrrrrrrrr$r%r&rresC&(!%$!&5((  " ?=r%rc`eZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZy)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)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrsr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__init__s  )##Hc2 > ]F%++ dl%++ dlkk  &*mm# 67 #)-F & 65 !'+yyF $ 6: &/3~~F , 68 $-1\\F * 66 "*0++F ' 69 %$*NNF ! 64 28))F /$%!   +e.@.@@DLM  ' !M ( N   s;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr=r$)r( attrib_inrr[rs r&handlerz%XMLParser._setevents..handler"sE5i#89:r%rc$||||fyr=r$)r(rr[rs r&rz%XMLParser._setevents..handler'sE3s8,-r%zstart-nsrc&|||||fyr=r$)rrrr[rs r&rz%XMLParser._setevents..handler.sx'<=>r%c,|||xsd|xsdffyNrr$)rrrr[s r&rz%XMLParser._setevents..handler2s "ciR'@ABr%zend-nsrc$||||fyr=r$)rrr[rs r&rz%XMLParser._setevents..handler8svf~67r%c||dfyr=r$)rrr[s r&rz%XMLParser._setevents..handler<st}-r%rcJ|||jj|fyr=)rr)r>rr[r3s r&rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r%rcL|||jj||fyr=)rr) pi_targetrrr[r3s r&rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr%zunknown event %r)rsr[rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr[ event_namers r&rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r%cxt|}|j|_|j|jf|_|r=)r codelinenooffsetposition)r3r|errs r& _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r%cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r3rznames r&_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr3rrs r&rzXMLParser._start_ns\s!{{##FLb#)<r data_handlerrrnrerpubidsystems r&rzXMLParser._defaultqsbq S= #{{//  T[[a45s]tBQx;6DM ]] &} $ ::{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r#r5rrrrrrrrrrrr$r%r&rrsN"&+Z3Bj =0 .34%l *"?r%r)out from_filec "| | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)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) rrrQrrrrrr rS)xml_datarroptionssiors r&rrsI-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d jfd Z d Z d Z ddZdZdZdZy)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_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r?rFr)_writer_with_comments _strip_textr}_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr[rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr%r&r'r(r)r*r+s r&r5zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r%c#DK||D]}|s|Ed{y7wr=r$)r3ns_stack _reversedrms r&_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrAr7r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r%c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrraz Namespace "rC) rr}rAr6addr2r8rCr[r7r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr%cT|js|jj|yyr=)r=rr[rs r&rzC14NWriterTarget.dataYs""" JJ  d ##r%rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNra) rr/r9rgr:_looks_like_prefix_namerr;r-_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r%c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rD)rs r&rz)C14NWriterTarget._start..s!''#q/r%rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserverarrrrrrT)r0rrGrIr5rPrLrsortr[ryr9r-r_escape_attrib_c14nrQr;r7)r3r(rrVrSrrrresolved_namesrqattrs attr_namer| parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r&rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r=rrr-rLr9rrCr<r6r7rs r&rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r%c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r.r=r<r-r;rrrQrs r&rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r%c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r=r<r-r;rrrQ)r3rrs r&rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r%r=)r r!r"r#r5reversedrArGrLrrrrrrrrrr$r%r&rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r%rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrCrDrrErrFrL rGrs r&rQrQs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrCrDrrErrKrMz rz rLrirGrs r&r\r\s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr=r)z r)@r#__all__rrbr8rIrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr2r0rrrrrrrr1rrrVrrrr r rrrrrrrrcompileUNICODEr9rPrrQr\rd _elementtreerkrr$r%r&rrs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E,,E43E4PKm#]N0etree/__pycache__/__init__.cpython-312.opt-1.pycnu[ ThEy)Nr+/usr/lib64/python3.12/xml/etree/__init__.pyrsrPKm#] A>>3etree/__pycache__/ElementTree.cpython-312.opt-1.pycnu[ Th!!dZgdZdZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z Gdde Zd ZGd d Zifd ZdCd ZdCdZeZGddZGddZe j.dZdCdZdZhdZdZdZeeedZdZdddddd d!d"Z e e_ d#Z!d$Z"d%Z#d&Z$dDddd'd(d)Z%Gd*d+ejLZ'dDddd'd(d,Z(d-Z)dEd.Z*dCd/Z+dDd0Z,Gd1d2Z-dCd3Z.dCd4Z/e.Z0dCd5Z1Gd6d7Z2Gd8d9Z3dCddd:d;Z4ejjdZ9d?Z:d@Z; eZZ>e>eey#e?$rYywxYw)FaLightweight 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. )CommentdumpElement ElementTree fromstringfromstringlistindent iselement iterparseparse ParseErrorPIProcessingInstructionQName SubElementtostring tostringlist TreeBuilderVERSIONXMLXMLID XMLParser XMLPullParserregister_namespace canonicalizeC14NWriterTargetz1.3.0N) ElementPathceZdZdZy)r zAn 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__./usr/lib64/python3.12/xml/etree/ElementTree.pyr r ks  r%r ct|dS)z2Return True if *element* appears to be an Element.tag)hasattr)elements r&r r ys 7E ""r%ceZdZdZdZ dZ dZ dZ ifdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZddZddZddZddZdZddZdZdZdZddZdZ y)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: text...tail Nc t|ts"td|jj||_i|||_g|_y)Nzattrib must be dict, not ) isinstancedict TypeError __class__r r(attrib _children)selfr(r1extras r&__init__zElement.__init__sL&$'  )),- -))5) r%c`d|jj|jt|fzS)Nz<%s %r at %#x>)r0r r(idr3s r&__repr__zElement.__repr__s&4>>#:#:DHHbh"OOOr%c&|j||S)zCreate 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. )r0)r3r(r1s r& makeelementzElement.makeelements~~c6**r%c|j|j|j}|j|_|j|_||dd|SN)r;r(r1texttail)r3elems r&__copy__zElement.__copy__s@$++6II II Q r%c,t|jSr=)lenr2r8s r&__len__zElement.__len__s4>>""r%cjtjdtdt|jdk7S)NzTesting an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. stacklevelr)warningswarnDeprecationWarningrCr2r8s r&__bool__zElement.__bool__s1  K 1   4>>"a''r%c |j|Sr=r2r3indexs r& __getitem__zElement.__getitem__s~~e$$r%ct|tr|D]}|j|n|j|||j|<yr=)r-slice_assert_is_elementr2)r3rPr*elts r& __setitem__zElement.__setitem__sB eU #'',  # #G , 'ur%c|j|=yr=rNrOs r& __delitem__zElement.__delitem__s NN5 !r%c\|j||jj|y)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. NrTr2appendr3 subelements r&r[zElement.appends$  + j)r%cj|D].}|j||jj|0y)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. NrZ)r3elementsr*s r&extendzElement.extends.  G  # #G , NN ! !' * r%c^|j||jj||y)z(Insert *subelement* at position *index*.N)rTr2insert)r3rPr]s r&rbzElement.inserts$  + eZ0r%cft|ts!tdt|jzy)Nzexpected an Element, not %s)r- _Element_Pyr/typer )r3es r&rTzElement._assert_is_elements.![)9DGr?r8s r&rwz Element.clear?s)  $$ DIr%c:|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. )r1get)r3keyrqs r&ryz Element.getJs{{sG,,r%c"||j|<y)zSet 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)r1)r3rzvalues r&setz Element.setWs! Cr%c6|jjS)zGet list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r1keysr8s r&rz Element.keysas{{!!r%c6|jjS)zGet element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r1itemsr8s r&rz Element.itemsjs{{  ""r%c#K|dk(rd}||j|k(r||jD]}|j|Ed{y7w)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(r2iter)r3r(rfs r&rz Element.iterusJ #:C ;$((c/JAvvc{ " " "sAA A A c#K|j}t|ts|y|j}|r||D]-}|j Ed{|j }|s*|/y7w)zCreate text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r(r-strr>itertextr?)r3r(trfs r&rzElement.itertexts`hh#s#  II GAzz| # #A  #sA A) A' A) A)r=NN)!r r!r"r#r(r1r>r?r5r9r;rArDrLrQrVrXr[r`rbrTrhrjrorsrurwryr}rrrrr$r%r&rr~s( C F1 D D$&P +#(%(" *+1 N * 8 E ; < % -!" ##,r%rc Xi||}|j||}|j||S)aSubelement 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[)parentr(r1r4r*s r&rrs6! % F  f-G MM' Nr%c2tt}||_|S)zComment 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. )rrr>)r>r*s r&rrsgGGL Nr%cdtt}||_|r|jdz|z|_|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.  )rrr>)targetr>r*s r&rrs3+,GGL ||c)D0 Nr%cHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) raQualified 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. Nc&|rd|d|}||_y)N{}r>)r3 text_or_urir(s r&r5zQName.__init__s &137K r%c|jSr=rr8s r&__str__z QName.__str__s yyr%cPd|jjd|jdS)N)r0r r>r8s r&r9zQName.__repr__s NN33TYY??r%c,t|jSr=)hashr>r8s r&__hash__zQName.__hash__sDIIr%crt|tr|j|jkS|j|kSr=r-rr>r3others r&__le__z QName.__le__. eU #99 * *yyE!!r%crt|tr|j|jkS|j|kSr=rrs r&__lt__z QName.__lt__. eU #99uzz) )yy5  r%crt|tr|j|jk\S|j|k\Sr=rrs r&__ge__z QName.__ge__rr%crt|tr|j|jkDS|j|kDSr=rrs r&__gt__z QName.__gt__rr%crt|tr|j|jk(S|j|k(Sr=rrs r&__eq__z QName.__eq__rr%r=) r r!r"r#r5rr9rrrrrrr$r%r&rrs5  @"!"!"r%rcpeZdZdZddZdZdZddZddZddZ dd Z dd Z dd Z dd d dZ dZy)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. Nc:||_|r|j|yyr=)_rootr )r3r*files r&r5zElementTree.__init__ s  JJt  r%c|jS)z!Return root element of this tree.rr8s r&getrootzElementTree.getroots zzr%c||_y)zReplace 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)r3r*s r&_setrootzElementTree._setroots  r%cd}t|dst|d}d} |Kt}t|dr5|j||_|j|r|j SS|j dx}r%|j||j dx}r%|j |_|j|r|j SS#|r|j wwxYw)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. FreadrbT _parse_wholei)r)openrrrcloserfeed)r3sourceparser close_sourcedatas r&r zElementTree.parse!s vv&&$'FL ~"6>2 "(!4!4V! r>r) _serialize ValueError _get_writerlower_serialize_textr _namespaces) r3file_or_filenameencodingxml_declarationdefault_namespacemethodrwritedeclared_encodingqnamesrm serializes r&rzElementTree.writes:F : %069: :"% )8 48R@QO$,^^%2&,,.6KK%()tzz2%0=N%O" &v. %VZ/CE5 4 4s BCCc(|j|dS)Nr)r)r)r3rs r& write_c14nzElementTree.write_c14nszz$vz..r%rr=)NNNN)r r!r"r#r5rrr rrjrorsrurrr$r%r&rrsZ   D $1,>,4,5." $ 3E $( 3Ej/r%rc#~K |j}|jdk(r|t|ddxsdfytj5}t |t jr|}nt |t jr1t j|}|j|jnFt j}d|_ ||_ |j|_ |j|_t j ||dd}|j|j|j|fdddy#t$rYXwxYw#1swYyxYw#t$rM|jdk(rd}t#|d|d 5}|j|fdddYy#1swYYyxYwwxYww) NrrrcyNTr$r$r%r&z_get_writer..sDr%xmlcharrefreplace )rerrorsnewlinew)rr)rrgetattr contextlib ExitStackr-ioBufferedIOBase RawIOBaseBufferedWritercallbackdetachwritableseekabletellAttributeError TextIOWrapperr)rrrstackrs r&rrs-+ && >> y (!1:tDOO O%%'5.0A0AB+D 0",,?,,-=>DNN4;;/,,.D$0DM!&DJ)9(A(A $4$9$9 ''19/B046 t{{+jj(**9('&*'(' ' >> y (H "C(,.15**h& &... 'sF= E$=F= B E"E .add_qname s .RayC 9++C3S#,>+//4F~!'#j/!9*0 3/5s$;F5M$'F5M$$3!&u  . &u - .sA.B 2B 8B B"!B") rr(r-rr>rrr rr) r@rrr(rzr|r>rmrs ` @@r&rrs(D\FJ(* $%.8 hh c5 !xxv%#((# S !& # _G!32 &s +**,JC#u%hh& #%'EJJf,D%**% 'yy dE "tyy'> dii '( : r%c |j}|j}|tur |d|znp|tur |d|zn[||}|,|r|t ||D]}t |||d|n(|d|zt |j} | s|r|rCt|jdD]$\} } | rd| z} |d| d t| d &| D]^\} } t| tr | j} t| tr|| j} n t| } |d || d | d `|s t|s|sA|d |r|t ||D]}t |||d||d |zd zn|d|jr|t |jyy)N rrc |dSNrr$xs r&rz _serialize_xml..hQqTr%rzr xmlns=""rr)r(r>rr _escape_cdata_serialize_xmllistrsorted_escape_attribr-rrCr?) rr@rrmrkwargsr(r>rfrvks r&rrRs ((C 99D g~ kD ! % % hoSk ;mD)*ua4HJ #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N*1-&)Q78"s4y(<c --.A"5!VT8LNdSj3&'e  yy mDII&'r%>brhrcolimgwbrareabaselinkmetaembedframeinputparamtrackrisindexbasefontc |j}|j}|tur|dt|zn|tur|dt|znj||}|*|r|t||D]}t |||dn9|d|zt |j}|s|r|rCt|jdD]$\} } | rd| z} |d| dt| d &|D]^\} } t| tr | j} t| tr|| j} n t| } |d || d| d `|d |j} |r$| d k(s| d k(r ||n|t||D]}t |||d| tvr|d|zd z|jr|t|jyy)Nrr rc |dSr r$r s r&rz!_serialize_html..rr%rrrrrrrscriptstyler)r(r>rrr_serialize_htmlrrrrr-r_escape_attrib_htmlr HTML_EMPTYr?) rr@rrmrr(r>rfrrrltags r&r0r0s ((C 99D g~ kM$//0 % % ht,,-Sk ;mD)*q&$7 #) &E  &z'7'7'9+9!;1 #aA*1- !;"DAq!!U+FF!!U+"166N/2&)Q78" #J99;D8#tw$K--.q&$7:%dSj3&' yy mDII&'r%c||jD] }|| |jr||jyyr=)rr?)rr@parts r&rrs1  d   yy diir%)rhtmlr>ctjd|r tdttj D]\}}||k(s||k(st|=|t|<y)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)rematchrrrr)rrrrs r&rrs[ xx 6"BCC^))+,1 8qF{q!-!N3r%rr6rdfwsdlxsxsidc)$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/cLtd|dt|jd)Nzcannot serialize z (type ))r/rer rs r&rrs! +/d1D1DE  r%c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)N&&r<r>replacer/rrrs r&rrso ) $;<<W-D $;<<V,D $;<<V,D ~ &)"4()AAA#"A#c| d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }d |vr|jd d}|S#ttf$rt|YywxYw)NrCrDrrErrFr" z rz  z rGrs r&rrs) $;<<W-D $;<<V,D $;<<V,D 4<<<h/D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB;:B;c d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw)NrCrDrrFrrKrGrs r&r1r1sm ) $;<<W-D $;<<V,D 4<<<h/D ~ &)"4()rIT)rrrc|dk(rtjntj}t|j |||||||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", *default_namespace* sets the default XML namespace (for "xmlns"). Returns an (optionally) encoded string containing the XML data. rrrrr)rStringIOBytesIOrrgetvalue)r*rrrrrstreams r&rr+sV ')3R[[]Fvx/>1B&,4H J ?? r%c.eZdZdZdZdZdZdZdZy)_ListDataStreamz7An auxiliary stream accumulating into a list reference.c||_yr=)lst)r3rXs r&r5z_ListDataStream.__init__Es r%cyrr$r8s r&rz_ListDataStream.writableHr%cyrr$r8s r&rz_ListDataStream.seekableKrZr%c:|jj|yr=)rXr[)r3bs r&rz_ListDataStream.writeNs r%c,t|jSr=)rCrXr8s r&rz_ListDataStream.tellQs488}r%N) r r!r"r#r5rrrrr$r%r&rVrVCsAr%rVc`g}t|}t|j|||||||S)NrP)rVrr)r*rrrrrrXrTs r&rrTsC C S !Fvx/>1B&,4H J Jr%ct|ts t|}|jtjd|j j }|r|ddk7r tjjdyy)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)rrN)r-rrsysstdoutrr?)r@r?s r&rrasb dK (4 JJszzIJ. <<>  D 48t# $r%ct|tr|j}|dkrtd|t |syd|zzgfd|dy)a&Indent an XML document by inserting newlines and indentation space after elements. *tree* is the ElementTree or Element to modify. The (root) element itself will not be changed, but the tail text of all elements in its subtree will be adapted. *space* is the whitespace to insert for each indentation level, two space characters by default. *level* is the initial indentation level. Setting this to a higher value than 0 can be used for indenting subtrees that are more deeply nested inside of a document. rz,Initial indentation level must be >= 0, got Nrc|dz} |}|jr|jjs||_|D]D}t |r |||j r|j jr>||_Fj js ||_yy#t$r|z}j|YwxYwr ) IndexErrorr[r>striprCr?)r@level child_levelchild_indentationchild_indent_children indentationsspaces r&rlz indent.._indent_childrensai  3 ,[ 9  yy  1)DIE5z  4::UZZ%5%5%7. zz!%e,EJ" 3 ,U 3e ;     1 2 3sB))"C C)r-rrrrC)treernrhrlrms ` @@r&rrtsb$ $||~ qyGwOPP t955=()L-,T1r%c>t}|j|||S)zParse 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 )rrros r&r r s =DJJvv Kr%ct||tdstddndfdGfddtjj }|}d |_tj||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_parserrrTFc3\K jEd{|jd}|snj|>j}jEd{}|||_r|j yy7v7*#r|j wwxYww)Ni@) read_eventsrr_close_and_return_rootrootr)rrrwitr pullparserwrs r&iteratorziterparse..iterators %11333{{9-% 446D!--/ / /B~ 4 0  s?B,BBA B'B(B<B,BBB))B,cBeZdZWWjZfdZy)$iterparse..IterParseIteratorc,rjyyr=)r)r3rrs r&__del__z,iterparse..IterParseIterator.__del__s r%N)r r!r"__next__r)rr{rsr&IterParseIteratorr}sF#,, r%rN) rr)r collectionsabcIteratorrwweakrefref) rrrrrrxrr{ryrzs ` @@@@r&r r st"ff=J 66 "fd#  $KOO44  BBG RB Ir%c8eZdZd dddZdZdZdZdZdZy) rN)rsctj|_|xstt |_|d}|j j |j|y)Nr)end)rdeque _events_queuerrrs _setevents)r3rrrss r&r5zXMLPullParser.__init__sL )..0A);="A >F  2 2F;r%c|j td|r |jj|yy#t$r%}|jj |Yd}~yd}~wwxYw)Feed encoded data to parser.Nz!feed() called after end of stream)rsrr SyntaxErrorrr[)r3rexcs r&rzXMLPullParser.feeds` << @A A  / !!$'  /""))#.. /s8 A&A!!A&cH|jj}d|_|Sr=)rsr)r3rws r&rvz$XMLPullParser._close_and_return_roots ||!!#  r%c$|jy)zFinish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)rvr8s r&rzXMLPullParser.closes ##%r%c#|K|j}|r*|j}t|tr|||r)yyw)zReturn an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)rpopleftr- Exception)r3rrevents r&ruzXMLPullParser.read_eventss; ##NN$E%+  s7<<cf|j td|jjy)Nz"flush() called after end of stream)rsrflushr8s r&rzXMLPullParser.flush$s( << AB B r%r=) r r!r"r5rrvrrurr$r%r&rrs' rs r&rr*s+ +-0 KK <<>r%c|stt}|j||j}i}|j D]}|j d}|s|||<||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. rr7)rrrrrry)r>rroidsr@r7s r&rr;sd +-0 KK <<>D C  XXd^ CG 9r%c~|stt}|D]}|j||jS)zParse 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. rr)sequencerr>s r&rrSs5 +-0 D <<>r%cVeZdZdZdddddddZdZdZdZd Zd Z d Z dd Z d Z y)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_factoryinsert_comments insert_piscg|_g|_d|_d|_d|_|t }||_||_|t}||_ ||_ |t}||_ yr=) _data_elem_lastr_tailr_comment_factoryrr _pi_factoryrr_factory)r3element_factoryrrrrs r&r5zTreeBuilder.__init__ysn      "%O /.  .J%$  "%O' r%c|jS)z;Flush builder buffers and return toplevel document Element.rr8s r&rzTreeBuilder.closeszzr%c|jr^|jJdj|j}|jr||j_n||j_g|_yyNr)rrjoinrr?r>r3r>s r&_flushzTreeBuilder._flushsP ::zz%wwtzz*::&*DJJO'+DJJODJ r%c:|jj|y)zAdd text to current element.N)rr[r3rs r&rzTreeBuilder.datas $r%c|j|j||x|_}|jr|jdj |n|j ||_|jj |d|_|S)zOpen new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rar)rrrrr[rr)r3r(attrsr@s r&startzTreeBuilder.startsp  MM#u55 T :: JJrN ! !$ ' ZZ DJ $  r%c|j|jj|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)rrpoprrrs r&rzTreeBuilder.ends2 ZZ^^%  zzr%cP|j|j|j|S)z`Create a comment using the comment_factory. *text* is the text of the comment. )_handle_singlerrrs r&commentzTreeBuilder.comments* ""  ! !4#7#7? ?r%cR|j|j|j||S)zCreate 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 ''. )rrr)r3rr>s r&pizTreeBuilder.pis* ""   doovt= =r%c||}|rH|j||_|jr|jdj|d|_|S)Nrar)rrrr[r)r3factoryrbargsr@s r&rzTreeBuilder._handle_singlesG~  KKMDJzz 2%%d+DJ r%r=) r r!r"r#r5rrrrrrrrr$r%r&rresC&(!%$!&5((  " ?=r%rc`eZdZdZddddZdZdZdZdZd Z d Z d Z d Z d Z dZdZy)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)rrcJ ddlm}|j |d}| t }|x|_|_|x|_|_ |j|_ i|_ |j|_t|dr|j |_t|dr|j$|_t|dr|j(|_t|dr|j,|_t|d r|j0|_t|d r|j4|_t|d r|j8|_d |_d |_d|_ i|_! d |jDz|_#y#t$r" ddl}n#t$r tdwxYwYwxYw#tH$rYywxYw)Nrexpatz7No module named expat; use SimpleXMLTreeBuilder insteadrrrstart_nsend_nsrrrrzExpat %d.%d.%d)% xml.parsersr ImportErrorpyexpat ParserCreaterrrsr_targeterror_error_names_defaultDefaultHandlerExpandr)_startStartElementHandler_endEndElementHandler _start_nsStartNamespaceDeclHandler_end_nsEndNamespaceDeclHandlerrCharacterDataHandlerrCommentHandlerrProcessingInstructionHandler buffer_textordered_attributes_doctypeentity version_infoversionr)r3rrrrs r&r5zXMLParser.__init__s  )##Hc2 > ]F%++ dl%++ dlkk  &*mm# 67 #)-F & 65 !'+yyF $ 6: &/3~~F , 68 $-1\\F * 66 "*0++F ' 69 %$*NNF ! 64 28))F /$%!   +e.@.@@DLM  ' !M ( N   s;E(F( F2E76F7F  FF F"!F"c|j}|j}|D]}|dk(r d|_|||jfd}||_(|dk(r|||j fd}||_F|dk(r6t|jdr|||jfd}n||fd }||_ |d k(r6t|jd r|||jfd }n||fd }||_ |dk(r|||fd}||_ |dk(r|||fd}||_td|zy)Nrrc&|||||fyr=r$)r( attrib_inrr[rs r&handlerz%XMLParser._setevents..handler"sE5i#89:r%rc$||||fyr=r$)r(rr[rs r&rz%XMLParser._setevents..handler'sE3s8,-r%zstart-nsrc&|||||fyr=r$)rrrr[rs r&rz%XMLParser._setevents..handler.sx'<=>r%c,|||xsd|xsdffyrr$)rrrr[s r&rz%XMLParser._setevents..handler2s "ciR'@ABr%zend-nsrc$||||fyr=r$)rrr[rs r&rz%XMLParser._setevents..handler8svf~67r%c||dfyr=r$)rrr[s r&rz%XMLParser._setevents..handler<st}-r%rcJ|||jj|fyr=)rr)r>rr[r3s r&rz%XMLParser._setevents..handler@sE4;;#6#6t#<=>r%rcL|||jj||fyr=)rr) pi_targetrrr[r3s r&rz%XMLParser._setevents..handlerDsE4;;>>)T#BCDr%zunknown event %r)rsr[rrrrrr)rrrrrrrr)r3 events_queueevents_to_reportrr[ event_namers r&rzXMLParser._seteventss5$$*JW$,-)2fC3:0x'4;;1.8'+||8/9.18.y((26?(/%t#3=f!%E7>3 !3j!@AAU+r%cxt|}|j|_|j|jf|_|r=)r codelinenooffsetposition)r3r|errs r& _raiseerrorzXMLParser._raiseerrorKs0::||U\\1  r%cz |j|}|S#t$r|}d|vrd|z}||j|<Y|SwxYw)Nrr)rKeyError)r3rznames r&_fixnamezXMLParser._fixnameQsU $;;s#D   $Dd{Tz#DKK   $s #::cJ|jj|xsd|xsdSr)rrr3rrs r&rzXMLParser._start_ns\s!{{##FLb#)<r data_handlerrrnrerpubidsystems r&rzXMLParser._defaultqsbq S= #{{//  T[[a45s]tBQx;6DM ]] &} $ ::{{   Q    KK 1 1+ >s)7A//B>BBBBB9)r r!r"r#r5rrrrrrrrrrrr$r%r&rrsN"&+Z3Bj =0 .34%l *"?r%r)out from_filec "| | tdd}|tjx}}tt |j fi|}|"|j ||jn| t||||jSdS)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) rrrQrrrrrr rS)xml_datarroptionssiors r&rrsI-UVV C {KKM!c .syyDGD EF H    i' _3<<>6$6r%z ^\w+:\w+$ceZdZdZdddddddddZefdZdZddZd Z d jfd Z d Z d Z ddZdZdZdZy)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_textrewrite_prefixesqname_aware_tagsqname_aware_attrs exclude_attrs exclude_tagsc2||_g|_||_||_|r t |nd|_|r t |nd|_||_|rt ||_nd|_|rt |j|_ nd|_ dgg|_ g|_ |s6|jjttj!|jjgi|_dg|_d|_d|_d|_d|_y)N)r?rFr)_writer_with_comments _strip_textr}_exclude_attrs _exclude_tags_rewrite_prefixes_qname_aware_tags intersection_find_qname_aware_attrs_declared_ns_stack _ns_stackr[rrr _prefix_map_preserve_space_pending_start _root_seen _root_done_ignored_depth) r3rr%r&r'r(r)r*r+s r&r5zC14NWriterTarget.__init__s  +%4Ac-0t2>S.D!1 %()9%:D "%)D " +./@+A+N+ND (+/D ( <$ #  NN ! !$~';';'="> ? b! %w"r%c#DK||D]}|s|Ed{y7wr=r$)r3ns_stack _reversedrms r&_iter_namespacesz!C14NWriterTarget._iter_namespaces(s$#H-J%%%.%s   c|jdd\}}|j|jD]\}}||k(s d|d|cStd|d|d)NrrrrzPrefix z of QName "" is not declared in scope)splitrAr7r)r3 prefixed_namerrrps r&_resolve_prefix_namez%C14NWriterTarget._resolve_prefix_name-sl$**32 ++DNN;FCF{C54&))<76(+m_D^_``r%c|%|dddk(r|ddjddnd|f\}}n|}t}|j|jD]/\}}||k(r||vr|r|d|n|||fcS|j |1|j ro||j vr|j |}n'dt|j x}|j |<|jdj||f|d|||fS|s d|vr|||fS|j|jD]:\}}||k(s |jdj||f|r|d|n|||fcS|s|||fStd|d ) Nrrrrrrraz Namespace "rC) rr}rAr6addr2r8rCr[r7r)r3rrr( prefixes_seenurs r&_qnamezC14NWriterTarget._qname4s ;38!93CuQRy''Q/"eHCC ..t/F/FGIAvCxF-7,2&3%(S#EE   f %H  ! !d&&&))#.34S9I9I5J4K1LL))#.  # #B ' . .V} =XQse$c3. .r.S= ..t~~>IAvCx''+22C=A,2&3%(S#EE? S= ;se+EFGGr%cT|js|jj|yyr=)r=rr[rs r&rzC14NWriterTarget.dataYs""" JJ  d ##r%rc||j}|jdd=|jr|jds|j}|j<|jdc}|_|r t |r|nd}|j g|||y|r(|jr|jt|yyyNra) rr/r9rgr:_looks_like_prefix_namerr;r-_escape_cdata_c14n)r3 _join_textrr qname_texts r&rzC14NWriterTarget._flush]s$**% JJqM   D$8$8$<::D   C/r%c |j4|r2|jDcic]\}}||jvs||}}}|h|}i}|'|j|x} ||<|j| |jX|rV|j |} | r@| D]:} || } t | s|j| x} || <|j| <nd} nd} |j } t|dDcic] }|| | }}|r.|Dcgc]\}}|rd|znd|f}}}|jng}|rVt|jD]:\}}| || vr||vr |||d}||\}} }|j|r|n| |f<|jd}|jj|r|dk(n|jd|j}|d ||dz|r:|d j|Dcgc]\}}d |d t|d c}}|d||t|||dd|_|j"jgycc}}wcc}wcc}}wcc}}w)Nc&|jddS)Nrr)rD)rs r&rz)C14NWriterTarget._start..s!''#q/r%rzxmlns:xmlnsrz+{http://www.w3.org/XML/1998/namespace}spacepreserverarrrrrrT)r0rrGrIr5rPrLrsortr[ryr9r-r_escape_attrib_c14nrQr;r7)r3r(rrVrSrrrresolved_namesrqattrs attr_namer| parse_qnamer parsed_qnamesrrr attr_qnamespace_behaviourrs r&rzC14NWriterTarget._starts    *u&+kkmTmdaq@S@S7SQTmET  !151J1J:1V VEN:. JJu   ' ' 311%8F!'I!),E.u58<8Q8QRW8XXu 5 5) "( Fkk 4: 153453qKN*53 4 $2#1KC'-F"'3?#1  NN I u{{}-1%!v+!~:M%nQ&78;A-:1-=* Is  *A!FG . ))$QR ##-*3M%Nq%QR S b!CU04 8UsI/I/3I5 I:Jc|jr|xjdzc_y|jr|j|jd|j |dd|j j t|j dk(|_|jj |jj y)Nrrrr) r=rrr-rLr9rrCr<r6r7rs r&rzC14NWriterTarget.ends      1 $   :: KKM bS)!,-Q/0   "d223q8 ##% r%c<|jsy|jry|jr|jdn(|jr|j r|j |jdt|d|js|jdyy)Nrz)r.r=r<r-r;rrrQrs r&rzC14NWriterTarget.commentsw""      ?? KK  __ KKM d-d34C89 KK r%c8|jry|jr|jdn(|jr|jr|j |j|rd|dt |dnd|d|js|jdyy)Nrz)r=r<r-r;rrrQ)r3rrs r&rzC14NWriterTarget.pis     ?? KK  __ KKM :>b,T232 6bPRO U KK r%r=)r r!r"r#r5reversedrArGrLrrrrrrrrrr$r%r&rrsj, %"&$#$# J4<& a#HJ$!# 210"C"J   r%rc d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}|S#ttf$rt|YywxYw) NrCrDrrErrFrL rGrs r&rQrQs) $;<<W-D $;<<V,D $;<<V,D 4<<<g.D ~ &)"4()sAAA98A9cP d|vr|jdd}d|vr|jdd}d|vr|jdd}d|vr|jdd}d |vr|jd d }d |vr|jd d }|S#ttf$rt|YywxYw) NrCrDrrErrKrMz rz rLrirGrs r&r\r\s) $;<<W-D $;<<V,D $;<<X.D 4<<<g.D 4<<<g.D 4<<<g.D ~ &)"4()sBBB%$B%)r)_set_factoriesr=r)z r)@r#__all__rrbr8rIrrcollections.abcrrrrrr r rrrrr rrcontextmanagerrrrr2r0rrrrrrrr1rrrVrrrr r rrrrrrrrcompileUNICODEr9rPrrQr\rd _elementtreerkrr$r%r&rrs!P (       # ^^B $&$  +"+"`\/\/B /+/+b;z0(d 0(d    !*-2$*38(.(,16(, %3! ) )8 )!T"&0b''" !%&* &/l 5p77t",  $vvth?h?Z7tt7<%"**\2::>DDD)&). 3K+712  s E,,E43E4PKm#]w{22(dom/__pycache__/__init__.cpython-312.pycnu[ Th dZGddZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZGddeZGddeZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZGd%d&eZGd'd(eZGd)d*eZGd+d,eZGd-d.eZ Gd/d0eZ!Gd1d2eZ"Gd3d4eZ#Gd5d6Z$d7Z%d8Z&d9Z'd:Z(d:Z)dd;l*m+Z+m,Z,y:)>\ )BD D4-$-"-r"c|jS)N)code)r/s r# _get_codezDOMException._get_codeHs yyr"N)rrrrr.r4rr"r#r)r)>sI. r"r)ceZdZeZy) IndexSizeErrN)rrrINDEX_SIZE_ERRr3rr"r#r6r6L Dr"r6ceZdZeZy)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr3rr"r#r:r:O Dr"r:ceZdZeZy)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr3rr"r#r>r>R Dr"r>ceZdZeZy)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr3rr"r#rBrBUr<r"rBceZdZeZy)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr3rr"r#rErEXr@r"rEceZdZeZy)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr3rr"r#rHrH[ Dr"rHceZdZeZy)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr3rr"r#rLrL^s &Dr"rLceZdZeZy) NotFoundErrN)rrr NOT_FOUND_ERRr3rr"r#rOrOa Dr"rOceZdZeZy)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr3rr"r#rSrSd Dr"rSceZdZeZy)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr3rr"r#rWrWgrJr"rWceZdZeZy)InvalidStateErrN)rrrINVALID_STATE_ERRr3rr"r#rZrZjrUr"rZceZdZeZy) SyntaxErrN)rrr SYNTAX_ERRr3rr"r#r]r]ms Dr"r]ceZdZeZy)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr3rr"r#r`r`ps #Dr"r`ceZdZeZy) NamespaceErrN)rrr NAMESPACE_ERRr3rr"r#rcrcsrQr"rcceZdZeZy)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr3rr"r#rfrfvr<r"rfceZdZeZy) ValidationErrN)rrrVALIDATION_ERRr3rr"r#ririyr8r"ric eZdZdZdZdZdZdZy)UserDataHandlerzBClass giving the operation constants for UserDataHandler.handle().rrrrN)rrrr NODE_CLONED NODE_IMPORTED NODE_DELETED NODE_RENAMEDrr"r#rlrl|sLKMLLr"rlz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation)-rrr7r;r?rCrFrIrMrPrTrXr[r^rardrgrjr-r)r6r:r>rBrErHrLrOrSrWrZr]r`rcrfrirl XML_NAMESPACEXMLNS_NAMESPACEXHTML_NAMESPACEEMPTY_NAMESPACE EMPTY_PREFIXdomregrqrrrr"r#rysh"%%4"#!"!"!"!"!"!"!" !"!#!#!# !#!# !#!# 9 <|!,!|!,!|'|',l l $\$<|L7 10 CCr"PKm#]/,AA*dom/__pycache__/xmlbuilder.cpython-312.pycnu[ Th0dZddlZddlZddlmZgdZGddZGddZd Z Gd d e Z Gd d e Z GddZ [GddZGddZy)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcec\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZy)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr"rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r#__init__zDOMBuilder.__init__9s   r"c|jSr)entityResolverr+s r#_get_entityResolverzDOMBuilder._get_entityResolver<s"""r"c||_yr)r/)r,r0s r#_set_entityResolverzDOMBuilder._set_entityResolver>s ,r"c|jSr)rr+s r#_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r"c||_yr)r5)r,rs r#_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r"c|jSr)r r+s r# _get_filterzDOMBuilder._get_filterFs {{r"c||_yr)r:)r,r s r# _set_filterzDOMBuilder._set_filterHs  r"ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr*KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r,namestatesettingsvalues r# setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr))hasattrr*rA)r,rIs r#r?zDOMBuilder.supportsFeatureYst}}k$&788r"cHt||xrdxsdf}||jvS)Nr r)rAr@)r,rIrJkeys r# canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r"rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rSrTrUrVrX)rr rWrYr[rrrrrr )rYrZr[)rr)rr r\r]r^ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)rAgetattrr*AttributeErrorrrrrrrrrrrDrErGrH)r,rIxnameoptionss r# getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&ddl}|jjSrl)rprq build_opener)r,rus r#rz DOMEntityResolver._create_openers~~**,,r"c~|jj}|jd}||jSy)Ncharset)rninfo get_paramr)r,rrrs r#rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r"N)r r r __slots__rfrrrr!r"r#rrsI, -r"rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrncharacterStream stringDatarrrorcfd|_d|_d|_d|_d|_d|_d|_yr)rr+s r#r-zDOMInputSource.__init__s4#    r"c|jSr)rnr+s r#_get_byteStreamzDOMInputSource._get_byteStream r"c||_yr)r)r,rns r#_set_byteStreamzDOMInputSource._set_byteStreams $r"c|jSr)rr+s r#_get_characterStreamz#DOMInputSource._get_characterStreams###r"c||_yr)r)r,rs r#_set_characterStreamz#DOMInputSource._set_characterStreams .r"c|jSr)rr+s r#_get_stringDatazDOMInputSource._get_stringDatarr"c||_yr)r)r,datas r#_set_stringDatazDOMInputSource._set_stringDatas r"c|jSr)rr+s r# _get_encodingzDOMInputSource._get_encoding }}r"c||_yr)r)r,rs r# _set_encodingzDOMInputSource._set_encoding    r"c|jSr)rr+s r# _get_publicIdzDOMInputSource._get_publicId#rr"c||_yr)r)r,rs r# _set_publicIdzDOMInputSource._set_publicId%rr"c|jSr)ror+s r# _get_systemIdzDOMInputSource._get_systemId(rr"c||_yr)r)r,ros r# _set_systemIdzDOMInputSource._set_systemId*rr"c|jSr)rr+s r# _get_baseURIzDOMInputSource._get_baseURI-s ||r"c||_yr)rr,rhs r# _set_baseURIzDOMInputSource._set_baseURI/s  r"N)r r r rr-rrrrrrrrrrrrrrr!r"r#rrsU@I%$/!!!r"rcJeZdZdZdZdZdZdZejZ dZ dZ dZ y ) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. r r%r&r'c|jSr)) whatToShowr+s r#_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr"c|jSr) FILTER_ACCEPTr,elements r# acceptNodezDOMBuilderFilter.acceptNodeG!!!r"c|jSr)rrs r#startContainerzDOMBuilderFilter.startContainerJrr"N)r r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr!r"r#rr3s8MMK$$J""r"rc8eZdZdZdZdZdZdZdZdZ dZ y ) DocumentLSz=Mixin to create documents that conform to the load/save spec.Fcy)NFr!r+s r# _get_asynczDocumentLS._get_asyncUsr"cF|rtjjdy)Nz.asynchronous document loading is not supported)rDrErF)r,flags r# _set_asynczDocumentLS._set_asyncXs& ''))@B B r"ctd)Nz'haven't figured out what this means yetryr+s r#abortzDocumentLS.abort]s" 57 7r"ctdNzhaven't written this yetrrs r#loadzDocumentLS.loadc!"<==r"ctdrr)r,rs r#loadXMLzDocumentLS.loadXMLfrr"c||}|j S|j|urtjj|j Sr)) ownerDocumentrDrEWrongDocumentErrtoxml)r,snodes r#saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r"N) r r r r async_rrrrrrr!r"r#rrPs)G FB 7 >>r"rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r%c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rDrErFMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrx)r,mode schemaTypes r#createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r"ctd)Nz-the writer interface hasn't been written yet!rr+s r#createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r"ctSr))rr+s r#createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r"N)r r r rrr r rr!r"r#rrqs 3= r"r)r rmxml.domrDxml.dom.NodeFilterr__all__rrrAobjectrrrrrr!r"r#rst: ) @@a)a)H*++\.V.b""4B  r"PKm#]i4b]b]-dom/__pycache__/minidom.cpython-312.opt-2.pycnu[ dAi X ddlZddlZddlmZmZmZmZddlddlm Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGdd eZeddZGd!d"e Zeed#d$ eed d% d&ZGd'd(ZGd)d*ee ZGd+d,ee Z ee dd- Gd.d/e Z!ee!d0d1 ee!d2d3 d4Z"d5Z#Gd6d7e Z$Gd8d9e!Z%Gd:d;eZ&ee&dd< Gd=d>Z'Gd?d@e'ee Z(GdAdBe'e Z)GdCdDe'ee Z*GdEdFe Z+GdGdHeZ,dIZ-GdJdKe e Z.ee.dLdM dNZ/dOZ0dPZ1dTdQZ2dUdRZ3dUdSZ4y)VN)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc |rT|jddjddjddjdd}|j|yy) N&z&z>)replacewrite)r+ras r _write_datar(sP! ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-) rrrrrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r\)rr]rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r] __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r]rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrbrrfr rrr[r[|s#IDrr[cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcp |jy |j|jS#t$rYywxYwr)rrr)rr<s r getAttributezElement.getAttributesB  ;;  ;;w'-- -  s ) 55cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrqs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjrxrrNrr)rr qualifiedNamerr localnamerqs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrwzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr|zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrkrr$rremoveAttributeNoderrr_set_attribute_node)rrqold1old2s rrxzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrqs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrqs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc: |jy||jvSNFrr?s r hasAttributezElement.hasAttributeDs% ;; t{{""rc<|jy||f|jvSr)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc. t||tSr-rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrbzElement.__repr___s)T\\2d8,DDDrc. |j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y|jd |zy) Nrz %s="rrr>rrz%s) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbsC   VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rkrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rwsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r|r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrkrurorbrsruryrrwr|rxsetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrbr&rrrrrr rrrhrhs1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrhrz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrkrrrrrr)elementrqs rrrsQG  $GNN499<@Gd''89  Drc\eZdZ dZdZeZdZdZdZ dZ dZ dZ dZ dZd Zd Zy) Childlessr Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuerdrc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrar)rra dotdotdots rrbzCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrr r s  HHBrr c4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrXz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr#r$rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr%rc@tjjdr#r$rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr%rc@tjjdr#r$rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr%rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrXrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c$eZdZ dZdZdZdZy) IdentifiedpublicIdsystemIdc ||_||_yr-r-)rr.r/s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r.rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r/rs r _get_systemIdzIdentified._get_systemIdr4rN)rrrrr1r3r6r rrr,r,sJ&I!rr,cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr{rr)rr}rr~s rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr8rrrCrDUserDataHandler NODE_CLONEDr:rr;Notationr.r/rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rlr&r rrr8r8s:&&HI DHHN"#6 rr8cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rDNcb||_||_t|_|j ||yr-)rrErr/r1)rrr.r/rHs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rFrs r_get_actualEncodingzEntity._get_actualEncodingbr?rc|jSr-rrs r _get_encodingzEntity._get_encodinger4rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder[rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder[r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder[rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrFrrrrrSrVrYrIrArHr[r rrrDrDSsNJHINHG8 #8;:9rrDc.eZdZejZdZdZy)rCNc6||_|j||yr-)rr1)rrr.r/s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrCrC{s!!HI8rrCc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)rd2.0)rdN)rCre)rCrf)rCN)ls-loadz3.0)rgNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr{rcreateElementNSrIrjdoctypern) rrr}rpradd_root_elementrr~rs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rprbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]s}t |||}|j j||jtjk(rn$|jtjk(r||_ ||_ u|jtj j"j$|||Sr-)rnrrrrrrr/rircr$r r%rNrprGrrCrDrArB)rrkrGrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J    # #J /""d&8&88$$(?(?? * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rhrj)rrrIs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)r rjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r{rhrj)rrr}rrrIs rrozDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r{rrjr)rrr}rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rDrj)rrr.r/rErIs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rCrj)rrr.r/rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrqs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrNri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrlr$r rdrrrrrrrrrrrrrrrrxr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrNrBrcrnr%r$rrrrGrQrPrFrrrrrrrrrrrSrrrVrrrrYrIrHrrbrlrrrrrrrrorrrrrrrsrr&rr rrrwrwsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrwrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}nM|jtj8k(r|j;|j6}n|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_n7|jtjJk(rtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)NTrzCannot clone node %s)9rjryrCrDrArB NODE_IMPORTEDr$r rdrorrrrrrr|rrr/rirIr?rr`rrarrrrrrrrrrNrnrtrr.r/r:rr;rCrcrrrDrErFrrrrrF) rUrknewOwnerDocumentrrGrqrrgrTrGrHrIrJs rriri\s $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r}fieldss rr{r{s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orc| ||sddlm}|j|Sddlm}t |j|f||dS)Nr expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrsB= ~g(!!$''# ' 24 4rcv |ddlm}|j|Sddlm}t |j|fd|iS)Nrrrr)rr parseStringrr)stringrrrs rrrsB0 ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrwrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)5r rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr[rrhrrrrrrrr rrr,r8rDrCrcryrNrwrir{rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPKm#]H:gg'dom/__pycache__/minidom.cpython-312.pycnu[ dAi ZdZddlZddlZddlmZmZmZmZddlddl m Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGd d!eZeddZGd"d#e Zeed$d% eed d& d'ZGd(d)ZGd*d+ee Z Gd,d-ee Z!ee!dd. Gd/d0e!Z"ee"d1d2 ee"d3d4 d5Z#d6Z$Gd7d8e!Z%Gd9d:e"Z&Gd;dd?Z(Gd@dAe(ee Z)GdBdCe(e Z*GdDdEe(ee Z+GdFdGe Z,GdHdIeZ-dJZ.GdKdLe e Z/ee/dMdN dOZ0dPZ1dQZ2dUdRZ3dVdSZ4dVdTZ5y)WacSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc|rT|jddjddjddjdd}|j|y y ) zWrites datachars to writer.&z&z>N)replacewrite)r+ras r _write_datar(sM ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-)!rrr__doc__rrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r])rr^rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r^ __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r^rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrcrrgr rrr\r\|s#IDrr\cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcn|jy |j|jS#t$rYywxYw)aReturns the value of the specified attribute. Returns the value of the element's attribute named attname as a string. An empty string is returned if the element does not have such an attribute. Note that an empty string may also be returned as an explicitly given attribute value, use the hasAttribute method to distinguish these two cases. r)rrr)rr<s r getAttributezElement.getAttributes= ;;  ;;w'-- -  s ( 44cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrrs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjryrrNrr)rr qualifiedNamerr localnamerrs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrxzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr}zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrlrr$rremoveAttributeNoderrr_set_attribute_node)rrrold1old2s rryzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrrs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrrs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc8|jy||jvS)zChecks whether the element has an attribute with the specified name. Returns True if the element has an attribute with the specified name. Otherwise, returns False. Frr?s r hasAttributezElement.hasAttributeDs ;; t{{""rc<|jy||f|jvSNF)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc,t||tS)zReturns all descendant elements with the given tag name. Returns the list of all descendant elements (not direct children only) with the specified tag name. rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrczElement.__repr___s)T\\2d8,DDDrc,|j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y |jd |zy ) zWrite an XML element to a file-like object Write the element to the writer object that must provide a write method (e.g. a file or StringIO object). rz %s="rrr>rrz%sN) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbs>  VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rlrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rxsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r}r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrlrurprbrtrvrzrrxr}rysetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrcr&rrrrrr rrriris1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrirz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrlrrrrrr)elementrrs rrrsQG  $GNN499<@Gd''89  Drc^eZdZdZdZdZeZdZdZ dZ dZ dZ dZ dZd Zd Zd Zy) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. r Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrXrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuererc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrbr)rra dotdotdots rrczCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrrrs  HHBrrc4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrYz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr$r%rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr&rc@tjjdr$r%rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr&rc@tjjdr$r%rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr&rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrYrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c&eZdZdZdZdZdZdZy) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdc ||_||_yr-r.)rr/r0s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r/rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r0rs r _get_systemIdzIdentified._get_systemIdr5rN)rrrrXrr2r4r7r rrr-r-sJ&I!rr-cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr|rr)rr~rrs rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr9rrrCrDUserDataHandler NODE_CLONEDr;rr<Notationr/r0rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rs rr&zDocumentType.writexmlEs \" TYY == LL $--t}}F G ]] LLdDMMB C    * LL  LL,, - LL  SXrr)rrrr DOCUMENT_TYPE_NODEr$rrr/r0r>rr?rlr&r rrr9r9s:&&HI DHHN"#6 rr9cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rENcb||_||_t|_|j ||yr-)rrFrr/r2)rrr/r0rIs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rGrs r_get_actualEncodingzEntity._get_actualEncodingbr@rc|jSr-rrs r _get_encodingzEntity._get_encodinger5rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder\rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder\r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder\rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrGrrrrrTrWrZrIrArHr[r rrrErESsNJHINHG8 #8;:9rrEc.eZdZejZdZdZy)rDNc6||_|j||yr-)rr2)rrr/r0s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrDrD{s!!HI8rrDc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)re2.0)reN)rCrf)rCrg)rCN)ls-loadz3.0)rhNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr|rcreateElementNSrIrjdoctypern) rrr~rqradd_root_elementrrrs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rqrbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]}t |||}|jj|sJ|j j||jtjk(r|j4J|jtjk(r|jJ||_||_|j#t$j&j(j*|||Sr-)rnrsrrrrr/rirjryrcr$r r%rrOrqrGrrCrDrBrC)rrkrHrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J++66u= ==    # #J /""d&8&88,,444$$(?(??}},,, * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rirj)rrrJs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)rrjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r|rirj)rrr~rrrJs rrpzDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r|rrjr)rrr~rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rErj)rrr/r0rFrJs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rDrj)rrr/r0rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrrs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrOri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrmr$r rdrrrrrrrrrrrrrrrryr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrOrBrdrnr%r$rrrrGrQrPrGrrrrrrrrrrrTrrrWrrrrZrIrHrrbrlrrrrrrrrprrrrrrrsrr&rr rrrxrxsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrxrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r)|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}n]|jtj8k(r|j;|j6}n#|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_nG|jtjJk(r|j|usJtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrzCannot clone node %s)9rjryrCrDrBrC NODE_IMPORTEDr$r rdrprrrrrrr}rrr/rirIr?rr`rrarrrrrrrrrrOrnrurr/r0r;rr<rDrcrrrErFrGrrrrrF) rUrknewOwnerDocumentrrHrrrrgrTrGrIrJrKs rriri\s   $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r~fieldss rr|r|s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orcz||sddlm}|j|Sddlm}t |j|f||dS)z3Parse a file into a DOM by filename or file object.r expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrs? ~g(!!$''# ' 24 4rct|ddlm}|j|Sddlm}t |j|fd|iS)z&Parse a file into a DOM from a string.rrrr)rr parseStringrr)stringrrrs rrrs? ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrxrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)6rXr rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr\rrirrrrrrrrrrr-r9rErDrdrzrNrxrir|rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPKm#] @ @0dom/__pycache__/xmlbuilder.cpython-312.opt-2.pycnu[ Th0 ddlZddlZddlmZgdZGddZGddZdZGd d e Z Gd d e Z Gd dZ [GddZ GddZy)N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcecZeZdZ dZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZy)OptionsTFN)__name__ __module__ __qualname__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr!rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r"__init__zDOMBuilder.__init__9s   r!c|jSr(entityResolverr*s r"_get_entityResolverzDOMBuilder._get_entityResolver<s"""r!c||_yr(r.)r+r/s r"_set_entityResolverzDOMBuilder._set_entityResolver>s ,r!c|jSr(rr*s r"_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r!c||_yr(r4)r+rs r"_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r!c|jSr(rr*s r" _get_filterzDOMBuilder._get_filterFs {{r!c||_yr(r9)r+rs r" _set_filterzDOMBuilder._set_filterHs  r!ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr)KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r+namestatesettingsvalues r" setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr()hasattrr)r@)r+rHs r"r>zDOMBuilder.supportsFeatureYst}}k$&788r!cHt||xrdxsdf}||jvS)Nr r)r@r?)r+rHrIkeys r" canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r!rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rRrSrTrUrW)rr rVrXrZrrr rr r )rXrYrZ)rr)rr r[r\r]ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)r@getattrr)AttributeErrorrrrrrrrrrrCrDrFrG)r+rHxnameoptionss r" getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&rQr?rcrirfr{rrr r!r"rr,sNL FN !$&?)+?AN"#-!) H9%;% )(+; & )(+;   ; ) ,+.; ) ,+.; + .-0; + .-0; " %$';" ' *),#;& ' *),';*  * +;0  1;4 - 0/25;8 - 0/29;<  ! #=;@  ! #A;D  E;J  203 203 3 -+.  s;IzK$!3A )r!rcB|jjddS)N-_)lowerreplace)rHs r"r@r@s ::<  S ))r!c(eZdZdZdZdZdZdZy)r)_openerct}||_||_|jj ||_|j ||_ddl}ddl }|jj|}|\}}} } } } | rM| jds<|j| dz} ||| | | | f}|jj||_|S)Nr/)rpublicIdrn _get_openeropenrm_guess_media_encodingencoding posixpath urllib.parserfurlparseendswithdirname urlunparsebaseURI) r+rrnsourcerrtpartsschemenetlocpathparamsqueryfragments r"rezDOMEntityResolver.resolveEntitys!"" ,,.33H=44V< ' %%h/8=5feX  c*$$T*S0DFD&%AE#\\44U;FN r!c| |jS#t$r$|j|_|jcYSwxYwr()rr`_create_openerr*s r"rzDOMEntityResolver._get_openers: <<  ..0DL<<  s *;;c>ddl}|jjSrk)rorp build_opener)r+rts r"rz DOMEntityResolver._create_openers~~**,,r!c~|jj}|jd}||jSy)Ncharset)rminfo get_paramr)r+rrrs r"rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r!N)r r r __slots__rerrrr r!r"rrsI, -r!rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrmcharacterStream stringDatarrrnrcfd|_d|_d|_d|_d|_d|_d|_yr(rr*s r"r,zDOMInputSource.__init__s4#    r!c|jSr(rmr*s r"_get_byteStreamzDOMInputSource._get_byteStream r!c||_yr(r)r+rms r"_set_byteStreamzDOMInputSource._set_byteStreams $r!c|jSr(rr*s r"_get_characterStreamz#DOMInputSource._get_characterStreams###r!c||_yr(r)r+rs r"_set_characterStreamz#DOMInputSource._set_characterStreams .r!c|jSr(rr*s r"_get_stringDatazDOMInputSource._get_stringDatarr!c||_yr(r)r+datas r"_set_stringDatazDOMInputSource._set_stringDatas r!c|jSr(rr*s r" _get_encodingzDOMInputSource._get_encoding }}r!c||_yr(r)r+rs r" _set_encodingzDOMInputSource._set_encoding    r!c|jSr(rr*s r" _get_publicIdzDOMInputSource._get_publicId#rr!c||_yr(r)r+rs r" _set_publicIdzDOMInputSource._set_publicId%rr!c|jSr(rnr*s r" _get_systemIdzDOMInputSource._get_systemId(rr!c||_yr(r)r+rns r" _set_systemIdzDOMInputSource._set_systemId*rr!c|jSr(rr*s r" _get_baseURIzDOMInputSource._get_baseURI-s ||r!c||_yr(rr+rgs r" _set_baseURIzDOMInputSource._set_baseURI/s  r!N)r r r rr,rrrrrrrrrrrrrrr r!r"rrsU@I%$/!!!r!rcHeZdZ dZdZdZdZejZ dZ dZ dZ y) DOMBuilderFilterr r$r%r&c|jSr() whatToShowr*s r"_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr!c|jSr( FILTER_ACCEPTr+elements r" acceptNodezDOMBuilderFilter.acceptNodeG!!!r!c|jSr(rrs r"startContainerzDOMBuilderFilter.startContainerJrr!N) r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr r!r"rr3s8MMK$$J""r!rc6eZdZ dZdZdZdZdZdZdZ y) DocumentLSFcy)NFr r*s r" _get_asynczDocumentLS._get_asyncUsr!cF|rtjjdy)Nz.asynchronous document loading is not supported)rCrDrE)r+flags r" _set_asynczDocumentLS._set_asyncXs& ''))@B B r!ctd)Nz'haven't figured out what this means yetrxr*s r"abortzDocumentLS.abort]s" 57 7r!ctdNzhaven't written this yetrrs r"loadzDocumentLS.loadc!"<==r!ctdrr)r+rs r"loadXMLzDocumentLS.loadXMLfrr!c||}|j S|j|urtjj|j Sr() ownerDocumentrCrDWrongDocumentErrtoxml)r+snodes r"saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r!N) r r r async_rrrrrrr r!r"rrPs)G FB 7 >>r!rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r$c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rCrDrEMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrw)r+mode schemaTypes r"createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r!ctd)Nz-the writer interface hasn't been written yet!rr*s r"createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r!ctSr()rr*s r"createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r!N)r r r rrr r rr r!r"rrqs 3= r!r)rlxml.domrCxml.dom.NodeFilterr__all__rrr@objectrrrrrr r!r"rst: ) @@a)a)H*++\.V.b""4B  r!PKm#];bcBB-dom/__pycache__/pulldom.cpython-312.opt-2.pycnu[ Thu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#c d|_yr%)r8rys rclearz PullDOM.clears 8 r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|SNr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PKm#]ف&dom/__pycache__/domreg.cpython-312.pycnu[ Th{ 8dZddlZdddZiZdZdZd dZd Zy) zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc|t|<y)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtc@|D]\}}|j||ryy)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr) hasFeature)domfeaturesfvs r _good_enoughr s&!~~a" r cPddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr'sG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s0 D D%$D%cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)__doc__rrrr rrr!r5r r r7s;>  '   )>Vr PKm#]J*''.dom/__pycache__/__init__.cpython-312.opt-2.pycnu[ Th GddZdZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGd d!eZGd"d#eZGd$d%eZGd&d'eZGd(d)eZGd*d+eZGd,d-eZGd.d/eZ Gd0d1eZ!Gd2d3eZ"Gd4d5Z#d6Z$d7Z%d8Z&d9Z'd9Z(dd:l)m*Z*m+Z+y9);cBeZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zy)Node N)__name__ __module__ __qualname__ __slots__ ELEMENT_NODEATTRIBUTE_NODE TEXT_NODECDATA_SECTION_NODEENTITY_REFERENCE_NODE ENTITY_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODEDOCUMENT_TYPE_NODEDOCUMENT_FRAGMENT_NODE NOTATION_NODEr)/usr/lib64/python3.12/xml/dom/__init__.pyrrsM.I#$L"#N"#I"#"#"#K"#"#L"#M"$"$"$Mr!rrrrrr r r r r rrr ceZdZ dZdZy) DOMExceptioncp|jtur tdtj|g|i|y)Nz0DOMException should not be instantiated directly) __class__r( RuntimeError Exception__init__)selfargskws r"r-zDOMException.__init__Bs8 >>\ )BD D4-$-"-r!c|jS)N)code)r.s r" _get_codezDOMException._get_codeHs yyr!N)rrrr-r3rr!r"r(r(>sI. r!r(ceZdZeZy) IndexSizeErrN)rrrINDEX_SIZE_ERRr2rr!r"r5r5L Dr!r5ceZdZeZy)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr2rr!r"r9r9O Dr!r9ceZdZeZy)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr2rr!r"r=r=R Dr!r=ceZdZeZy)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr2rr!r"rArAUr;r!rAceZdZeZy)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr2rr!r"rDrDXr?r!rDceZdZeZy)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr2rr!r"rGrG[ Dr!rGceZdZeZy)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr2rr!r"rKrK^s &Dr!rKceZdZeZy) NotFoundErrN)rrr NOT_FOUND_ERRr2rr!r"rNrNa Dr!rNceZdZeZy)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr2rr!r"rRrRd Dr!rRceZdZeZy)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr2rr!r"rVrVgrIr!rVceZdZeZy)InvalidStateErrN)rrrINVALID_STATE_ERRr2rr!r"rYrYjrTr!rYceZdZeZy) SyntaxErrN)rrr SYNTAX_ERRr2rr!r"r\r\ms Dr!r\ceZdZeZy)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr2rr!r"r_r_ps #Dr!r_ceZdZeZy) NamespaceErrN)rrr NAMESPACE_ERRr2rr!r"rbrbsrPr!rbceZdZeZy)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr2rr!r"rerevr;r!receZdZeZy) ValidationErrN)rrrVALIDATION_ERRr2rr!r"rhrhyr7r!rhceZdZ dZdZdZdZy)UserDataHandlerrrrrN)rrr NODE_CLONED NODE_IMPORTED NODE_DELETED NODE_RENAMEDrr!r"rkrk|sLKMLLr!rkz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation),rr6r:r>rBrErHrLrOrSrWrZr]r`rcrfrir,r(r5r9r=rArDrGrKrNrRrVrYr\r_rbrerhrk XML_NAMESPACEXMLNS_NAMESPACEXHTML_NAMESPACEEMPTY_NAMESPACE EMPTY_PREFIXdomregrprqrr!r"rxsh"%%4"#!"!"!"!"!"!"!" !"!#!#!# !#!# !#!# 9 <|!,!|!,!|'|',l l $\$<|L7 10 CCr!PKm#]~((*dom/__pycache__/NodeFilter.cpython-312.pycnu[ ThGddZy)cVeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZy) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname____doc__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr)rrr*s""rPKm#]ف,dom/__pycache__/domreg.cpython-312.opt-1.pycnu[ Th{ 8dZddlZdddZiZdZdZd dZd Zy) zRegistration facilities for DOM. This module should not be used directly. Instead, the functions getDOMImplementation and registerDOMImplementation should be imported from xml.dom.Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc|t|<y)aIregisterDOMImplementation(name, factory) Register the factory function with the name. The factory function should return an object which implements the DOMImplementation interface. The factory function can either return the same object, or a new one (e.g. if that implementation supports some customization).N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtc@|D]\}}|j||ryy)zF_good_enough(dom, features) -> Return 1 if the dom offers the featuresr) hasFeature)domfeaturesfvs r _good_enoughr s&!~~a" r cPddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)aSgetDOMImplementation(name = None, features = ()) -> DOM implementation. Return a suitable DOM implementation. The name is either well-known, the module name of a DOM implementation, or None. If it is not None, imports the corresponding module and returns DOMImplementation object if the import succeeds. If name is not given, consider the available implementations to find one with the required feature set. If no implementation can be found, raise an ImportError. The features list must be a sequence of (feature, version) pairs which are passed to hasFeature.rNgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr'sG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s0 D D%$D%cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)__doc__rrrr rrr!r5r r r7s;>  '   )>Vr PKm#] 2dom/__pycache__/expatbuilder.cpython-312.opt-1.pycnu[ Thm dZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZej Zej"Zej$j&Zej$j(Zej$j*Zej$j,Zej.Zej2ddej2dd ej2dd ej2dd ej2dd ej2dd ej2ddej2ddej2ddd ZGddeZdZdZGddZeeefZ GddeZ!GddeZ"Gdde"Z#Gdde"Z$d Z%d!e%zZ&Gd"d#eZ'Gd$d%Z(Gd&d'e(eZ)Gd(d)e(e'Z*Gd*d+e+Z,Gd,d-eZ-d3d.Z.d3d/Z/d3d0Z0d3d1Z1d2Z2y)4zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c*|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.Nc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c*tjS)zCreate a new parser object.)r ParserCreater-s r) createParserzExpatBuilder.createParsers!!##r+cB|js|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParserso||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+ctjtdd|_|j|_|jj |_d|_y)z6Free all data structures used during DOM construction.NF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resets>,;; T4) }} --22 r+c|j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ y)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)r~zExpatBuilder.installs*.)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c||j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)zIParse a document from a file object, returning the document node.Ti@Fr+N) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles!   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B/8B// B;:B;c|j} |j|d|j||j}|j d|_|S#t$rY0wxYw)z*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc:eZdZdZdZdZdZdZeje jeje jeje jej e j"ej$e j&ej(e j*ej,e j.ej0e j2ej4e j6ej8e j:ej<e j>ej@e jBi Z"y)rpzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.roc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrrrrrr appendChildrr rar!r)r'rr"r#parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)#rPrQrRrrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) r@r?rsrrArrBrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r>r>s >Ic"eZdZdZdZdZdZy)rrTcptj|||j}dD]}t||dy)N)rrrrrr)r>r*rssetattr)r'rWrrbs r)r*zRejecter.__init__s5dG,D FD$ 'r+c,|jdz|_yr)r@r'argss r)rzRejecter.start_element_handlerskkAo r+c|jdk(rT|jj}|jj||j|_|j |_y|jdz |_yNrr3)r@r?rsr~rArrBr)r'rIrs r)rzRejecter.end_element_handlersV ;;! ]]**F MM ! !& ))-F &'+}}F $++/DKr+N)rPrQrRrSr*rrrTr+r)rr sI (&*r+rceZdZdZdZdZy)rrTc|jj}|j||jj|ur|jdz|_yyr)r?rrAr@)r'rIrs r)rzSkipper.start_element_handler*sE}}$$ ==  ,++/DK -r+c |jdk(rR|j|jj_|j |jj_d|_y|jdz |_|j |yrK)r@rAr?rsrrBrrHs r)rzSkipper.end_element_handler0s` ;;! 9=DMM ! ! 56:mmDMM ! ! 3 DM++/DK DMM4 r+N)rPrQrRrSrrrTr+r)rr'sI* !r+rz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c<eZdZdZd dZdZdZdZdZdZ d Z y) FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. Nc|jtk(r||_||_n|j|_||_t j ||yr&)rr5originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+c@|j|jS)zRParse a document fragment from a file object, returning the fragment node.)rrr'rs r)rzFragmentBuilder.parseFilees ,,r+c||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)zMParse a document fragment from a string, returning the fragment node.zPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrRrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrT) r'rrridentrnsattrsrrTs r)rzFragmentBuilder.parseStringjs !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 5C%%C8c:|jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rXz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r[z FragmentBuilder._getDeclarationssc ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrXrTr-s r)r\zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterRcreateDocumentFragmentrTrrZrkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|jj||fy)z/Push this namespace declaration on our storage.N)rqr)r'rgres r)rxz'Namespaces.start_namespace_decl_handlers !!((&#7r+cd|vrt||\}}}}nt}|}d}t}tj||||}|j |_t|j|||_|jr|jD]u\}}|r*tjt|d|zt|d}n tjdtdt}||_ |j |_t||w|jdd=|r|j|j } |j"} t%dt'|dD]} || } || dz} d| vr6t|| \}}}}tj||||}|| |<|| ||f<n0tj| t| t}|| | <|| t| f<|j |_| |_ ||_yy)Nr[xmlns:xmlnsrr^r3)rirrrElementrrr rrqrrYrrr _ensure_attributes_attrs_attrsNSrr` ownerElement)r'rbrrerfrgrhrrrrrr8rs r)rz Namespaces.start_element_handlers $;,:4,F )CFE!CEI!Fuc69=!]]dllD)  $ $#88  WT8f3D%E%4fgGA Wo%,l|j }|rt|S) zNReturn string of namespace attributes from this element and ancestors.rX_ns_prefix_urir|r}z z=''r[)rhasattrritemsrr)r'attrsrr rgredeclnames r)r\zFragmentBuilderNS._getNSattrs2s,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrrtr\rTr+r)rr+s4r+rceZdZdZy)rzEException raised to short-circuit parsing in InternalSubsetExtractor.N)rPrQrRrrTr+r)rrPsOr+rc>eZdZdZdZdZdZdZdZdZ dZ d Z y) rzBXML processor which can rip out the internal document type subset.Nc|jS)z'Return the internal subset as a string.)rr-s r)rz!InternalSubsetExtractor.getSubsetYs {{r+cP tj||y#t$rYywxYwr&)rkrrrVs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)r~zInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrXz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrr~rrrrTr+r)rrTs.L F  @  r+rc|r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrk isinstancestropenr)r namespacesrWfpresults r)parsersl  ".$ $ &&r*F M""4( M  Ms A##A-cR|r t}n t}|j|S)zOParse a document from a string, returning the resulting Document node. )rrkr)rrrWs r)rrs' ".   v &&r+c|r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrPrrrr)rrrrWrrs r) parseFragmentrsq#G,!'*$ $ &&r*F M""4( M  Ms A%%A/cV|r t|}n t|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrPr)rrrrWs r)parseFragmentStringrs, #G,!'*   v &&r+cF|jr t|St|S)z,Create a builder based on an Options object.)rrrk)rus r) makeBuilderrs!g&&G$$r+)T)3rxml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr5DOMBuilderFilterrrrrgetDOMImplementationrTypeInfor6objectr rYrirkr rpr>rrrir]rProrr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PKm#]v$822,dom/__pycache__/expatbuilder.cpython-312.pycnu[ Thm dZddlmZmZmZddlmZmZmZddlm Z ddl m Z m Z ddl mZejZej Zej"Zej$j&Zej$j(Zej$j*Zej$j,Zej.Zej2ddej2dd ej2dd ej2dd ej2dd ej2dd ej2ddej2ddej2ddd ZGddeZdZdZGddZeeefZ GddeZ!GddeZ"Gdde"Z#Gdde"Z$d Z%d!e%zZ&Gd"d#eZ'Gd$d%Z(Gd&d'e(eZ)Gd(d)e(e'Z*Gd*d+e+Z,Gd,d-eZ-d3d.Z.d3d/Z/d3d0Z0d3d1Z1d2Z2y)4zFacility to use the Expat parser to load a minidom instance from a string or file. This avoids all the overhead of SAX and pulldom to gain performance. ) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c6d|vsJ|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs $;; JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document instance.Nc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c*tjS)zCreate a new parser object.)r ParserCreater-s r) createParserzExpatBuilder.createParsers!!##r+cB|js|j|_|jjj|_d|j_d|j_d|j_|j|j|jS)z7Return the parser object, creating a new one if needed.T) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParserso||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+ctjtdd|_|j|_|jj |_d|_y)z6Free all data structures used during DOM construction.NF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resets>,;; T4) }} --22 r+c|j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ y)z>Install the callbacks needed to build the DOM into the parser.N)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)r~zExpatBuilder.installs*.)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c||j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)zIParse a document from a file object, returning the document node.Ti@Fr+N) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles!   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B/8B// B;:B;c|j} |j|d|j||j}|j d|_|S#t$rY0wxYw)z*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc:eZdZdZdZdZdZdZeje jeje jeje jej e j"ej$e j&ej(e j*ej,e j.ej0e j2ej4e j6ej8e j:ej<e j>ej@e jBi Z"y)rpzoWrapper around a DOMBuilderFilter which implements the checks to make the whatToShow filter attribute work.roc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrrrrrr appendChildrr rar!r)r'rr"r#parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)#rPrQrRrrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) r@r?rsrrArrBrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r>r>s >Ic"eZdZdZdZdZdZy)rrTcptj|||j}dD]}t||dy)N)rrrrrr)r>r*rssetattr)r'rWrrbs r)r*zRejecter.__init__s5dG,D FD$ 'r+c,|jdz|_yr)r@r'argss r)rzRejecter.start_element_handlerskkAo r+c|jdk(rT|jj}|jj||j|_|j |_y|jdz |_yNrr3)r@r?rsr~rArrBr)r'rIrs r)rzRejecter.end_element_handlersV ;;! ]]**F MM ! !& ))-F &'+}}F $++/DKr+N)rPrQrRrSr*rrrTr+r)rr sI (&*r+rceZdZdZdZdZy)rrTc|jj}|j||jj|ur|jdz|_yyr)r?rrAr@)r'rIrs r)rzSkipper.start_element_handler*sE}}$$ ==  ,++/DK -r+c |jdk(rR|j|jj_|j |jj_d|_y|jdz |_|j |yrK)r@rAr?rsrrBrrHs r)rzSkipper.end_element_handler0s` ;;! 9=DMM ! ! 56:mmDMM ! ! 3 DM++/DK DMM4 r+N)rPrQrRrSrrrTr+r)rr'sI* !r+rz8http://xml.python.org/entities/fragment-builder/internalz %%s ]> &fragment-builder-internal;c<eZdZdZd dZdZdZdZdZdZ d Z y) FragmentBuilderzBuilder which constructs document fragments given XML source text and a context node. The context node is expected to provide information about the namespace declarations which are in scope at the start of the fragment. Nc|jtk(r||_||_n|j|_||_t j ||yr&)rr5originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+c@|j|jS)zRParse a document fragment from a file object, returning the fragment node.)rrr'rs r)rzFragmentBuilder.parseFilees ,,r+c||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)zMParse a document fragment from a string, returning the fragment node.zPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrRrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrT) r'rrridentrnsattrsrrTs r)rzFragmentBuilder.parseStringjs !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 5C%%C8c:|jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) zRe-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string. rXz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r[z FragmentBuilder._getDeclarationssc ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrXrTr-s r)r\zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterRcreateDocumentFragmentrTrrZrkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|jj||fy)z/Push this namespace declaration on our storage.N)rqr)r'rgres r)rxz'Namespaces.start_namespace_decl_handlers !!((&#7r+cd|vrt||\}}}}nt}|}d}t}tj||||}|j |_t|j|||_|jr|jD]u\}}|r*tjt|d|zt|d}n tjdtdt}||_ |j |_t||w|jdd=|r|j|j } |j"} t%dt'|dD]} || } || dz} d| vr6t|| \}}}}tj||||}|| |<|| ||f<n0tj| t| t}|| | <|| t| f<|j |_| |_ ||_yy)Nr[xmlns:xmlnsrr^r3)rirrrElementrrr rrqrrYrrr _ensure_attributes_attrs_attrsNSrr` ownerElement)r'rbrrerfrgrhrrrrrr8rs r)rz Namespaces.start_element_handlers $;,:4,F )CFE!CEI!Fuc69=!]]dllD)  $ $#88  WT8f3D%E%4fgGA Wo%,lrgrdrrr)r'rbrrerfrgrhs r)rzNamespaces.end_element_handlersllGd{0>tT0J-Y,,3#--:#NNf4???5 ''4/@?@/++>DCD>"--DL  $ $W -r+N) rPrQrRrrrrxr~rxrrrTr+r)roros)A'  38-&^  .r+roceZdZdZdZy)ExpatBuilderNSz*Document builder that supports namespaces.cNtj||jyr&)rkrtrrr-s r)rtzExpatBuilderNS.reset&s4  r+N)rPrQrRrrtrTr+r)rr#s 4r+rceZdZdZdZdZy)FragmentBuilderNSz*Fragment builder that supports namespaces.cNtj||jyr&)rPrtrrr-s r)rtzFragmentBuilderNS.reset.sd# r+cd}|j}g}|rtt|drY|jjD]<\}}||vr |j ||rd|z}nd}|r |d|d|d}4d|d|d}>|j }|rt|S) zNReturn string of namespace attributes from this element and ancestors.rX_ns_prefix_urir|r}z z=''r[)rhasattrritemsrr)r'attrsrr rgredeclnames r)r\zFragmentBuilderNS._getNSattrs2s,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrrtr\rTr+r)rr+s4r+rceZdZdZy)rzEException raised to short-circuit parsing in InternalSubsetExtractor.N)rPrQrRrrTr+r)rrPsOr+rc>eZdZdZdZdZdZdZdZdZ dZ d Z y) rzBXML processor which can rip out the internal document type subset.Nc|jS)z'Return the internal subset as a string.)rr-s r)rz!InternalSubsetExtractor.getSubsetYs {{r+cP tj||y#t$rYywxYwr&)rkrrrVs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)r~zInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrXz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrr~rrrrTr+r)rrTs.L F  @  r+rc|r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)z{Parse a document, returning the resulting Document node. 'file' may be either a file name or an open file object. rbN)rrk isinstancestropenr)r namespacesrWfpresults r)parsersl  ".$ $ &&r*F M""4( M  Ms A##A-cR|r t}n t}|j|S)zOParse a document from a string, returning the resulting Document node. )rrkr)rrrWs r)rrs' ".   v &&r+c|r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYw)zParse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. rN)rrPrrrr)rrrrWrrs r) parseFragmentrsq#G,!'*$ $ &&r*F M""4( M  Ms A%%A/cV|r t|}n t|}|j|S)zParse a fragment of a document from a string, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. )rrPr)rrrrWs r)parseFragmentStringrs, #G,!'*   v &&r+cF|jr t|St|S)z,Create a builder based on an Options object.)rrrk)rus r) makeBuilderrs!g&&G$$r+)T)3rxml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr5DOMBuilderFilterrrrrgetDOMImplementationrTypeInfor6objectr rYrirkr rpr>rrrir]rProrr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PKm#] 0dom/__pycache__/minicompat.cpython-312.opt-1.pycnu[ Th' PdZgdZddlZefZGddeZGddeZ dZ y) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. )NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrcbt|d|z}|fd}t|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Crr")getattrr+setattr)klassr?r#getr@props rrres7 %'D. *C"C C# &D E4r) __doc____all__xml.domrstrrlistrtuplerrrrrrLs<T Ff t0BEB6rPKm#]O O ,dom/__pycache__/domreg.cpython-312.opt-2.pycnu[ Th{ 6 ddlZdddZiZdZdZd dZdZy) Nzxml.dom.minidomzxml.dom.DOMImplementation)minidom4DOMc |t|<y)N) registered)namefactorys '/usr/lib64/python3.12/xml/dom/domreg.pyregisterDOMImplementationr sJtcB |D]\}}|j||ryy)Nr) hasFeature)domfeaturesfvs r _good_enoughr s)L!~~a" r cR ddl}d}tj|}|rt|iidg}|j S|r t |St jjs'd|jvrt |jdSt|tr t|}t jD]}|}t||s|cStjD]} t |}t||s|cSt#d#t $rY8wxYw)NrgetDOMImplementation PYTHON_DOM)rz$no suitable DOM implementation found)oswell_known_implementationsget __import__rrsysflagsignore_environmentenviron isinstancestr_parse_feature_stringvaluesrkeys Exception ImportError)rrrcreatormodrs r rr's CG $ ( ( .C b"'=&>?'')) $!! YY ) )lbjj.H#2::l+CDD(C (2$$&i X &J' .224 &g6C X &J 5 < ==    s1 D D&%D&cg}|j}d}t|}||krR||}|ddvrtd||dz}d}||kr||}|ddvr|dz}|}|j||f||krRt |S)Nr 0123456789zbad feature name: r )splitlen ValueErrorappendtuple)srpartsilengthfeatureversionrs r r!r!RsH GGIE A ZF f*( 1: %w@A A E v:aAt|#E'*+ f* ?r )N)rrrr rrr!r5r r r6s;>  '   )>Vr PKm#],2dom/__pycache__/expatbuilder.cpython-312.opt-2.pycnu[ Thm  ddlmZmZmZddlmZmZmZddlmZddl m Z m Z ddl m Z ejZejZej Zej"j$Zej"j&Zej"j(Zej"j*Zej,Zej0ddej0ddej0dd ej0dd ej0dd ej0dd ej0dd ej0ddej0ddd ZGddeZdZdZGddZeeefZGddeZ GddeZ!Gdde!Z"Gdde!Z#dZ$d e$zZ%Gd!d"eZ&Gd#d$Z'Gd%d&e'eZ(Gd'd(e'e&Z)Gd)d*e*Z+Gd+d,eZ,d2d-Z-d2d.Z.d2d/Z/d2d0Z0d1Z1y)3) xmlbuilderminidomNode)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACE)expat) _append_child_set_attribute_node) NodeFilterNcdata enumerationentityentitiesididrefidrefsnmtokennmtokens) CDATAENUMENTITYENTITIESIDIDREFIDREFSNMTOKENNMTOKENScHeZdZdZd dZdZdZdZdZdZ d Z d Z d Z y) ElementInfo _attr_info_modeltagNameNc.||_g|_||_yN)r$r"r#)selfr$models -/usr/lib64/python3.12/xml/dom/expatbuilder.py__init__zElementInfo.__init__?s  cH|j|j|jfSr&r!r's r) __getstate__zElementInfo.__getstate__Ds T\\99r+c.|\|_|_|_yr&r!)r'states r) __setstate__zElementInfo.__setstate__Gs5:2dlr+c|jD]0}|d|k(s |d}|ddk(r tdcSt|dcStjS)Nr(r)r" _typeinfo_mapr_no_type)r'anameinfots r)getAttributeTypezElementInfo.getAttributeTypeJsXOODAw%HQ43;(00(b22 $r+c"tjSr&)rr7)r' namespaceURI localNames r)getAttributeTypeNSzElementInfo.getAttributeTypeNSTsr+c|jrE|jd}|tjjtjjfvSyNrF)r#r r( XML_CTYPE_ANYXML_CTYPE_MIXED)r'types r)isElementContentzElementInfo.isElementContentWsF ;;;;q>D 9 9 % ; ; == =r+cp|jr*|jdtjjk(SyrA)r#r r(XML_CTYPE_EMPTYr-s r)isEmptyzElementInfo.isEmpty_s) ;;;;q>U[[%@%@@ @r+cJ|jD]}|d|k(s |ddk(cSy)Nr3r4rF)r")r'r8r9s r)isIdzElementInfo.isIdes0OODAw%Bx4''$r+c(|j||fSr&)rJ)r'eurienameaurir8s r)isIdNSzElementInfo.isIdNSksyy$''r+r&) __name__ __module__ __qualname__ __slots__r*r.r1r;r?rErHrJrOr+r)r r <s41I :;    (r+r c&|j||Sr&)_intern_setdefault)builderss r)_internrYos  % %a ++r+c*|jd}|j}t|dk(r)|\}}}|||}|d|}|||}|||}n3t|dk(r|\}}t}|||x}}nt d|z||||||fS)N :z4Unsupported syntax: spaces in URIs not supported: %r)splitrVlenr ValueError)rWnamepartsinternuri localnameprefixqnames r)_parse_ns_namerirs JJsOE  ' 'F 5zQ!&Y'!9-ue$9i0 UqY"9i88 ORVVWW #s Y 55r+ceZdZ ddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) ExpatBuilderNc|tj}||_|jj%t |jj|_nd|_t |_d|_|jyr&) rOptions_optionsfilterFilterVisibilityController_filterr_finish_start_element_parserreset)r'optionss r)r*zExpatBuilder.__init__sc ? ((*G ==   +5dmm6J6JKDLDL*,D &  r+c, tjSr&)r ParserCreater-s r) createParserzExpatBuilder.createParsers)!!##r+cD |js|j|_|jjj|_d|j_d|j_d|j_|j|j|jSNT) rsrxrd setdefaultrV buffer_textordered_attributesspecified_attributesinstallr-s r) getParserzExpatBuilder.getParsersrE||,,.DL&*ll&9&9&D&DD #'+DLL $.2DLL +04DLL - LL &||r+c tjtdd|_|j|_|jj |_d|_yNF)theDOMImplementationcreateDocumentrdocumentcurNode _elem_info_cdatar-s r)rtzExpatBuilder.resetsAD,;; T4) }} --22 r+c |j|_|j|_|j|_|j |_|jjr|j|_ |j|_ |jjr|j|_|jj"r4|j$|_|j(|_|j,|_n|j0|_|j2|_|j6|_|j:|_|j>|_ yr&)!start_doctype_decl_handlerStartDoctypeDeclHandlerfirst_element_handlerStartElementHandlerend_element_handlerEndElementHandler pi_handlerProcessingInstructionHandlerrnrentity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_sectionsstart_cdata_section_handlerStartCdataSectionHandlerend_cdata_section_handlerEndCdataSectionHandlercharacter_data_handler_cdataCharacterDataHandlercharacter_data_handlerexternal_entity_ref_handlerExternalEntityRefHandlerxml_decl_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr'parsers r)rzExpatBuilder.installsL)-)H)H&%)%?%?"#'#;#; .2oo+ == ! !'+'?'?F $%)%?%?" == ! !$($8$8F ! == ' '.2.N.NF +,0,J,JF )*.*K*KF '*.*E*EF '*.*J*J' $ 5 5$($=$=!$($=$=!r+c~ |j}d} |jdx}rQ|j|d|r'|jjr|j |d}|jdx}rQ|jdd|j}|jd|_|S#t $rY0wxYw)NTi@Fr+) rreadParserdocumentElement _setup_subset ParseEscapertrs)r'filer first_bufferbufferdocs r) parseFilezExpatBuilder.parseFiles !   IIg..&. VU+DMM$A$A&&v.$ !IIg..&. LLd #mm      sA#B09B00 B<;B<c |j} |j|d|j||j}|j d|_|S#t$rY0wxYwrz)rrrrrrtrs)r'stringrrs r) parseStringzExpatBuilder.parseStringsfJ!  LL &   v &mm      s#A A'&A'c |jjrGt}|j||j }||jj_yyr&)rdoctypeInternalSubsetExtractorr getSubsetinternalSubset)r'r extractorsubsets r)rzExpatBuilder._setup_subsetsM= == /1I  ! !& )((*F39DMM ! ! 0 !r+c~|jjj|||}|j|_t |j|||j_|j rn|j j|tk(rLd|j_|jjd=d}d|j_ d|j_ |rb|"g|j_g|j_d|j_d|j_|j$|j_yyN)rimplementationcreateDocumentType ownerDocumentr rrq acceptNode FILTER_REJECT childNodesrsrrr_seq notationsrrend_doctype_decl_handlerEndDoctypeDeclHandler)r' doctypeNamesystemIdpublicIdhas_internal_subsetrs r)rz'ExpatBuilder.start_doctype_decl_handlers--..AA 8- $ dmmW- '  <*>DLL '48OO 14<<')D $$0r+c|jj||}t|j||jr?|jj |t k(r|jj|yyyr&)rcreateProcessingInstructionr rrqrr removeChild)r'targetdatanodes r)rzExpatBuilder.pi_handler s]}}88FdllD) <DII$EDI <<>DDI!%D dllD)r+c2|jj}|r0|djtk(r|d}|j|z|_yt j }|j|z|_|j|_t|j|yr) rrrrrrrrrr )r'rrrs r)rz#ExpatBuilder.character_data_handler#sv\\,, *R.11Y>b>D D(DI ||~II$ !]]dllD)r+c |ry|jjsy|jj||||}|6|jj |} |j j | |jjjjj ||jrO|jj|tk(r,|jjjjd=yyyr) rnrr_create_entitycreateTextNoderappendrrrqrr) r' entityNameis_parameter_entityrbaserr notationNamerchilds r)rz ExpatBuilder.entity_decl_handler.s  }}%% }}++J,4lD  MM007E OO " "5 ) &&++2248 <.& :O**+ *( *8$9 + %%5 -".* !$" B1r+rkc8eZdZ dZdZdZdZeje jeje jeje jeje j ej"e j$ej&e j(ej*e j,ej.e j0ej2e j4ej6e j8ej:e j<ej>e j@i Z!y)rproc||_yr&r)r'ros r)r*z#FilterVisibilityController.__init__s  r+c|j|j}|jj|zrK|jj |}|t k(rt |tvrtdt|z|StS)Nz)startContainer() returned illegal value: ) _nodetype_maskrro whatToShowrFILTER_INTERRUPTr_ALLOWED_FILTER_RETURNSrareprr)r'rmaskvals r)rz)FilterVisibilityController.startContainersz""4==1 ;; ! !D (++,,T2C&&!!11 ADIMOOJ r+c|j|j}|jj|zr|jj |}|t k(rt |tk(r7|j}|jddD]}|j|tS|tvrtdt|z|StS)Nz%acceptNode() returned illegal value: )rrrorrr rrrr appendChildrr!rar"r)r'rr#r$parentrs r)rz%FilterVisibilityController.acceptNodes""4==1 ;; ! !D (++((.C&&!!k!!__Q/E&&u-0%$11 =S IKKJ r+N)"rPrQrRrSr*rrr ELEMENT_NODEr SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr SHOW_TEXTrSHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCE ENTITY_NODE SHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTION COMMENT_NODE SHOW_COMMENT DOCUMENT_NODE SHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENT NOTATION_NODE SHOW_NOTATIONrrTr+r)rprps5I !!* **A*A **C*C **>*> **G*G ""**J*J **@*@ ((**P*P **A*A **B*B **G*G ##**K*K **B*B  Nr+rpceZdZdZdZy) FilterCrutch)_builder_level _old_start_old_endcd|_||_|j}|j|_|j |_|j|_|j|_yr) rAr@rsrrBrrCrr)r'rWrs r)r*zFilterCrutch.__init__sO   4400 %)%?%?"#'#;#; r+N)rPrQrRrSr*rTr+r)r?r?s >I %%s ]> &fragment-builder-internal;c:eZdZ d dZdZdZdZdZdZdZ y) FragmentBuilderNc|jtk(r||_||_n|j|_||_t j ||yr&)rr6originalDocumentrrrkr*)r'rrus r)r*zFragmentBuilder.__init__XsD   } ,$+D !"DL$+$9$9D !"DLdG,r+c<tj|d|_yr&)rkrtfragmentr-s r)rtzFragmentBuilder.resetas4  r+cB |j|jSr&)rrr'rs r)rzFragmentBuilder.parseFilees  ,,r+c ||_|j}|jj}d}|rd|jxs|j }|j rd|j d|jd}n|jrd|jz}nd}|j}t|||fz} |j|d|j}|j|S#|jxYw)NzPUBLIC "z" ""z SYSTEM "%s"T) _sourcerrSrr_getDeclarationsrr _getNSattrs_FRAGMENT_BUILDER_TEMPLATErrtrU) r'rrridentrnsattrsrrUs r)rzFragmentBuilder.parseStringjs  !''// ++Ft/D/D/FF#,,g.>.>@!!%(8(88F""$-0HH  LL4 (==    JJL s 6C&&C9c< |jjj}d}|rut|jj D]s}|jj |}|r|dz}|d|j}|jr |d|jd|jd}b|d|jd}ut|jj D]}|jj |}|r|dz}|d|j}|jr |d|jd|jd }n;|jr|d|jd }n|d |jjd }|jr|d |j}|d z}|S) NrYz z z SYSTEM "z )rrrrrlengthitemnodeNamerrr firstChildrr)r'rrXrnotationrs r)r\z FragmentBuilder._getDeclarationssh ,,,,44  7,,334",,11!4F A)*H,=,=>$$h//1B1BDA./0A0ABA57++223 ))..q1F A'(&//:??foov@A__,-v?A%&(9(9(>(>?A&&,-v/B/BCAG4r+cy)NrYrTr-s r)r]zFragmentBuilder._getNSattrssr+c|tk(r|j}|j}|jj |}|j |_|jj |_|j|_ |j|jd||_||_d|_ ytj|||||S#||_||_d|_ wxYw)NTr) $_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrrrsExternalEntityParserCreaterScreateDocumentFragmentrUrr[rkr)r'rrrr old_document old_cur_noders r)rz+FragmentBuilder.external_entity_ref_handlers ; ; ==L<|j }|rt|S) NrY_ns_prefix_urir}r~z z=''r[)rhasattrritemsrr)r'attrsrrrgredeclnames r)r]zFragmentBuilderNS._getNSattrs2s ,, w 01#*#9#9#?#?#AKFC{ HHV$#+f#4#*5:Hc J/7 <$B((G  r+N)rPrQrRrtr]rTr+r)rr+s4r+rceZdZ y)rN)rPrQrRrTr+r)rrPsOr+rc<eZdZ dZdZdZdZdZdZdZ dZ y) rNc |jSr&)rr-s r)rz!InternalSubsetExtractor.getSubsetYs5{{r+cP tj||y#t$rYywxYwr&)rkrrrWs r)rz!InternalSubsetExtractor.parseFile]s)   " "4 .     %%cP tj||y#t$rYywxYwr&)rkrr)r'rs r)rz#InternalSubsetExtractor.parseStringcs)   $ $T6 2   rcH|j|_|j|_yr&)rrrrrs r)rzInternalSubsetExtractor.installis)-)H)H&%)%?%?"r+c|rD|j}g|_|jj|_|j|_yt r&)rrrDefaultHandlerrrr)r'rbrrrrs r)rz2InternalSubsetExtractor.start_doctype_decl_handlerms@ ^^%FDK$(KK$6$6F !+/+H+HF (- r+cdj|jjddjdd}||_t)NrYz   )joinrreplacer)r'rXs r)rz0InternalSubsetExtractor.end_doctype_decl_handlerws= GGDKK ( ( 6 > >tT J mr+ctr&)r)r'rbrs r)rz-InternalSubsetExtractor.start_element_handler|s mr+) rPrQrRrrrrrrrrrTr+r)rrTs.L F  @  r+rc |r t}n t}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYwNrb)rrk isinstancestropenr)r namespacesrWfpresults r)parsersq ".$ $ &&r*F M""4( M  Ms A$$A.cT |r t}n t}|j|Sr&)rrkr)rrrWs r)rrs, ".   v &&r+c |r t|}n t|}t|tr(t |d5}|j |}ddd|S|j |}|S#1swYSxYwr)rrQrrrr)rrrrWrrs r) parseFragmentrsv #G,!'*$ $ &&r*F M""4( M  Ms A&&A0cX |r t|}n t|}|j|Sr&)rrQr)rrrrWs r)parseFragmentStringrs1#G,!'*   v &&r+cH |jr t|St|Sr&)rrrk)rus r) makeBuilderrs$6g&&G$$r+)T)2xml.domrrrrrr xml.parsersr xml.dom.minidomr r xml.dom.NodeFilterr rrr6DOMBuilderFilterrrrr getDOMImplementationrTypeInfor6objectr rYrirkr!rpr?rrrjr^rQrprr ExceptionrrrrrrrrTr+r)rs/:.-BB>) NN ,,"" ++99 ++99 ))55 ..??3w335!  w/   }5   x0   z2   t,   w/   x0   y1   z2  1(&1(f,6&y1y1| )-E7 7 t <6 <*|*8!l!2?%*+ +r9lr9j\.\.~Z" O"J ) )l)X$'( '%r+PKm#]-!D!D-dom/__pycache__/pulldom.cpython-312.opt-1.pycnu[ Thu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#cd|_y)z.clear(): Explicitly release parsing structuresN)r8rys rclearz PullDOM.clears  r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|S)Nr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PKm#]/n0dom/__pycache__/NodeFilter.cpython-312.opt-2.pycnu[ ThGddZy)cTeZdZ dZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZy) NodeFilterl @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr(rrr)s""rPKm#]ޔu  0dom/__pycache__/minicompat.cpython-312.opt-2.pycnu[ Th' N gdZddlZefZGddeZGddeZdZ y))NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrcbt|d|z}|fd}t|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Crr")getattrr+setattr)klassr?r#getr@props rrres7 %'D. *C"C C# &D E4r) __all__xml.domrstrrlistrtuplerrrrrrKs<T Ff t0BEB6rPKm#]6AA0dom/__pycache__/xmlbuilder.cpython-312.opt-1.pycnu[ Th0dZddlZddlZddlmZgdZGddZGddZd Z Gd d e Z Gd d e Z GddZ [GddZGddZy)z4Implementation of the DOM Level 3 'LS-Load' feature.N) NodeFilter) DOMBuilderDOMEntityResolverDOMInputSourcec\eZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZdZdZdZdZy)OptionszFeatures object that has variables set for each DOMBuilder feature. The DOMBuilder class uses an instance of this class to pass settings to the ExpatBuilder class. TFN)__name__ __module__ __qualname____doc__ namespacesnamespace_declarations validationexternal_parameter_entitiesexternal_general_entitiesexternal_dtd_subsetvalidate_if_schemavalidatedatatype_normalizationcreate_entity_ref_nodesentitieswhitespace_in_element_contentcdata_sectionscommentscharset_overrides_xml_encodinginfosetsupported_mediatypes_only errorHandlerfilter+/usr/lib64/python3.12/xml/dom/xmlbuilder.pyrr srJ!J"& $H""H$(!NH%)"G %L Fr"rc BeZdZdZdZdZdZdZdZdZ eeee fZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZiddgddgddgddgddgddgddgddgddgddgdddgddgddgddgddgddgd d gd!gd"gd#gggd$d%gd&gd'gd(Zd)Zd*Zd+Zd,Zd-Zy).rNr c"t|_yN)r_optionsselfs r#__init__zDOMBuilder.__init__9s   r"c|jSr)entityResolverr+s r#_get_entityResolverzDOMBuilder._get_entityResolver<s"""r"c||_yr)r/)r,r0s r#_set_entityResolverzDOMBuilder._set_entityResolver>s ,r"c|jSr)rr+s r#_get_errorHandlerzDOMBuilder._get_errorHandlerAs   r"c||_yr)r5)r,rs r#_set_errorHandlerzDOMBuilder._set_errorHandlerCs (r"c|jSr)r r+s r# _get_filterzDOMBuilder._get_filterFs {{r"c||_yr)r:)r,r s r# _set_filterzDOMBuilder._set_filterHs  r"ch|j|rG|xrdxsd} |jt||f}|D]\}}t|j||yt jjdt|z#t $r$t jjd|dwxYw)Nr rzunsupported feature: zunknown feature: ) supportsFeature _settings _name_xformsetattrr*KeyErrorxmldomNotSupportedErr NotFoundErrrepr)r,namestatesettingsvalues r# setFeaturezDOMBuilder.setFeatureKs    %Ka$1E 8>>;t+BC Cs B-B1c@t|jt|Sr))hasattrr*rA)r,rIs r#r?zDOMBuilder.supportsFeatureYst}}k$&788r"cHt||xrdxsdf}||jvS)Nr r)rAr@)r,rIrJkeys r# canSetFeaturezDOMBuilder.canSetFeature\s)4 %+A"23dnn$$r"rr)rr )rr)rr)rr )rr)rr rrrr)rr rr)rr )rrrr rr)rr )rrrr rrrr ) rSrTrUrVrX)rr rWrYr[rrrrrr )rYrZr[)rr)rr r\r]r^ct|} t|j|S#t$r|dk(r|j}|jxro|j xra|j xrS|jxrE|jxs6|jxs(|jxs|jxs |j cYStjjdt!|zwxYw)Nrzfeature %s not known)rAgetattrr*AttributeErrorrrrrrrrrrrDrErGrH)r,rIxnameoptionss r# getFeaturezDOMBuilder.getFeaturesD! K4==%0 0 Ky --66<#AA<#,,<$BB<")!?!?";$+$>$>";$+$C$C";%,$4$4";%,$:$: < =''%%&ddl}|jjSrl)rprq build_opener)r,rus r#rz DOMEntityResolver._create_openers~~**,,r"c~|jj}|jd}||jSy)Ncharset)rninfo get_paramr)r,rrrs r#rz'DOMEntityResolver._guess_media_encodings;  %%'..+  ==? "r"N)r r r __slots__rfrrrr!r"r#rrsI, -r"rcjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy)rrncharacterStream stringDatarrrorcfd|_d|_d|_d|_d|_d|_d|_yr)rr+s r#r-zDOMInputSource.__init__s4#    r"c|jSr)rnr+s r#_get_byteStreamzDOMInputSource._get_byteStream r"c||_yr)r)r,rns r#_set_byteStreamzDOMInputSource._set_byteStreams $r"c|jSr)rr+s r#_get_characterStreamz#DOMInputSource._get_characterStreams###r"c||_yr)r)r,rs r#_set_characterStreamz#DOMInputSource._set_characterStreams .r"c|jSr)rr+s r#_get_stringDatazDOMInputSource._get_stringDatarr"c||_yr)r)r,datas r#_set_stringDatazDOMInputSource._set_stringDatas r"c|jSr)rr+s r# _get_encodingzDOMInputSource._get_encoding }}r"c||_yr)r)r,rs r# _set_encodingzDOMInputSource._set_encoding    r"c|jSr)rr+s r# _get_publicIdzDOMInputSource._get_publicId#rr"c||_yr)r)r,rs r# _set_publicIdzDOMInputSource._set_publicId%rr"c|jSr)ror+s r# _get_systemIdzDOMInputSource._get_systemId(rr"c||_yr)r)r,ros r# _set_systemIdzDOMInputSource._set_systemId*rr"c|jSr)rr+s r# _get_baseURIzDOMInputSource._get_baseURI-s ||r"c||_yr)rr,rhs r# _set_baseURIzDOMInputSource._set_baseURI/s  r"N)r r r rr-rrrrrrrrrrrrrrr!r"r#rrsU@I%$/!!!r"rcJeZdZdZdZdZdZdZejZ dZ dZ dZ y ) DOMBuilderFilterzSElement filter which can be used to tailor construction of a DOM instance. r r%r&r'c|jSr)) whatToShowr+s r#_get_whatToShowz DOMBuilderFilter._get_whatToShowDrr"c|jSr) FILTER_ACCEPTr,elements r# acceptNodezDOMBuilderFilter.acceptNodeG!!!r"c|jSr)rrs r#startContainerzDOMBuilderFilter.startContainerJrr"N)r r r r r FILTER_REJECT FILTER_SKIPFILTER_INTERRUPTrSHOW_ALLrrrrr!r"r#rr3s8MMK$$J""r"rc8eZdZdZdZdZdZdZdZdZ dZ y ) DocumentLSz=Mixin to create documents that conform to the load/save spec.Fcy)NFr!r+s r# _get_asynczDocumentLS._get_asyncUsr"cF|rtjjdy)Nz.asynchronous document loading is not supported)rDrErF)r,flags r# _set_asynczDocumentLS._set_asyncXs& ''))@B B r"ctd)Nz'haven't figured out what this means yetryr+s r#abortzDocumentLS.abort]s" 57 7r"ctdNzhaven't written this yetrrs r#loadzDocumentLS.loadc!"<==r"ctdrr)r,rs r#loadXMLzDocumentLS.loadXMLfrr"c||}|j S|j|urtjj|j Sr)) ownerDocumentrDrEWrongDocumentErrtoxml)r,snodes r#saveXMLzDocumentLS.saveXMLisI =E{{}  ,''**, ,{{}r"N) r r r r async_rrrrrrr!r"r#rrPs)G FB 7 >>r"rc&eZdZdZdZdZdZdZy)DOMImplementationLSr r%c|tjjd||jk(r t S||j k(rtjjdt d)NzschemaType not yet supportedz'asynchronous builders are not supportedzunknown value for mode)rDrErFMODE_SYNCHRONOUSrMODE_ASYNCHRONOUSrx)r,mode schemaTypes r#createDOMBuilderz$DOMImplementationLS.createDOMBuilderusl  !'')).0 0 4(( (<  4)) )''))9; ;122r"ctd)Nz-the writer interface hasn't been written yet!rr+s r#createDOMWriterz#DOMImplementationLS.createDOMWriters! ;= =r"ctSr))rr+s r#createDOMInputSourcez(DOMImplementationLS.createDOMInputSources r"N)r r r rrr r rr!r"r#rrqs 3= r"r)r rmxml.domrDxml.dom.NodeFilterr__all__rrrAobjectrrrrrr!r"r#rst: ) @@a)a)H*++\.V.b""4B  r"PKm#] 7 7 *dom/__pycache__/minicompat.cpython-312.pycnu[ Th' PdZgdZddlZefZGddeZGddeZ dZ y) zPython version compatibility support for minidom. This module contains internal implementation details and should not be imported; use xml.dom.minidom instead. )NodeList EmptyNodeList StringTypes defpropertyNc>eZdZdZdZdZdZeeedZdZ y) rc:d|cxkrt|kr||SyyNrlenselfindexs +/usr/lib64/python3.12/xml/dom/minicompat.pyitemz NodeList.item5s"  !D !;  "ct|SNr rs r _get_lengthzNodeList._get_length9s 4yrc@tjjdNz.attempt to modify read-only attribute 'length'xmldomNoModificationAllowedErrrvalues r _set_lengthzNodeList._set_length<gg.. <> >r$The number of nodes in the NodeList.docc|g}||ddyrr)rstates r __setstate__zNodeList.__setstate__Ds =EQrN) __name__ __module__ __qualname__ __slots__rrrpropertylengthr&rrrrr2s/I>k;@BFrrcDeZdZdZdZdZdZdZdZe eedZ y ) rrc<t}|j||SrrextendrotherNLs r__add__zEmptyNodeList.__add__M Z % rc<t}|j||Srr/r1s r__radd__zEmptyNodeList.__radd__Rr5rcyrrr s rrzEmptyNodeList.itemWsrcyr rrs rrzEmptyNodeList._get_lengthZsrc@tjjdrrrs rrzEmptyNodeList._set_length]r rr!r"N) r'r(r)r*r4r7rrrr+r,rrrrrJs4I  >k;@BFrrct|d|z}|fd}t|d|zr Jd|zt|||}t|||y)N_get_cXtjjdt|z)Nz&attempt to modify read-only attribute )rrrrepr)rrnames rsetzdefproperty..setgs'gg.. 4tDz AC Cr_set_zexpected not to find _set_r")getattrhasattrr+setattr)klassr?r#getr@props rrresZ %'D. *C"Cugn-/ '$ ./ - C# &D E4r) __doc____all__xml.domrstrrlistrtuplerrrrrrNs<T Ff t0BEB6rPKm#]~((0dom/__pycache__/NodeFilter.cpython-312.opt-1.pycnu[ ThGddZy)cVeZdZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZy) NodeFilterzL This is the DOM2 NodeFilter interface. It contains only constants. l @iiict)N)NotImplementedError)selfnodes +/usr/lib64/python3.12/xml/dom/NodeFilter.py acceptNodezNodeFilter.acceptNodes!!N)__name__ __module__ __qualname____doc__ FILTER_ACCEPT FILTER_REJECT FILTER_SKIPSHOW_ALL SHOW_ELEMENTSHOW_ATTRIBUTE SHOW_TEXTSHOW_CDATA_SECTIONSHOW_ENTITY_REFERENCE SHOW_ENTITYSHOW_PROCESSING_INSTRUCTION SHOW_COMMENT SHOW_DOCUMENTSHOW_DOCUMENT_TYPESHOW_DOCUMENT_FRAGMENT SHOW_NOTATIONrrrrrscMMK",H",L",N",I",",",K",",L",M",",",M"rrN)rr)rrr*s""rPKm#]w{22.dom/__pycache__/__init__.cpython-312.opt-1.pycnu[ Th dZGddZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZGddeZGddeZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZGd%d&eZGd'd(eZGd)d*eZGd+d,eZGd-d.eZ Gd/d0eZ!Gd1d2eZ"Gd3d4eZ#Gd5d6Z$d7Z%d8Z&d9Z'd:Z(d:Z)dd;l*m+Z+m,Z,y:)>\ )BD D4-$-"-r"c|jS)N)code)r/s r# _get_codezDOMException._get_codeHs yyr"N)rrrrr.r4rr"r#r)r)>sI. r"r)ceZdZeZy) IndexSizeErrN)rrrINDEX_SIZE_ERRr3rr"r#r6r6L Dr"r6ceZdZeZy)DomstringSizeErrN)rrrDOMSTRING_SIZE_ERRr3rr"r#r:r:O Dr"r:ceZdZeZy)HierarchyRequestErrN)rrrHIERARCHY_REQUEST_ERRr3rr"r#r>r>R Dr"r>ceZdZeZy)WrongDocumentErrN)rrrWRONG_DOCUMENT_ERRr3rr"r#rBrBUr<r"rBceZdZeZy)InvalidCharacterErrN)rrrINVALID_CHARACTER_ERRr3rr"r#rErEXr@r"rEceZdZeZy)NoDataAllowedErrN)rrrNO_DATA_ALLOWED_ERRr3rr"r#rHrH[ Dr"rHceZdZeZy)NoModificationAllowedErrN)rrrNO_MODIFICATION_ALLOWED_ERRr3rr"r#rLrL^s &Dr"rLceZdZeZy) NotFoundErrN)rrr NOT_FOUND_ERRr3rr"r#rOrOa Dr"rOceZdZeZy)NotSupportedErrN)rrrNOT_SUPPORTED_ERRr3rr"r#rSrSd Dr"rSceZdZeZy)InuseAttributeErrN)rrrINUSE_ATTRIBUTE_ERRr3rr"r#rWrWgrJr"rWceZdZeZy)InvalidStateErrN)rrrINVALID_STATE_ERRr3rr"r#rZrZjrUr"rZceZdZeZy) SyntaxErrN)rrr SYNTAX_ERRr3rr"r#r]r]ms Dr"r]ceZdZeZy)InvalidModificationErrN)rrrINVALID_MODIFICATION_ERRr3rr"r#r`r`ps #Dr"r`ceZdZeZy) NamespaceErrN)rrr NAMESPACE_ERRr3rr"r#rcrcsrQr"rcceZdZeZy)InvalidAccessErrN)rrrINVALID_ACCESS_ERRr3rr"r#rfrfvr<r"rfceZdZeZy) ValidationErrN)rrrVALIDATION_ERRr3rr"r#ririyr8r"ric eZdZdZdZdZdZdZy)UserDataHandlerzBClass giving the operation constants for UserDataHandler.handle().rrrrN)rrrr NODE_CLONED NODE_IMPORTED NODE_DELETED NODE_RENAMEDrr"r#rlrl|sLKMLLr"rlz$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/2000/xmlns/zhttp://www.w3.org/1999/xhtmlN)getDOMImplementationregisterDOMImplementation)-rrr7r;r?rCrFrIrMrPrTrXr[r^rardrgrjr-r)r6r:r>rBrErHrLrOrSrWrZr]r`rcrfrirl XML_NAMESPACEXMLNS_NAMESPACEXHTML_NAMESPACEEMPTY_NAMESPACE EMPTY_PREFIXdomregrqrrrr"r#rysh"%%4"#!"!"!"!"!"!"!" !"!#!#!# !#!# !#!# 9 <|!,!|!,!|'|',l l $\$<|L7 10 CCr"PKm#]-!D!D'dom/__pycache__/pulldom.cpython-312.pycnu[ Thu-ddlZddlZdZdZdZdZdZdZdZ d Z Gd d ejjZ Gd d ZGddZGdde ZdZddZddZy)N START_ELEMENT END_ELEMENTCOMMENTSTART_DOCUMENT END_DOCUMENTPROCESSING_INSTRUCTIONIGNORABLE_WHITESPACE CHARACTERSc|eZdZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZy)PullDOMNc6ddlm}||_ddg|_|j|_g|_|j j |_ |j j|_|dig|_ |jd|_ g|_ y#t$rY1wxYw)Nr) XML_NAMESPACExml) xml.domrdocumentFactory firstEvent lastEvent elementStackappendpushpopAttributeError _ns_contexts_current_contextpending_events)selfrrs (/usr/lib64/python3.12/xml/dom/pulldom.py__init__zPullDOM.__init__s).,%%,,  ((,,DH,E23 $ 1 1" 5     s B BBc>|jd}|jd=|SNr)r)rresults rrz PullDOM.pop!s%""2&   b ! c||_yN)_locator)rlocators rsetDocumentLocatorzPullDOM.setDocumentLocator&s  r#ct|dsg|_|jj|xsd|f|jj|jj |xsd|j|<y)N _xmlns_attrsxmlns)hasattrr*rrrcopy)rprefixuris rstartPrefixMappingzPullDOM.startPrefixMapping)sit^, "D    &"3GS!9:   !6!6!;!;!=>%+^tc"r#cB|jj|_yr%)rrr)rr.s rendPrefixMappingzPullDOM.endPrefixMapping0s $ 1 1 5 5 7r#cd}t|dd}|"|D]\}}||j||f<g|_|\}} |rZ||j|} | r | dz| z}n| }|jr|jj ||} nM|j ||} n:|jr|jj| } n|j d| } |jD]\}}|\} } | |k(r;| dk(r| }nd| z}|jj| |}| j|nx| rJ|j| } | r | dz| z}n| }|jj| |}| j|n,|jj| }| j|||_ t| fdg|jd<|jd|_|j!| y)Nzhttp://www.w3.org/2000/xmlns/r*:r+zxmlns:)getattr_attrsr*rdocumentcreateElementNS buildDocument createElementitemscreateAttributeNSsetAttributeNodeNScreateAttributesetAttributeNodevaluerrr)rnametagNameattrs xmlns_uri xmlns_attrsanamerAr/ localnamer.nodea_uri a_localnameqnameattrs rstartElementNSzPullDOM.startElementNS3s3 dND9  " + u38 i/0!, "D Y ..s3$slY6G'G}}}}44S'B))#w7}}}}229=))$ : ;;=KE%!& E; !')'E${2E}}66ueD''-..u5"SL;6E'E}}66ueD''-}}44[A%%d+DJ)),,T2D9q* $r#cvt|jfdg|jd<|jd|_yNr5rrr)rrBrCs r endElementNSzPullDOM.endElementNSl0)488:6=q*r#c|jr|jj|}n|jd|}|jD]8\}}|jj |}||_|j |:t|fdg|jd<|jd|_|j|yrP) r8r;r:r<r?rAr@rrr)rrBrDrIrGrArMs r startElementzPullDOM.startElementps ====..t4D%%dD1D ;;=KE%==007DDJ  ! !$ ') ,T2D9q* $r#cvt|jfdg|jd<|jd|_yrPrQ)rrBs r endElementzPullDOM.endElementrSr#c|jrG|jj|}t|fdg|jd<|jd|_yt|fdg}|jj |yrP)r8 createCommentrrrr)rsrIevents rcommentzPullDOM.commentsf ====..q1D")4$ 7DNN1 !^^A.DNq\4(E    & &u -r#c|jrH|jj||}t|fdg|jd<|jd|_yt||fdg}|jj |yrP)r8createProcessingInstructionrrrr)rtargetdatarIr[s rprocessingInstructionzPullDOM.processingInstructionsl ====<}}++E22D94@q*r#c|jj|}t|fdg|jd<|jd|_yrP)r8rcr rrds r characterszPullDOM.characterss>}}++E2($/6q*r#c|j4ddl}|jjjj |_yy)Nr)rxml.dom.minidomdomminidomDocumentimplementation)rrs r startDocumentzPullDOM.startDocuments2    ' "#&77??#;#;#J#JD  (r#cR|jj||d}||_t|fdg|jd<|jd|_|j ||j D]}|ddtk(r1|d\}}}|jj||}t|f|d<nN|ddtk(r-|jj|dd}t|f|d<ntd|dd||jd<||_d|_|jS)Nr5rzUnknown pending event ) rcreateDocumentr8rrrrrr^rrYAssertionError firstChild) rr/tagnamerIe_r_r`ns rr:zPullDOM.buildDocuments$##223F ,d3T:q* $$$AtAw00 !! &MM==fdK.2!1aG#MM//!Q8|!$%=ad1gFF !DNN1 DN%#r#cft|jfdg|jd<|jyrP)rr8rrrs r endDocumentzPullDOM.endDocuments'*DMM:DAq  r#cd|_y)z.clear(): Explicitly release parsing structuresN)r8rys rclearz PullDOM.clears  r#r%)__name__ __module__ __qualname__r&r8rrr(r0r2rNrRrUrWr\rarfrhror:rzr|r#rr r scHH!   487r+ +..+ + K 0r#r ceZdZdZdZdZy) ErrorHandlerct|yr%)printr exceptions rwarningzErrorHandler.warnings  ir#c|r%rrs rerrorzErrorHandler.errorr#c|r%rrs r fatalErrorzErrorHandler.fatalErrorrr#N)r}r~rrrrrr#rrrsr#rcBeZdZdZdZdZdZdZdZdZ dZ d Z y ) DOMEventStreamc||_||_||_t|jds|j|_|j y)Nfeed)streamparserbufsizer,_slurpgetEventreset)rrrrs rrzDOMEventStream.__init__s9   t{{F+ KKDM r#ct|_|jjtj j jd|jj|jyrP) r pulldomr setFeaturersaxhandlerfeature_namespacessetContentHandlerrys rrzDOMEventStream.resetsCy  swwAA1E %%dll3r#c6|j}|r|Str%)r StopIterationrrcs r__next__zDOMEventStream.__next__s ]]_ Ir#c|Sr%rrys r__iter__zDOMEventStream.__iter__s r#c|j}|g}|rb|\}}||ury|tk7r|dj||tk(r|j |n |tk(r|d=|j}|rayyr!)rr appendChildrr)rrIr[parentstokencur_nodes r expandNodezDOMEventStream.expandNodesx &#OE84 # ''1 %x(+%BKMMOEr#c@|jjds%|jj|j_|jjdsw|jj |j }|s|j jy|j j||jjdsw|jjdd}|jjdd|jjd<|S)Nr5r) rrrrreadrrcloser)rbufrs rrzDOMEventStream.getEvents||&&q)%)\\%<%sM!"C(&-! $$& &&' 22r#cddlm}t|}||}|stjj }t |||S)Nr)StringIO)iorlenrrrr)stringrrrrs r parseStringrIs<&kG 6 C $$& #vw //r#)NNr%)xml.saxrxml.sax.handlerrrrrrrr r rContentHandlerr rrrrrrrr#rrs  ! 1-  ucgg$$unMM^%g%B! 30r#PKm#]\ff-dom/__pycache__/minidom.cpython-312.opt-1.pycnu[ dAi ZdZddlZddlZddlmZmZmZmZddlddl m Z m Z ejjjejjjfZGddejjZ ee dd ee d d ee d d dZdZdZdZGdde ZGdde Zeedd eed d eedd GddeZeedd eZGd d!eZeddZGd"d#e Zeed$d% eed d& d'ZGd(d)ZGd*d+ee Z Gd,d-ee Z!ee!dd. Gd/d0e!Z"ee"d1d2 ee"d3d4 d5Z#d6Z$Gd7d8e!Z%Gd9d:e"Z&Gd;dd?Z(Gd@dAe(ee Z)GdBdCe(e Z*GdDdEe(ee Z+GdFdGe Z,GdHdIeZ-dJZ.GdKdLe e Z/ee/dMdN dOZ0dPZ1dQZ2dUdRZ3dVdSZ4dVdTZ5y)WacSimple implementation of the Level 1 DOM. Namespaces and other minor Level 2 features are also supported. parse("foo.xml") parseString("") Todo: ===== * convenience methods for getting elements and text. * more testing * bring some of the writer and linearizer code into conformance with this interface * SAX 2 namespaces N)EMPTY_NAMESPACE EMPTY_PREFIXXMLNS_NAMESPACEdomreg)*)DOMImplementationLS DocumentLSceZdZdZdZdZdZdZeZ dZ ddZ ddZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZ y)NodeNcy)NTselfs (/usr/lib64/python3.12/xml/dom/minidom.py__bool__z Node.__bool__+c*|jdd||SN) toprettyxml)rencoding standalones rtoxmlz Node.toxml.sB*==rcv|tj}n+tjtj|dd}|jt j k(r|j|d||||n|j|d||||jS|jjS)Nxmlcharrefreplace )rerrorsnewliner) ioStringIO TextIOWrapperBytesIOnodeTyper DOCUMENT_NODEwritexmlgetvaluedetach)rindentnewlrrwriters rrzNode.toprettyxml1s  [[]F%%bjjl/7-@.24F ==D.. . MM&"fdHj I MM&"fd 3  ??$ $==?++- -rc,t|jSN)bool childNodesrs r hasChildNodeszNode.hasChildNodesDsDOO$$rc|jSr-r/rs r_get_childNodeszNode._get_childNodesG rc:|jr|jdSyNrr2rs r_get_firstChildzNode._get_firstChildJs ????1% % rc:|jr|jdSyNr2rs r_get_lastChildzNode._get_lastChildNs ????2& & rc&|j|jk(r.t|jD]}|j |||S|j|j vr6t jjt|dt||j|jj|||j||S |jj|}|jt vr t#||jj%||||_||_|r!|j|dz }||_||_nd|_||_ |S#t$rt jjwxYw)N cannot be child of )r$DOCUMENT_FRAGMENT_NODEtupler/ insertBefore_child_node_typesxmldomHierarchyRequestErrrepr parentNode removeChild appendChildindex ValueError NotFoundErr_nodeTypes_with_children_clear_id_cacheinsert nextSiblingpreviousSibling)rnewChildrefChildcrJnodes rrAzNode.insertBeforeRsn    ; ; ;8../!!!X.0O   D$:$: :''--.28nd4jIK K    *    + +H 5     X &$! ,--h7  $<<% OO " "5( 3#+H '/H $uQw/#+ +/(+/("&H  ,gg))++ ,s E(((Fc|j|jk(r-t|jD]}|j ||S|j|j vr6t jjt|dt||jtvr t||j|jj|t||d|_|SNr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH _append_childrP)rrUrTs rrIzNode.appendChildrs ==D77 74??+  #,K == 6 6 6''--.24j$t*EG G ]]6 6 D ! ?? & OO ' ' -dD! rc|j|jk(r/|j}|j||j ||S|j|j vr6t jjt|dt|||ury|j|jj| |jj|}||j|<||_ d|_ |jtvs|jtvr t!||j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rt jjwxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrRoldChildrSrJs r replaceChildzNode.replaceChilds    ; ; ;++H   X &$$Xx8 8   D$:$: :''--.28nd4jIK K x      *    + +H 5 (OO))(3E"*""   !9 9  $<< D !'33#+#;#; ##'  # #3;H $ $ 0   3;H 0! (''%%' ' (s F(F?c |jj||j |j|j _|j|j |j_dx|_|_|jtvr t|d|_ |S#t$rtjj wxYwr-) r/removerKrCrDrLrPrQr$rMrNrGrrZs rrHzNode.removeChilds ( OO " "8 ,    +3;3K3KH 0  # # /3;3G3GH $ $ 0:>>x7    8 8 D !" (''%%' ' (s B(Ccg}|jD]M}|jtjk(r|jsN|r|j |d_|j r|j |j _|j{|r~|dj|jk(rb|d}|j|jz|_|j |_|j r||j _|j|j||j||jtjk(s>|jP||jddyr9) r/r$r TEXT_NODEdatarPrQunlinkappend ELEMENT_NODE normalize)rLchildrUs rrezNode.normalizes  __E~~/zz,1,=,=")((>U^^;R5D $ EJJ 6DI','8'8D$((<@))9LLNHHUO>>T%6%66OO%-%.rc8t|||jxs|Sr-) _clone_node ownerDocument)rdeeps r cloneNodezNode.cloneNodes4t'9'9'ATBBrcN|jjj||Sr-)rjimplementation hasFeaturerfeatureversions r isSupportedzNode.isSupporteds!!!00;;GWMMrcyr-r rs r_get_localNamezNode._get_localNamesrc ||uSr-r rothers r isSameNodezNode.isSameNodes u}rc,|j|dr|Syr-)rsrrqs r getInterfacezNode.getInterfaces   GT *KrcR |j|dS#ttf$rYywxYwr6) _user_dataAttributeErrorKeyErrorrkeys r getUserDatazNode.getUserDatas2 ??3'* *)  s &&cd} |j}||vr||d}| d}|||=|S||f||<|S#t$r i}||_Y4wxYwr6)r~r)rrrahandleroldds r setUserDatazNode.setUserDatasy A !8C&)C <GcF G_AcF  ADO s 0AAct|drGt|jjD] \}\}}| |j |||||"yy)Nr~)hasattrlistr~itemshandle)r operationsrcdstrrars r_call_user_data_handlerzNode._call_user_data_handlersQ 4 &(,T__-B-B-D(E$_dG&NN9c4cB)F 'rcdx|_|_|jr0|jD]}|jt |_d|_d|_yr-)rGrjr/rbNodeListrQrP)rrgs rrbz Node.unlinksH/33$, ?? )&jDO#rc|Sr-r rs r __enter__zNode.__enter__s rc$|jyr-)rb)retevtbs r__exit__z Node.__exit__s  rNN) rNN)!__name__ __module__ __qualname__ namespaceURIrGrjrPrQrprefixrrrr0r3r7r;rArIr[rHrerlrsruryr|rrrrbrrr rrr r "sLJMKO F><@#.&%&'@"@ 6CN  $C rr firstChildzFirst child node, or None.)doc lastChildzLast child node, or None. localNamez"Namespace-local name of this node.cv|j}|r|d}||_||_|j|||_yr9)r/rQrPrcrG)rrUr/lasts rrXrXs<J"~#dDOrc|rT|jddjddjddjdd}|j|y y ) zWrites datachars to writer.&z&z>N)replacewrite)r+ras r _write_datar(sM ||C)11#v>GD(+GGC,@  T rc|jD]Q}|jtjk(r%|dk(s|j|k(r|j |t |||S|SNr)r/r$r rdtagNamerc_get_elements_by_tagName_helper)parentnamercrUs rrr/sT!! ==D-- - S[DLLD0 IIdO'dB7 " Irc|jD]g}|jtjk(s!|dk(s|j|k(r%|dk(s|j |k(r|j |t||||i|Sr)r/r$r rdrrrc"_get_elements_by_tagName_ns_helper)rnsURIrrrUs rrr7sk!! ==D-- -c!T^^y%@#!2!2e!; $ .tUIr J " IrceZdZejZdZdZdZdZ ejejejejejejej fZdZy)DocumentFragmentz#document-fragmentNc"t|_yr-)rr/rs r__init__zDocumentFragment.__init__Ns "*r)rrrr r?r$nodeName nodeValue attributesrGrdr`CDATA_SECTION_NODEENTITY_REFERENCE_NODEPROCESSING_INSTRUCTION_NODE COMMENT_NODE NOTATION_NODErBrr rrrr@sk**H#HIJJ**003399**++ -%rrceZdZdZej ZdZdZdZ ejejfZ e ddfdZdZdZdZdZeeexZZd Zd ZeeexZZd Zd ZeeeZd ZdZdZy)Attr)_name_valuer_prefixr/ _localNamerj ownerElementNFcd|_d|_||_||_||_|||_t |_|jjtyr-) rrjrrrrrr/rcText)rqNamerrrs rrz Attr.__init__\sT ! (  'DO"* tv&rcx |jS#t$r"|jjdddcYSwxYwN:r>r:)rrrsplitrs rruzAttr._get_localNamels< 3?? " 3==&&sA.r2 2 3 (99c|jSr-) specifiedrs r_get_specifiedzAttr._get_specifiedr ~~rc|jSr-)rrs r _get_namezAttr._get_nameu zzrcV||_|jt|jyyr-)rrrNrvalues r _set_namezAttr._set_namexs(    ( D-- . )rc|jSr-)rrs r _get_valuezAttr._get_value {{rc||_||jd_|jt |j||jd_yr6)rr/rarrNrs r _set_valuezAttr._set_valuesE "'    ( D-- ."'rc|jSr-)rrs r _get_prefixzAttr._get_prefix ||rc|j}|dk(r*|r(|tk7rtjj d||_| |j }n|d|j }|jrt|j||_ y)Nxmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer) rrrCrD NamespaceErrrrrrNr)rrnsurinewNames r _set_prefixzAttr._set_prefixs|!! W /1gg**KMM >nnG!'8G    D-- . rc|j}||j|j=|j|j|j f=|j r;d|_|xjdzc_|jxjdzc_ |jD]}|j|jdd=y)NFr>) r_attrsr_attrsNSrr_is_id_magic_id_nodesrj_magic_id_countr/rb)relemrgs rrbz Attr.unlinks      DMM* t00$..AB{{# $$)$""22a72__E LLN% OOA rc|jry|j}|j}||y|j|}|y|jr&|j |j|j S|j|jSNTF) rrjr_get_elem_inforisIdNSrisIdrrrrinfos r _get_isIdzAttr._get_isIds} ;;     ;$,!!$' <   ;;t00$..A A99T]]+ +rc|j}|j}||tS|j|}|tS|jr&|j |j|j S|j|jSr-) rjr_no_typerrgetAttributeTypeNSrgetAttributeTyperrs r_get_schemaTypezAttr._get_schemaTypes{     ;$,O!!$' <O   **4+<+6 T]D$6rr-)!rrr__doc__rrrrrrrrr rr$__len__r(r+r.r0r3r5r8r=r@rCrHrKr:rOrQrSrWr rrrrs8I*     ( "$$,GC %%$%$1 $  ( ( ' >?rrlengthz$Number of nodes in the NamedNodeMap.c(eZdZdZdZdZdZdZy)TypeInfo namespacerc ||_||_yr-r])rr^rs rrzTypeInfo.__init__s" rc|jr4d|jjd|jd|jdSd|jjd|jdS)Nr z (from z)>r)r^ __class__rrrs r__repr__zTypeInfo.__repr__sM >>*...*A*A499*...: : !% 7 7C Crc|jSr-)rrs rrzTypeInfo._get_name yyrc|jSr-)r^rs r_get_namespacezTypeInfo._get_namespacerrN)rrrrrrcrrgr rrr\r\|s#IDrr\cjeZdZdZej ZdZeZ dZ ej ejejejejejfZeddfdZdZdZdZdZd Zd Zd Zd Zd ZdZdZeZdZdZ dZ!e!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-y)Element) rjrGrrrrrr/rrrPrQNrcd|_d|_|x|_|_||_||_t |_dx|_|_ d|_ d|_ yr-) rjrGrrrrrr/rPrQrr)rrrrrs rrzElement.__init__sW!'.. t} ("*2664/  rc:|ji|_i|_yyr-)rrrs r_ensure_attributeszElement._ensure_attributess ;; DKDM rcx |jS#t$r"|jjdddcYSwxYwr)rrrrrs rruzElement._get_localNames< 2?? " 2<<%%c1-b1 1 2rc|jSr-rrs r _get_tagNamezElement._get_tagNamerrc|j8t|jjD]}|jd|_d|_t j|yr-)rrrrbrr )rattrs rrbzElement.unlinksK ;; "T[[//12 3   Drcn|jy |j|jS#t$rYywxYw)aReturns the value of the specified attribute. Returns the value of the element's attribute named attname as a string. An empty string is returned if the element does not have such an attribute. Note that an empty string may also be returned as an explicitly given attribute value, use the hasAttribute method to distinguish these two cases. r)rrr)rr<s r getAttributezElement.getAttributes= ;;  ;;w'-- -  s ( 44cr|jy |j||fjS#t$rYywxYwr)rrrrBs rgetAttributeNSzElement.getAttributeNSs@ ==  ==, !:;AA A  s * 66c|j|}|5t|}||_|j|_|j |y||jk7r ||_|j r t |yyyr-)getAttributeNoderrrjsetAttributeNoderrN)rr<rrrs r setAttributezElement.setAttributeso$$W- <=DDJ!%!3!3D   ! !$ ' djj DJyy%!rcNt|\}}|j||}|8t||||}||_|j|_|j |y||jk7r||_|j r t||j|k7r||_||_ yyr-) _nssplitgetAttributeNodeNSrrrjryrrNrr)rr qualifiedNamerr localnamerrs rsetAttributeNSzElement.setAttributeNSs$]3 &&|Y? < |YGDDJ!%!3!3D   ! !$ ' "" 99#D){{f$$ - %rcR|jy|jj|Sr-r#)rattrnames rrxzElement.getAttributeNodes" ;; {{x((rcV|jy|jj||fSr-)rr$rBs rr}zElement.getAttributeNodeNSs) == }}  , !:;;rc|jd|fvrtjjd|j |j j |jd}||j||jj |j|jfd}|||ur|j|t||||ur|S||ur|Sy)Nzattribute node already owned) rrCrDInuseAttributeErrrlrr$rremoveAttributeNoderrr_set_attribute_node)rrrold1old2s rryzElement.setAttributeNode s   T4L 0''++,JK K !{{tyy$/    $ $T *}}  $"3"3T^^!DdK  D 0  $ $T *D$' t K t K rc|jtjj |j|}|j |y#t $rtjjwxYwr-)rrCrDrLrrr)rrrrs rremoveAttributezElement.removeAttribute"sf == ''%%' ' (;;t$D   & (''%%' ' (s A (A5c|jtjj |j||f}|j |y#t$rtjjwxYwr-)rrCrDrLrr)rrrrrs rremoveAttributeNSzElement.removeAttributeNS+sk == ''%%' ' (==, !:;D   & (''%%' ' (s A(A7c(|tjj |j|jt ||j|j|_|S#t $rtjjwxYwr-) rCrDrLrrrrNrbrjrNs rrzElement.removeAttributeNode4s{ <''%%' ' ( KK "  "//  (''%%' ' (s A))(Bc8|jy||jvS)zChecks whether the element has an attribute with the specified name. Returns True if the element has an attribute with the specified name. Otherwise, returns False. Frr?s r hasAttributezElement.hasAttributeDs ;; t{{""rc<|jy||f|jvSNF)rrBs rhasAttributeNSzElement.hasAttributeNSNs# == i(DMM99rc,t||tS)zReturns all descendant elements with the given tag name. Returns the list of all descendant elements (not direct children only) with the specified tag name. rrr?s rgetElementsByTagNamezElement.getElementsByTagNameSs /tT8:FFrc.t|||tSr-rrrBs rgetElementsByTagNameNSzElement.getElementsByTagNameNS[1 , 8:7 7rc6d|jt|fzS)Nz)rr'rs rrczElement.__repr___s)T\\2d8,DDDrc,|j|dz|jz|j}|jD]@}|jd|zt |||j |jdB|j r|jdt|j dk(r[|j djtjtjfvr"|j dj|dddnJ|j||j D]}|j|||z|||j||jd|jd|y |jd |zy ) zWrite an XML element to a file-like object Write the element to the writer object that must provide a write method (e.g. a file or StringIO object). rz %s="rrr>rrz%sN) rr_get_attributesrrrr/rr$r r`rr&)rr+r) addindentr*r a_namerUs rr&zElement.writexmlbs>  VCZ$,,./$$&jjlF LLF* + f 3 3 4 LL # ?? LL DOO$)"++(?(?0AA"++FBB? T" OODMM&&*:ItL, V$ LLdllD9 : LL 'rcd|jt|j|j|Sr-)rlrrrrs rrzElement._get_attributess% !DKK==rc|jryyrrrs r hasAttributeszElement.hasAttributess ;;rcH|j|}|j|yr-)rxsetIdAttributeNode)rridAttrs rsetIdAttributezElement.setIdAttributes &&t, 'rcJ|j||}|j|yr-)r}r)rrrrs rsetIdAttributeNSzElement.setIdAttributeNSs"((yA 'rcr||j|jstjj t |tjj |jsGd|_|xjdz c_|jxjdz c_ t|yy)NTr>) ryrrCrDrL_get_containing_entrefNoModificationAllowedErrrrrjrrN)rrs rrzElement.setIdAttributeNodes >1D1D!E''%%' ' !$ ' 3''224 4}} FM  A %    . .! 3 . D ! rrrr).rrrrr rdr$rrrrrrr`rrrBrrrlrurprbrtrvrzrrxr}rysetAttributeNodeNSrrrremoveAttributeNodeNSrrrrrcr&rrrrrr rrriris1I  HIJO**99**0033 5.=T* 2   &.") < &*'' 0#: G7E(@>(( "rrirz*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.ct||j||j|j<||j|j |j f<||_yr-)rNrlrrrrrr)elementrrs rrrsQG  $GNN499<@Gd''89  Drc^eZdZdZdZdZeZdZdZ dZ dZ dZ dZ dZd Zd Zd Zy) ChildlesszMixin that makes childless-ness easy to implement and avoids the complexity of the Node methods that deal with children. r Ncyr-r rs rr7zChildless._get_firstChildrrcyr-r rs rr;zChildless._get_lastChildrrcZtjj|jdz)Nz nodes cannot have childrenrCrDrErrNs rrIzChildless.appendChild&gg)) MM9 9; ;rcyrr rs rr0zChildless.hasChildNodesrcZtjj|jdzNz nodes do not have childrenrrrRrSs rrAzChildless.insertBeforerrcZtjj|jdzr)rCrDrLrr^s rrHzChildless.removeChilds&gg!! MM9 9; ;rcyr-r rs rrezChildless.normalizes rcZtjj|jdzrrrrRrZs rr[zChildless.replaceChildrr)rrrrXrr EmptyNodeListr/rrr7r;rIr0rArHrer[r rrrrsLIJJJI;;; ;rrcreZdZejZdZdZdZdZ e ee Z dZ dZ e e e Zd dZy) ProcessingInstructiontargetrac ||_||_yr-r)rrras rrzProcessingInstruction.__init__s  rc|jSr-rars r_get_nodeValuez$ProcessingInstruction._get_nodeValuererc||_yr-rrs r_set_nodeValuez$ProcessingInstruction._set_nodeValues  rc|jSr-rrs r _get_nodeNamez#ProcessingInstruction._get_nodeNamerrc||_yr-rrs r _set_nodeNamez#ProcessingInstruction._set_nodeNames  rc d|j|d|jd|jd|y)Nz)rrrarr+r)rr*s rr&zProcessingInstruction.writexmls t{{DIItLMrNr)rrrr rr$rrrrrrrrrr&r rrrrsI//H"I 8I }5HNrrcfeZdZdZdZdZeZdZdZe eexZ Z dZ dZ dZd Zd Zd Zy ) CharacterData)_datarjrGrQrPctdx|_|_dx|_|_d|_t j |yr)rjrGrQrPrr rrs rrzCharacterData.__init__s4/33T_266t/  drc,t|jSr-)rrars rrzCharacterData._get_length499~rc|jSr-rrs r _get_datazCharacterData._get_datarrc||_yr-rrras r _set_datazCharacterData._set_datas  rc|j}t|dkDrd}nd}d|jjd|dd|dS)N z...rz)rarrbr)rra dotdotdots rrczCharacterData.__repr__ sByy t9r>II NN # #T!BZ< >.."yy) $ 2 2 ??tt'A'AA|++G4,,Wd;IIgv& rc<t|||j|yr-)rrars rr&z Text.writexmlUsF 4@Arc|jg}|j}|Y|jtjtj fvr)|j d|j|j}nn|Y|j}|X|jtjtj fvr(|j|j|j}nn|Xdj|S)Nrr) rarQr$r r`rrOrPrcjoin)rrfrGs r_get_wholeTextzText._get_wholeTextZs YYK  mzzdnnd.E.EFFAFF#%% m   mzzdnnd.E.EFF MM m wwqzrc|j}|j}|P|jtjtj fvr |j}|j ||}nn|P|j}|s|j ||P|jtjtj fvr |j}|j ||}nn|P|r ||_|Syr-) rGrQr$r r`rrHrPra)rcontentrrGrs rreplaceWholeTextzText.replaceWholeTextls  mzzdnnd.E.EFF((""1% m      t $mzzdnnd.E.EFF}}""1% m DIKrc|jjryt|}|y|jj |}|y|j Sr)rastrip_get_containing_elementrjrisElementContent)rrrs r!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContentsR 99?? &t, <!!006 <((* *rr)rrrrr r`r$rrrr&rrrr rrrr?s4I~~HHJ B $8 +rrisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content. wholeTextz.The text of all logically-adjacent text nodes.c||j}|.|jtjk(r|S|j}|.yr-)rGr$r rdrUrTs rrrs< A - ::** *H LL - rc||j}|.|jtjk(r|S|j}|.yr-)rGr$r rr s rrrs< A - ::33 3H LL - rc6eZdZejZdZdZddZy)Commentz#commentc<tj|||_yr-)rrrrs rrzComment.__init__st$ rc|d|jvr td|j|d|jd|y)Nz--z%'--' is not allowed in a comment nodez)rarKrrs rr&zComment.writexmls1 499 DE E  4@ArNr) rrrr rr$rrr&r rrrrs  HHBrrc4eZdZdZej ZdZddZy) CDATASectionr z#cdata-sectionc|jjddk\r td|jd|jzy)Nz]]>rz$']]>' not allowed in a CDATA sectionz)rafindrKrrs rr&zCDATASection.writexmls9 99>>% A %CD D % 12rNr) rrrrr rr$rr&r rrrrsI&&HH3rrc`eZdZdZddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ReadOnlySequentialNamedNodeMap_seqc||_yr-r)rseqs rrz'ReadOnlySequentialNamedNodeMap.__init__s  rc,t|jSr-rrrs rrYz&ReadOnlySequentialNamedNodeMap.__len__rrc,t|jSr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_lengthrrcL|jD]}|j|k(s|cSyr-)rrrFs rr@z+ReadOnlySequentialNamedNodeMap.getNamedItems!AzzT!rcl|jD]%}|j|k(s|j|k(s#|cSyr-)rrrrJs rrCz-ReadOnlySequentialNamedNodeMap.getNamedItemNSs,A~~-!++2Jrct|tr|j|}n|j|}| t ||Sr-)rr@rCr@r)r name_or_tuplerUs rr8z*ReadOnlySequentialNamedNodeMap.__getitem__sC mU +&4&& 6D$$]3D <=) ) rcL|dkry |j|S#t$rYywxYwr6)rrrs rrz#ReadOnlySequentialNamedNodeMap.items2 19 99U# #  s  ##c@tjjdNz"NamedNodeMap instance is read-onlyrCrDrr?s rrHz.ReadOnlySequentialNamedNodeMap.removeNamedItemgg.. 02 2rc@tjjdr$r%rBs rrKz0ReadOnlySequentialNamedNodeMap.removeNamedItemNSr&rc@tjjdr$r%rNs rr:z+ReadOnlySequentialNamedNodeMap.setNamedItemr&rc@tjjdr$r%rNs rrOz-ReadOnlySequentialNamedNodeMap.setNamedItemNSr&rc|jgSr-rrs rrSz+ReadOnlySequentialNamedNodeMap.__getstate__s {rc|d|_yr6rrUs rrWz+ReadOnlySequentialNamedNodeMap.__setstate__s !H rN)r )rrrrrrYrr@rCr8rrHrKr:rOrSrWr rrrrsHI  2222rrz&Number of entries in the NamedNodeMap.c&eZdZdZdZdZdZdZy) Identifiedz@Mix-in class that supports the publicId and systemId attributes.publicIdsystemIdc ||_||_yr-r.)rr/r0s r_identified_mixin_initz!Identified._identified_mixin_init s    rc|jSr-)r/rs r _get_publicIdzIdentified._get_publicId }}rc|jSr-)r0rs r _get_systemIdzIdentified._get_systemIdr5rN)rrrrXrr2r4r7r rrr-r-sJ&I!rr-cReZdZejZdZdZdZdZ dZ dZ dZ dZ ddZy) DocumentTypeNct|_t|_|rt|\}}||_|j|_yr-)rentities notationsr|rr)rr~rrs rrzDocumentType.__init__s:68 79  ( 7 FI!DI  rc|jSr-)internalSubsetrs r_get_internalSubsetz DocumentType._get_internalSubset'"""rc|jtd}|j|_|j|_tj j j}|r\g|j_ g|j_ |jjD]e}t|j|j|j}|jjj||j|||g|jjD]}t!|j|j|j|j"}|j$|_|j&|_|j(|_|jjj||j||||j||||Syr-)rjr9rrrCrDUserDataHandler NODE_CLONEDr;rr<Notationr/r0rcrEntity notationNameactualEncodingrrr)rrkclonerrGnotationeentitys rrlzDocumentType.cloneNode*sY    % &EEJ!YYEN//;;I&(#')$,,A' AJJ KHOO((//9--iHE-++A#AJJ AJJ$%NN4F,-,<,rs rr&zDocumentType.writexmlEs \" TYY == LL $--t}}F G ]] LLdDMMB C    * LL  LL,, - LL  SXrr)rrrr DOCUMENT_TYPE_NODEr$rrr/r0r>rr?rlr&r rrr9r9s:&&HI DHHN"#6 rr9cheZdZdZej ZdZdZdZ dZ dZ dZ dZ dZdZdZdZd Zy) rENcb||_||_t|_|j ||yr-)rrFrr/r2)rrr/r0rIs rrzEntity.__init__\s* $"* ##Hh7rc|jSr-rGrs r_get_actualEncodingzEntity._get_actualEncodingbr@rc|jSr-rrs r _get_encodingzEntity._get_encodinger5rc|jSr-rrrs r _get_versionzEntity._get_versionhrrc@tjjd)Nz(cannot append children to an entity noderCrDrE)rrRs rrIzEntity.appendChildksgg)) 68 8rc@tjjd)Nz+cannot insert children below an entity noder\rs rrAzEntity.insertBeforeosgg)) 9; ;rc@tjjd)Nz*cannot remove children from an entity noder\r^s rrHzEntity.removeChildssgg)) 8: :rc@tjjd)Nz)cannot replace children of an entity noder\rs rr[zEntity.replaceChildwsgg)) 79 9r)rrrrr ENTITY_NODEr$rrGrrrrrTrWrZrIrArHr[r rrrErESsNJHINHG8 #8;:9rrEc.eZdZejZdZdZy)rDNc6||_|j||yr-)rr2)rrr/r0s rrzNotation.__init__s  ##Hh7r)rrrr rr$rrr rrrDrD{s!!HI8rrDc2eZdZgdZdZdZdZdZdZy)DOMImplementation))core1.0)re2.0)reN)rCrf)rCrg)rCN)ls-loadz3.0)rhNcL|dk(rd}|j|f|jvSr)lower _featuresrps rrozDOMImplementation.hasFeatures( b=G )T^^;;rcH|r+|jtjjd|j }|duxr |duxr|du }|s!|rtjj d|rt |\}}|dk(r$|dk7rtjjd|r!|stjjd|j||}|r|j||j||r|x|_|_ ||_ ||_ |S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces) rGrCrDWrongDocumentErr_create_documentInvalidCharacterErrr|rcreateElementNSrIrjdoctypern) rrr~rqradd_root_elementrrrs rcreateDocumentz DOMImplementation.createDocuments. w))5''**:< <##% , 4!4$1T$9!4$+tO5!1''--.DE E  ( 7 FI#IIgg**+HIIlgg**>@@)), FG( OOG $ 9< x7"   8 +#'D  (''%%' ' (s A (A1ch|jD]#}|jtjk(s!|cSyr-)r/r$r rdrNs rrzDocument._get_documentElementds'OOD}} 1 11 $rc|j!|jjd|_tj|yr-)rqrbr rs rrbzDocument.unlinkis/ << # LL   !DL Drc|sy|jjddd}|j|_|j|_|j|_|j D]s}t |||}|j j||jtjk(rn$|jtjk(r||_ ||_ u|jtj j"j$|||Sr-)rnrsrrrrr/rircr$r r%rOrqrGrrCrDrBrC)rrkrHrG childclones rrlzDocument.cloneNodeos##224tD??  A$Qe4J    # #J /""d&8&88$$(?(?? * $)J !! $$SWW%<%<%H%H%)5 2 rc(t}||_|Sr-)rrj)rrs rcreateDocumentFragmentzDocument.createDocumentFragments  rc*t|}||_|Sr-)rirj)rrrJs r createElementzDocument.createElements G rclt|ts tdt}||_||_|SNznode contents must be a string)rrr;rrarj)rrats rcreateTextNodezDocument.createTextNodes2$$<= = Frclt|ts tdt}||_||_|Sr)rrr;rrarjrrarTs rcreateCDATASectionzDocument.createCDATASections2$$<= = Nrc*t|}||_|Sr-)rrjrs r createCommentzDocument.createComments DMrc,t||}||_|Sr-)rrj)rrraps rcreateProcessingInstructionz$Document.createProcessingInstructions !&$ /rc8t|}||_d|_|Sr)rrjr)rras rcreateAttributezDocument.createAttributes KrcJt|\}}t|||}||_|Sr-)r|rirj)rrr~rrrJs rrpzDocument.createElementNSs+$]3 M< 8rcZt|\}}t||||}||_d|_|Sr)r|rrjr)rrr~rrrs rcreateAttributeNSzDocument.createAttributeNSs4$]3  i @rc0t||||}||_|Sr-)rErj)rrr/r0rFrJs r_create_entityzDocument._create_entitys 48\ :rc.t|||}||_|Sr-)rDrj)rrr/r0rGs r_create_notationzDocument._create_notations T8X .rc||jvr|j|S|js |jsy|j}||jg}||_n|syd}|r|j }|j |jDcgc]}|jtvr|c}|j|}|r.|jjD]}|jrb|j|j|js7||j|j <|j |k(r|}b|j"ron|j%|j&r:||j|j <|j |k(r|}|j"rn|j(s||j|j <|j |k(r|}|j"dk(snenc|j"rW|jjD]:}|j(s||j|j <|j |k(s9|}<| |S|r|Scc}w)Nr>)rrrrrpopextendr/r$rMrrrrrrrrrrr)rr'stackresultrUrgrrrs rgetElementByIdzDocument.getElementByIds  >>"% %4#7#7%% =))*E$)D !99;D LLT__I_E"^^/GG _I J&&t,D!OO224D((;;t'8'8$..I9=DNN4::6#zzR/)-%)%9%9 %499-59tzz2::+%)F!%!5!5!59tzz2::+%)F!11Q6!'5(%% OO224D{{59tzz2::+%)F 5 ! ON IIs Ic,t||tSr-rr?s rrzDocument.getElementsByTagNames.tT8:FFrc.t|||tSr-rrBs rrzDocument.getElementsByTagNameNSrrc:|jj||Sr-)rnrorps rrszDocument.isSupported s""--gw??rc |jtjk(rtjj d|jtj k(rtjj dt|||S)Nzcannot import document nodesz!cannot import document type nodes)r$r r%rCrDNotSupportedErrrOri)rrUrks r importNodezDocument.importNode sa ==D.. .''))*HI I ]]d55 5''))*MN N4t,,rcg}|r|jd|d||jd|rdndd|jddj|d||jD]}|j ||||y) Nz encoding="rz standalone="yesnozrzillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrmr$r rdrrrrrrrrrrrrrrrryr)rrGrrrrris_ids r renameNodezDocument.renameNode#s ??$ &''**,0!//CD D ::d//1D1DE E''))JL L ? *d{$(JJsA$6! '&#''*A*AA''..799go&#''*A*AA**(;(;;''..>@@ FI ::,, ,nnG"++A.G  % ::** *AIAF"((+..q1 r)rrrNN)=rrrrr rdrrrOrBrdrnr%r$rrrrGrQrPrGrrrrrrrrrrrTrrrWrrrrZrIrHrrbrlrrrrrrrrprrrrrrrsrr&rr rrrxrxsE@I**D,L,L**D,C,CE'(N!!HHIJJ$((Ok NHJGLKO%(# !(,   *        8tG7@-KO  ; 3rrxrz#Top-level element of this document.c |jj|r%tjjj }n$tjjj }|jtjk(r|j|j|j}|jjD]j}|j|j|j|j |j#|j|j$}|j&|_l|r|j(D] }t+|||}|j-|"n|jtj.k(rD|j1}|r|j(D] }t+|||}|j-|"n|jtj2k(r|j5|j6}nM|jtj8k(r|j;|j6}n|jtj<k(r(|j?|j@|j6}n|jtjBk(r|jE|j6}n|jtjFk(r@|jI|j|j}d|_|j |_n7|jtjJk(rtjjj }|jLjO|jP|jR|jT}||_|rg|jV_,g|jZ_,|jZjXD]y} t]| j| jR| jT} || _|jZjXj_| ta| dsg| jc|| | {|jVjXD]} te| j| jR| jT| jf} | jh| _4| jj| _5| jl| _6|| _|jVjXj_| ta| ds| jc|| | n+tjjodtq|zta|dr|jc||||S)zo Clone a node and give it the new owner document. Called by Node.cloneNode and Document.importNode TrzCannot clone node %s)9rjryrCrDrBrC NODE_IMPORTEDr$r rdrprrrrrrr}rrr/rirIr?rr`rrarrrrrrrrrrOrnrurr/r0r;rr<rDrcrrrErFrGrrrrrF) rUrknewOwnerDocumentrrHrrrrgrTrGrIrJrKs rriri\s  $$%56GG++77 GG++99  }}))) 001B1B15@OO**,D  !2!2DMM4:: N(():):DNNKA..AK- t-=>!!!$) $55 5 779 t-=>!!!$) $.. ( // : $11 1 33DII> $:: : <r)rr)r~fieldss rr|r|s4  a (F 6{a fQi  rc~||i|}|j\}}|j||j|Sr-)getEvent expandNoder)funcargskwargseventstoktyperootNodes r_do_pulldom_parsers> 4 "6 "F)GX h LLN Orcz||sddlm}|j|Sddlm}t |j|f||dS)z3Parse a file into a DOM by filename or file object.r expatbuilderpulldom)parserbufsize)xml.domrparserr)filerrrrs rrrs? ~g(!!$''# ' 24 4rct|ddlm}|j|Sddlm}t |j|fd|iS)z&Parse a file into a DOM from a string.rrrr)rr parseStringrr)stringrrrs rrrs? ~(''//# !4!4vi"*F!35 5rc|rQt|trtj|}|D]'\}}tj j ||r'ytj Sr-)rrr_parse_feature_stringrxrnro)featuresfvs rgetDOMImplementationrsT h $33H=HDAq**55a;  " ""rrr-)6rXr rrCrrrrxml.dom.minicompatxml.dom.xmlbuilderrr rDr rdrrM defpropertyrXrrrrrobjectr AttributeListr\rrirrrrrrrrrrr-r9rErDrdrzrNrxrir|rrrrr rrrs" JJ > GGLL55GGLL>>@t377<<tl D,$@A D+$?@ D+$HI%t%$z84z8x D&$FG D+$MN D,$EFa?6a?F L(68 v( D$ M"dM"^ G\<> G[79  &;&;RNItN4ECItECN M8)EFS+=S+j D0./ D+@B Bm B 34 3<V<| *H8:  ::y$:x&9Z&9P8z9d8M+M^(&(T2QtZQf  H'57Od!45#rPKm#]0i(sax/__pycache__/__init__.cpython-312.pycnu[ Th $dZddlmZddlmZmZddlmZmZm Z m Z m Z efdZ efdZ dgZdZerdd lZdd lZdd lZej(j*s,d ej,vrej,d j/d Z[[dd Zd Zy )aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,ct|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 1AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r))__doc__ xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr=s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPKm#]i;ss1sax/__pycache__/_exceptions.cpython-312.opt-2.pycnu[ Th[t GddeZGddeZGddeZGddeZGdd eZy ) c.eZdZ ddZdZdZdZdZy) SAXExceptionNcN ||_||_tj||yN)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyr zSAXException.__init__s%  #4%c |jSrrr s r getMessagezSAXException.getMessages.yyrc |jSr)rrs r getExceptionzSAXException.getExceptionsCrc |jSrrrs r __str__zSAXException.__str__s:yyrc td)N __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s =]++rr)__name__ __module__ __qualname__r rrrrrr rrs  &,rrc2eZdZ dZdZdZdZdZdZy)SAXParseExceptionc tj|||||_|jj|_|jj |_|jj|_yr) rr _locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r r zSAXParseException.__init__7s\OdC3 224}}446  335 rc |jSr)r&rs r r%z!SAXParseException.getColumnNumberDs ||rc |jSr)r(rs r r'zSAXParseException.getLineNumberIsN}}rc8 |jjSr)r" getPublicIdrs r r-zSAXParseException.getPublicIdMsO}}((**rc |jSr)r$rs r r#zSAXParseException.getSystemIdQsO~~rc |j}|d}|j}|d}|j}|d}|d|d|d|jS)Nz ?:z: )r#r'r%r)r sysidlinenumcolnums r rzSAXParseException.__str__Us`:  " =E$$& ?G%%' >F!&CCrN) rrrr r%r'r-r#rrrr r r *s& . 6 + Drr c eZdZy)SAXNotRecognizedExceptionNrrrrrr r6r6es,rr6c eZdZy)SAXNotSupportedExceptionNr7rrr r9r9osrr9c eZdZy)SAXReaderNotAvailableNr7rrr r;r;ys!rr;N)rrr r6r9r;rrr r<sI' ,9 ,J6D 6Dv, ,|!4!rPKm#]5KK+sax/__pycache__/_exceptions.cpython-312.pycnu[ Th[vdZGddeZGddeZGddeZGddeZGd d eZy ) z!Different kinds of SAX Exceptionsc0eZdZdZddZdZdZdZdZy) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcL||_||_tj||y)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyrzSAXException.__init__s" #4%c|jS)z$Return a message for this exception.rr s r getMessagezSAXException.getMessage yyr c|jS)z9Return the embedded exception, or None if there was none.)rrs r getExceptionzSAXException.getExceptions r c|jS)0Create a string representation of the exception.rrs r __str__zSAXException.__str__rr ctd)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s]++r )N) __name__ __module__ __qualname____doc__rrrrrr r rrs  &,r rc4eZdZdZdZdZdZdZdZdZ y) SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.ctj|||||_|jj|_|jj |_|jj|_y)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r rzSAXParseException.__init__7sYdC3 224}}446  335 r c|jS)zNThe column number of the end of the text where the exception occurred.)r(rs r r'z!SAXParseException.getColumnNumberDs||r c|jS)zDThe line number of the end of the text where the exception occurred.)r*rs r r)zSAXParseException.getLineNumberIs }}r c6|jjS)zEGet the public identifier of the entity where the exception occurred.)r$ getPublicIdrs r r/zSAXParseException.getPublicIdMs}}((**r c|jS)zEGet the system identifier of the entity where the exception occurred.)r&rs r r%zSAXParseException.getSystemIdQs ~~r c|j}|d}|j}|d}|j}|d}|d|d|d|jS)rz ?:z: )r%r)r'r)r sysidlinenumcolnums r rzSAXParseException.__str__Us]  " =E$$& ?G%%' >F!&CCr N) rrrrrr'r)r/r%rr r r r"r"*s& . 6 + Dr r"ceZdZdZy)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r8r8es,r r8ceZdZdZy)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr9r r r r;r;osr r;ceZdZdZy)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr9r r r r=r=ys!r r=N)rrrr"r8r;r=r r r r>sI' ,9 ,J6D 6Dv, ,|!4!r PKm#] ^ΰ .sax/__pycache__/__init__.cpython-312.opt-2.pycnu[ Th " ddlmZddlmZmZddlmZmZmZm Z m Z efdZ efdZ dgZ dZerddlZddlZddlZej&j(s,d ej*vrej*d j-d Z [[d d Zd Zy)) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,c t|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 2AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r)) xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr<s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPKm#]ޠc4c4/sax/__pycache__/xmlreader.cpython-312.opt-2.pycnu[ ThP1 ddlmZddlmZmZGddZGddeZGddZGd d ZGd d Z Gd de Z dZ e dk(re yy))handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncheZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy) XMLReaderctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002c tdNz This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parsesK!"DEErc |jSr r rs rgetContentHandlerzXMLReader.getContentHandler"s-!!!rc ||_yr rrrs rsetContentHandlerzXMLReader.setContentHandler&s D$rc |jSr r rs r getDTDHandlerzXMLReader.getDTDHandler*s*   rc ||_yr r%r"s r setDTDHandlerzXMLReader.setDTDHandler.s A#rc |jSr rrs rgetEntityResolverzXMLReader.getEntityResolver2s-   rc ||_yr r*)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s :$rc |jSr rrs rgetErrorHandlerzXMLReader.getErrorHandler:s+   rc ||_yr r0r"s rsetErrorHandlerzXMLReader.setErrorHandler>s =#rc td)NzLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs = ''GHHrc td|zNzFeature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureKs;'(E(LMMrc td|zr8r9)rr;states r setFeaturezXMLReader.setFeatureOs+'(E(LMMrc td|zNzProperty '%s' not recognizedr9r:s r getPropertyzXMLReader.getPropertySs<'(F(MNNrc td|zrAr9)rr;values r setPropertyzXMLReader.setPropertyWs,'(F(MNNrN)__name__ __module__ __qualname__rrr r#r&r(r+r.r1r3r6r<r?rBrErrrr sX 3 F"%!$!%!$INNOOrrc4eZdZ ddZdZdZdZdZdZy) IncrementalParserc<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rPprepare_input_source prepareParsergetCharacterStream getByteStreamreadrMfeedclose)rrrPfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rc tdrr)rdatas rrWzIncrementalParser.feeds ( ""DEErc td)Nz!prepareParser must be overridden!rrs rrSzIncrementalParser.prepareParsers =!"EFFrc tdrrrs rrXzIncrementalParser.closes )""DEErc tdrrrs rresetzIncrementalParser.resets ""DEErN)i) rFrGrHrrrWrSrXr`rIrrrKrK[s)&! FG FFrrKc&eZdZ dZdZdZdZy)Locatorc yNrIrs rgetColumnNumberzLocator.getColumnNumbers@rc yrdrIrs r getLineNumberzLocator.getLineNumbers>rc yr rIrs r getPublicIdzLocator.getPublicId=rc yr rIrs r getSystemIdzLocator.getSystemIdrkrN)rFrGrHrfrhrjrmrIrrrbrbs" rrbcReZdZ d dZdZdZdZdZdZdZ d Z d Z d Z d Z y) InputSourceNcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc ||_yr rr)r public_ids r setPublicIdzInputSource.setPublicId 9$rc |jSr ryrs rrjzInputSource.getPublicId<rc ||_yr rqrvs r setSystemIdzInputSource.setSystemIdr|rc |jSr rrs rrmzInputSource.getSystemIdr~rc ||_yr rs)rencodings r setEncodingzInputSource.setEncodings 9#rc |jSr rrs r getEncodingzInputSource.getEncoding9rc ||_yr rt)rbytefiles r setByteStreamzInputSource.setByteStreams A#rc |jSr rrs rrUzInputSource.getByteStreams 1rc ||_yr ru)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreams 0#rc |jSr rrs rrTzInputSource.getCharacterStreamrrr )rFrGrHrr{rjrrmrrrrUrrTrIrrroros? B % % # ##rrocteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc ||_yr _attrs)rattrss rrzAttributesImpl.__init__s 7 rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArIr:s rgetTypezAttributesImpl.getTypesrc |j|Sr rr:s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr:s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr:s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr:s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr:s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr:s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr; alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rFrGrHrrrrrrrrrrrrrrrrrrIrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc" ||_||_yr )r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts =  rc|jjD]\}}||k(s |j|cSt|r )rrrrrr;nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr:s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rFrGrHrrrrrrrIrrrrRs "+9rrc@tttyr )rrKrbrIrr_testrts K Ir__main__N) rQr _exceptionsrrrrKrbrorrrrFrIrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPKm#](W[L[L)sax/__pycache__/xmlreader.cpython-312.pycnu[ ThP1dZddlmZddlmZmZGddZGddeZGdd ZGd d Z Gd d Z Gdde Z dZ e dk(re yy)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy) XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.ctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002ctd)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parses!"DEErc|jS)z#Returns the current ContentHandler.r rs rgetContentHandlerzXMLReader.getContentHandler"s!!!rc||_y)z:Registers a new object to receive document content events.Nrrrs rsetContentHandlerzXMLReader.setContentHandler&s $rc|jS)z Returns the current DTD handler.r rs r getDTDHandlerzXMLReader.getDTDHandler*   rc||_y)z7Register an object to receive basic DTD-related events.Nr%r"s r setDTDHandlerzXMLReader.setDTDHandler. #rc|jS)z#Returns the current EntityResolver.rrs rgetEntityResolverzXMLReader.getEntityResolver2r'rc||_y)z0Register an object to resolve external entities.Nr,)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s $rc|jS)z!Returns the current ErrorHandler.rrs rgetErrorHandlerzXMLReader.getErrorHandler:r'rc||_y)z3Register an object to receive error-message events.Nr2r"s rsetErrorHandlerzXMLReader.setErrorHandler>r*rctd)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs''GHHrctd|z)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureK'(E(LMMrctd|z)z!Sets the state of a SAX2 feature.r:r;)rr=states r setFeaturezXMLReader.setFeatureOr?rctd|z)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedr;r<s r getPropertyzXMLReader.getPropertyS'(F(MNNrctd|z)z"Sets the value of a SAX2 property.rDr;)rr=values r setPropertyzXMLReader.setPropertyWrFrN)__name__ __module__ __qualname____doc__rrr r#r&r)r-r0r3r5r8r>rBrErIrrrr sX 3 F"%!$!%!$INNOOrrc6eZdZdZd dZdZdZdZdZdZ y) IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.c<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rUprepare_input_source prepareParsergetCharacterStream getByteStreamreadrRfeedclose)rrrUfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rctd)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rr)rdatas rr\zIncrementalParser.feeds""DEErctd)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!rrs rrXzIncrementalParser.prepareParsers""EFFrctd)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rrrs rr]zIncrementalParser.closes""DEErctd)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rrrs rresetzIncrementalParser.resets ""DEErN)i) rJrKrLrMrrr\rXr]rerNrrrPrP[s)&! FG FFrrPc(eZdZdZdZdZdZdZy)LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cy)z6Return the column number where the current event ends.rNrs rgetColumnNumberzLocator.getColumnNumberrcy)z4Return the line number where the current event ends.rirNrs r getLineNumberzLocator.getLineNumberrkrcy)z3Return the public identifier for the current event.NrNrs r getPublicIdzLocator.getPublicIdrcy)z3Return the system identifier for the current event.NrNrs r getSystemIdzLocator.getSystemIdrprN)rJrKrLrMrjrmrorrrNrrrgrgs" rrgcTeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d Zy) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc||_y)z/Sets the public identifier of this InputSource.Nrw)r public_ids r setPublicIdzInputSource.setPublicId $rc|jS)z2Returns the public identifier of this InputSource.r~rs rrozInputSource.getPublicIdrc||_y)z/Sets the system identifier of this InputSource.Nrvr{s r setSystemIdzInputSource.setSystemIdrrc|jS)z2Returns the system identifier of this InputSource.rrs rrrzInputSource.getSystemIdrrc||_y)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.Nrx)rencodings r setEncodingzInputSource.setEncoding #rc|jS)z/Get the character encoding of this InputSource.rrs r getEncodingzInputSource.getEncoding rc||_y)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.Nry)rbytefiles r setByteStreamzInputSource.setByteStreams #rc|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rrs rrZzInputSource.getByteStreams rc||_y)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.Nrz)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreamrrc|jS)z/Get the character stream for this input source.rrs rrYzInputSource.getCharacterStreamrrr )rJrKrLrMrrrorrrrrrrZrrYrNrrrtrts? B % % # ##rrtcteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc||_y)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)rattrss rrzAttributesImpl.__init__s  rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArNr<s rgetTypezAttributesImpl.getTypesrc |j|Sr rr<s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr<s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr<s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr<s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr<s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr<s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr= alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rJrKrLrrrrrrrrrrrrrrrrrrNrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc ||_||_y)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts   rc|jjD]\}}||k(s |j|cSt|r )rrrrrr=nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr<s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rJrKrLrrrrrrrNrrrrRs "+9rrc@tttyr )rrPrgrNrr_testrts K Ir__main__N)rMrVr _exceptionsrrrrPrgrtrrrrJrNrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPKm#]@+:+:'sax/__pycache__/handler.cpython-312.pycnu[ Th=dZdZGddZGddZGddZGdd Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZGddZy)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac"eZdZdZdZdZdZy) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.c|)zHandle a recoverable error.self exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error c|)zHandle a non-recoverable error.rrs r fatalErrorzErrorHandler.fatalError$r r ct|y)zHandle a warning.N)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname____doc__r rrrr r rrs0r rcdeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cd|_y)N_locatorrs r __init__zContentHandler.__init__6s  r c||_y)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s *  r cy)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrs r startDocumentzContentHandler.startDocumentPr cy)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrs r endDocumentzContentHandler.endDocumentWr"r cy)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`r"r cy)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rr&s r endPrefixMappingzContentHandler.endPrefixMappingwr"r cy)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrss r startElementzContentHandler.startElement~r"r cy)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrr,s r endElementzContentHandler.endElementr"r cy)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rr,qnamer-s r startElementNSzContentHandler.startElementNSr"r cy)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rr,r3s r endElementNSzContentHandler.endElementNSr"r cy)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nrrcontents r characterszContentHandler.charactersr"r cy)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespacer"r cy)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructionr"r cy)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrr0s r skippedEntityzContentHandler.skippedEntityr"r N)rrrrrrr!r$r(r*r.r1r4r6r:r=rArCrr r rr/sN=  . .C+ - 0   r rceZdZdZdZdZy) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cy)z$Handle a notation declaration event.Nr)rr,publicIdsystemIds r notationDeclzDTDHandler.notationDeclr"r cy)z,Handle an unparsed entity declaration event.Nr)rr,rGrHndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDeclr"r N)rrrrrIrLrr r rErEs3 /7r rEceZdZdZdZy)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.c|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rrGrHs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrrPrr r rNrNs 2 r rNz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc.eZdZdZdZdZdZdZdZy)LexicalHandleraOptional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.cy)zReports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.Nrr8s r commentzLexicalHandler.commentfr"r cy)aReport the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).Nr)rr, public_id system_ids r startDTDzLexicalHandler.startDTDlr"r cy)z$Signals the end of DTD declarations.Nrrs r endDTDzLexicalHandler.endDTDyr"r cy)zReports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.Nrrs r startCDATAzLexicalHandler.startCDATA|r"r cy)z*Reports the end of a CDATA marked section.Nrrs r endCDATAzLexicalHandler.endCDATAr"r N) rrrrrTrXrZr\r^rr r rRrRYs! 8G (3) 9r rRN)rversionrrrErNfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrRrr r rns  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PKm#]y\-sax/__pycache__/handler.cpython-312.opt-2.pycnu[ Th= dZGddZGddZGddZGddZd Zd Zd Zd Zd Z dZ eeeee e gZ dZ dZ dZdZdZdZe ee eeegZGddZy)z2.0betac eZdZ dZdZdZy) ErrorHandlerc |Nself exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error s %c |rrrs r fatalErrorzErrorHandler.fatalError$s )r c t|yr)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname__r rrrr r rrs0r rcbeZdZ dZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy)ContentHandlercd|_yr_locatorrs r __init__zContentHandler.__init__6s  r c ||_yrr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s G(  r cyrrrs r startDocumentzContentHandler.startDocumentPs r cyrrrs r endDocumentzContentHandler.endDocumentWs r cyrr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`s r cyrr)rr$s r endPrefixMappingzContentHandler.endPrefixMappingws Cr cyrr)rnameattrss r startElementzContentHandler.startElement~s r cyrrrr*s r endElementzContentHandler.endElements +r cyrr)rr*qnamer+s r startElementNSzContentHandler.startElementNSs r cyrr)rr*r1s r endElementNSzContentHandler.endElementNSs -r cyrrrcontents r characterszContentHandler.characterss 0r cyrr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespaces r cyrr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructions r cyrrr.s r skippedEntityzContentHandler.skippedEntitys r N)rrrrrr r"r&r(r,r/r2r4r8r;r?rArr r rr/sN=  . .C+ - 0   r rceZdZ dZdZy) DTDHandlercyrr)rr*publicIdsystemIds r notationDeclzDTDHandler.notationDecls.r cyrr)rr*rErFndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDecls6r N)rrrrGrJrr r rCrCs3 /7r rCceZdZ dZy)EntityResolverc |Srr)rrErFs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrNrr r rLrLs 2 r rLz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc,eZdZ dZdZdZdZdZy)LexicalHandlercyrrr6s r commentzLexicalHandler.commentfs Gr cyrr)rr* public_id system_ids r startDTDzLexicalHandler.startDTDls (r cyrrrs r endDTDzLexicalHandler.endDTDys2r cyrrrs r startCDATAzLexicalHandler.startCDATA|s )r cyrrrs r endCDATAzLexicalHandler.endCDATAs8r N)rrrrRrVrXrZr\rr r rPrPYs! 8G (3) 9r rPN)versionrrrCrLfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrPrr r rls  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PKm#]EOTOT1sax/__pycache__/expatreader.cpython-312.opt-1.pycnu[ Th>dZdZddlddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z  dd l m Z ee d s ed d dd lmZmZmZej*Zej,Z dd lZdd lZej2Z[[GddZGddej8ZGddej<ej8ZdZ e!dk(rydd l"Z#e Z$e$jKe#jLj&jOe$jQe#jLjSe$jUdy y #e$r ed d wxYw#e$rdZYwxYw)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc.eZdZdZdZdZdZdZdZy) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. c$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN) rrr__doc__r$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZdZd#dZdZdZdZdZdZ dZ d Z d$d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#y")% ExpatParserz$SAX driver for the pyexpat C module.ctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rctj|}||_ |j|jj t |tjj||y#|jxYw)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr8parse _close_sourcer"sources rrGzExpatParser.parseasn..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA33Bcx|j*|jj|jyyr)r3r&SetBaserIs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr8setContentHandlerr<_reset_cont_handler)r"rs rrOzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr:r r?rrrrr>SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrR) r<SAXNotSupportedExceptionrr:rr>r r?rrrrS)r"rUstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr;r r?r r&hasattrr\rSrXrTs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr]) rr^r;r<_reset_lex_handler_propr r?r rXrS)r"rUvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r<rDrE startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrgr rhrirjrkrlrm)r" was_enabledrprqs rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rJfiles rrHzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)roF) r=r& isinstancerrrrE endDocumentr<r'r,rHr!s rrzzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rEprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrPzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r;r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rrbz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r:r r r/ getEncodingr?r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrPunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr;rbexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr<r=rs rrDzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rE startElementAttributesImpl)r"rUattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rE endElementrTs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrEstartElementNSAttributesNSImpl) r"rUrpairnewattrsqnamesanamercpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rEr)r"rns rcharacter_datazExpatParser.character_datarrc<|jj||yr)rEstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rEendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r;startDTD)r"rUsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rUbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rUrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r> _ent_handler resolveEntityrrCr/r3r=appendr&ExternalEntityParserCreaterr8rG)r"contextrrrrJs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rE skippedEntity)r"rUis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)$rrrr4r$rGrMrOrVrZr`rdrrrwrHrzrPrbrDr(r-r0r3rrrrrrrrrrrrrrrrr6r6Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr6ct|i|Sr)r6)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)+r4versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r_SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr8r6rrxml.sax.saxutilsxmlprOsax XMLGeneratorsetErrorHandler ErrorHandlerrGrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE*EEEEPKm#]5KK1sax/__pycache__/_exceptions.cpython-312.opt-1.pycnu[ Th[vdZGddeZGddeZGddeZGddeZGd d eZy ) z!Different kinds of SAX Exceptionsc0eZdZdZddZdZdZdZdZy) SAXExceptionaEncapsulate an XML error or warning. This class can contain basic error or warning information from either the XML parser or the application: you can subclass it to provide additional functionality, or to add localization. Note that although you will receive a SAXException as the argument to the handlers in the ErrorHandler interface, you are not actually required to raise the exception; instead, you can simply read the information in it.NcL||_||_tj||y)zUCreates an exception. The message is required, but the exception is optional.N)_msg _exception Exception__init__)selfmsg exceptions ,/usr/lib64/python3.12/xml/sax/_exceptions.pyrzSAXException.__init__s" #4%c|jS)z$Return a message for this exception.rr s r getMessagezSAXException.getMessage yyr c|jS)z9Return the embedded exception, or None if there was none.)rrs r getExceptionzSAXException.getExceptions r c|jS)0Create a string representation of the exception.rrs r __str__zSAXException.__str__rr ctd)zvAvoids weird error messages if someone does exception[ix] by mistake, since Exception has __getitem__ defined. __getitem__)AttributeError)r ixs r rzSAXException.__getitem__"s]++r )N) __name__ __module__ __qualname____doc__rrrrrr r rrs  &,r rc4eZdZdZdZdZdZdZdZdZ y) SAXParseExceptiona#Encapsulate an XML parse error or warning. This exception will include information for locating the error in the original XML document. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to raise the exception; instead, it can simply read the information in it and take a different action. Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.ctj|||||_|jj|_|jj |_|jj|_y)zECreates the exception. The exception parameter is allowed to be None.N) rr_locator getSystemId _systemIdgetColumnNumber_colnum getLineNumber_linenum)r r r locators r rzSAXParseException.__init__7sYdC3 224}}446  335 r c|jS)zNThe column number of the end of the text where the exception occurred.)r(rs r r'z!SAXParseException.getColumnNumberDs||r c|jS)zDThe line number of the end of the text where the exception occurred.)r*rs r r)zSAXParseException.getLineNumberIs }}r c6|jjS)zEGet the public identifier of the entity where the exception occurred.)r$ getPublicIdrs r r/zSAXParseException.getPublicIdMs}}((**r c|jS)zEGet the system identifier of the entity where the exception occurred.)r&rs r r%zSAXParseException.getSystemIdQs ~~r c|j}|d}|j}|d}|j}|d}|d|d|d|jS)rz ?:z: )r%r)r'r)r sysidlinenumcolnums r rzSAXParseException.__str__Us]  " =E$$& ?G%%' >F!&CCr N) rrrrrr'r)r/r%rr r r r"r"*s& . 6 + Dr r"ceZdZdZy)SAXNotRecognizedExceptionzException class for an unrecognized identifier. An XMLReader will raise this exception when it is confronted with an unrecognized feature or property. SAX applications and extensions may use this class for similar purposes.Nrrrrr r r r8r8es,r r8ceZdZdZy)SAXNotSupportedExceptionaException class for an unsupported operation. An XMLReader will raise this exception when a service it cannot perform is requested (specifically setting a state or value). SAX applications and extensions may use this class for similar purposes.Nr9r r r r;r;osr r;ceZdZdZy)SAXReaderNotAvailableaException class for a missing driver. An XMLReader module (driver) should raise this exception when it is first imported, e.g. when a support module cannot be imported. It also may be raised during parsing, e.g. if executing an external program is not permitted.Nr9r r r r=r=ys!r r=N)rrrr"r8r;r=r r r r>sI' ,9 ,J6D 6Dv, ,|!4!r PKm#](W[L[L/sax/__pycache__/xmlreader.cpython-312.opt-1.pycnu[ ThP1dZddlmZddlmZmZGddZGddeZGdd ZGd d Z Gd d Z Gdde Z dZ e dk(re yy)z]An XML Reader is the SAX 2 name for an XML parser. XML Parsers should be based on this code. )handler)SAXNotSupportedExceptionSAXNotRecognizedExceptioncjeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZy) XMLReadera%Interface for reading an XML document using callbacks. XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse. All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.ctj|_tj|_tj |_tj|_yN) rContentHandler _cont_handler DTDHandler _dtd_handlerEntityResolver _ent_handler ErrorHandler _err_handlerselfs */usr/lib64/python3.12/xml/sax/xmlreader.py__init__zXMLReader.__init__sF$335#..0#224#002ctd)zAParse an XML document from a system identifier or an InputSource. This method must be implemented!NotImplementedErrorrsources rparsezXMLReader.parses!"DEErc|jS)z#Returns the current ContentHandler.r rs rgetContentHandlerzXMLReader.getContentHandler"s!!!rc||_y)z:Registers a new object to receive document content events.Nrrrs rsetContentHandlerzXMLReader.setContentHandler&s $rc|jS)z Returns the current DTD handler.r rs r getDTDHandlerzXMLReader.getDTDHandler*   rc||_y)z7Register an object to receive basic DTD-related events.Nr%r"s r setDTDHandlerzXMLReader.setDTDHandler. #rc|jS)z#Returns the current EntityResolver.rrs rgetEntityResolverzXMLReader.getEntityResolver2r'rc||_y)z0Register an object to resolve external entities.Nr,)rresolvers rsetEntityResolverzXMLReader.setEntityResolver6s $rc|jS)z!Returns the current ErrorHandler.rrs rgetErrorHandlerzXMLReader.getErrorHandler:r'rc||_y)z3Register an object to receive error-message events.Nr2r"s rsetErrorHandlerzXMLReader.setErrorHandler>r*rctd)aHAllow an application to set the locale for errors and warnings. SAX parsers are not required to provide localization for errors and warnings; if they cannot support the requested locale, however, they must raise a SAX exception. Applications may request a locale change in the middle of a parse.zLocale support not implemented)r)rlocales r setLocalezXMLReader.setLocaleBs''GHHrctd|z)z1Looks up and returns the state of a SAX2 feature.Feature '%s' not recognizedrrnames r getFeaturezXMLReader.getFeatureK'(E(LMMrctd|z)z!Sets the state of a SAX2 feature.r:r;)rr=states r setFeaturezXMLReader.setFeatureOr?rctd|z)z2Looks up and returns the value of a SAX2 property.Property '%s' not recognizedr;r<s r getPropertyzXMLReader.getPropertyS'(F(MNNrctd|z)z"Sets the value of a SAX2 property.rDr;)rr=values r setPropertyzXMLReader.setPropertyWrFrN)__name__ __module__ __qualname____doc__rrr r#r&r)r-r0r3r5r8r>rBrErIrrrr sX 3 F"%!$!%!$INNOOrrc6eZdZdZd dZdZdZdZdZdZ y) IncrementalParserasThis interface adds three extra methods to the XMLReader interface that allow XML parsers to support incremental parsing. Support for this interface is optional, since not all underlying XML parsers support this functionality. When the parser is instantiated it is ready to begin accepting data from the feed method immediately. After parsing has been finished with a call to close the reset method must be called to make the parser ready to accept new data, either from feed or using the parse method. Note that these methods must _not_ be called during parsing, that is, after parse has been called and before it returns. By default, the class also implements the parse method of the XMLReader interface using the feed, close and reset methods of the IncrementalParser interface as a convenience to SAX 2.0 driver writers.c<||_tj|yr )_bufsizerr)rbufsizes rrzIncrementalParser.__init__os 4 rcPddlm}|j|}|j||j }||j }|j |jx}r/|j||j |jx}r/|jy)Nr)saxutils) rUprepare_input_source prepareParsergetCharacterStream getByteStreamreadrRfeedclose)rrrUfilebuffers rrzIncrementalParser.parsess..v6 6"((* <'')D $--00f0 IIf  $--00f0 rctd)aThis method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.rr)rdatas rr\zIncrementalParser.feeds""DEErctd)ztThis method is called by the parse implementation to allow the SAX 2.0 driver to prepare itself for parsing.z!prepareParser must be overridden!rrs rrXzIncrementalParser.prepareParsers""EFFrctd)aThis method is called when the entire XML document has been passed to the parser through the feed method, to notify the parser that there are no more data. This allows the parser to do the final checks on the document and empty the internal data buffer. The parser will not be ready to parse another document until the reset method has been called. close may raise SAXException.rrrs rr]zIncrementalParser.closes""DEErctd)zThis method is called after close has been called to reset the parser so that it is ready to parse new documents. The results of calling parse or feed after close without calling reset are undefined.rrrs rresetzIncrementalParser.resets ""DEErN)i) rJrKrLrMrrr\rXr]rerNrrrPrP[s)&! FG FFrrPc(eZdZdZdZdZdZdZy)LocatorzInterface for associating a SAX event with a document location. A locator object will return valid results only during calls to DocumentHandler methods; at any other time, the results are unpredictable.cy)z6Return the column number where the current event ends.rNrs rgetColumnNumberzLocator.getColumnNumberrcy)z4Return the line number where the current event ends.rirNrs r getLineNumberzLocator.getLineNumberrkrcy)z3Return the public identifier for the current event.NrNrs r getPublicIdzLocator.getPublicIdrcy)z3Return the system identifier for the current event.NrNrs r getSystemIdzLocator.getSystemIdrprN)rJrKrLrMrjrmrorrrNrrrgrgs" rrgcTeZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d Zy) InputSourceanEncapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will create objects of this class for use in the XMLReader.parse method and for returning from EntityResolver.resolveEntity. An InputSource belongs to the application, the XMLReader is not allowed to modify InputSource objects passed to it from the application, although it may make copies and modify those.NcJ||_d|_d|_d|_d|_yr )_InputSource__system_id_InputSource__public_id_InputSource__encoding_InputSource__bytefile_InputSource__charfiler system_ids rrzInputSource.__init__s'$rc||_y)z/Sets the public identifier of this InputSource.Nrw)r public_ids r setPublicIdzInputSource.setPublicId $rc|jS)z2Returns the public identifier of this InputSource.r~rs rrozInputSource.getPublicIdrc||_y)z/Sets the system identifier of this InputSource.Nrvr{s r setSystemIdzInputSource.setSystemIdrrc|jS)z2Returns the system identifier of this InputSource.rrs rrrzInputSource.getSystemIdrrc||_y)a4Sets the character encoding of this InputSource. The encoding must be a string acceptable for an XML encoding declaration (see section 4.3.3 of the XML recommendation). The encoding attribute of the InputSource is ignored if the InputSource also contains a character stream.Nrx)rencodings r setEncodingzInputSource.setEncoding #rc|jS)z/Get the character encoding of this InputSource.rrs r getEncodingzInputSource.getEncoding rc||_y)aSet the byte stream (a Python file-like object which does not perform byte-to-character conversion) for this input source. The SAX parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself. If the application knows the character encoding of the byte stream, it should set it with the setEncoding method.Nry)rbytefiles r setByteStreamzInputSource.setByteStreams #rc|jS)zGet the byte stream for this input source. The getEncoding method will return the character encoding for this byte stream, or None if unknown.rrs rrZzInputSource.getByteStreams rc||_y)a^Set the character stream for this input source. (The stream must be a Python 2.0 Unicode-wrapped file-like that performs conversion to Unicode strings.) If there is a character stream specified, the SAX parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.Nrz)rcharfiles rsetCharacterStreamzInputSource.setCharacterStreamrrc|jS)z/Get the character stream for this input source.rrs rrYzInputSource.getCharacterStreamrrr )rJrKrLrMrrrorrrrrrrZrrYrNrrrtrts? B % % # ##rrtcteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZddZdZdZdZy)AttributesImplc||_y)zQNon-NS-aware implementation. attrs should be of the form {name : value}.N_attrs)rattrss rrzAttributesImpl.__init__s  rc,t|jSr lenrrs r getLengthzAttributesImpl.getLength4;;rcy)NCDATArNr<s rgetTypezAttributesImpl.getTypesrc |j|Sr rr<s rgetValuezAttributesImpl.getValue"{{4  rc |j|Sr rr<s rgetValueByQNamezAttributesImpl.getValueByQName%rrc8||jvr t||Sr rKeyErrorr<s rgetNameByQNamezAttributesImpl.getNameByQName( t{{ "4.  rc8||jvr t||Sr rr<s rgetQNameByNamezAttributesImpl.getQNameByName-rrcHt|jjSr listrkeysrs rgetNameszAttributesImpl.getNames2DKK$$&''rcHt|jjSr rrs r getQNameszAttributesImpl.getQNames5rrc,t|jSr rrs r__len__zAttributesImpl.__len__8rrc |j|Sr rr<s r __getitem__zAttributesImpl.__getitem__;rrcHt|jjSr rrs rrzAttributesImpl.keys>rrc||jvSr rr<s r __contains__zAttributesImpl.__contains__Ast{{""rNc:|jj||Sr )rget)rr= alternatives rrzAttributesImpl.getDs{{t[11rc8|j|jSr ) __class__rrs rcopyzAttributesImpl.copyGs~~dkk**rcHt|jjSr )rritemsrs rrzAttributesImpl.itemsJsDKK%%'((rcHt|jjSr )rrvaluesrs rrzAttributesImpl.valuesMsDKK&&())rr )rJrKrLrrrrrrrrrrrrrrrrrrNrrrrsW  !!  (( !(#2+)*rrc0eZdZdZdZdZdZdZdZy)AttributesNSImplc ||_||_y)zNS-aware implementation. attrs should be of the form {(ns_uri, lname): value, ...}. qnames of the form {(ns_uri, lname): qname, ...}.N)r_qnames)rrqnamess rrzAttributesNSImpl.__init__Ts   rc|jjD]\}}||k(s |j|cSt|r )rrrrrr=nsnameqnames rrz AttributesNSImpl.getValueByQName\s?#||113OVU}{{6** 4tnrcn|jjD]\}}||k(s |cSt|r )rrrrs rrzAttributesNSImpl.getNameByQNamecs5#||113OVU}  4tnrc |j|Sr )rr<s rrzAttributesNSImpl.getQNameByNamejs||D!!rcHt|jjSr )rrrrs rrzAttributesNSImpl.getQNamesmsDLL'')**rcN|j|j|jSr )rrrrs rrzAttributesNSImpl.copyps~~dkk4<<88rN) rJrKrLrrrrrrrNrrrrRs "+9rrc@tttyr )rrPrgrNrr_testrts K Ir__main__N)rMrVr _exceptionsrrrrPrgrtrrrrJrNrrrsz"L NONO`DF DFP0UUr:*:*|9~9D  z GrPKm#]@+:+:-sax/__pycache__/handler.cpython-312.opt-1.pycnu[ Th=dZdZGddZGddZGddZGdd Zd Zd Zd Zd Z dZ dZ eeee e e gZ dZ dZdZdZdZdZe eeeeegZGddZy)a0 This module contains the core classes of version 2.0 of SAX for Python. This file provides only default classes with absolutely minimum functionality, from which drivers and applications can be subclassed. Many of these classes are empty and are included only as documentation of the interfaces. $Id$ z2.0betac"eZdZdZdZdZdZy) ErrorHandleraBasic interface for SAX error handlers. If you create an object that implements this interface, then register the object with your XMLReader, the parser will call the methods in your object to report all warnings and errors. There are three levels of errors available: warnings, (possibly) recoverable errors, and unrecoverable errors. All methods take a SAXParseException as the only parameter.c|)zHandle a recoverable error.self exceptions (/usr/lib64/python3.12/xml/sax/handler.pyerrorzErrorHandler.error c|)zHandle a non-recoverable error.rrs r fatalErrorzErrorHandler.fatalError$r r ct|y)zHandle a warning.N)printrs r warningzErrorHandler.warning(s  ir N)__name__ __module__ __qualname____doc__r rrrr r rrs0r rcdeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZy)ContentHandlerzInterface for receiving logical document content events. This is the main callback interface in SAX, and the one most important to applications. The order of events in this interface mirrors the order of the information in the document.cd|_y)N_locatorrs r __init__zContentHandler.__init__6s  r c||_y)a#Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface. The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine. Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.Nr)rlocators r setDocumentLocatorz!ContentHandler.setDocumentLocator9s *  r cy)zReceive notification of the beginning of a document. The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).Nrrs r startDocumentzContentHandler.startDocumentPr cy)aQReceive notification of the end of a document. The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.Nrrs r endDocumentzContentHandler.endDocumentWr"r cy)aBegin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default). There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each-other: all startPrefixMapping events will occur before the corresponding startElement event, and all endPrefixMapping events will occur after the corresponding endElement event, but their order is not guaranteed.Nr)rprefixuris r startPrefixMappingz!ContentHandler.startPrefixMapping`r"r cy)zEnd the scope of a prefix-URI mapping. See startPrefixMapping for details. This event will always occur after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.Nr)rr&s r endPrefixMappingzContentHandler.endPrefixMappingwr"r cy)aSignals the start of an element in non-namespace mode. The name parameter contains the raw XML 1.0 name of the element type as a string and the attrs parameter holds an instance of the Attributes class containing the attributes of the element.Nr)rnameattrss r startElementzContentHandler.startElement~r"r cy)zSignals the end of an element in non-namespace mode. The name parameter contains the name of the element type, just as with the startElement event.Nrrr,s r endElementzContentHandler.endElementr"r cy)aSignals the start of an element in namespace mode. The name parameter contains the name of the element type as a (uri, localname) tuple, the qname parameter the raw XML 1.0 name used in the source document, and the attrs parameter holds an instance of the Attributes class containing the attributes of the element. The uri part of the name tuple is None for elements which have no namespace.Nr)rr,qnamer-s r startElementNSzContentHandler.startElementNSr"r cy)zSignals the end of an element in namespace mode. The name parameter contains the name of the element type, just as with the startElementNS event.Nr)rr,r3s r endElementNSzContentHandler.endElementNSr"r cy)aReceive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.Nrrcontents r characterszContentHandler.charactersr"r cy)awReceive notification of ignorable whitespace in element content. Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.Nr)r whitespaces r ignorableWhitespacez"ContentHandler.ignorableWhitespacer"r cy)aReceive notification of a processing instruction. The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element. A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.Nr)rtargetdatas r processingInstructionz$ContentHandler.processingInstructionr"r cy)aReceive notification of a skipped entity. The Parser will invoke this method once for each entity skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.Nrr0s r skippedEntityzContentHandler.skippedEntityr"r N)rrrrrrr!r$r(r*r.r1r4r6r:r=rArCrr r rr/sN=  . .C+ - 0   r rceZdZdZdZdZy) DTDHandlerzHandle DTD events. This interface specifies only those DTD events required for basic parsing (unparsed entities and attributes).cy)z$Handle a notation declaration event.Nr)rr,publicIdsystemIds r notationDeclzDTDHandler.notationDeclr"r cy)z,Handle an unparsed entity declaration event.Nr)rr,rGrHndatas r unparsedEntityDeclzDTDHandler.unparsedEntityDeclr"r N)rrrrrIrLrr r rErEs3 /7r rEceZdZdZdZy)EntityResolvera7Basic interface for resolving entities. If you create an object implementing this interface, then register the object with your Parser, the parser will call the method in your object to resolve all external entities. Note that DefaultHandler implements this interface with the default behaviour.c|S)zResolve the system identifier of an entity and return either the system identifier to read from as a string, or an InputSource to read from.r)rrGrHs r resolveEntityzEntityResolver.resolveEntitys r N)rrrrrPrr r rNrNs 2 r rNz&http://xml.org/sax/features/namespacesz.http://xml.org/sax/features/namespace-prefixesz,http://xml.org/sax/features/string-interningz&http://xml.org/sax/features/validationz5http://xml.org/sax/features/external-general-entitiesz7http://xml.org/sax/features/external-parameter-entitiesz-http://xml.org/sax/properties/lexical-handlerz1http://xml.org/sax/properties/declaration-handlerz&http://xml.org/sax/properties/dom-nodez(http://xml.org/sax/properties/xml-stringz-http://www.python.org/sax/properties/encodingz3http://www.python.org/sax/properties/interning-dictc.eZdZdZdZdZdZdZdZy)LexicalHandleraOptional SAX2 handler for lexical events. This handler is used to obtain lexical information about an XML document, that is, information about how the document was encoded (as opposed to what it contains, which is reported to the ContentHandler), such as comments and CDATA marked section boundaries. To set the LexicalHandler of an XMLReader, use the setProperty method with the property identifier 'http://xml.org/sax/properties/lexical-handler'.cy)zReports a comment anywhere in the document (including the DTD and outside the document element). content is a string that holds the contents of the comment.Nrr8s r commentzLexicalHandler.commentfr"r cy)aReport the start of the DTD declarations, if the document has an associated DTD. A startEntity event will be reported before declaration events from the external DTD subset are reported, and this can be used to infer from which subset DTD declarations derive. name is the name of the document element type, public_id the public identifier of the DTD (or None if none were supplied) and system_id the system identfier of the external subset (or None if none were supplied).Nr)rr, public_id system_ids r startDTDzLexicalHandler.startDTDlr"r cy)z$Signals the end of DTD declarations.Nrrs r endDTDzLexicalHandler.endDTDyr"r cy)zReports the beginning of a CDATA marked section. The contents of the CDATA marked section will be reported through the characters event.Nrrs r startCDATAzLexicalHandler.startCDATA|r"r cy)z*Reports the end of a CDATA marked section.Nrrs r endCDATAzLexicalHandler.endCDATAr"r N) rrrrrTrXrZr\r^rr r rRrRYs! 8G (3) 9r rRN)rversionrrrErNfeature_namespacesfeature_namespace_prefixesfeature_string_interningfeature_validationfeature_external_gesfeature_external_pes all_featuresproperty_lexical_handlerproperty_declaration_handlerproperty_dom_nodeproperty_xml_stringproperty_encodingproperty_interning_dictall_propertiesrRrr r rns  2\\B 7 7  (> NJ > O Q#*("$$ & K S =A DP+#.%#) +*9*9r PKm#]EOTOT+sax/__pycache__/expatreader.cpython-312.pycnu[ Th>dZdZddlddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z  dd l m Z ee d s ed d dd lmZmZmZej*Zej,Z dd lZdd lZej2Z[[GddZGddej8ZGddej<ej8ZdZ e!dk(rydd l"Z#e Z$e$jKe#jLj&jOe$jQe#jLjSe$jUdy y #e$r ed d wxYw#e$rdZYwxYw)z] SAX driver for the pyexpat C module. This driver works with pyexpat.__version__ == '2.22'. z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc.eZdZdZdZdZdZdZdZy) ExpatLocatorzLocator for use with the ExpatParser class. This uses a weak reference to the parser object to avoid creating a circular reference between the parser and the content handler. c$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN) rrr__doc__r$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZdZd#dZdZdZdZdZdZ dZ d Z d$d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#y")% ExpatParserz$SAX driver for the pyexpat C module.ctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rctj|}||_ |j|jj t |tjj||y#|jxYw)z3Parse an XML document from a URL or an InputSource.N) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr8parse _close_sourcer"sources rrGzExpatParser.parseasn..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA33Bcx|j*|jj|jyyr)r3r&SetBaserIs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr8setContentHandlerr<_reset_cont_handler)r"rs rrOzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr:r r?rrrrr>SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrR) r<SAXNotSupportedExceptionrr:rr>r r?rrrrS)r"rUstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr;r r?r r&hasattrr\rSrXrTs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr]) rr^r;r<_reset_lex_handler_propr r?r rXrS)r"rUvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r<rDrE startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrgr rhrirjrkrlrm)r" was_enabledrprqs rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rJfiles rrHzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)roF) r=r& isinstancerrrrE endDocumentr<r'r,rHr!s rrzzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rEprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrPzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r;r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rrbz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r:r r r/ getEncodingr?r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrPunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr;rbexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr<r=rs rrDzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rE startElementAttributesImpl)r"rUattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rE endElementrTs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrEstartElementNSAttributesNSImpl) r"rUrpairnewattrsqnamesanamercpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rEr)r"rns rcharacter_datazExpatParser.character_datarrc<|jj||yr)rEstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rEendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r;startDTD)r"rUsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rUbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rUrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r> _ent_handler resolveEntityrrCr/r3r=appendr&ExternalEntityParserCreaterr8rG)r"contextrrrrJs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rE skippedEntity)r"rUis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)$rrrr4r$rGrMrOrVrZr`rdrrrwrHrzrPrbrDr(r-r0r3rrrrrrrrrrrrrrrrr6r6Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr6ct|i|Sr)r6)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)+r4versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r_SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr8r6rrxml.sax.saxutilsxmlprOsax XMLGeneratorsetErrorHandler ErrorHandlerrGrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE*EEEEPKm#]' [RR1sax/__pycache__/expatreader.cpython-312.opt-2.pycnu[ Th> dZddlddlmZmZddlmZddlmZmZddlmZddlm Z m Z  ddl m Z e e d s ed d dd lmZmZmZej(Zej*Z dd lZdd lZej0Z[[GddZGddej6ZGddej:ej6ZdZe dk(rydd l!Z"eZ#e#jIe"jJj$jMe#jOe"jJjQe#jSdy y #e$r ed d wxYw#e$rd ZYwxYw)z0.20)*)feature_validationfeature_namespaces)feature_namespace_prefixes)feature_external_gesfeature_external_pes)feature_string_interning)property_xml_stringproperty_interning_dict)expat ParserCreatezexpat not supportedN) xmlreadersaxutilshandlerc|SN)os ,/usr/lib64/python3.12/xml/sax/expatreader.py_mkproxyr!sc eZdZy) _ClosedParserN)__name__ __module__ __qualname__rrrrr(srrc,eZdZ dZdZdZdZdZy) ExpatLocatorc$t||_yr)r_refselfparsers r__init__zExpatLocator.__init__3sV$ rc`|j}|jy|jjSr)r _parserErrorColumnNumberr!s rgetColumnNumberzExpatLocator.getColumnNumber6s( >> !~~///rc`|j}|jy|jjSN)r r&ErrorLineNumberr!s r getLineNumberzExpatLocator.getLineNumber<s( >> !~~---rcT|j}|y|jjSr)r _source getPublicIdr!s rr0zExpatLocator.getPublicIdB& >~~))++rcT|j}|y|jjSr)r r/ getSystemIdr!s rr3zExpatLocator.getSystemIdHr1rN)rrrr$r(r-r0r3rrrrr-s  %0 . , ,rrceZdZ d"dZdZdZdZdZdZdZ dZ d#d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"y!)$ ExpatParserctjj||tj|_d|_||_d|_d|_g|_ d|_ d|_ y)NFr) rIncrementalParserr$ InputSourcer/r& _namespaces_lex_handler_prop_parsing _entity_stack _external_ges _interning)r"namespaceHandlingbufsizes rr$zExpatParser.__init__Ts]##,,T7; ,,.  ,!% rc tj|}||_ |j|jj t |tjj||y#|jxYwr) rprepare_input_sourcer/reset _cont_handlersetDocumentLocatorrrr7parse _close_sourcer"sources rrFzExpatParser.parseasq=..v6   JJL    1 1,t2D E  ' ' - -dF ;     s AA44Bcx|j*|jj|jyyr)r3r&SetBaserHs r prepareParserzExpatParser.prepareParserqs1     + LL !3!3!5 6 ,rc~tjj|||jr|j yyr)rr7setContentHandlerr;_reset_cont_handler)r"rs rrNzExpatParser.setContentHandlerws0##55dGD ==  $ $ & rc|tk(r |jS|tk(r|jduS|tt t fvry|tk(r |jStd|z)NrFeature '%s' not recognized) rr9r r>rrrrr=SAXNotRecognizedExceptionr"names r getFeaturezExpatParser.getFeature|sn % %## # - -??$. . (*>022 ) )%% %'(E(LMMrcj|jr td|tk(r||_y|tk(r||_y|t k(r|r|ji|_yd|_yy|tk(r|r tdy|tk(r|r tdy|tk(r|r tdytd|z)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrQ) r;SAXNotSupportedExceptionrr9rr=r r>rrrrR)r"rTstates r setFeaturezExpatParser.setFeatures ==*+NO O % %$D  ) )!&D  - -??*&(DO"&+' '.799) ).EGG/ /.>@@,-46 6rc<|tjk(r |jS|tk(r |jS|t k(rR|j r;t|j dr|j jStdtdtd|z)NGetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsingProperty '%s' not recognized) rproperty_lexical_handlerr:r r>r r&hasattrr[rRrWrSs r getPropertyzExpatParser.getPropertys 733 3)) ) , ,?? " ( (||4<<):;<<77993*++/DFF'(F(MNNrc|tjk(r%||_|jr|j yy|t k(r||_y|tk(rtd|ztd|z)NzProperty '%s' cannot be setr\) rr]r:r;_reset_lex_handler_propr r>r rWrR)r"rTvalues r setPropertyzExpatParser.setPropertys{ 733 3%*D "}},,. , ,#DO ( (*+H+/,01 1,,J,0-12 2rc|js1|jd|_|jj |jj ||y#t j$rO}tt j|j||}|jj|Yd}~yd}~wwxYw)NT) r;rCrD startDocumentr&Parser errorSAXParseException ErrorStringcode _err_handler fatalError)r"dataisFinaleexcs rfeedzExpatParser.feeds}} JJL DM    , , . . LL  tW -{{ .#E$5$5aff$=q$GC    ( ( - - .sAB>/AB99B>c|jy|jj} |jjd|jjdd|jj|y#tj $rO}t t j|j||}|jj|Yd}~yd}~wwxYw#|jj|wxYw)NFr) r&GetReparseDeferralEnabledSetReparseDeferralEnabledrfr rgrhrirjrkrl)r" was_enabledrorps rflushzExpatParser.flushs <<  ll<<>  @ LL 2 25 9 LL  sE * LL 2 2; ? {{ .#E$5$5aff$=q$GC    ( ( - - . LL 2 2; ?s*7A<<CACC!CC!!C>c|j} |j}||j|j}||jyy#|j}||jwwxYwr)r/getCharacterStreamclose getByteStream)r"rIfiles rrGzExpatParser._close_sourcesu ,,.D '')D  '')D  s "A%A9c|js&|jt|jtry |j dd|j j d|_d|_d|_|jGt}|jj|_|jj|_ ||_|jy#d|_|jGt}|jj|_|jj|_ ||_|jwxYw)NrT)rnF) r<r& isinstancerrqrD endDocumentr;r'r,rGr!s rryzExpatParser.closes   $,,"6 t||] 3  ! IIc4I (    * * ,!DMDL!DM||'&+/<<+I+I()-)E)E&%    "DM||'&+/<<+I+I()-)E)E&%    s ;CA,Ec|jj|j_|jj|j_yr)rDprocessingInstructionr&ProcessingInstructionHandler charactersCharacterDataHandlerr"s rrOzExpatParser._reset_cont_handlers5$($6$6$L$L 1,0,>,>,I,I )rc*|j}|j}|$d|_d|_d|_d|_d|_y|j|_|j|_|j|_|j|_|j|_yr) r:r&CommentHandlerStartCdataSectionHandlerEndCdataSectionHandlerStartDoctypeDeclHandlerEndDoctypeDeclHandlercomment startCDATAendCDATAstart_doctype_declendDTD)r"lexr#s rraz#ExpatParser._reset_lex_handler_prop s$$ ;$(F !.2F +,0F )-1F *+/F ($'KKF !.1nnF +,/LLF )-1-D-DF *+.::F (rcJ|jrtj|jj d|j |_d|j _|j|j _ |j|j _ nttj|jj |j |_|j|j _ |j|j _ |j|j|j _|j"|j _|j&|j _|j*|j _d|_|j0r|j3|j4|j _ |j8|j _|j j?tj@d|_!g|_"y#t<$rYCwxYw)N )internr+F)#r9r r r/ getEncodingr>r&namespace_prefixesstart_element_nsStartElementHandlerend_element_nsEndElementHandler start_element end_elementrOunparsed_entity_declUnparsedEntityDeclHandler notation_declNotationDeclHandlerstart_namespace_declStartNamespaceDeclHandlerend_namespace_declEndNamespaceDeclHandler_decl_handler_propr:raexternal_entity_refExternalEntityRefHandlerskipped_entity_handlerSkippedEntityHandlerAttributeErrorSetParamEntityParsing*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr;r<rs rrCzExpatParser.resets    --dll.F.F.H#59__FDL./DLL +/3/D/DDLL ,-1-@-@DLL * --dll.F.F.H7;HDL/3/A/ADLL ,-1-=-=DLL *   "151J1J .+/+=+= (151J1J ./3/F/F ,"&  ! !  ( ( *150H0H - 040K0KDLL - **  < < >    sH H"!H"cH|jy|jjSr)r&r'rs rr(zExpatParser.getColumnNumberCs << ||---rcH|jy|jjSr*)r&r,rs rr-zExpatParser.getLineNumberHs << ||+++rc6|jjSr)r/r0rs rr0zExpatParser.getPublicIdM||''))rc6|jjSr)r/r3rs rr3zExpatParser.getSystemIdPrrcN|jj|t|yr)rD startElementAttributesImpl)r"rTattrss rrzExpatParser.start_elementTs ''nU.CDrc:|jj|yr)rD endElementrSs rrzExpatParser.end_elementW %%d+rc|j}t|dk(rd|f}n$t|dk(r |d|df}n t|}i}i}|jD]c\}}|j}t|} | dk(r|} d|f} n-| dk(r|dd|d} |d|df} n|d} t|} ||| <| || <e|jj |dt ||y)Nr+r:)splitlentupleitemsrDstartElementNSAttributesNSImpl) r"rTrpairnewattrsqnamesanamerbpartslengthqnameapairs rrzExpatParser.start_element_nsZszz| t9>$$rc:|jj|yr)rDr)r"rms rcharacter_datazExpatParser.character_datarrc<|jj||yr)rDstartPrefixMapping)r"prefixuris rrz ExpatParser.start_namespace_decls --fc:rc:|jj|yr)rDendPrefixMapping)r"rs rrzExpatParser.end_namespace_decls ++F3rc>|jj|||yr)r:startDTD)r"rTsysidpubidhas_internal_subsets rrzExpatParser.start_doctype_decls ''eU;rc@|jj||||yr) _dtd_handlerunparsedEntityDecl)r"rTbaserr notation_names rrz ExpatParser.unparsed_entity_decls ,,T5%Orc>|jj|||yr)r notationDecl)r"rTrrrs rrzExpatParser.notation_decls &&tUE:rc |jsy|jj||}tj||j j xsd}|jj|j|j f|jj||_ ||_ tjj|||jd\|_ |_|jd=y#YyxYw)Nr+r)r= _ent_handler resolveEntityrrBr/r3r<appendr&ExternalEntityParserCreaterr7rF)r"contextrrrrIs rrzExpatParser.external_entity_refs!!""00>..v/3||/G/G/I02/13 !!4<<">?||>>wG     ' ' - -dF ;(,'9'9"'=$t|   r "  s 5 C??DcH|rd|z}|jj|y)N%)rD skippedEntity)r"rTis_pes rrz"ExpatParser.skipped_entity_handlers" t8D ((.rN)ri)F)#rrrr$rFrLrNrUrYr_rcrqrvrGryrOrarCr(r-r0r3rrrrrrrrrrrrrrrrr5r5Qs.  7 ' N6<O$ 2 ." @ !*J 6 # N. , **E, ND 4?,;4<P;,/rr5ct|i|Sr)r5)argskwargss r create_parserrs  ' ''r__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)*versionxml.sax._exceptionsxml.sax.handlerrrrrrr r r xml.parsersr r^SAXReaderNotAvailable ImportErrorxml.saxrrrrr_weakrefweakrefproxyrrLocatorrr7r5rrxml.sax.saxutilsxmlprNsax XMLGeneratorsetErrorHandler ErrorHandlerrFrrrrsT !B6F4HA! 5. )#$94@@00))--  }}H  ,9$$,Hg/)--y/@/@g/V (  zA((5578cgg**,-GG HI a =  5t <<=sE)EEEEPKm#]LL(sax/__pycache__/saxutils.cpython-312.pycnu[ Th/dZddlZddlZddlZddlZddlZddlmZddlm Z dZ ifdZ ifdZ ifd Z d ZGd d ejZGd de j"ZddZy)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercZ|jD]\}}|j||}|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvalues )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s+ggi U IIc5 ! Hc|jdd}|jdd}|jdd}|r t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rrdataentitiess r escapersH <<W %D <<V $D <<V $DdH- Krc|jdd}|jdd}|r t||}|jddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrs r unescaper"sD << $D << $DdH- << %%rci|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) aEscape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrs r quoteattrr$0spG(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|SN)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr _wrapperr'Xs I *rr3cyr)r5rr z _gettextwriter..]strcy)NTr5r5rr r6z _gettextwriter..bs$rxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r _gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss r rUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rct|dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r _qnamezXMLGenerator._qname~sY 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r _finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr))rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr))rYappendrZcopyr[r+rburis r startPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs r endPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr$r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s r rfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r"z xmlns="%s"rwrxTr)rgrVrcr[rr$r]r^)r+r,qnameryrbrqr s r startElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr))rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr))rgr?rr\rVrs r ignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs r processingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rr rQrQpsH ,"0(7 "($5)!2rrQceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcPtjj|||_yr))r XMLReaderrU_parentr+parents r rUzXMLFilterBase.__init__s$$T* rc:|jj|yr)) _err_handlererrorr+ exceptions r rzXMLFilterBase.errors  *rc:|jj|yr))r fatalErrorrs r rzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr))rwarningrs r rzXMLFilterBase.warnings !!),rc:|jj|yr)) _cont_handlersetDocumentLocator)r+locators r rz XMLFilterBase.setDocumentLocators --g6rc8|jjyr))rrjris r rjzXMLFilterBase.startDocuments ((*rc8|jjyr))rrlris r rlzXMLFilterBase.endDocuments &&(rc<|jj||yr))rrrrps r rrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr))rrurts r ruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr))rrz)r+r,rys r rzzXMLFilterBase.startElement  ''e4rc:|jj|yr))rrfr}s r rfzXMLFilterBase.endElements %%d+rc>|jj|||yr))rr)r+r,rrys r rzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr))rrrs r rzXMLFilterBase.endElementNSrrc:|jj|yr))rrrs r rzXMLFilterBase.characterss %%g.rc:|jj|yr))rr)r+charss r rz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr))rrrs r rz#XMLFilterBase.processingInstructions 00>rc:|jj|yr))r skippedEntityr}s r rzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr)) _dtd_handler notationDecl)r+r,publicIdsystemIds r rzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr))runparsedEntityDecl)r+r,rrndatas r rz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr)) _ent_handler resolveEntity)r+rrs r rzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr))rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources r rzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr))r setLocale)r+locales r rzXMLFilterBase.setLocale9s v&rc8|jj|Sr))r getFeaturer}s r rzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr))r setFeature)r+r,states r rzXMLFilterBase.setFeature?s e,rc8|jj|Sr))r getPropertyr}s r rzXMLFilterBase.getPropertyBs||''--rc<|jj||yr))r setProperty)r+r,r s r rzXMLFilterBase.setPropertyEs   u-rc|jSr)rris r getParentzXMLFilterBase.getParentJs ||rc||_yr)rrs r setParentzXMLFilterBase.setParentMs  rr)) r/r0r1__doc__rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rr rrs +0- 7+);45,>5/6?/ AN C #'--.. rrcjt|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames r prepare_input_sourcerRs&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPKm#]LL.sax/__pycache__/saxutils.cpython-312.opt-1.pycnu[ Th/dZddlZddlZddlZddlZddlZddlmZddlm Z dZ ifdZ ifdZ ifd Z d ZGd d ejZGd de j"ZddZy)znA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N)handler) xmlreadercZ|jD]\}}|j||}|S)z2Replace substrings of a string using a dictionary.)itemsreplace)sdkeyvalues )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s+ggi U IIc5 ! Hc|jdd}|jdd}|jdd}|r t||}|S)zEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. &&>><<rrdataentitiess r escapersH <<W %D <<V $D <<V $DdH- Krc|jdd}|jdd}|r t||}|jddS)a Unescape &, <, and > in a string of data. You can unescape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. rrrrrrrrs r unescaper"sD << $D << $DdH- << %%rci|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) aEscape and quote an attribute value. Escape &, <, and > in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. z z z )   "'z"%s"z"z'%s')rrrs r quoteattrr$0spG(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|SN)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr _wrapperr'Xs I *rr3cyr)r5rr z _gettextwriter..]strcy)NTr5r5rr r6z _gettextwriter..bs$rxmlcharrefreplacerT)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r _gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss r rUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rct|dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)z7Builds a qualified name from a (ns_url, localname) pairrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r _qnamezXMLGenerator._qname~sY 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r _finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr))rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr))rYappendrZcopyr[r+rburis r startPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs r endPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr$r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s r rfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r"z xmlns="%s"rwrxTr)rgrVrcr[rr$r]r^)r+r,qnameryrbrqr s r startElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr))rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr))rgr?rr\rVrs r ignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs r processingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rr rQrQpsH ,"0(7 "($5)!2rrQceZdZdZddZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseaYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.NcPtjj|||_yr))r XMLReaderrU_parentr+parents r rUzXMLFilterBase.__init__s$$T* rc:|jj|yr)) _err_handlererrorr+ exceptions r rzXMLFilterBase.errors  *rc:|jj|yr))r fatalErrorrs r rzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr))rwarningrs r rzXMLFilterBase.warnings !!),rc:|jj|yr)) _cont_handlersetDocumentLocator)r+locators r rz XMLFilterBase.setDocumentLocators --g6rc8|jjyr))rrjris r rjzXMLFilterBase.startDocuments ((*rc8|jjyr))rrlris r rlzXMLFilterBase.endDocuments &&(rc<|jj||yr))rrrrps r rrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr))rrurts r ruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr))rrz)r+r,rys r rzzXMLFilterBase.startElement  ''e4rc:|jj|yr))rrfr}s r rfzXMLFilterBase.endElements %%d+rc>|jj|||yr))rr)r+r,rrys r rzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr))rrrs r rzXMLFilterBase.endElementNSrrc:|jj|yr))rrrs r rzXMLFilterBase.characterss %%g.rc:|jj|yr))rr)r+charss r rz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr))rrrs r rz#XMLFilterBase.processingInstructions 00>rc:|jj|yr))r skippedEntityr}s r rzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr)) _dtd_handler notationDecl)r+r,publicIdsystemIds r rzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr))runparsedEntityDecl)r+r,rrndatas r rz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr)) _ent_handler resolveEntity)r+rrs r rzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr))rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources r rzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr))r setLocale)r+locales r rzXMLFilterBase.setLocale9s v&rc8|jj|Sr))r getFeaturer}s r rzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr))r setFeature)r+r,states r rzXMLFilterBase.setFeature?s e,rc8|jj|Sr))r getPropertyr}s r rzXMLFilterBase.getPropertyBs||''--rc<|jj||yr))r setProperty)r+r,r s r rzXMLFilterBase.setPropertyEs   u-rc|jSr)rris r getParentzXMLFilterBase.getParentJs ||rc||_yr)rrs r setParentzXMLFilterBase.setParentMs  rr)) r/r0r1__doc__rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rr rrs +0- 7+);45,>5/6?/ AN C #'--.. rrcjt|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)zThis function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.readrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames r prepare_input_sourcerRs&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPKm#]0i.sax/__pycache__/__init__.cpython-312.opt-1.pycnu[ Th $dZddlmZddlmZmZddlmZmZm Z m Z m Z efdZ efdZ dgZdZerdd lZdd lZdd lZej(j*s,d ej,vrej,d j/d Z[[dd Zd Zy )aSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. ) InputSource)ContentHandler ErrorHandler) SAXExceptionSAXNotRecognizedExceptionSAXParseExceptionSAXNotSupportedExceptionSAXReaderNotAvailablec~t}|j||j||j|y)N) make_parsersetContentHandlersetErrorHandlerparse)sourcehandler errorHandlerparsers )/usr/lib64/python3.12/xml/sax/__init__.pyrrs1 ]F W% <( LLcTddl}| t}t}|j||j |t }t |tr!|j|j|n |j|j||j|y)N) iorr r rr isinstancestrsetCharacterStreamStringIO setByteStreamBytesIOr)stringrrrrinpsrcs r parseStringr!#s #~ ]F W% <( ]F&#!!"++f"56RZZ/0 LLrzxml.sax.expatreaderrN PY_SAX_PARSER,ct|tzD]} t|cSt dd#t$rddl}||j vrY>  !+. .? 2D 99  ckk)*%   s 1AAAc@t|iidg}|jS)N create_parser) __import__r.)r, drv_modules rr'r'\s$K2.?@J  # # %%r))__doc__ xmlreaderrrrr _exceptionsrrrr r rr!r&_falsexml.sax.expatreaderxmlosr)flagsignore_environmentenvironsplitr r'r1rrr=s*#1.. )5 /;n $--   yy##2::(E**_5;;C@:4&rPKm#]H><<r rdataentitiess rescapersM <<W %D <<V $D <<V $DdH- Krc |jdd}|jdd}|r t||}|jddS)Nrrrrrrrrs runescaper"sI << $D << $DdH- << %%rc i|dddd}t||}d|vr"d|vrd|jddz}|Sd |z}|Sd|z}|S) Nz z z )   "'z"%s"z"z'%s')rr rs r quoteattrr%0su G(F'vFH $ !D d{ $;DLLh77D KD=D K} Krcddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nPtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY%wxYw) Nrc2eZdZWjZfdZy) _gettextwriter.._wrapperct|Sr)getattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))rN)__name__ __module__ __qualname__ __class__r.)r-sr_wrapperr(Xs I *rr3cyrr5rrz _gettextwriter..]strcy)NTr5r5rrr6z _gettextwriter..bs$rxmlcharrefreplacer T)encodingerrorsnewline write_through)sysstdout isinstanceio TextIOBasecodecs StreamWriterStreamReaderWriter RawIOBasecloseBufferedIOBasewritablewriteseekabletellAttributeError TextIOWrapper)r-r9r=r3buffers` r_gettextwriterrOGs {zz#r}}% #++V-F-FGH #r||$ * *# ""$&yy  "llFO((FK   FX#6$(*. 00   s"C<< DDcdeZdZddZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZdZy) XMLGeneratorNctjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ y)NF)rContentHandler__init__rOrI_writeflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)r+r-r9short_empty_elementss rrUzXMLGenerator.__init__rst''-S(+ii ii D $ 1 1" 5#% !%9"&+#rcv |dr/d|dk(rd|dzS|j|d}|r |dz|dzS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:r:)rZ)r+r,prefixs r_qnamezXMLGenerator._qname~s\E 7 6a@Q''**473F|d1g--AwrcN|jr|jdd|_yy)NrFr^rV)r+ endElements r_finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements$  & & KK */D ' 'rc@|jd|jzy)Nz$ )rVr\r+s r startDocumentzXMLGenerator.startDocuments ;' (rc$|jyr)rXris r endDocumentzXMLGenerator.endDocuments  rc|jj|jj||j|<|jj||fyr)rYappendrZcopyr[r+rburis rstartPrefixMappingzXMLGenerator.startPrefixMappingsM   !6!6!;!;!=>%+c"   '' 6rcF|jd|_|jd=y)NrS)rYrZr+rbs rendPrefixMappingzXMLGenerator.endPrefixMappings# $ 1 1" 5   b !rc |j|jd|z|jD]%\}}|jd|dt|'|jrd|_y|jdy)Nr =Tr)rgrVrr%r]r^)r+r,attrsr s r startElementzXMLGenerator.startElementse **, C$J"[[]MT5 KKD)E*:; <+  % %*.D ' KK rcv|jr|jdd|_y|jd|zyNz/>Fzrer+r,s rrfzXMLGenerator.endElements/  & & KK */D ' KK$ 'rc |j|jd|j|z|jD]4\}}|r|jd|d|d!|jd|z6g|_|j D]4\}}|jd|j|dt |6|j rd|_y|jd y) Nrz xmlns:z="r#z xmlns="%s"rwrxTr)rgrVrcr[rr%r]r^)r+r,qnameryrbrqr s rstartElementNSzXMLGenerator.startElementNSs **, C$++d++,33KFC <= MC/0 4 $& "[[]MT5 KKDKK$5y7GH I+  % %*.D ' KK rc|jr|jdd|_y|jd|j|zyr|)r^rVrcr+r,rs r endElementNSzXMLGenerator.endElementNSs9  & & KK */D ' KK$++d"33 4rc|rQ|jt|tst||j}|j t |yyr)rgr?strr\rVrr+contents r characterszXMLGenerator.characterss@   . . 0gs+gt~~6 KKw ( rc|rH|jt|tst||j}|j |yyr)rgr?rr\rVrs rignorableWhitespacez XMLGenerator.ignorableWhitespaces<   . . 0gs+gt~~6 KK rcT|j|jd|d|dy)Nz)rgrVr+targetrs rprocessingInstructionz"XMLGenerator.processingInstructions **, 6401r)Nz iso-8859-1F)F)r/r0r1rUrcrgrjrlrrrurzrfrrrrrr5rrrQrQpsH ,"0(7 "($5)!2rrQceZdZ ddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) XMLFilterBaseNcPtjj|||_yr)r XMLReaderrU_parentr+parents rrUzXMLFilterBase.__init__s$$T* rc:|jj|yr) _err_handlererrorr+ exceptions rrzXMLFilterBase.errors  *rc:|jj|yr)r fatalErrorrs rrzXMLFilterBase.fatalErrors $$Y/rc:|jj|yr)rwarningrs rrzXMLFilterBase.warnings !!),rc:|jj|yr) _cont_handlersetDocumentLocator)r+locators rrz XMLFilterBase.setDocumentLocators --g6rc8|jjyr)rrjris rrjzXMLFilterBase.startDocuments ((*rc8|jjyr)rrlris rrlzXMLFilterBase.endDocuments &&(rc<|jj||yr)rrrrps rrrz XMLFilterBase.startPrefixMappings --fc:rc:|jj|yr)rrurts rruzXMLFilterBase.endPrefixMappings ++F3rc<|jj||yr)rrz)r+r,rys rrzzXMLFilterBase.startElement  ''e4rc:|jj|yr)rrfr}s rrfzXMLFilterBase.endElements %%d+rc>|jj|||yr)rr)r+r,rrys rrzXMLFilterBase.startElementNSs ))$u=rc<|jj||yr)rrrs rrzXMLFilterBase.endElementNSrrc:|jj|yr)rrrs rrzXMLFilterBase.characterss %%g.rc:|jj|yr)rr)r+charss rrz!XMLFilterBase.ignorableWhitespaces ..u5rc<|jj||yr)rrrs rrz#XMLFilterBase.processingInstructions 00>rc:|jj|yr)r skippedEntityr}s rrzXMLFilterBase.skippedEntity s ((.rc>|jj|||yr) _dtd_handler notationDecl)r+r,publicIdsystemIds rrzXMLFilterBase.notationDecl%s &&tXx@rc@|jj||||yr)runparsedEntityDecl)r+r,rrndatas rrz XMLFilterBase.unparsedEntityDecl(s ,,T8XuMrc:|jj||Sr) _ent_handler resolveEntity)r+rrs rrzXMLFilterBase.resolveEntity-s  ..xBBrc|jj||jj||jj||jj ||jj |yr)rsetContentHandlersetErrorHandlersetEntityResolver setDTDHandlerparse)r+sources rrzXMLFilterBase.parse2s\ &&t, $$T* &&t, ""4( 6"rc:|jj|yr)r setLocale)r+locales rrzXMLFilterBase.setLocale9s v&rc8|jj|Sr)r getFeaturer}s rrzXMLFilterBase.getFeature<s||&&t,,rc<|jj||yr)r setFeature)r+r,states rrzXMLFilterBase.setFeature?s e,rc8|jj|Sr)r getPropertyr}s rrzXMLFilterBase.getPropertyBs||''--rc<|jj||yr)r setProperty)r+r,r s rrzXMLFilterBase.setPropertyEs   u-rc|jSrrris r getParentzXMLFilterBase.getParentJs ||rc||_yrrrs r setParentzXMLFilterBase.setParentMs  rr)r/r0r1rUrrrrrjrlrrrurzrfrrrrrrrrrrrrrrrrrr5rrrrs +0- 7+);45,>5/6?/ AN C #'--.. rrcl t|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr5t|jtr|j|j|j'|j|j}tj j#tj j%|}tj j'||}tj j)|r|j|t+|d}n\|jt,j.j1||t,j2j5|j}|j||S)Nreadrr,rb)r?osPathLikefspathrr InputSourcehasattrrsetCharacterStream setByteStreamr, setSystemIdgetCharacterStream getByteStream getSystemIdpathdirnamenormpathjoinisfileopenurllibrurljoinrequesturlopen)rbasefsysidbasehead sysidfilenames rprepare_input_sourcerRsF&"++&6"&#&&v.  &&( affQi %  % %a (   # 1f *QVVS"9   qvv &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- (   } -]D)A   v||33D%@ A&&v'9'9';rsv ('    & .'0Rp27))p2fkI''k^rPKm#] 2??,parsers/__pycache__/__init__.cpython-312.pycnu[ ThdZy)zPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N)__doc__-/usr/lib64/python3.12/xml/parsers/__init__.pyrs rPKm#]:q)parsers/__pycache__/expat.cpython-312.pycnu[ ThVdZddlZddleejd<eejd<y)z1Interface to the Expat non-validating XML parser.N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)__doc__syspyexpatmodelmoduleserrors*/usr/lib64/python3.12/xml/parsers/expat.pyr s.7 */ %&*0 &'r PKm#];&2parsers/__pycache__/__init__.cpython-312.opt-2.pycnu[ Thy)Nr-/usr/lib64/python3.12/xml/parsers/__init__.pyrs rPKm#]tdd/parsers/__pycache__/expat.cpython-312.opt-2.pycnu[ ThT ddlZddleejd<eejd<y)N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)syspyexpatmodelmoduleserrors*/usr/lib64/python3.12/xml/parsers/expat.pyr s.7 */ %&*0 &'r PKm#]:q/parsers/__pycache__/expat.cpython-312.opt-1.pycnu[ ThVdZddlZddleejd<eejd<y)z1Interface to the Expat non-validating XML parser.N)*zxml.parsers.expat.modelzxml.parsers.expat.errors)__doc__syspyexpatmodelmoduleserrors*/usr/lib64/python3.12/xml/parsers/expat.pyr s.7 */ %&*0 &'r PKm#] 2??2parsers/__pycache__/__init__.cpython-312.opt-1.pycnu[ ThdZy)zPython interfaces to XML parsers. This package contains one module: expat -- Python wrapper for James Clark's Expat parser, with namespace support. N)__doc__-/usr/lib64/python3.12/xml/parsers/__init__.pyrs rPKm#]#!$__pycache__/__init__.cpython-312.pycnu[ Th-dZgdZy)aCore XML support for Python. This package contains four sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Megginson and ported to Python by Lars Marius Garshol. This supports the SAX 2 API. etree -- The ElementTree XML library. This is a subset of the full ElementTree XML release. )domparserssaxetreeN)__doc____all__%/usr/lib64/python3.12/xml/__init__.pyr s& -r PKm#]ID*__pycache__/__init__.cpython-312.opt-2.pycnu[ Th- gdZy))domparserssaxetreeN)__all__%/usr/lib64/python3.12/xml/__init__.pyr s& -rPKm#]#!*__pycache__/__init__.cpython-312.opt-1.pycnu[ Th-dZgdZy)aCore XML support for Python. This package contains four sub-packages: dom -- The W3C Document Object Model. This supports DOM Level 1 + Namespaces. parsers -- Python wrappers for XML parsers (currently only supports Expat). sax -- The Simple API for XML, developed by XML-Dev, led by David Megginson and ported to Python by Lars Marius Garshol. This supports the SAX 2 API. etree -- The ElementTree XML library. This is a subset of the full ElementTree XML release. )domparserssaxetreeN)__doc____all__%/usr/lib64/python3.12/xml/__init__.pyr s& -r PKD#]catalognu[PKi#]=p66 __init__.pyonu[PKi#]G||i etree/ElementTree.pycnu[PKi#]hNwW*etree/__init__.pyonu[PKi#][ etree/ElementTree.pyonu[PKi#]:W@!!!!3etree/ElementTree.pynu[PKi#]Bu?etree/ElementPath.pycnu[PKi#]RR]etree/cElementTree.pynu[PKi#]P^6^etree/cElementTree.pycnu[PKi#]Bu,_etree/ElementPath.pyonu[PKi#]dX((3}etree/ElementInclude.pynu[PKi#]Y檯etree/ElementInclude.pyonu[PKi#]P^etree/cElementTree.pyonu[PKi#]2QEEetree/__init__.pynu[PKi#]Y檯etree/ElementInclude.pycnu[PKi#]hNwW etree/__init__.pycnu[PKi#]q66ϰetree/ElementPath.pynu[PKi#]}ffdom/NodeFilter.pyonu[PKi#]]Cn~n~hdom/expatbuilder.pyonu[PKi#]xw{ { kdom/domreg.pynu[PKi#]iOOxdom/__init__.pyonu[PKi#]Iӎ  adom/minidom.pynu[PKi#]HJ8 8 -dom/domreg.pyonu[PKi#][s#33dom/pulldom.pycnu[PKi#]' ' dom/minicompat.pynu[PKi#]skEE`dom/minidom.pycnu[PKi#]Sp ;;dom/xmlbuilder.pycnu[PKi#]"i'dom/minidom.pyonu[PKi#]8n?00'dom/xmlbuilder.pynu[PKi#] .Wdom/expatbuilder.pycnu[PKi#] 5Iu-u-dom/pulldom.pynu[PKi#]}ffdom/NodeFilter.pycnu[PKi#]#@ Z dom/minicompat.pyonu[PKi#]ȳdom/__init__.pynu[PKi#]HJ8 8 (dom/domreg.pycnu[PKi#][s#335dom/pulldom.pyonu[PKi#]o;;Oidom/xmlbuilder.pyonu[PKi#]mmtQdom/NodeFilter.pynu[PKi#]iOO:dom/__init__.pycnu[PKi#]xgmmdom/expatbuilder.pynu[PKi#]VYf f yN dom/minicompat.pycnu[PKi#]hj!\ sax/__init__.pyonu[PKi#]99k sax/saxutils.pyonu[PKi#]99 sax/saxutils.pycnu[PKi#]ȳKK$ sax/xmlreader.pycnu[PKi#]deq22{* sax/handler.pyonu[PKi#]9==] sax/handler.pynu[PKi#]ᶨP1P1ݚ sax/xmlreader.pynu[PKi#]C[[m sax/_exceptions.pynu[PKi#]deq22 sax/handler.pycnu[PKi#]|.x - sax/__init__.pynu[PKi#]R>> sax/expatreader.pynu[PKi#]//] sax/saxutils.pynu[PKi#]/ sax/_exceptions.pyonu[PKi#]'ZE;E;p sax/expatreader.pycnu[PKi#]hj sax/__init__.pycnu[PKi#]'ZE;E; sax/expatreader.pyonu[PKi#]ȳKKa, sax/xmlreader.pyonu[PKi#]/w sax/_exceptions.pycnu[PKi#]@ X--  __init__.pynu[PKi#]=p66 | __init__.pycnu[PKi#]-l:: parsers/__init__.pyonu[PKi#]0l parsers/expat.pyonu[PKi#]0̙ parsers/expat.pycnu[PKi#];c}, parsers/expat.pynu[PKi#];|d parsers/__init__.pynu[PKi#]-l::N parsers/__init__.pycnu[PKi#]#}P3̞ etree/__pycache__/cElementTree.cpython-36.opt-2.pycnu[PKi#]M휺,֟ etree/__pycache__/ElementTree.cpython-36.pycnu[PKi#]A3}})N etree/__pycache__/__init__.cpython-36.pycnu[PKi#]A3}}/O etree/__pycache__/__init__.cpython-36.opt-1.pycnu[PKi#]Ib}2P etree/__pycache__/ElementPath.cpython-36.opt-2.pycnu[PKi#]tH2h etree/__pycache__/ElementTree.cpython-36.opt-1.pycnu[PKi#]#}P-etree/__pycache__/cElementTree.cpython-36.pycnu[PKi#]#}P3etree/__pycache__/cElementTree.cpython-36.opt-1.pycnu[PKi#]A3}}/etree/__pycache__/__init__.cpython-36.opt-2.pycnu[PKi#]1bmm2etree/__pycache__/ElementTree.cpython-36.opt-2.pycnu[PKi#]xr5"etree/__pycache__/ElementInclude.cpython-36.opt-1.pycnu[PKi#]Ib}2etree/__pycache__/ElementPath.cpython-36.opt-1.pycnu[PKi#]xr5etree/__pycache__/ElementInclude.cpython-36.opt-2.pycnu[PKi#]xr/yetree/__pycache__/ElementInclude.cpython-36.pycnu[PKi#]Ib},etree/__pycache__/ElementPath.cpython-36.pycnu[PKi#]ɵ /Fdom/__pycache__/minicompat.cpython-36.opt-1.pycnu[PKi#]$YG j j+0dom/__pycache__/expatbuilder.cpython-36.pycnu[PKi#]H^)Adom/__pycache__/NodeFilter.cpython-36.pycnu[PKi#]99'Edom/__pycache__/__init__.cpython-36.pycnu[PKi#] 944)7[dom/__pycache__/xmlbuilder.cpython-36.pycnu[PKi#]))))&dom/__pycache__/pulldom.cpython-36.pycnu[PKi#]H^/dom/__pycache__/NodeFilter.cpython-36.opt-1.pycnu[PKi#]99-dom/__pycache__/__init__.cpython-36.opt-1.pycnu[PKi#]{ΑUU+dom/__pycache__/domreg.cpython-36.opt-2.pycnu[PKi#]|6 )^dom/__pycache__/minicompat.cpython-36.pycnu[PKi#]Wd!)))),dom/__pycache__/pulldom.cpython-36.opt-1.pycnu[PKi#]>Mpw'w',#dom/__pycache__/pulldom.cpython-36.opt-2.pycnu[PKi#]a44/6dom/__pycache__/xmlbuilder.cpython-36.opt-1.pycnu[PKi#])<*-(ldom/__pycache__/__init__.cpython-36.opt-2.pycnu[PKi#]Jꃺ]]1~dom/__pycache__/expatbuilder.cpython-36.opt-2.pycnu[PKi#]AP /dom/__pycache__/minicompat.cpython-36.opt-2.pycnu[PKi#]  +dom/__pycache__/domreg.cpython-36.opt-1.pycnu[PKi#]=&3&3/Xdom/__pycache__/xmlbuilder.cpython-36.opt-2.pycnu[PKi#]  %%dom/__pycache__/domreg.cpython-36.pycnu[PKi#]t,91dom/__pycache__/minidom.cpython-36.opt-2.pycnu[PKi#].o\\/dom/__pycache__/NodeFilter.cpython-36.opt-2.pycnu[PKi#]㣓&Wdom/__pycache__/minidom.cpython-36.pycnu[PKi#]--,@dom/__pycache__/minidom.cpython-36.opt-1.pycnu[PKi#]M+gg1ɻdom/__pycache__/expatbuilder.cpython-36.opt-1.pycnu[PKi#]Šb..0&$sax/__pycache__/expatreader.cpython-36.opt-2.pycnu[PKi#]oڐ++-TSsax/__pycache__/saxutils.cpython-36.opt-2.pycnu[PKi#]VZ Z 'Asax/__pycache__/__init__.cpython-36.pycnu[PKi#]b=n,sax/__pycache__/handler.cpython-36.opt-2.pycnu[PKi#]VZ Z -sax/__pycache__/__init__.cpython-36.opt-1.pycnu[PKi#]P' 0sax/__pycache__/_exceptions.cpython-36.opt-2.pycnu[PKi#]_&00,sax/__pycache__/handler.cpython-36.opt-1.pycnu[PKi#]leBB(_sax/__pycache__/xmlreader.cpython-36.pycnu[PKi#]+((.(sax/__pycache__/xmlreader.cpython-36.opt-2.pycnu[PKi#])[[0Rsax/__pycache__/_exceptions.cpython-36.opt-1.pycnu[PKi#]}>>-gsax/__pycache__/__init__.cpython-36.opt-2.pycnu[PKi#])[[*dpsax/__pycache__/_exceptions.cpython-36.pycnu[PKi#]k0k00sax/__pycache__/expatreader.cpython-36.opt-1.pycnu[PKi#]&y 2 2-sax/__pycache__/saxutils.cpython-36.opt-1.pycnu[PKi#]&y 2 2'Jsax/__pycache__/saxutils.cpython-36.pycnu[PKi#]_&00&sax/__pycache__/handler.cpython-36.pycnu[PKi#]k0k0*Lsax/__pycache__/expatreader.cpython-36.pycnu[PKi#]leBB.|sax/__pycache__/xmlreader.cpython-36.opt-1.pycnu[PKi#]@s+++Zparsers/__pycache__/__init__.cpython-36.pycnu[PKi#]@s++1parsers/__pycache__/__init__.cpython-36.opt-1.pycnu[PKi#]9:.lparsers/__pycache__/expat.cpython-36.opt-2.pycnu[PKi#]P\}(1parsers/__pycache__/__init__.cpython-36.opt-2.pycnu[PKi#]dGHH(parsers/__pycache__/expat.cpython-36.pycnu[PKi#]dGHH.Rparsers/__pycache__/expat.cpython-36.opt-1.pycnu[PKi#] J#__pycache__/__init__.cpython-36.pycnu[PKi#] J)__pycache__/__init__.cpython-36.opt-1.pycnu[PKi#]!)__pycache__/__init__.cpython-36.opt-2.pycnu[PKm#]N*etree/__pycache__/__init__.cpython-312.pycnu[PKm#]>h993etree/__pycache__/ElementPath.cpython-312.opt-1.pycnu[PKm#]LN0 etree/__pycache__/ElementInclude.cpython-312.pycnu[PKm#]N0etree/__pycache__/__init__.cpython-312.opt-2.pycnu[PKm#]؅4etree/__pycache__/cElementTree.cpython-312.opt-1.pycnu[PKm#]؅4etree/__pycache__/cElementTree.cpython-312.opt-2.pycnu[PKm#]>h99-4etree/__pycache__/ElementPath.cpython-312.pycnu[PKm#]>h993]Wetree/__pycache__/ElementPath.cpython-312.opt-2.pycnu[PKm#]\3etree/__pycache__/ElementTree.cpython-312.opt-2.pycnu[PKm#]LN6etree/__pycache__/ElementInclude.cpython-312.opt-1.pycnu[PKm#]LN6etree/__pycache__/ElementInclude.cpython-312.opt-2.pycnu[PKm#]؅.etree/__pycache__/cElementTree.cpython-312.pycnu[PKm#]k7A7A-etree/__pycache__/ElementTree.cpython-312.pycnu[PKm#]N0etree/__pycache__/__init__.cpython-312.opt-1.pycnu[PKm#] A>>3etree/__pycache__/ElementTree.cpython-312.opt-1.pycnu[PKm#]w{22(+dom/__pycache__/__init__.cpython-312.pycnu[PKm#]/,AA*:Ddom/__pycache__/xmlbuilder.cpython-312.pycnu[PKm#]i4b]b]-Pdom/__pycache__/minidom.cpython-312.opt-2.pycnu[PKm#]H:gg'dom/__pycache__/minidom.cpython-312.pycnu[PKm#] @ @0/Ldom/__pycache__/xmlbuilder.cpython-312.opt-2.pycnu[PKm#];bcBB-dom/__pycache__/pulldom.cpython-312.opt-2.pycnu[PKm#]ف&|dom/__pycache__/domreg.cpython-312.pycnu[PKm#]J*''.dom/__pycache__/__init__.cpython-312.opt-2.pycnu[PKm#]~((*@dom/__pycache__/NodeFilter.cpython-312.pycnu[PKm#]ف,dom/__pycache__/domreg.cpython-312.opt-1.pycnu[PKm#] 2dom/__pycache__/expatbuilder.cpython-312.opt-1.pycnu[PKm#]v$822,dom/__pycache__/expatbuilder.cpython-312.pycnu[PKm#] 0g dom/__pycache__/minicompat.cpython-312.opt-1.pycnu[PKm#]O O ,t dom/__pycache__/domreg.cpython-312.opt-2.pycnu[PKm#],2U dom/__pycache__/expatbuilder.cpython-312.opt-2.pycnu[PKm#]-!D!D-#!dom/__pycache__/pulldom.cpython-312.opt-1.pycnu[PKm#]/n06h!dom/__pycache__/NodeFilter.cpython-312.opt-2.pycnu[PKm#]ޔu  0el!dom/__pycache__/minicompat.cpython-312.opt-2.pycnu[PKm#]6AA0x!dom/__pycache__/xmlbuilder.cpython-312.opt-1.pycnu[PKm#] 7 7 *պ!dom/__pycache__/minicompat.cpython-312.pycnu[PKm#]~((0f!dom/__pycache__/NodeFilter.cpython-312.opt-1.pycnu[PKm#]w{22.!dom/__pycache__/__init__.cpython-312.opt-1.pycnu[PKm#]-!D!D'~!dom/__pycache__/pulldom.cpython-312.pycnu[PKm#]\ff-)"dom/__pycache__/minidom.cpython-312.opt-1.pycnu[PKm#]0i(,#sax/__pycache__/__init__.cpython-312.pycnu[PKm#]i;ss1O#sax/__pycache__/_exceptions.cpython-312.opt-2.pycnu[PKm#]5KK+##sax/__pycache__/_exceptions.cpython-312.pycnu[PKm#] ^ΰ .#sax/__pycache__/__init__.cpython-312.opt-2.pycnu[PKm#]ޠc4c4/#sax/__pycache__/xmlreader.cpython-312.opt-2.pycnu[PKm#](W[L[L)$sax/__pycache__/xmlreader.cpython-312.pycnu[PKm#]@+:+:'MT$sax/__pycache__/handler.cpython-312.pycnu[PKm#]y\-ώ$sax/__pycache__/handler.cpython-312.opt-2.pycnu[PKm#]EOTOT1$sax/__pycache__/expatreader.cpython-312.opt-1.pycnu[PKm#]5KK1$sax/__pycache__/_exceptions.cpython-312.opt-1.pycnu[PKm#](W[L[L/q%sax/__pycache__/xmlreader.cpython-312.opt-1.pycnu[PKm#]@+:+:-+`%sax/__pycache__/handler.cpython-312.opt-1.pycnu[PKm#]EOTOT+%sax/__pycache__/expatreader.cpython-312.pycnu[PKm#]' [RR1]%sax/__pycache__/expatreader.cpython-312.opt-2.pycnu[PKm#]LL(B&sax/__pycache__/saxutils.cpython-312.pycnu[PKm#]LL.f&sax/__pycache__/saxutils.cpython-312.opt-1.pycnu[PKm#]0i.O&sax/__pycache__/__init__.cpython-312.opt-1.pycnu[PKm#]H