ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python37/lib64/python3.7/xml/dom/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/xml/dom/__pycache__/pulldom.cpython-37.pyc

B

�x�c�-�@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�4/opt/alt/python37/lib64/python3.7/xml/dom/pulldom.py�__init__s

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

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

zPullDOM.startElementNScCs&t|��fdg|jd<|jd|_dS)Nr))rrr)rr2r3rrr�endElementNSlszPullDOM.endElementNScCs~|jr|j�|�}n|�d|�}x0|��D]$\}}|j�|�}||_|�|�q*Wt|fdg|jd<|jd|_|�	|�dS)Nr))
r+r-r,r.r/r1r0rrr)rr2r4r6r5r1r7rrr�startElementpszPullDOM.startElementcCs&t|��fdg|jd<|jd|_dS)Nr))rrr)rr2rrr�
endElementszPullDOM.endElementcCsN|jr2|j�|�}t|fdg|jd<|jd|_nt|fdg}|j�|�dS)Nr))r+�
createCommentrrrr)r�sr6�eventrrr�comment�szPullDOM.commentcCsR|jr4|j�||�}t|fdg|jd<|jd|_nt||fdg}|j�|�dS)Nr))r+�createProcessingInstructionrrrr)r�target�datar6r>rrr�processingInstruction�szPullDOM.processingInstructioncCs.|j�|�}t|fdg|jd<|jd|_dS)Nr))r+�createTextNoderr)r�charsr6rrr�ignorableWhitespace�szPullDOM.ignorableWhitespacecCs.|j�|�}t|fdg|jd<|jd|_dS)Nr))r+rDr	r)rrEr6rrr�
characters�szPullDOM.characterscCs$|jdkr ddl}|jjjj|_dS)Nr)rZxml.dom.minidomZdomZminidomZDocument�implementation)rrrrr�
startDocument�s
zPullDOM.startDocumentc	Cs�|j�||d�}||_t|fdg|jd<|jd|_|�|�x�|jD]�}|ddtkr�|d\}}}|j�||�}t|f|d<nD|ddt	kr�|j�
|dd�}t	|f|d<ntd|dd��||jd<||_qFWd|_|jS)Nr)rzUnknown pending event )
rZcreateDocumentr+rrrrrr@rr<�AssertionErrorZ
firstChild)	rr%Ztagnamer6�e�_rArB�nrrrr,�s$


zPullDOM.buildDocumentcCs t|jfdg|jd<|��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+rrrr&r'r8r9r:r;r?rCrFrGrIr,rNrOrrrrr

s&
9		r
c@s$eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCst|�dS)N)�print)r�	exceptionrrr�warning�szErrorHandler.warningcCs|�dS)Nr)rrUrrr�error�szErrorHandler.errorcCs|�dS)Nr)rrUrrr�
fatalError�szErrorHandler.fatalErrorN)rPrQrRrVrWrXrrrrrS�srSc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�DOMEventStreamcCs2||_||_||_t|jd�s&|j|_|��dS)N�feed)�stream�parser�bufsizer"�_slurp�getEvent�reset)rr[r\r]rrrr�szDOMEventStream.__init__cCs.t�|_|j�tjjjd�|j�|j�dS)Nr))	r
�pulldomr\Z
setFeaturer�saxZhandlerZfeature_namespacesZsetContentHandler)rrrrr`�szDOMEventStream.resetcCs|��}|r|St�dS)N)r_�
IndexError)r�pos�rcrrr�__getitem__�szDOMEventStream.__getitem__cCs|��}|r|St�dS)N)r_�
StopIteration)rrerrr�__next__�szDOMEventStream.__next__cCs|S)Nr)rrrr�__iter__�szDOMEventStream.__iter__cCsp|��}|g}x\|rj|\}}||kr(dS|tkr>|d�|�|tkrR|�|�n|tkr`|d=|��}qWdS)Nr
)r_r�appendChildrr)rr6r>�parents�tokenZcur_noderrr�
expandNode�szDOMEventStream.expandNodecCs�|jjds|jj|j_x<|jjdsT|j�|j�}|sF|j��dS|j�|�qW|jjdd}|jjdd|jjd<|S)Nr)r)	rarrr[�readr]r\�closerZ)r�bufrerrrr_�s
zDOMEventStream.getEventcCs|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)rar)rrerrrrrszDOMEventStream._emitcCs|j��|`d|_d|_dS)z+clear(): Explicitly release parsing objectsN)rarOr\r[)rrrrrOs
zDOMEventStream.clearN)
rPrQrRrr`rfrhrirmr_r^rrrOrrrrrY�s
rYc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SAX2DOMcCs2t�||||�|jd}|jd}|�|�dS)Nr
���)r
r8rrj)rr2r3r4�curNode�
parentNoderrrr8#s

zSAX2DOM.startElementNScCs0t�|||�|jd}|jd}|�|�dS)Nr
rt)r
r:rrj)rr2r4rurvrrrr:)s

zSAX2DOM.startElementcCs4t�|||�|jdd}|jd}|�|�dS)Nrr)r
)r
rCrrrj)rrArBr6rvrrrrC/s
zSAX2DOM.processingInstructioncCs2t�||�|jdd}|jd}|�|�dS)Nrr)r
)r
rFrrrj)rrEr6rvrrrrF5s
zSAX2DOM.ignorableWhitespacecCs2t�||�|jdd}|jd}|�|�dS)Nrr)r
)r
rGrrrj)rrEr6rvrrrrG;s
zSAX2DOM.charactersN)rPrQrRr8r:rCrFrGrrrrrs!s
rsi�?cCs@|dkrt}t|t�r"t|d�}n|}|s4tj��}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrrb�make_parserrY)Zstream_or_stringr\r]r[rrrrqDs

rqcCs6ddlm}t|�}||�}|s*tj��}t|||�S)Nr)�StringIO)�ior}�lenrrbr|rY)�stringr\r}r]rprrr�parseStringOs
r�)NN)N)Zxml.saxrZxml.sax.handlerrrrrrrrr	rbZContentHandlerr
rSrYrsrxrqr�rrrr�<module>s"8U!


Zerion Mini Shell 1.0