ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/lib64/python3.6/xml/dom/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib64/python3.6/xml/dom/__pycache__/pulldom.cpython-36.pyc

3


 \�-�@s�ddlZddlZdZdZdZdZdZdZdZ	d	Z
Gd
d�dejj�Z
Gdd
�d
�ZGdd�d�ZGdd�de
�ZdZddd�Zddd�ZdS)�N�
START_ELEMENT�END_ELEMENT�COMMENT�START_DOCUMENT�END_DOCUMENT�PROCESSING_INSTRUCTION�IGNORABLE_WHITESPACE�
CHARACTERSc@s�eZdZdZdZd$dd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)%�PullDOMNcCszddlm}||_ddg|_|j|_g|_|jj|_y|jj|_Wnt	k
rVYnX|dig|_
|j
d|_g|_dS)Nr)�
XML_NAMESPACE�xml����)
Zxml.domr�documentFactory�
firstEvent�	lastEvent�elementStack�append�push�pop�AttributeError�_ns_contexts�_current_context�pending_events)�selfrr�r�'/usr/lib64/python3.6/xml/dom/pulldom.py�__init__s

zPullDOM.__init__cCs|jd}|jd=|S)Nr
rr)r)r�resultrrrr!s
zPullDOM.popcCs
||_dS)N)�_locator)rZlocatorrrr�setDocumentLocator&szPullDOM.setDocumentLocatorcCsHt|d�sg|_|jj|pd|f�|jj|jj��|p<d|j|<dS)N�_xmlns_attrs�xmlns)�hasattrr!rrr�copy)r�prefix�urirrr�startPrefixMapping)s

zPullDOM.startPrefixMappingcCs|jj�|_dS)N)rrr)rr%rrr�endPrefixMapping0szPullDOM.endPrefixMappingcCs�d}t|dd�}|dk	r>x|D]\}}||j||f<qWg|_|\}}	|r�|dkrr|j|}
|
rn|
d|	}n|	}|jr�|jj||�}q�|j||�}n |jr�|jj|	�}n|jd|	�}x�|j�D]�\}}|\}}
||k�r
|
dkr�|
}nd|
}|jj	||�}|j
|�nX|�rL|j|}
|
�r.|
d|
}n|
}|jj	||�}|j
|�n|jj|
�}|j|�||_
q�Wt|fdg|jd<|jd|_|j|�dS)Nzhttp://www.w3.org/2000/xmlns/r!�:r"zxmlns:r
)�getattr�_attrsr!r�documentZcreateElementNS�
buildDocument�
createElement�itemsZcreateAttributeNSZsetAttributeNodeNS�createAttribute�setAttributeNode�valuerrr)r�name�tagName�attrsZ	xmlns_uriZxmlns_attrs�anamer2r&Z	localnamer%�nodeZa_uriZa_localnameZqname�attrrrr�startElementNS3sP




zPullDOM.startElementNScCs&t|j�fdg|jd<|jd|_dS)Nr
)rrr)rr3r4rrr�endElementNSlszPullDOM.endElementNScCs~|jr|jj|�}n|jd|�}x0|j�D]$\}}|jj|�}||_|j|�q*Wt|fdg|jd<|jd|_|j	|�dS)Nr
)
r,r.r-r/r0r2r1rrr)rr3r5r7r6r2r8rrr�startElementpszPullDOM.startElementcCs&t|j�fdg|jd<|jd|_dS)Nr
)rrr)rr3rrr�
endElementszPullDOM.endElementcCsN|jr2|jj|�}t|fdg|jd<|jd|_nt|fdg}|jj|�dS)Nr
)r,�
createCommentrrrr)r�sr7�eventrrr�comment�szPullDOM.commentcCsR|jr4|jj||�}t|fdg|jd<|jd|_nt||fdg}|jj|�dS)Nr
)r,�createProcessingInstructionrrrr)r�target�datar7r?rrr�processingInstruction�szPullDOM.processingInstructioncCs.|jj|�}t|fdg|jd<|jd|_dS)Nr
)r,�createTextNoderr)r�charsr7rrr�ignorableWhitespace�szPullDOM.ignorableWhitespacecCs.|jj|�}t|fdg|jd<|jd|_dS)Nr
)r,rEr	r)rrFr7rrr�
characters�szPullDOM.characterscCs$|jdkr ddl}|jjjj|_dS)Nr)rZxml.dom.minidomZdomZminidomZDocument�implementation)rrrrr�
startDocument�s
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<ntd|dd��||jd<||_qFWd|_|jS)Nr
rzUnknown pending event )
rZcreateDocumentr,rrrrrrArr=�AssertionErrorZ
firstChild)	rr&Ztagnamer7�e�_rBrC�nrrrr-�s$


zPullDOM.buildDocumentcCs t|jfdg|jd<|j�dS)Nr
)rr,rr)rrrr�endDocument�szPullDOM.endDocumentcCs
d|_dS)z.clear(): Explicitly release parsing structuresN)r,)rrrr�clear�sz
PullDOM.clear)N)�__name__�
__module__�__qualname__rr,rrr r'r(r9r:r;r<r@rDrGrHrJr-rOrPrrrrr

s&
9		r
c@s$eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCst|�dS)N)�print)r�	exceptionrrr�warning�szErrorHandler.warningcCs|�dS)Nr)rrVrrr�error�szErrorHandler.errorcCs|�dS)Nr)rrVrrr�
fatalError�szErrorHandler.fatalErrorN)rQrRrSrWrXrYrrrrrT�srTc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�DOMEventStreamcCs2||_||_||_t|jd�s&|j|_|j�dS)N�feed)�stream�parser�bufsizer#�_slurp�getEvent�reset)rr\r]r^rrrr�szDOMEventStream.__init__cCs.t�|_|jjtjjjd�|jj|j�dS)Nr
)	r
�pulldomr]Z
setFeaturer�saxZhandlerZfeature_namespacesZsetContentHandler)rrrrra�szDOMEventStream.resetcCs|j�}|r|St�dS)N)r`�
IndexError)r�pos�rcrrr�__getitem__�szDOMEventStream.__getitem__cCs|j�}|r|St�dS)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?�parents�tokenZcur_noderrr�
expandNode�szDOMEventStream.expandNodecCs�|jjds|jj|j_x<|jjdsT|jj|j�}|sF|jj�dS|jj|�qW|jjdd}|jjdd|jjd<|S)Nr
r)	rbrrr\�readr^r]�closer[)r�bufrfrrrr`�s
zDOMEventStream.getEventcCs|jj|j�|j|_|j�S)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_rsrPrrrrrZ�s
rZc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SAX2DOMcCs2tj||||�|jd}|jd}|j|�dS)Nr
�r���)r
r9rrk)rr3r4r5�curNode�
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
rtru��cCs@|dkrt}t|t�r"t|d�}n|}|s4tjj�}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrrc�make_parserrZ)Zstream_or_stringr]r^r\rrrrrDs

rrcCs6ddlm}t|�}||�}|s*tjj�}t|||�S)Nr)�StringIO)�ior��lenrrcr�rZ)�stringr]r�r^rqrrr�parseStringOs
r�i@i�?)NN)N)Zxml.saxrZxml.sax.handlerrrrrrrrr	rcZContentHandlerr
rTrZrtr|rrr�rrrr�<module>s"8U!


Zerion Mini Shell 1.0