ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/xml/dom/__pycache__/pulldom.cpython-38.pyc

U

.��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|_z|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/python38/lib64/python3.8/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��|_dSr)rrr)rr&rrr�endPrefixMapping0szPullDOM.endPrefixMappingcCs�d}t|dd�}|dk	r:|D]\}}||j||f<qg|_|\}}	|r�|dkrn|j|}
|
rj|
d|	}n|	}|jr�|j�||�}q�|�||�}n |jr�|j�|	�}n|�d|	�}|��D]�\}}|\}}
||k�r|
dkr�|
}nd|
}|j�	||�}|�
|�nX|�rF|j|}
|
�r(|
d|
}n|
}|j�	||�}|�
|�n|j�|
�}|�|�||_
q�t|fdg|jd<|jd|_|�|�dS)Nzhttp://www.w3.org/2000/xmlns/r"�:r#zxmlns:�)�getattr�_attrsr"r�documentZcreateElementNS�
buildDocument�
createElement�itemsZcreateAttributeNSZsetAttributeNodeNS�createAttribute�setAttributeNode�valuerrr)r�name�tagName�attrsZ	xmlns_uriZxmlns_attrs�anamer4r'Z	localnamer&�nodeZa_uriZa_localnameZqname�attrrrr�startElementNS3sP



zPullDOM.startElementNScCs&t|��fdg|jd<|jd|_dS�Nr+�rrr)rr5r6rrr�endElementNSlszPullDOM.endElementNScCsz|jr|j�|�}n|�d|�}|��D]$\}}|j�|�}||_|�|�q(t|fdg|jd<|jd|_|�	|�dSr<)
r.r0r/r1r2r4r3rrr)rr5r7r9r8r4r:rrr�startElementpszPullDOM.startElementcCs&t|��fdg|jd<|jd|_dSr<r=)rr5rrr�
endElementszPullDOM.endElementcCsN|jr2|j�|�}t|fdg|jd<|jd|_nt|fdg}|j�|�dSr<)r.�
createCommentrrrr)r�sr9�eventrrr�comment�szPullDOM.commentcCsR|jr4|j�||�}t|fdg|jd<|jd|_nt||fdg}|j�|�dSr<)r.�createProcessingInstructionrrrr)r�target�datar9rCrrr�processingInstruction�szPullDOM.processingInstructioncCs.|j�|�}t|fdg|jd<|jd|_dSr<)r.�createTextNoderr�r�charsr9rrr�ignorableWhitespace�szPullDOM.ignorableWhitespacecCs.|j�|�}t|fdg|jd<|jd|_dSr<)r.rIr	rrJrrr�
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|_|�|�|jD]�}|ddtkr�|d\}}}|j�||�}t|f|d<nD|ddt	kr�|j�
|dd�}t	|f|d<ntd|dd��||jd<||_qDd|_|jS)Nr+rzUnknown pending event )
rZcreateDocumentr.rrrrrrErrA�AssertionErrorZ
firstChild)	rr'Ztagnamer9�e�_rFrG�nrrrr/�s$


zPullDOM.buildDocumentcCs t|jfdg|jd<|��dSr<)rr.rr�rrrr�endDocument�szPullDOM.endDocumentcCs
d|_dS)z.clear(): Explicitly release parsing structuresN)r.rTrrr�clear�sz
PullDOM.clear)N)�__name__�
__module__�__qualname__r r.rrr!r(r)r;r>r?r@rDrHrLrMrOr/rUrVrrrrr

s&
9		r
c@s$eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCst|�dSr)�print�rZ	exceptionrrr�warning�szErrorHandler.warningcCs|�dSrrr\rrr�error�szErrorHandler.errorcCs|�dSrrr\rrr�
fatalError�szErrorHandler.fatalErrorN)rWrXrYr]r^r_rrrrrZ�srZc@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)rrbrcrdrrrr�szDOMEventStream.__init__cCs.t�|_|j�tjjjd�|j�|j�dSr<)	r
�pulldomrcZ
setFeaturer�saxZhandlerZfeature_namespacesZsetContentHandlerrTrrrrg�szDOMEventStream.resetcCs0ddl}|jdtdd�|��}|r(|St�dS)Nrz[DOMEventStream's __getitem__ method ignores 'pos' parameter. Use iterator protocol instead.�)�
stacklevel)�warnings�warn�DeprecationWarningrf�
IndexError)r�posrl�rcrrr�__getitem__�s�zDOMEventStream.__getitem__cCs|��}|r|St�dSr)rf�
StopIteration�rrqrrr�__next__�szDOMEventStream.__next__cCs|SrrrTrrr�__iter__�szDOMEventStream.__iter__cCsl|��}|g}|rh|\}}||kr&dS|tkr<|d�|�|tkrP|�|�n|tkr^|d=|��}qdSr)rfr�appendChildrr)rr9rC�parents�tokenZcur_noderrr�
expandNode�szDOMEventStream.expandNodecCs~|jjds|jj|j_|jjdsR|j�|j�}|sD|j��dS|j�|�q|jjdd}|jjdd|jjd<|S)Nr+r)	rhrrrb�readrdrc�closera)r�bufrqrrrrfs
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).
        )rc�parserb�_emitrfrTrrrreszDOMEventStream._slurpcCs,|jjdd}|jjdd|jjd<|S)zn Fallback replacement for getEvent() that emits
            the events that _slurp() read previously.
        r+r)rhrrtrrrrszDOMEventStream._emitcCs|j��|`d|_d|_dS)z+clear(): Explicitly release parsing objectsN)rhrVrcrbrTrrrrV!s
zDOMEventStream.clearN)
rWrXrYrrgrrrurvrzrfrerrVrrrrr`�s

r`c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SAX2DOMcCs2t�||||�|jd}|jd}|�|�dS�Nr
���)r
r;rrw)rr5r6r7�curNode�
parentNoderrrr;*s

zSAX2DOM.startElementNScCs0t�|||�|jd}|jd}|�|�dSr�)r
r?rrw)rr5r7r�r�rrrr?0s

zSAX2DOM.startElementcCs4t�|||�|jdd}|jd}|�|�dS�Nrr+r
)r
rHrrrw)rrFrGr9r�rrrrH6s
zSAX2DOM.processingInstructioncCs2t�||�|jdd}|jd}|�|�dSr�)r
rLrrrw�rrKr9r�rrrrL<s
zSAX2DOM.ignorableWhitespacecCs2t�||�|jdd}|jd}|�|�dSr�)r
rMrrrwr�rrrrMBs
zSAX2DOM.charactersN)rWrXrYr;r?rHrLrMrrrrr�(s
r�i�?cCs@|dkrt}t|t�r"t|d�}n|}|s4tj��}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrri�make_parserr`)Zstream_or_stringrcrdrbrrrr~Ks

r~cCs6ddlm}t|�}||�}|s*tj��}t|||�S)Nr)�StringIO)�ior��lenrrir�r`)�stringrcr�rdr}rrr�parseStringVs
r�)NN)N)Zxml.saxrZxml.sax.handlerrrrrrrrr	riZContentHandlerr
rZr`r�r�r~r�rrrr�<module>s"8\!


Zerion Mini Shell 1.0