ok

Mini Shell

Direktori : /opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyo

�
Bu�_c@`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]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__init__)s		(t__name__t
__module__R(((s]/opt/alt/python36/lib/python3.6/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]/opt/alt/python36/lib/python3.6/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]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytappendChild4scC`s|jS(N(R(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getChildNodes;s(RRRRRtpropertyt
childNodes(((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR/s			c`sJg�tjdt��d���fd���|d�dj��S(NtpreventDoubleDashCommentsic
`s
t|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�Wq	t|t�s+t|t
�rI�jd	d||f�q	�jd
�x�|D]}�||d�q]Wn�|jtkr��jdd||jf�t|d�r	|jr	�jd	d||jf�q	n%tjj|j�}|dk	rZ|jd
�}|jd�}tj|}�jdd||�j|�f�n'�jdd|�j|j�f�t|d�rvg}x�|jj�D]�\}	}
tj|	�}|dk	r|j�\}}	�j|	�}	tj|}d||	f}n�j|	�}|j||
f�q�Wx?t|�D].\}	}
�jdd|d|	|
f�qAWn|jr��jd	d|d|jf�n|d7}x|D]}�||�q�Wt|d�r	|jr	�jd	d|d|jf�ndS(Nutagugetrootu	#documentu
<!DOCTYPE %s>u<!DOCTYPE %s "%s" "%s">u|%s%su iu|%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
isinstancetstrtbytesttagtcomment_typettextttailtetree_builderst
tag_regexptmatchtgroupRtprefixestfromXmlNametattribtitemstgroupstsorted(
Rtindenttdtd_strtnext_elementtnsmatchtnsR.tprefixt
attributesRtvaluetattr_stringtchild(t
infosetFiltertrvtserializeElement(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRHEsp
		"

$

)	%

u
(Rt
InfosetFiltertTruetjoin(R((RFRGRHs]/opt/alt/python36/lib/python3.6/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#RR.R/R0R8RKR9R1(RR=RRCtattrRE(RGRH(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRH�s*		2	
u(RK(R((RGRHs]/opt/alt/python36/lib/python3.6/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]/opt/alt/python36/lib/python3.6/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(RF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
_coerceKey�s$cS`sH|jjj|j|�}trDt|t�rD|jd�}n|S(Nuascii(RR8RVR	R+R
tdecode(RRURC((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__getitem__�scS`s ||jjj|j|�<dS(N(RR8RV(RRURC((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__setitem__�scS`s|jjj|j|�=dS(N(RR8RV(RRU((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__delitem__�scS`st|jjj�S(N(titerRR8(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__iter__�scS`st|jjj�S(N(tlenRR8(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__len__�scS`s|jjjj�S(N(RR8tclear(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR_�s(
RRRRVRXRYRZR\R^R_((RF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRR�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
coerceElementR`Rt_attributes(RRRa(RRtbuilderRF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�sc`s4�j|�|_|j|j|j�|j_dS(N(Rbt_namet_getETreeTagt
_namespaceRR.(RR(RF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setName�sc`s�j|j�S(N(R7Re(R(RF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getName�scS`s|jS(N(Rc(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getAttributes�scS`s$|j}|j�|j|�dS(N(RBR_tupdate(RRCRB((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setAttributes�s	
c`s)�j|�}�jj|||�dS(N(tcoerceCharactersR`t
insertText(RtdatatinsertBefore(RdRF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRnscS`sGt|�|j|j�}|jjrC|jjj|jj�n|S(N(ttypeRRaRR8Rk(RR((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt	cloneNodesN(
RRRRhRiRRRjRlRBRRnRr((RRRdRF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR`�s		tCommentc`sAeZ��fd�Z�fd�Zd�Zeee�ZRS(c`s&�j|�}�jj||�dS(N(t
coerceCommentRsR(RRo(RdRF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRsc`s�j|�}||j_dS(N(RtRR0(RRo(RF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_setDatascS`s
|jjS(N(RR0(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getDatas(RRRRuRvRRo((RdRF(s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRs
s	(R2tgetETreeModuleRRRIRJRFtnamespaceHTMLElementsRR`RstelementClasstcommentClassRRPR(RRxRQR`Rs((RRRdRFs]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR�s	 %$"		cC`s2tjj|�|j|_g|_d|_dS(N(RRPtresettinsertCommentInitialt
insertCommenttinitial_commentsRRM(R((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR{s	cC`s
t|�S(N(RL(RR((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRL#scC`s$tr|jjS|jjj�SdS(N(RQtdocumentRR(R((s]/opt/alt/python36/lib/python3.6/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openElementsRR0R#textendtlistR1(RtfragmentR((s]/opt/alt/python36/lib/python3.6/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(twarningstwarnRRRMRFRbtdoctypeClass(RttokenRR
RtcoercedNameRM((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
insertDoctype6s


cC`s|jj|�dS(N(R~R#(RRotparent((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR|FscC`s^||jkrA|jjj�djtkrAtjdt�ntt	|�j
||�dS(Ni����u@lxml cannot represent adjacent comments beyond the root elements(RRRR.R/R�R�RtsuperRPR}(RRoR�((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pytinsertCommentMainKscC`sZd}|jrN|d|jj7}|jjdk	sG|jjdk	r|d|jj|jjped�7}|jjr|jj}|jd�dkr�|jd�dkr�tj	dt
�|jdd�}n|jd�dkr�|d	|7}q|d
|7}q|d7}n|d7}|jj|d
krNtj	dt
�qNn|d7}tj
|�}x4|jD])}|j|d�}|j|j�qqW|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(RMRR
RRRFtcoercePubidtfindR�R�RtreplaceRt
fromstringR~RztaddpreviousRt
documentClassRtgetroottreeRtgettdefaultNamespaceR.RyRR#R�R�R}(RR�tdocStrtsysidtroott
comment_tokentcommentRRat	etree_tagtroot_element((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt
insertRootQsJ	 *



			N(RRRR�RR�RRyRzt
fragmentClassRtimplementationtFalseRR{RLR�R�R�R|R�R�(((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRP�s\				
	($t__doc__t
__future__RRRR�tretsystcollections.abcRtImportErrortcollectionstRRRRR2Rt
lxml.etreetpip._vendor.sixR	R
RJRQtcompileR3RsR.R/tobjectRRRLRORP(((s]/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt<module>
s.
	O	)

Zerion Mini Shell 1.0