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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib64/python3.6/xml/etree/__pycache__
Viewing File: /usr/lib64/python3.6/xml/etree/__pycache__/ElementTree.cpython-36.opt-1.pyc
3 \���@sHdZddddddddd d d d d ddddddddddgZdZddlZddlZddlZddlZddlZddlZddl m Z Gdd �d e �Z dd�Z Gdd�d�Zifd d�Zd^d!d�Zd_d"d �ZeZGd#d �d �ZGd$d�d�Zejd%d&��Zd`d'd(�Zd)d*�ZdaZy ee�ZWnek �r"YnXd8d9�Zd:d;�Zeeed<�Zd=d�Zd>d?d@dAdBdCdDdE�Z e e_ dFdG�Z!dHdI�Z"dJdK�Z#dLdM�Z$dbdNdO�dPd�Z%GdQdR�dRej&�Z'dcdNdO�dSd�Z(dTd�Z)dddUd �Z*dedVd�Z+GdWd�d�Z,dfdXd�Z-dgdYd�Z.e-Z/dhdZd�Z0Gd[d�d�Z1Gd\d�d�Z2yeZ3dd]l4TWne5k �rBYnXdS)iaLightweight XML support for Python. XML is an inherently hierarchical data format, and the most natural way to represent it is with a tree. This module has two classes for this purpose: 1. ElementTree represents the whole XML document as a tree and 2. Element represents a single node in this tree. Interactions with the whole document (reading and writing to/from files) are usually done on the ElementTree level. Interactions with a single XML element and its sub-elements are done on the Element level. Element is a flexible container object designed to store hierarchical data structures in memory. It can be described as a cross between a list and a dictionary. Each Element has a number of properties associated with it: 'tag' - a string containing the element's name. 'attributes' - a Python dictionary storing the element's attributes. 'text' - a string containing the element's text content. 'tail' - an optional string containing text after the element's end tag. And a number of child elements stored in a Python sequence. To create an element instance, use the Element constructor, or the SubElement factory function. You can also use the ElementTree class to wrap an element structure and convert it to and from XML. �Comment�dump�Element� ElementTree� fromstring�fromstringlist� iselement� iterparse�parse� ParseError�PI�ProcessingInstruction�QName� SubElement�tostring� tostringlist� TreeBuilder�VERSION�XML�XMLID� XMLParser� XMLPullParser�register_namespacez1.3.0�N�)� ElementPathc@seZdZdZdS)r z�An error when parsing an XML document. In addition to its exception value, a ParseError contains two extra attributes: 'code' - the specific exception code 'position' - the line and column of the error N)�__name__� __module__� __qualname__�__doc__�rr�#/usr/lib64/python3.6/ElementTree.pyr hscCs t|d�S)z2Return True if *element* appears to be an Element.�tag)�hasattr)�elementrrr rvsc@s eZdZdZdZdZdZdZifdd�Zdd�Z dd�Z d d �Z d d �Z d d�Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd9d!d"�Zd:d#d$�Zd;d%d&�Zd<d'd(�Zd)d*�Zd=d+d,�Zd-d.�Zd/d0�Zd1d2�Zd>d3d4�Z d?d5d6�Z!d7d8�Z"dS)@rahAn XML element. This class is the reference implementation of the Element interface. An element's length is its number of subelements. That means if you want to check if an element is truly empty, you should check BOTH its length AND its text attribute. The element tag, attribute names, and attribute values can be either bytes or strings. *tag* is the element name. *attrib* is an optional dictionary containing element attributes. *extra* are additional element attributes given as keyword arguments. Example form: <tag attrib>text<child/>...</tag>tail NcKsDt|t�std|jjf��|j�}|j|�||_||_g|_ dS)Nzattrib must be dict, not %s) � isinstance�dict� TypeError� __class__r�copy�updater!�attrib� _children)�selfr!r*�extrarrr �__init__�s  zElement.__init__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)r'rr!�id)r,rrr �__repr__�szElement.__repr__cCs |j||�S)z�Create a new element with the same type. *tag* is a string containing the element name. *attrib* is a dictionary containing the element attributes. Do not call this method, use the SubElement factory function instead. )r')r,r!r*rrr � makeelement�s zElement.makeelementcCs0|j|j|j�}|j|_|j|_||dd�<|S)z�Return copy of current element. This creates a shallow copy. Subelements will be shared with the original tree. N)r1r!r*�text�tail)r,�elemrrr r(�s  z Element.copycCs t|j�S)N)�lenr+)r,rrr �__len__�szElement.__len__cCstjdtdd�t|j�dkS)NzyThe behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.�)� stacklevelr)�warnings�warn� FutureWarningr5r+)r,rrr �__bool__�s zElement.__bool__cCs |j|S)N)r+)r,�indexrrr � __getitem__�szElement.__getitem__cCs||j|<dS)N)r+)r,r=r#rrr � __setitem__�szElement.__setitem__cCs |j|=dS)N)r+)r,r=rrr � __delitem__�szElement.__delitem__cCs|j|�|jj|�dS)aAdd *subelement* to the end of this element. The new element will appear in document order after the last existing subelement (or directly after the text, if it's the first subelement), but before the end tag for this element. N)�_assert_is_elementr+�append)r,� subelementrrr rB�s zElement.appendcCs(x|D]}|j|�qW|jj|�dS)zkAppend subelements from a sequence. *elements* is a sequence with zero or more elements. N)rAr+�extend)r,�elementsr#rrr rD�s zElement.extendcCs|j|�|jj||�dS)z(Insert *subelement* at position *index*.N)rAr+�insert)r,r=rCrrr rF�s zElement.insertcCs t|t�stdt|�j��dS)Nzexpected an Element, not %s)r$� _Element_Pyr&�typer)r,�errr rA�s zElement._assert_is_elementcCs|jj|�dS)a�Remove matching subelement. Unlike the find methods, this method compares elements based on identity, NOT ON tag value or contents. To remove subelements by other means, the easiest way is to use a list comprehension to select what elements to keep, and then use slice assignment to update the parent element. ValueError is raised if a matching element could not be found. N)r+�remove)r,rCrrr rJs zElement.removecCstjdtdd�|jS)z`(Deprecated) Return all subelements. Elements are returned in document order. zaThis method will be removed in future versions. Use 'list(elem)' or iteration over elem instead.r7)r8)r9r:�DeprecationWarningr+)r,rrr � getchildrens zElement.getchildrencCstj|||�S)aFind first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. )r�find)r,�path� namespacesrrr rM!s z Element.findcCstj||||�S)a�Find text for first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *default* is the value to return if the element was not found, *namespaces* is an optional mapping from namespace prefix to full name. Return text content of first matching element, or default value if none was found. Note that if an element is found having no text content, the empty string is returned. )r�findtext)r,rN�defaultrOrrr rP,s zElement.findtextcCstj|||�S)aFind all matching subelements by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Returns list containing all matching elements in document order. )r�findall)r,rNrOrrr rR:s zElement.findallcCstj|||�S)a Find all matching subelements by tag name or path. *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return an iterable yielding all matching elements in document order. )r�iterfind)r,rNrOrrr rSEs zElement.iterfindcCs |jj�g|_d|_|_dS)z�Reset element. This function removes all subelements, clears all attributes, and sets the text and tail attributes to None. N)r*�clearr+r2r3)r,rrr rTPs z Element.clearcCs|jj||�S)agGet element attribute. Equivalent to attrib.get, but some implementations may handle this a bit more efficiently. *key* is what attribute to look for, and *default* is what to return if the attribute was not found. Returns a string containing the attribute value, or the default if attribute was not found. )r*�get)r,�keyrQrrr rU[s z Element.getcCs||j|<dS)z�Set element attribute. Equivalent to attrib[key] = value, but some implementations may handle this a bit more efficiently. *key* is what attribute to set, and *value* is the attribute value to set it to. N)r*)r,rV�valuerrr �sethsz Element.setcCs |jj�S)z�Get list of attribute names. Names are returned in an arbitrary order, just like an ordinary Python dict. Equivalent to attrib.keys() )r*�keys)r,rrr rYrsz Element.keyscCs |jj�S)z�Get element attributes as a sequence. The attributes are returned in arbitrary order. Equivalent to attrib.items(). Return a list of (name, value) tuples. )r*�items)r,rrr rZ{s z Element.itemsccsH|dkr d}|dks|j|kr$|Vx|jD]}|j|�EdHq,WdS)aCreate tree iterator. The iterator loops over the element and all subelements in document order, returning all elements with a matching tag. If the tree structure is modified during iteration, new or removed elements may or may not be included. To get a stable set, use the list() function on the iterator, and loop over the resulting list. *tag* is what tags to look for (default is to return all elements) Return an iterator containing all the matching elements. �*N)r!r+�iter)r,r!rIrrr r\�s  z Element.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions. Use 'elem.iter()' or 'list(elem.iter())' instead.r7)r8)r9r:�PendingDeprecationWarning�listr\)r,r!rrr � getiterator�s zElement.getiteratorccs^|j}t|t� r|dk rdS|j}|r.|Vx*|D]"}|j�EdH|j}|r4|Vq4WdS)z�Create text iterator. The iterator loops over the element and all subelements in document order, returning all inner text. N)r!r$�strr2�itertextr3)r,r!�trIrrr ra�s zElement.itertext)N)NN)N)N)N)N)N)#rrrrr!r*r2r3r.r0r1r(r6r<r>r?r@rBrDrFrArJrLrMrPrRrSrTrUrXrYrZr\r_rarrrr r{s@            cKs,|j�}|j|�|j||�}|j|�|S)a�Subelement factory which creates an element instance, and appends it to an existing parent. The element tag, attribute names, and attribute values can be either bytes or Unicode strings. *parent* is the parent element, *tag* is the subelements name, *attrib* is an optional directory containing element attributes, *extra* are additional attributes given as keyword arguments. )r(r)r1rB)�parentr!r*r-r#rrr r�s    cCstt�}||_|S)z�Comment element factory. This function creates a special element which the standard serializer serializes as an XML comment. *text* is a string containing the comment string. )rrr2)r2r#rrr r�s cCs&tt�}||_|r"|jd||_|S)a*Processing Instruction element factory. This function creates a special element which the standard serializer serializes as an XML comment. *target* is a string containing the processing instruction, *text* is a string containing the processing instruction contents, if any. � )rr r2)�targetr2r#rrr r �s c@sZeZdZdZddd�Zdd�Zdd�Zd d �Zd d �Zd d�Z dd�Z dd�Z dd�Z dS)r a�Qualified name wrapper. This class can be used to wrap a QName attribute value in order to get proper namespace handing on output. *text_or_uri* is a string containing the QName value either in the form {uri}local, or if the tag argument is given, the URI part of a QName. *tag* is an optional argument which if given, will make the first argument (text_or_uri) be interpreted as a URI, and this argument (tag) be interpreted as a local name. NcCs|rd||f}||_dS)Nz{%s}%s)r2)r,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|j�S)N)�hashr2)r,rrr �__hash__szQName.__hash__cCs t|t�r|j|jkS|j|kS)N)r$r r2)r,�otherrrr �__le__s  z QName.__le__cCs t|t�r|j|jkS|j|kS)N)r$r r2)r,rirrr �__lt__ s  z QName.__lt__cCs t|t�r|j|jkS|j|kS)N)r$r r2)r,rirrr �__ge__s  z QName.__ge__cCs t|t�r|j|jkS|j|kS)N)r$r r2)r,rirrr �__gt__s  z QName.__gt__cCs t|t�r|j|jkS|j|kS)N)r$r r2)r,rirrr �__eq__s  z QName.__eq__)N) rrrrr.rfr0rhrjrkrlrmrnrrrr r �s  c@s�eZdZdZddd�Zdd�Zdd�Zdd d �Zdd d �Zd d d�Z d!dd�Z d"dd�Z d#dd�Z d$dd�Z d%dd�dd�Zdd�ZdS)&ra%An XML element hierarchy. This class also provides support for serialization to and from standard XML. *element* is an optional root element node, *file* is an optional file handle or file name of an XML file whose contents will be used to initialize the tree with. NcCs||_|r|j|�dS)N)�_rootr )r,r#�filerrr r.)szElementTree.__init__cCs|jS)z!Return root element of this tree.)ro)r,rrr �getroot/szElementTree.getrootcCs ||_dS)z�Replace root element of this tree. This will discard the current contents of the tree and replace it with the given element. Use with care! N)ro)r,r#rrr �_setroot3szElementTree._setrootc Cs�d}t|d�st|d�}d}zZ|dkrHt�}t|d�rH|j|�|_|jSx|jd�}|sZP|j|�qJW|j�|_|jS|r�|j�XdS)a=Load external XML document into element tree. *source* is a file name or file object, *parser* is an optional parser instance that defaults to XMLParser. ParseError is raised if the parser fails to parse the document. Returns the root element of the given source document. F�read�rbTN� _parse_wholei)r"�openrrurors�feed�close)r,�source�parser� close_source�datarrr r =s&       zElementTree.parsecCs |jj|�S)z�Create and return tree iterator for the root element. The iterator loops over all elements in this tree, in document order. *tag* is a string with the tag name to iterate over (default is to return all elements). )ror\)r,r!rrr r\bs zElementTree.itercCstjdtdd�t|j|��S)NzbThis method will be removed in future versions. Use 'tree.iter()' or 'list(tree.iter())' instead.r7)r8)r9r:r]r^r\)r,r!rrr r_os zElementTree.getiteratorcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)a\Find first matching element by tag name or path. Same as getroot().find(path), which is Element.find() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. Nr�/�.z�This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorM)r,rNrOrrr rMxs  zElementTree.findcCs<|dd�dkr,d|}tjd|tdd�|jj|||�S)aeFind first matching element by tag name or path. Same as getroot().findtext(path), which is Element.findtext() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return the first matching element, or None if no element was found. Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorP)r,rNrQrOrrr rP�s  zElementTree.findtextcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)aaFind all matching subelements by tag name or path. Same as getroot().findall(path), which is Element.findall(). *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return list containing all matching elements in document order. Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorR)r,rNrOrrr rR�s  zElementTree.findallcCs:|dd�dkr,d|}tjd|tdd�|jj||�S)agFind all matching subelements by tag name or path. Same as getroot().iterfind(path), which is element.iterfind() *path* is a string having either an element tag or an XPath, *namespaces* is an optional mapping from namespace prefix to full name. Return an iterable yielding all matching elements in document order. Nrr}r~z�This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %rr7)r8)r9r:r;rorS)r,rNrOrrr rS�s  zElementTree.iterfindT)�short_empty_elementscCs�|s d}n|tkrtd|��|s4|dkr0d}nd}|j�}t||���}|dkr�|sd|dkr�|d kr�|} |dkr�ddl} | j�} |d | f�|d kr�t||j�n,t|j|�\} } t|} | ||j| | |d �WdQRXdS) a�Write element tree to a file as XML. Arguments: *file_or_filename* -- file name or a file object opened for writing *encoding* -- the output encoding (default: US-ASCII) *xml_declaration* -- bool indicating if an XML declaration should be added to the output. If None, an XML declaration is added if encoding IS NOT either of: US-ASCII, UTF-8, or Unicode *default_namespace* -- sets the default XML namespace (for "xmlns") *method* -- either "xml" (default), "html, "text", or "c14n" *short_empty_elements* -- controls the formatting of elements that contain no content. If True (default) they are emitted as a single self-closed tag, otherwise they are emitted as a pair of start/end tags �xmlzunknown method %r�c14n�utf-8�us-asciiN�unicoderz$<?xml version='1.0' encoding='%s'?> r2)r)r�r�r�) � _serialize� ValueError�lower� _get_writer�locale�getpreferredencoding�_serialize_textro� _namespaces)r,�file_or_filename�encodingZxml_declaration�default_namespace�methodrZ enc_lower�writeZdeclared_encodingr��qnamesrOZ serializerrr r��s2     zElementTree.writecCs|j|dd�S)Nr�)r�)r�)r,rprrr � write_c14n szElementTree.write_c14n)NN)N)N)N)N)NN)N)N)NNNN)rrrrr.rqrrr r\r_rMrPrRrSr�r�rrrr rs"   %    5ccs"y |j}WnPtk rZ|dkr.t|d�}nt|d|dd�}|�|jVWdQRXYn�X|dkrl|Vn�tj���}t|tj�r�|}nft|tj�r�tj |�}|j |j �nBtj�}dd�|_ ||_y|j |_ |j|_Wntk r�YnXtj||ddd�}|j |j �|jVWdQRXdS) Nr��w�xmlcharrefreplace)r��errorscSsdS)NTrrrrr �<lambda>3sz_get_writer.<locals>.<lambda>� )r�r��newline)r��AttributeErrorrv� contextlib� ExitStackr$�io�BufferedIOBase� RawIOBase�BufferedWriter�callback�detach�writable�seekable�tell� TextIOWrapper)r�r�r�rp�stackrrr r�s>         r�csddi�i��rd��<���fdd�}x�|j�D]�}|j}t|t�r\|j�kr�||j�n<t|t�rx|�kr�||�n |dk r�|tk r�|tk r�t|�xR|j �D]F\}}t|t�r�|j}|�kr�||�t|t�r�|j�kr�||j�q�W|j}t|t�r2|j�kr2||j�q2W��fS)N�c s�y�|dd�dkr�|dd�jdd�\}}�j|�}|dkrjtj|�}|dkrZdt��}|dkrj|�|<|r�d||f�|<q�|�|<n�r�td��|�|<Wntk r�t|�YnXdS)Nr�{�}zns%dr�z%s:%sz<cannot use non-qualified names with default_namespace option)�rsplitrU�_namespace_mapr5r�r&�_raise_serialization_error)Zqname�urir!�prefix)r�rOr�rr � add_qnamePs&     z_namespaces.<locals>.add_qname) r\r!r$r r2r`rr r�rZ)r4r�r�r!rVrWr2r)r�rOr�r r�Es4      r�c Ks�|j}|j}|tkr$|d|��n�|tkr<|d|��nv||}|dkr�|r\|t|��x|D]}t|||d|d�qbW�n2|d|�t|j��} | s�|�rD|r�x@t|j�dd�d�D](\} } | r�d| } |d | t | �f�q�WxZt| �D]N\} } t | t ��r | j} t | t ��r$|| j} nt | �} |d || | f�q�W|�s\t |��s\| �r�|d �|�rv|t|��x |D]}t|||d|d��q|W|d |d �n|d �|j �r�|t|j ��dS)Nz <!--%s-->z<?%s?>)r�<cSs|dS)Nrr)�xrrr r��sz _serialize_xml.<locals>.<lambda>)rV�:z xmlns%s="%s"z %s="%s"�>z</z />)r!r2rr � _escape_cdata�_serialize_xmlr^rZ�sorted�_escape_attribr$r r5r3) r�r4r�rOr�kwargsr!r2rIrZ�v�krrr r��sT             r��area�base�basefont�br�col�frame�hr�img�input�isindex�link�meta�paramc Ks�|j}|j}|tkr(|dt|���n�|tkrD|dt|���n|||}|dkr�|rd|t|��x|D]}t|||d�qjW�n<|d|�t|j��}|s�|�rH|r�x@t|j�dd�d�D](\} } | r�d| } |d| t | �f�q�WxZt|�D]N\} } t | t ��r| j} t | t ��r(|| j} nt | �} |d || | f�q�W|d �|j �} |�r�| d k�sr| d k�r|||�n |t|��x|D]}t|||d��q�W| tk�r�|d |d �|j�r�|t|j��dS)Nz <!--%s-->z<?%s?>r�cSs|dS)Nrr)r�rrr r��sz!_serialize_html.<locals>.<lambda>)rVr�z xmlns%s="%s"z %s="%s"r�ZscriptZstylez</)r!r2rr�r �_serialize_htmlr^rZr�r�r$r �_escape_attrib_htmlr�� HTML_EMPTYr3) r�r4r�rOr�r!r2rIrZr�r�Zltagrrr r��sT             r�cCs.x|j�D] }||�q W|jr*||j�dS)N)rar3)r�r4�partrrr r��s r�)r��htmlr2cCsPtjd|�rtd��x.ttj��D]\}}||ks:||kr"t|=q"W|t|<dS)atRegister a namespace prefix. The registry is global, and any existing mapping for either the given prefix or the namespace URI will be removed. *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and attributes in this namespace will be serialized with prefix if possible. ValueError is raised if prefix is reserved or is invalid. zns\d+$z'Prefix format reserved for internal useN)�re�matchr�r^r�rZ)r�r�r�r�rrr r�s  r�r�ZrdfZwsdlZxsZxsiZdc)z$http://www.w3.org/XML/1998/namespacezhttp://www.w3.org/1999/xhtmlz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://schemas.xmlsoap.org/wsdl/z http://www.w3.org/2001/XMLSchemaz)http://www.w3.org/2001/XMLSchema-instancez http://purl.org/dc/elements/1.1/cCstd|t|�jf��dS)Nzcannot serialize %r (type %s))r&rHr)r2rrr r�sr�c Csfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk r`t|�YnXdS)N�&z&amp;r�z&lt;r�z&gt;)�replacer&r�r�)r2rrr r�$s   r�c Cs�y�d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}d|krR|jdd�}d |krf|jd d �}d |krz|jd d �}d |kr�|jd d �}d |kr�|jd d�}|Sttfk r�t|�YnXdS)Nr�z&amp;r�z&lt;r�z&gt;�"z&quot;z r�� z&#10;� z&#09;)r�r&r�r�)r2rrr r�4s(        r�c Csfy@d|kr|jdd�}d|kr*|jdd�}d|kr>|jdd�}|Sttfk r`t|�YnXdS)Nr�z&amp;r�z&gt;r�z&quot;)r�r&r�r�)r2rrr r�Ps   r�T)rcCs6|dkrtj�ntj�}t|�j||||d�|j�S)a�Generate string representation of XML element. All subelements are included. If encoding is "unicode", a string is returned. Otherwise a bytestring is returned. *element* is an Element instance, *encoding* is an optional output encoding defaulting to US-ASCII, *method* is an optional output which can be one of "xml" (default), "html", "text" or "c14n". Returns an (optionally) encoded string containing the XML data. r�)r�r)r��StringIO�BytesIOrr��getvalue)r#r�r�r�streamrrr r_sc@s8eZdZdZdd�Zdd�Zdd�Zdd �Zd d �Zd S) �_ListDataStreamz7An auxiliary stream accumulating into a list reference.cCs ||_dS)N)�lst)r,r�rrr r.tsz_ListDataStream.__init__cCsdS)NTr)r,rrr r�wsz_ListDataStream.writablecCsdS)NTr)r,rrr r�zsz_ListDataStream.seekablecCs|jj|�dS)N)r�rB)r,�brrr r�}sz_ListDataStream.writecCs t|j�S)N)r5r�)r,rrr r��sz_ListDataStream.tellN) rrrrr.r�r�r�r�rrrr r�rs r�cCs&g}t|�}t|�j||||d�|S)N)r�r)r�rr�)r#r�r�rr�r�rrr r�s cCsNt|t�st|�}|jtjdd�|j�j}| s>|ddkrJtjjd�dS)a#Write element tree or element structure to sys.stdout. This function should be used for debugging only. *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file. r�)r�rr�N���)r$rr��sys�stdoutrqr3)r4r3rrr r�s  cCst�}|j||�|S)z�Parse XML document into element tree. *source* is a filename or file object containing XML data, *parser* is an optional parser instance defaulting to XMLParser. Return an ElementTree instance. )rr )ryrz�treerrr r �s  csdt||d������fdd��G�fdd�dtj�}|��d�_�~d�t�d�s`t�d ��d ��S) aJIncrementally parse XML document into ElementTree. This class also reports what's going on to the user based on the *events* it is initialized with. The supported events are the strings "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get detailed namespace information). If *events* is omitted, only "end" events are reported. *source* is a filename or file object containing XML data, *events* is a list of events to report back, *parser* is an optional parser instance. Returns an iterator providing (event, elem) pairs. )�events�_parserc 3sbzNx,�j�EdH�jd�}|s"P�j|�qW�j�}�j�EdH|�_Wd�r\�j�XdS)N�ii@)� read_eventsrsrw�_close_and_return_root�rootrx)r|r�)r{�it� pullparserryrr �iterator�s  ziterparse.<locals>.iteratorcseZdZ��jZdS)z$iterparse.<locals>.IterParseIteratorN)rrr�__next__r)r�rr �IterParseIterator�sr�NFrsrtT)r� collections�Iteratorr�r"rv)ryr�rzr�r)r{r�r�r�ryr r�s   c@s<eZdZd dd�dd�Zdd�Zdd�Zd d �Zd d �ZdS)rN)r�cCs<tj�|_|ptt�d�|_|dkr(d}|jj|j|�dS)N)re�end)r�)r��deque� _events_queuerrr�� _setevents)r,r�r�rrr r.�s  zXMLPullParser.__init__cCsZ|jdkrtd��|rVy|jj|�Wn.tk rT}z|jj|�WYdd}~XnXdS)zFeed encoded data to parser.Nz!feed() called after end of stream)r�r�rw� SyntaxErrorr�rB)r,r|�excrrr rw�s zXMLPullParser.feedcCs|jj�}d|_|S)N)r�rx)r,r�rrr r��s z$XMLPullParser._close_and_return_rootcCs |j�dS)z�Finish feeding data to parser. Unlike XMLParser, does not return the root element. Use read_events() to consume elements from XMLPullParser. N)r�)r,rrr rx�szXMLPullParser.closeccs2|j}x&|r,|j�}t|t�r$|�q|VqWdS)z�Return an iterator over currently available (event, elem) pairs. Events are consumed from the internal event queue as they are retrieved from the iterator. N)r��popleftr$� Exception)r,r��eventrrr r�s  zXMLPullParser.read_events)N)rrrr.rwr�rxr�rrrr r�s   cCs"|stt�d�}|j|�|j�S)aParse XML document from string constant. This function can be used to embed "XML Literals" in Python code. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. )re)rrrwrx)r2rzrrr rs   cCsV|stt�d�}|j|�|j�}i}x&|j�D]}|jd�}|r0|||<q0W||fS)aParse XML document from string constant for its IDs. *text* is a string containing XML data, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an (Element, dict) tuple, in which the dict maps element id:s to elements. )rer/)rrrwrxr\rU)r2rzr�Zidsr4r/rrr r&s     cCs0|stt�d�}x|D]}|j|�qW|j�S)z�Parse XML document from sequence of string fragments. *sequence* is a list of other sequence, *parser* is an optional parser instance, defaulting to the standard XMLParser. Returns an Element instance. )re)rrrwrx)Zsequencerzr2rrr r>s   c@sBeZdZdZddd�Zdd�Zdd�Zd d �Zd d �Zd d�Z dS)ra�Generic element structure builder. This builder converts a sequence of start, data, and end method calls to a well-formed element structure. You can use this class to build an element structure using a custom XML parser, or a parser for some other XML-like format. *element_factory* is an optional element factory which is called to create new Element instances, as necessary. NcCs.g|_g|_d|_d|_|dkr$t}||_dS)N)�_data�_elem�_last�_tailr�_factory)r,Zelement_factoryrrr r.]szTreeBuilder.__init__cCs|jS)z;Flush builder buffers and return toplevel document Element.)r�)r,rrr rxfszTreeBuilder.closecCs>|jr:|jdk r4dj|j�}|jr,||j_n||j_g|_dS)Nr�)r�r��joinr�r3r2)r,r2rrr �_flushls   zTreeBuilder._flushcCs|jj|�dS)zAdd text to current element.N)r�rB)r,r|rrr r|xszTreeBuilder.datacCsF|j�|j||�|_}|jr0|jdj|�|jj|�d|_|S)z�Open new element and return it. *tag* is the element name, *attrs* is a dict containing element attributes. rrr�)r�r�r�r�rBr�)r,r!Zattrsr4rrr �start|s zTreeBuilder.startcCs |j�|jj�|_d|_|jS)zOClose and return current Element. *tag* is the element name. r)r�r��popr�r�)r,r!rrr r��s zTreeBuilder.end)N) rrrrr.rxr�r|r�r�rrrr rPs   c@sfeZdZdZddd�Zdd�Zdd �Zd d �Zd d �Zdd�Z dd�Z dd�Z e Z dd�Z dd�ZdS)ra�Element structure builder for XML source data based on the expat parser. *html* are predefined HTML entities (deprecated and not supported), *target* is an optional target object which defaults to an instance of the standard TreeBuilder class, *encoding* is an optional encoding string which if given, overrides the encoding specified in the XML file: http://www.iana.org/assignments/character-sets rNcCs<yddlm}Wn>tk rNy ddl}Wntk rHtd��YnXYnX|j|d�}|dkrjt�}||_|_||_|_ |j |_ i|_ |j |_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d�r�|j|_t|d �r�|j|_d |_d |_d |_d|_i|_yd |j|_ Wnt!k �r6YnXdS) Nr)�expatz7No module named expat; use SimpleXMLTreeBuilder insteadr�r�r�r|�comment�pirzExpat %d.%d.%d)"� xml.parsersr�� ImportErrorZpyexpatZ ParserCreaterrzr�re�_target�error�_error�_names�_defaultZDefaultHandlerExpandr"�_start�StartElementHandler�_end�EndElementHandlerr|ZCharacterDataHandlerrZCommentHandlerrZProcessingInstructionHandlerZ buffer_text�ordered_attributes�specified_attributes�_doctype�entity� version_info�versionr�)r,r�rer�r�rzrrr r.�sF         zXMLParser.__init__cCs�|j}|j}x�|D]�}|dkrDd|_d|_|||jfdd�}||_q|dkrf|||jfdd�}||_q|dkr�||fdd�}||_q|d kr�||fd d�}||_ qt d |��qWdS) Nr�rcSs|||||�f�dS)Nr)r!Z attrib_inr�rBr�rrr �handler�sz%XMLParser._setevents.<locals>.handlerr�cSs||||�f�dS)Nr)r!r�rBr�rrr r�szstart-nscSs|||p d|pdff�dS)Nr�r)r�r�r�rBrrr r�szend-nscSs||df�dS)Nr)r�r�rBrrr r�szunknown event %r) r�rBr rr r r r ZStartNamespaceDeclHandlerZEndNamespaceDeclHandlerr�)r,Z events_queueZevents_to_reportrzrBZ event_namerrrr r��s( zXMLParser._seteventscCs&t|�}|j|_|j|jf|_|�dS)N)r �code�lineno�offsetZposition)r,rW�errrrr � _raiseerror�szXMLParser._raiseerrorc CsFy|j|}Wn2tk r@|}d|kr2d|}||j|<YnX|S)Nr�r�)r�KeyError)r,rV�namerrr �_fixname�szXMLParser._fixnamecCsV|j}||�}i}|rHx0tdt|�d�D]}||d||||�<q(W|jj||�S)Nrr7r)r�ranger5rer�)r,r!Z attr_listZfixnamer*�irrr r szXMLParser._startcCs|jj|j|��S)N)rer�r)r,r!rrr r szXMLParser._endc Cs�|dd�}|dkr�y |jj}Wntk r4dSXy||j|dd��WnZtk r�ddlm}|jd||jj |jj f�}d|_ |jj |_ |jj |_ |�YnX�nD|dkr�|dd�d kr�g|_�n"|jdk �r�|d kr�d|_dS|j�}|�sdS|jj|�t|j�}|d k�r�|jd}|d k�rb|d k�rb|j\}}} } | �r�| dd�} n*|dk�r�|dk�r�|j\}}} d} ndSt|jd��r�|jj|| | dd��n:|j|jk�r�|j|| | dd��|j|| | dd��d|_dS)Nrr�r)r�z'undefined entity %s: line %d, column %d� r�� z <!DOCTYPEr�r7ZPUBLIC�ZSYSTEM��doctyper�r�r�r�r�)rer|r�rrrr�rrzZErrorLineNumberZErrorColumnNumberrrrr�striprBr5r"r"�_XMLParser__doctype) r,r2r�Z data_handlerr�r�nrHr�pubid�systemrrr rsZ            zXMLParser._defaultcCstjdt�dS)z�(Deprecated) Handle doctype declaration *name* is the Doctype name, *pubid* is the public identifier, and *system* is the system identifier. z[This method of XMLParser is deprecated. Define doctype() method on the TreeBuilder target.N)r9r:rK)r,rr&r'rrr r"EszXMLParser.doctypecCsFy|jj|d�Wn.|jk r@}z|j|�WYdd}~XnXdS)zFeed encoded data to parser.rN)rz�Parserr)r,r|r�rrr rwUszXMLParser.feedcCs�y|jjdd�Wn.|jk r@}z|j|�WYdd}~XnXz,y |jj}Wntk rdYnX|�SWd|`|`|`|`XdS)z;Finish feeding data to parser and return element structure.r�rN) rzr(rrrerxr�r�r)r,r�Z close_handlerrrr rx\s  zXMLParser.close)rNN)rrrrr.r�rrr r rr"r$rwrxrrrr r�s  *!  4)r[)N)N)N) r�r�r�r�r�r�r�r�r�r�r�r�r�)NN)NN)N)NN)N)N)N)6r�__all__rr�r�r9r�r�r�r�rr�r rrrrr r r r�contextmanagerr�r�r�r�rX� NameErrorr�r�r�rr�r�r�r�r�rr�r�rrr rrrrrrrrrGZ _elementtreerrrrr �<module>"s�) A   0t4 =2 2  05   KU