ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/xml/dom/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/xml/dom/__pycache__/pulldom.cpython-34.pyc

�
j f�-�@s�ddlZddlZdZdZdZdZdZdZdZ	d	Z
Gd
d�dejj�Z
Gdd
�d
�ZGdd�d�ZGdd�de
�ZdZdddd�Zddd�ZdS)�N�
START_ELEMENT�END_ELEMENT�COMMENT�START_DOCUMENT�END_DOCUMENT�PROCESSING_INSTRUCTION�IGNORABLE_WHITESPACE�
CHARACTERSc@s�eZdZdZdZddd�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)$�PullDOMNcCs�ddlm}||_ddg|_|j|_g|_|jj|_y|jj|_Wnt	k
rsYnXid|6g|_
|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/python34/lib64/python3.4/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.setDocumentLocatorcCsgt|d�sg|_n|jj|p-d|f�|jj|jj��|pYd|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	rZx'|D]\}}||j||f<q+Wg|_n|\}}	|r�|dkr�|j|}
|
r�|
d|	}q�|	}n|jr�|jj||�}q|j||�}n0|jr�|jj|	�}n|jd|	�}x�|j�D]�\}}|\}}
||kr�|
dkrQ|
}n
d|
}|jj	||�}|j
|�nt|r�|j|}
|
r�|
d|
}n|
}|jj	||�}|j
|�n|jj|
�}|j|�||_
qWt|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.startElementNScCs3t|j�fdg|jd<|jd|_dS)Nr
)rrr)rr2r3rrr�endElementNSlszPullDOM.endElementNScCs�|jr|jj|�}n|jd|�}xB|j�D]4\}}|jj|�}||_|j|�q=Wt|fdg|jd<|jd|_|j	|�dS)Nr
)
r+r-r,r.r/r1r0rrr)rr2r4r6r5r1r7rrr�startElementps		zPullDOM.startElementcCs3t|j�fdg|jd<|jd|_dS)Nr
)rrr)rr2rrr�
endElementszPullDOM.endElementcCsm|jrG|jj|�}t|fdg|jd<|jd|_n"t|fdg}|jj|�dS)Nr
)r+�
createCommentrrrr)r�sr6�eventrrr�comment�s	zPullDOM.commentcCss|jrJ|jj||�}t|fdg|jd<|jd|_n%t||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�szPullDOM.ignorableWhitespacecCs?|jj|�}t|fdg|jd<|jd|_dS)Nr
)r+rDr	r)rrEr6rrr�
characters�szPullDOM.characterscCs7|jdkr3ddl}|jjjj|_ndS)Nr)rZxml.dom.minidomZdomZminidomZDocument�implementation)rrrrr�
startDocument�szPullDOM.startDocumentc	Cs8|jj||d�}||_t|fdg|jd<|jd|_|j|�x�|jD]�}|ddtkr�|d\}}}|jj||�}t|f|d<nX|ddt	kr�|jj
|dd�}t	|f|d<ntd|dd��||jd<||_qaWd|_|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)�__name__�
__module__�__qualname__rr+rrr r'r(r8r9r:r;r?rCrFrGrIr,rNrOrrrrr

s&9		r
c@s4eZdZdd�Zdd�Zdd�ZdS)�ErrorHandlercCst|�dS)N)�print)r�	exceptionrrr�warning�szErrorHandler.warningcCs
|�dS)Nr)rrUrrr�error�szErrorHandler.errorcCs
|�dS)Nr)rrUrrr�
fatalError�szErrorHandler.fatalErrorN)rPrQrRrVrWrXrrrrrS�srSc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�DOMEventStreamcCsJ||_||_||_t|jd�s<|j|_n|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`�szDOMEventStream.resetcCs |j�}|r|St�dS)N)r_�
IndexError)r�pos�rcrrr�__getitem__�szDOMEventStream.__getitem__cCs |j�}|r|St�dS)N)r_�
StopIteration)rrerrr�__next__�szDOMEventStream.__next__cCs|S)Nr)rrrr�__iter__�szDOMEventStream.__iter__cCs�|j�}|g}x�|r�|\}}||kr:dS|tkrZ|dj|�n|tkrv|j|�n|tkr�|d=n|j�}qWdS)Nr
rr)r_r�appendChildrr)rr6r>�parents�tokenZcur_noderrr�
expandNode�s		
zDOMEventStream.expandNodecCs�|jjds%|jj|j_nxP|jjdsw|jj|j�}|sd|jj�dS|jj|�q(W|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^szDOMEventStream._slurpcCs6|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@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SAX2DOMcCsAtj||||�|jd}|jd}|j|�dS)Nr
�r���)r
r8rrj)rr2r3r4�curNode�
parentNoderrrr8#s

zSAX2DOM.startElementNScCs>tj|||�|jd}|jd}|j|�dS)Nr
rtrru)r
r:rrj)rr2r4rvrwrrrr:)s

zSAX2DOM.startElementcCsBtj|||�|jdd}|jd}|j|�dS)Nrr
r)r
rCrrrj)rrArBr6rwrrrrC/s
zSAX2DOM.processingInstructioncCs?tj||�|jdd}|jd}|j|�dS)Nrr
r)r
rFrrrj)rrEr6rwrrrrF5s
zSAX2DOM.ignorableWhitespacecCs?tj||�|jdd}|jd}|j|�dS)Nrr
r)r
rGrrrj)rrEr6rwrrrrG;s
zSAX2DOM.charactersN)rPrQrRr8r:rCrFrGrrrrrs!s
rsrt��cCsd|dkrt}nt|t�r6t|d�}n|}|sTtjj�}nt|||�S)N�rb)�default_bufsize�
isinstance�str�openrrb�make_parserrY)Zstream_or_stringr\r]r[rrrrqDs	rqcCsPddlm}t|�}||�}|s@tjj�}nt|||�S)Nr)�StringIO)�ior��lenrrbrrY)�stringr\r�r]rprrr�parseStringOsr�i@i�?)Zxml.saxrZxml.sax.handlerrrrrrrrr	rbZContentHandlerr
rSrYrsr{rqr�rrrr�<module>s �U!

Zerion Mini Shell 1.0