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.opt-2.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:�)�getattrZ_attrsr"r�documentZcreateElementNS�
buildDocument�
createElement�itemsZcreateAttributeNSZsetAttributeNodeNS�createAttribute�setAttributeNode�valuerrr)r�name�tagName�attrsZ	xmlns_uriZxmlns_attrs�anamer3r'Z	localnamer&�nodeZa_uriZa_localnameZqname�attrrrr�startElementNS3sP



zPullDOM.startElementNScCs&t|��fdg|jd<|jd|_dS�Nr+�rrr)rr4r5rrr�endElementNSlszPullDOM.endElementNScCsz|jr|j�|�}n|�d|�}|��D]$\}}|j�|�}||_|�|�q(t|fdg|jd<|jd|_|�	|�dSr;)
r-r/r.r0r1r3r2rrr)rr4r6r8r7r3r9rrr�startElementpszPullDOM.startElementcCs&t|��fdg|jd<|jd|_dSr;r<)rr4rrr�
endElementszPullDOM.endElementcCsN|jr2|j�|�}t|fdg|jd<|jd|_nt|fdg}|j�|�dSr;)r-�
createCommentrrrr)r�sr8�eventrrr�comment�szPullDOM.commentcCsR|jr4|j�||�}t|fdg|jd<|jd|_nt||fdg}|j�|�dSr;)r-�createProcessingInstructionrrrr)r�target�datar8rBrrr�processingInstruction�szPullDOM.processingInstructioncCs.|j�|�}t|fdg|jd<|jd|_dSr;)r-�createTextNoderr�r�charsr8rrr�ignorableWhitespace�szPullDOM.ignorableWhitespacecCs.|j�|�}t|fdg|jd<|jd|_dSr;)r-rHr	rrIrrr�
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-rrrrrrDrr@�AssertionErrorZ
firstChild)	rr'Ztagnamer8�e�_rErF�nrrrr.�s$


zPullDOM.buildDocumentcCs t|jfdg|jd<|��dSr;)rr-rr�rrrr�endDocument�szPullDOM.endDocumentcCs
d|_dSr)r-rSrrr�clear�sz
PullDOM.clear)N)�__name__�
__module__�__qualname__r r-rrr!r(r)r:r=r>r?rCrGrKrLrNr.rTrUrrrrr

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)rVrWrXr\r]r^rrrrrY�srYc@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)rrarbrcrrrr�szDOMEventStream.__init__cCs.t�|_|j�tjjjd�|j�|j�dSr;)	r
�pulldomrbZ
setFeaturer�saxZhandlerZfeature_namespacesZsetContentHandlerrSrrrrf�szDOMEventStream.resetcCs0ddl}|jdtdd�|��}|r(|St�dS)Nrz[DOMEventStream's __getitem__ method ignores 'pos' parameter. Use iterator protocol instead.�)�
stacklevel)�warnings�warn�DeprecationWarningre�
IndexError)r�posrk�rcrrr�__getitem__�s�zDOMEventStream.__getitem__cCs|��}|r|St�dSr)re�
StopIteration�rrprrr�__next__�szDOMEventStream.__next__cCs|SrrrSrrr�__iter__�szDOMEventStream.__iter__cCsl|��}|g}|rh|\}}||kr&dS|tkr<|d�|�|tkrP|�|�n|tkr^|d=|��}qdSr)rer�appendChildrr)rr8rB�parents�tokenZcur_noderrr�
expandNode�szDOMEventStream.expandNodecCs~|jjds|jj|j_|jjdsR|j�|j�}|sD|j��dS|j�|�q|jjdd}|jjdd|jjd<|S�Nr+r)	rgrrra�readrcrb�closer`)r�bufrprrrres
zDOMEventStream.getEventcCs|j�|j�|j|_|��Sr)rb�parsera�_emitrerSrrrrdszDOMEventStream._slurpcCs,|jjdd}|jjdd|jjd<|Srz)rgrrsrrrrszDOMEventStream._emitcCs|j��|`d|_d|_dSr)rgrUrbrarSrrrrU!s
zDOMEventStream.clearN)
rVrWrXrrfrqrtruryrerdrrUrrrrr_�s

r_c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SAX2DOMcCs2t�||||�|jd}|jd}|�|�dS�Nr
���)r
r:rrv)rr4r5r6�curNode�
parentNoderrrr:*s

zSAX2DOM.startElementNScCs0t�|||�|jd}|jd}|�|�dSr�)r
r>rrv)rr4r6r�r�rrrr>0s

zSAX2DOM.startElementcCs4t�|||�|jdd}|jd}|�|�dS�Nrr+r
)r
rGrrrv)rrErFr8r�rrrrG6s
zSAX2DOM.processingInstructioncCs2t�||�|jdd}|jd}|�|�dSr�)r
rKrrrv�rrJr8r�rrrrK<s
zSAX2DOM.ignorableWhitespacecCs2t�||�|jdd}|jd}|�|�dSr�)r
rLrrrvr�rrrrLBs
zSAX2DOM.charactersN)rVrWrXr:r>rGrKrLrrrrr�(s
r�i�?cCs@|dkrt}t|t�r"t|d�}n|}|s4tj��}t|||�S)N�rb)�default_bufsize�
isinstance�str�openrrh�make_parserr_)Zstream_or_stringrbrcrarrrr~Ks

r~cCs6ddlm}t|�}||�}|s*tj��}t|||�S)Nr)�StringIO)�ior��lenrrhr�r_)�stringrbr�rcr}rrr�parseStringVs
r�)NN)N)Zxml.saxrZxml.sax.handlerrrrrrrrr	rhZContentHandlerr
rYr_r�r�r~r�rrrr�<module>s"8\!


Zerion Mini Shell 1.0