ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/site-packages/lxml/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/usr/lib64/python2.7/site-packages/lxml/sax.pyc

�
;�gQc@s�dZddlmZddlmZddlmZmZddlmZm	Z	dej
fd��YZd�Zd	efd
��YZ
defd��YZd
�ZdS(sI
SAX-based adapter to copy trees from/to the Python standard library.

Use the `ElementTreeContentHandler` class to build an ElementTree from
SAX events.

Use the `ElementTreeProducer` class or the `saxify()` function to fire
the SAX events of an ElementTree against a SAX ContentHandler.

See http://codespeak.net/lxml/sax.html
i����(tContentHandler(tetree(tElementTreet
SubElement(tCommenttProcessingInstructiontSaxErrorcBseZdZRS(sGeneral SAX error.
    (t__name__t
__module__t__doc__(((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRscCs8|ddkr*t|djdd��Sd|fSdS(Nit{it}(ttupletsplittNone(ttag((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt	_getNsTagstElementTreeContentHandlercBs�eZdZdd�Zd�Zeedej�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
dd
�Zd�Zd�Zdd
�Zd�Zd�ZeZRS(s/Build an lxml ElementTree from SAX events.
    cCsed|_g|_g|_d|_idgd6|_i|_|dkrXtj}n||_	dS(N(
Rt_roott_root_siblingst_element_stackt_default_nst_ns_mappingt
_new_mappingsRtElementt_makeelement(tselftmakeelement((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt__init__!s					cCs
t|j�S(s=Contains the generated ElementTree after parsing is finished.(RR(R((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt
_get_etree,stdoccCsdS(N((Rtlocator((s./usr/lib64/python2.7/site-packages/lxml/sax.pytsetDocumentLocator2scCsdS(N((R((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt
startDocument5scCsdS(N((R((s./usr/lib64/python2.7/site-packages/lxml/sax.pytendDocument8scCse||j|<y|j|j|�Wn!tk
rH|g|j|<nX|dkra||_ndS(N(RRtappendtKeyErrorRR(Rtprefixturi((s./usr/lib64/python2.7/site-packages/lxml/sax.pytstartPrefixMapping;s

cCs7|j|}|j�|dkr3|d|_ndS(Ni����(RtpopRR(RR%tns_uri_list((s./usr/lib64/python2.7/site-packages/lxml/sax.pytendPrefixMappingDs

cCsH|\}}|rd|}n%|jr>d|j|f}n|}|S(Ns{%s}%s(R(Rt
ns_name_tupletns_urit
local_nametel_tag((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt	_buildTagJs
	c
CsM|j|�}|r�i}y|j�}Wntk
rJ|j�}nXxH|D]7\}}|drud|}	n
|d}	|||	<qRWnd}|j}
|jdkr|j|||j�}|_|j	r	t
|d�r	x!|j	D]}|j|�q�Wn|j	2nt|
d|||j�}|
j
|�|jj�dS(Nis{%s}%sitaddpreviousi����(R/t	iteritemstAttributeErrortitemsRRRRRRthasattrR0RR#tclear(
Rtns_nametqnamet
attributestel_nametattrstiter_attributest
name_tupletvaluet	attr_namet
element_stacktelementtsibling((s./usr/lib64/python2.7/site-packages/lxml/sax.pytstartElementNSTs0



	


cCsIt||�}|jdkr1|jj|�n|jdj|�dS(Ni����(RRRRR#R(Rttargettdatatpi((s./usr/lib64/python2.7/site-packages/lxml/sax.pytprocessingInstructionuscCsD|jj�}|j|�}||jkr@td|��ndS(NsUnexpected element closed: (RR(R/RR(RR6R7R@R.((s./usr/lib64/python2.7/site-packages/lxml/sax.pytendElementNS|scCs]|r@tg|j�D]\}}d|f|f^q�}n|jd|f||�dS(N(tdictR3RRB(RtnameR8tktv((s./usr/lib64/python2.7/site-packages/lxml/sax.pytstartElement�s7cCs|jd|f|�dS(N(RGR(RRI((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt
endElement�scCs_|jd}y$|d}|jp&d||_Wn'tk
rZ|jpMd||_nXdS(Ni����t(Rttailt
IndexErrorttext(RRDtlast_element((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt
characters�s


N(RRR	RRRtpropertyRR R!R"R'R*R/RBRFRGRLRMRStignorableWhitespace(((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRs"								
!				
tElementTreeProducercBs2eZdZd�Zd�Zd�Zd�ZRS(s5Produces SAX events for an element and children.
    cCsky|j�}Wntk
r)|}nX||_||_ddlm}||_|ii�|_dS(Ni����(tAttributesNSImpl(tgetrootR2t_elementt_content_handlertxml.sax.xmlreaderRWt_attr_classt_empty_attributes(Rtelement_or_treetcontent_handlerR@t
attr_class((s./usr/lib64/python2.7/site-packages/lxml/sax.pyR�s

			cCs|jj�|j}t|d�r�g}|j�}x5t|dd�tkrn|j|�|j�}q:Wx.|ddd�D]}|j	|i�q�Wn|j	|i�t|d�r	|j
�}x;t|dd�tkr|j	|i�|j
�}q�Wn|jj�dS(NtgetpreviousRi����tgetnext(RZR!RYR4RatgetattrRRR#t_recursive_saxifyRbR"(RR@tsiblingsRA((s./usr/lib64/python2.7/site-packages/lxml/sax.pytsaxify�s"
	
cCs|j}|j}|tks*|tkro|tkrO|j|j|j�n|jrk|j|j�ndSg}|j	}|j
�}|r�i}i}	xK|D]C\}
}t|
�}|||<||d|d||�|	|<q�W|j||	�}
n	|j
}
t|�\}}|||||�}x$|D]\}}|j||�q6W|j||f||
�|jr�|j|j�nx|D]}|j||�q�W|j||f|�x!|D]\}}|j|�q�W|jr|j|j�ndS(Nii(RZRRRRFRCRQRORSt_build_qnameR3RR\R]R'RBRdRGR*(RR@tprefixesR_Rtnew_prefixestbuild_qnametattribstattr_valuestattr_qnamestattr_ns_nameR=t
attr_ns_tupletsax_attributesR,R-R7R%R&tchild((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRd�sJ				
"	
	
	cCsi|dkr|Sy||}Wn<tk
r\dt|�}||<|j||f�nX|d|S(Nsns%02dt:(RR$tlenR#(RR,R-RhRiR%((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRg�s
(RRR	RRfRdRg(((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRV�s
			+cCst||�j�S(slOne-shot helper to generate SAX events from an XML tree and fire
    them against a SAX ContentHandler.
    (RVRf(R^R_((s./usr/lib64/python2.7/site-packages/lxml/sax.pyRf�sN(R	txml.sax.handlerRtlxmlRt
lxml.etreeRRRRt	LxmlErrorRRRtobjectRVRf(((s./usr/lib64/python2.7/site-packages/lxml/sax.pyt<module>s	{Z

Zerion Mini Shell 1.0