ok

Mini Shell

Direktori : /usr/lib64/python3.6/xml/dom/__pycache__/
Upload File :
Current File : //usr/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/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
)�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|j�fdg|jd<|jd|_dS)Nr
)rrr)rr2r3rrr�endElementNSlszPullDOM.endElementNScCs~|jr|jj|�}n|jd|�}x0|j�D]$\}}|jj|�}||_|j|�q*Wt|fdg|jd<|jd|_|j	|�dS)Nr
)
r+r-r,r.r/r1r0rrr)rr2r4r6r5r1r7rrr�startElementpszPullDOM.startElementcCs&t|j�fdg|jd<|jd|_dS)Nr
)rrr)rr2rrr�
endElementszPullDOM.endElementcCsN|jr2|jj|�}t|fdg|jd<|jd|_nt|fdg}|jj|�dS)Nr
)r+�
createCommentrrrr)r�sr6�eventrrr�comment�szPullDOM.commentcCsR|jr4|jj||�}t|fdg|jd<|jd|_nt||fdg}|jj|�dS)Nr
)r+�createProcessingInstructionrrrr)r�target�datar6r>rrr�processingInstruction�szPullDOM.processingInstructioncCs.|jj|�}t|fdg|jd<|jd|_dS)Nr
)r+�createTextNoderr)r�charsr6rrr�ignorableWhitespace�szPullDOM.ignorableWhitespacecCs.|jj|�}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�|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+rrrrrr@rr<�AssertionErrorZ
firstChild)	rr&Ztagnamer6�e�_rArB�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(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|_|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)rrrrr`�szDOMEventStream.resetcCs|j�}|r|St�dS)N)r_�
IndexError)r�pos�rcrrr�__getitem__�szDOMEventStream.__getitem__cCs|j�}|r|St�dS)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>�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)	rarrr[�readr]r\�closerZ)r�bufrerrrr_�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)rar)rrerrrrrszDOMEventStream._emitcCs|jj�|`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)�SAX2DOMcCs2tj||||�|jd}|jd}|j|�dS)Nr
�r���)r
r8rrj)rr2r3r4�curNode�
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
rsrt��cCs@|dkrt}t|t�r"t|d�}n|}|s4tjj�}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrrb�make_parserrY)Zstream_or_stringr\r]r[rrrrqDs

rqcCs6ddlm}t|�}||�}|s*tjj�}t|||�S)Nr)�StringIO)�ior��lenrrbrrY)�stringr\r�r]rprrr�parseStringOs
r�i@i�?)NN)N)Zxml.saxrZxml.sax.handlerrrrrrrrr	rbZContentHandlerr
rSrYrsr{rqr�rrrr�<module>s"8U!


Zerion Mini Shell 1.0