Your IP : 18.117.105.184


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/base.pyc

�
�Rec@`s\ddlmZmZmZddlmZddlmZmZm	Z	dZiee�e
fd6eee	ddfhB�e
fd6eee	ddfe	ddfhB�e
fd	6ee	ddfe	dd
fg�e
fd
6ee	ddfe	ddfg�efd
6Zdefd��YZdefd��YZdefd��YZdS(i(tabsolute_importtdivisiontunicode_literals(t	text_typei(tscopingElementsttableInsertModeElementst
namespacesuhtmlubuttonuoluululistutableuoptgroupuoptionuselecttNodecB`skeZdZd�Zd�Zd�Zd�Zdd�Zd�Z	d�Z
d�Zd	�Zd
�Z
RS(uRepresents an item in the treecC`s:||_d|_d|_i|_g|_g|_dS(uRCreates a Node

        :arg name: The tag name associated with the node

        N(tnametNonetparenttvaluet
attributest
childNodest_flags(tselfR((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/base.pyt__init__s					cC`sadjg|jj�D]\}}d||f^q�}|rRd|j|fSd|jSdS(Nu u%s="%s"u<%s %s>u<%s>(tjoinRtitemsR(RRRt
attributesStr((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/base.pyt__str__-s
	2cC`sd|jS(Nu<%s>(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/base.pyt__repr__6scC`s
t�dS(u[Insert node as a child of the current node

        :arg node: the node to insert

        N(tNotImplementedError(Rtnode((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/base.pytappendChild9scC`s
t�dS(uBInsert data as text in the current node, positioned before the
        start of node insertBefore or to the end of the node's text.

        :arg data: the data to insert

        :arg insertBefore: True if you want to insert the text before the node
            and False if you want to insert it after the node

        N(R(RtdatatinsertBefore((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/base.pyt
insertTextAs
cC`s
t�dS(uInsert node as a child of the current node, before refNode in the
        list of child nodes. Raises ValueError if refNode is not a child of
        the current node

        :arg node: the node to insert

        :arg refNode: the child node to insert the node before

        N(R(RRtrefNode((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/base.pyRMs
cC`s
t�dS(uhRemove node from the children of the current node

        :arg node: the child node to remove

        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/base.pytremoveChildYscC`s.x|jD]}|j|�q
Wg|_dS(u�Move all the children of the current node to newParent.
        This is needed so that trees that don't store text as nodes move the
        text in the correct way

        :arg newParent: the node to move all this node's children to

        N(R
R(Rt	newParenttchild((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/base.pytreparentChildrenas	cC`s
t�dS(u�Return a shallow copy of the current node i.e. a node with the same
        name and attributes but with no parent or child nodes
        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/base.pyt	cloneNodenscC`s
t�dS(uFReturn true if the node has children or text, false otherwise
        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/base.pyt
hasContenttsN(t__name__t
__module__t__doc__RRRRR	RRRR 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/base.pyRs								
	tActiveFormattingElementscB`seZd�Zd�ZRS(cC`s�d}|tkrxj|ddd�D]R}|tkr<Pn|j||�r[|d7}n|dkr&|j|�Pq&q&Wntj||�dS(Nii����ii(tMarkert
nodesEqualtremovetlisttappend(RRt
equalCounttelement((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/base.pyR+{s

cC`s0|j|jkstS|j|jks,tStS(N(t	nameTupletFalseRtTrue(Rtnode1tnode2((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/base.pyR(�s
(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/base.pyR&zs	
tTreeBuildercB`s�eZdZdZdZdZdZdZd�Z	d�Z
dd�Zd�Zd�Z
d�Zd�Zd�Zdd	�Zd
�Zd�Zd�Zeee�Zd
�Zd�Zdd�Zd�Zdd�Zd�Zd�Zd�ZRS(uBase treebuilder implementation

    * documentClass - the class to use for the bottommost node of a document
    * elementClass - the class to use for HTML Elements
    * commentClass - the class to use for comments
    * doctypeClass - the class to use for doctypes

    cC`s)|rd|_n	d|_|j�dS(umCreate a TreeBuilder

        :arg namespaceHTMLElements: whether or not to namespace HTML elements

        uhttp://www.w3.org/1999/xhtmlN(tdefaultNamespaceR	treset(RtnamespaceHTMLElements((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/base.pyR�s	cC`sCg|_t�|_d|_d|_t|_|j�|_	dS(N(
topenElementsR&tactiveFormattingElementsR	theadPointertformPointerR/tinsertFromTablet
documentClasstdocument(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/base.pyR5�s				cC`s�t|d�}|sOt|t�r7td|f}nt|t�sOt�nt|\}}x^t|j�D]M}|r�||kr�t	S|r�|j
|kr�t	S||j
|kArotSqoWts�t�dS(Nu	nameTupleuhtml(thasattrt
isinstanceRRttupletAssertionErrortlistElementsMaptreversedR7R0R.R/(Rttargettvariantt	exactNodetlistElementstinvertR((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/base.pytelementInScope�scC`s'|js
dSt|j�d}|j|}|tksH||jkrLdSxL|tkr�||jkr�|dkr�d}Pn|d8}|j|}qOWx�tr"|d7}|j|}|j�}|jidd6|jd6|jd6|j	d6�}||j|<||jdkr�Pq�q�WdS(	Niii����uStartTagutypeunameu	namespaceudata(
R8tlenR'R7R0R!t
insertElementRt	namespaceR(RtitentrytcloneR-((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/base.pyt#reconstructActiveFormattingElements�s.	

	




cC`s>|jj�}x(|jr9|tkr9|jj�}qWdS(N(R8tpopR'(RRN((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/base.pytclearActiveFormattingElementsscC`sHxA|jddd�D])}|tkr-Pq|j|kr|SqWtS(u�Check if an element exists between the end of the active
        formatting elements and the last marker. If it does, return it, else
        return falseNi����(R8R'RR/(RRtitem((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/base.pyt!elementInActiveFormattingElements
scC`s3|j|�}|jj|�|jj|�dS(N(t
createElementR7R+R=R(RttokenR-((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/base.pyt
insertRootscC`sG|d}|d}|d}|j|||�}|jj|�dS(NunameupublicIdusystemId(tdoctypeClassR=R(RRVRtpublicIdtsystemIdtdoctype((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/base.pyt
insertDoctype s



cC`s:|dkr|jd}n|j|j|d��dS(Ni����udata(R	R7RtcommentClass(RRVR
((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/base.pyt
insertComment(scC`sB|d}|jd|j�}|j||�}|d|_|S(u.Create an element but don't insert it anywhereunameu	namespaceudata(tgetR4telementClassR(RRVRRLR-((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/base.pyRU-s


cC`s|jS(N(t_insertFromTable(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/base.pyt_getInsertFromTable5scC`s.||_|r|j|_n|j|_dS(usSwitch the function used to insert an element from the
        normal one to the misnested table one and back againN(RatinsertElementTableRKtinsertElementNormal(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/base.pyt_setInsertFromTable8s	cC`s�|d}t|t�s)td|��|jd|j�}|j||�}|d|_|jdj|�|jj	|�|S(NunameuElement %s not unicodeu	namespaceudatai����(
R?RRAR_R4R`RR7RR+(RRVRRLR-((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/base.pyRdCs

cC`s�|j|�}|jdjtkr2|j|�S|j�\}}|dkr`|j|�n|j||�|jj	|�|S(u-Create an element and insert it into the treei����N(
RUR7RRRdtgetTableMisnestedNodePositionR	RRR+(RRVR-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/base.pyRcMs
cC`s{|dkr|jd}n|jsE|jrU|jdjtkrU|j|�n"|j�\}}|j||�dS(uInsert text data.i����N(R	R7R;RRRRf(RRR
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/base.pyR]s
	cC`s�d}d}d}x7|jddd�D]}|jdkr)|}Pq)q)W|r�|jrm|j}|}q�|j|jj|�d}n
|jd}||fS(usGet the foster parent element, and sibling to insert before
        (or None) when inserting a misnested table nodeNi����utableii(R	R7RR
tindex(Rt	lastTabletfosterParentRtelm((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/base.pyRfls			
c
C`sO|jdj}|td
�krK||krK|jj�|j|�ndS(Ni����uddudtuliuoptionuoptgroupupurpurt(uddudtuliuoptionuoptgroupupurpurt(R7Rt	frozensetRQtgenerateImpliedEndTags(RtexcludeR((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/base.pyRl�s

cC`s|jS(uReturn the final tree(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/base.pytgetDocument�scC`s$|j�}|jdj|�|S(uReturn the final fragmenti(t
fragmentClassR7R (Rtfragment((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/base.pytgetFragment�scC`s
t�dS(u�Serialize the subtree of node in the format required by unit tests

        :arg node: the node from which to start serializing

        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/base.pyttestSerializer�sN(R#R$R%R	R<R`R]RXRoRR5RIRPRRRTRWR\R^RURbRetpropertyR;RdRcRRfRlRnRqRr(((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/base.pyR3�s6			.									
		
		N(t
__future__RRRtpip._vendor.sixRt	constantsRRRR	R'RkR/R0RBtobjectRR*R&R3(((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/base.pyt<module>s$ c

?>