Your IP : 3.21.46.129


Current Path : /opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyc

�
�Rec@`sudZddlmZmZmZddlZddlZddlZyddlm	Z	Wn!e
k
r}ddlm	Z	nXddlm
Z
ddlmZdd	lmZdd
lmZddlmZddljZddlmZmZeZejd
�Zejd�jZdefd��YZdefd��YZ d�Z!d�Z"de
j#fd��YZ#dS(u�Module for supporting the lxml.etree library. The idea here is to use as much
of the native library as possible, without using fragile hacks like custom element
names that break between releases. The downside of this is that we cannot represent
all possible trees; specifically the following are known to cause problems:

Text or comments as siblings of the root element
Docypes with no name

When any of these things occur, we emit a DataLossWarning
i(tabsolute_importtdivisiontunicode_literalsN(tMutableMappingi(tbasei(tDataLossWarning(t	constants(tetree(t	_ihatexml(tPY3tbinary_typeu
{([^}]*)}(.*)uasdtDocumentTypecB`seZd�ZRS(cC`s||_||_||_dS(N(tnametpublicIdtsystemId(tselfRR
R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__init__)s		(t__name__t
__module__R(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR(stDocumentcB`s/eZd�Zd�Zd�Zee�ZRS(cC`sd|_g|_dS(N(tNonet_elementTreet_childNodes(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR0s	cC`sC|jj�}x|jj�j�D]}q%W|j|j�dS(N(Rtgetroottitersiblingstaddnextt_element(Rtelementtlast((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytappendChild4scC`s|jS(N(R(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getChildNodes;s(RRRRRtpropertyt
childNodes(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR/s			c`sJg�tjdt��d���fd���|d�dj��S(NtpreventDoubleDashCommentsic
`sMt|d�s�t|d�r
�jd�|jjr�|jjpL|jjsbd|jj}n%d|jj|jj|jjf}�jdd|d|f�n|j�}x"|j�dk	r�|j�}q�Wx�|dk	r	�||d�|j
�}q�WqIt|t�s+t|t
�rqt|t�sStjd	dksSt��jd
d||f�qI�jd�x�|D]}�||d�q�Wn�|jtkr�jdd||jf�t|d
�rI|jrI�jd
d||jf�qIn=t|tj�s$t�tjj|j�}|dk	r�|jd�}|jd�}tj|}�jdd||�j|�f�n'�jdd|�j|j�f�t|d�r�g}x�|jj�D]�\}	}
tj|	�}|dk	rN|j �\}}	�j|	�}	tj|}d||	f}n�j|	�}|j||
f�q�Wx?t!|�D].\}	}
�jdd|d|	|
f�q�Wn|jr��jd
d|d|jf�n|d7}x|D]}�||�q�Wt|d
�rI|jrI�jd
d|d|jf�ndS(Nutagugetrootu	#documentu
<!DOCTYPE %s>u<!DOCTYPE %s "%s" "%s">u|%s%su iiu|%s"%s"u#document-fragmentu|%s<!-- %s -->utailiu
|%s<%s %s>u|%s<%s>uattribu%s %su
|%s%s="%s"("thasattrtappendtdocinfotinternalDTDt	public_idt
system_urlt	root_nameRtgetpreviousRtgetnextt
isinstancetstrtbytestsystversion_infotAssertionErrorttagtcomment_typettextttailRt_Elementtetree_builderst
tag_regexptmatchtgroupRtprefixestfromXmlNametattribtitemstgroupstsorted(
Rtindenttdtd_strtnext_elementtnsmatchtnsR1tprefixt
attributesRtvaluetattr_stringtchild(t
infosetFiltertrvtserializeElement(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRLEst
		"(

$

)	%

u
(Rt
InfosetFiltertTruetjoin(R((RJRKRLs�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttestSerializerAs
F
c`s/g���fd���|�dj��S(u4Serialize an element and its child nodes to a stringc`s�t|d�si|jjrV|jjr6|jj}nd|jj}�j|�n�|j��n�|jtkr��jd|j	f�n�|j
s��jd|jf�nUdjg|j
j�D]\}}d||f^q��}�jd|j|f�|j	r&�j|j	�nx|D]}�|�q-W�jd|jf�t|d	�r�|j
r��j|j
�ndS(
Nutagu
<!DOCTYPE %s>u	<!--%s-->u<%s>u u%s="%s"u<%s %s>u</%s>utail(R"R$R%tdoctypeR(R#RR1R2R3R<ROR=R4(RRARRGtattrRI(RKRL(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRL�s*		2	
u(RO(R((RKRLs�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttostring�s 
tTreeBuildercB`s�eZeZeZd	Zd	ZeZ	e
Zed�Z
d�Zd�Zd�Zd�Zd�Zd	d�Zd	d�Zd�ZRS(
c`s�tjtd|��tjdt��|_||_dtf�fd��Y�d�j	f���fd��Y}d�j
f��fd��Y}||_||_t
jj||�dS(	NtfullTreeR!t
Attributesc`sVeZd�Z�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cS`s
||_dS(N(R(RR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�sc`sFt|t�r3d|d�j|d�f}n�j|�}|S(Nu{%s}%sii(R+ttupletcoerceAttribute(RtkeyR(RJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
_coerceKey�s$cS`sH|jjj|j|�}trDt|t�rD|jd�}n|S(Nuascii(RR<RZR	R+R
tdecode(RRYRG((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__getitem__�scS`s ||jjj|j|�<dS(N(RR<RZ(RRYRG((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__setitem__�scS`s|jjj|j|�=dS(N(RR<RZ(RRY((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__delitem__�scS`st|jjj�S(N(titerRR<(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__iter__�scS`st|jjj�S(N(tlenRR<(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__len__�scS`s|jjjj�S(N(RR<tclear(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRc�s(
RRRRZR\R]R^R`RbRc((RJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRV�s						tElementc`s�eZ���fd�Z�fd�Z�fd�Zeee�Zd�Zd�Zeee�Z	d��fd�Zd�ZRS(c`s;�j|�}�jj||d|��|�|_dS(Nt	namespace(t
coerceElementRdRt_attributes(RRRe(RVtbuilderRJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�sc`s4�j|�|_|j|j|j�|j_dS(N(Rft_namet_getETreeTagt
_namespaceRR1(RR(RJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setName�sc`s�j|j�S(N(R;Ri(R(RJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getName�scS`s|jS(N(Rg(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getAttributes�scS`s$|j}|j�|j|�dS(N(RFRctupdate(RRGRF((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setAttributes�s	
c`s)�j|�}�jj|||�dS(N(tcoerceCharactersRdt
insertText(RtdatatinsertBefore(RhRJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRrscS`sGt|�|j|j�}|jjrC|jjj|jj�n|S(N(ttypeRReRR<Ro(RR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt	cloneNodesN(
RRRRlRmRRRnRpRFRRrRv((RVRhRJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRd�s		tCommentc`sAeZ��fd�Z�fd�Zd�Zeee�ZRS(c`s&�j|�}�jj||�dS(N(t
coerceCommentRwR(RRs(RhRJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRsc`s�j|�}||j_dS(N(RxRR3(RRs(RJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setDatascS`s
|jjS(N(RR3(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getDatas(RRRRyRzRRs((RhRJ(s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRw
s	(R6tgetETreeModuleRRRMRNRJtnamespaceHTMLElementsRRdRwtelementClasstcommentClassRRTR(RR|RURdRw((RVRhRJs�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�s	 %$"		cC`s2tjj|�|j|_g|_d|_dS(N(RRTtresettinsertCommentInitialt
insertCommenttinitial_commentsRRQ(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRs	cC`s
t|�S(N(RP(RR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRP#scC`s$tr|jjS|jjj�SdS(N(RUtdocumentRR(R((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytgetDocument&s
cC`seg}|jdj}|jr2|j|j�n|jt|��|jra|j|j�n|S(Ni(topenElementsRR3R#textendtlistR4(RtfragmentR((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytgetFragment,s		cC`s�|d}|d}|d}|s@tjdt�d|_nO|jj|�}||krqtjdt�n|j|||�}||_dS(NunameupublicIdusystemIdu#lxml cannot represent empty doctypeu%lxml cannot represent non-xml doctype(twarningstwarnRRRQRJRftdoctypeClass(RttokenRR
RtcoercedNameRQ((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
insertDoctype6s


cC`sM|dks!||jks!t�|jjdks9t�|jj|�dS(N(RR�R0RR�R#(RRstparent((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�Fs!cC`s^||jkrA|jjj�djtkrAtjdt�ntt	|�j
||�dS(Ni����u@lxml cannot represent adjacent comments beyond the root elements(R�RRR1R2R�R�RtsuperRTR�(RRsR�((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytinsertCommentMainKscC`sld}|jr`|jjs!t�|d|jj7}|jjdk	sY|jjdk	r*|d|jj|jjpwd�7}|jjr|jj}|jd�dkr�|jd�dkr�t	j
dt�|jdd�}n|jd�dkr|d	|7}q'|d
|7}q*|d7}n|d7}|jj|d
kr`t	j
dt�q`n|d7}t
j|�}x4|jD])}|j|d�}|j|j�q�W|j�|_|j�|j_|d
}|jd|j�}|dkr|}	nd||f}	|	|_|j||�}
||
_|jjj|
�|jj|
�|j|_dS(Nuu<!DOCTYPE %su
 PUBLIC "%s" u'iu"u6DOCTYPE system cannot contain single and double quotesuU00027u"%s"u'%s'u''u>unameuGlxml cannot represent doctype with a different name to the root elementu$<THIS_SHOULD_NEVER_APPEAR_PUBLICLY/>udatau	namespaceu{%s}%s( RQRR0R
RRRJtcoercePubidtfindR�R�RtreplaceRt
fromstringR�R~taddpreviousRt
documentClassR�tgetroottreeRtgettdefaultNamespaceR1R}RR#R�R�R�(RR�tdocStrtsysidtroott
comment_tokentcommentRRet	etree_tagtroot_element((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
insertRootQsL	 *



			N(RRRR�RR�RR}R~t
fragmentClassRtimplementationtFalseRRRPR�R�R�R�R�R�(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRT�s\				
	($t__doc__t
__future__RRRR�treR.tcollections.abcRtImportErrortcollectionstRRRRR6Rt
lxml.etreetpip._vendor.sixR	R
RNRUtcompileR7RwR1R2tobjectRRRPRSRT(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt<module>
s.
	O	)

?>