+
    |f8                     l   ^RI HtHtHt RtR]! ]4      R3R]! ]]R,          R30,          4      R3R]! ]]R,          R3]R,          R30,          4      R3R	]! ]R,          R3]R,          R	3.4      R3R
]! ]R,          R3]R,          R3.4      R3/t ! R R4      t ! R R]4      t	 ! R R4      t
R# )   )scopingElementstableInsertModeElements
namespacesNFbuttonhtmllistolultableselectoptgroupoptionTc                   d   a  ] tR t^t o RtR tR tR tR tRR lt	R t
R	 tR
 tR tR tRtV tR# )NodezRepresents an item in the treec                X    Wn         RV n        RV n        / V n        . V n        . V n        R# )zBCreates a Node

:arg name: The tag name associated with the node

N)nameparentvalue
attributes
childNodes_flags)selfr   s   &&</usr/lib/python3/dist-packages/html5lib/treebuilders/base.py__init__Node.__init__   s.     	
     c           
         R P                  V P                  P                  4        UUu. uF  w  rV: RV: R2NK  	  upp4      pV'       d   RV P                  : R V: R2# RV P                  ,          # u uppi ) z=""<><%s>)joinr   itemsr   )r   r   r   attributesStrs   &   r   __str__Node.__str__*   sl    "&//"7"7"9";"9 '2d 26u"="9"; < = $		=99TYY''";s   A6
c                (    R V P                   ,          # )r"   )r   r   s   &r   __repr__Node.__repr__3   s    ##r   c                    \         h)zKInsert node as a child of the current node

:arg node: the node to insert

NotImplementedErrorr   nodes   &&r   appendChildNode.appendChild6   
     "!r   Nc                    \         h)a  Insert 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

r-   )r   datainsertBefores   &&&r   
insertTextNode.insertText>   
     "!r   c                    \         h)zInsert 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

r-   )r   r0   refNodes   &&&r   r6   Node.insertBeforeJ   r9   r   c                    \         h)zXRemove node from the children of the current node

:arg node: the child node to remove

r-   r/   s   &&r   removeChildNode.removeChildV   r3   r   c                \    V P                    F  pVP                  V4       K  	  . V n         R# )zMove 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   r1   )r   	newParentchilds   && r   reparentChildrenNode.reparentChildren^   s'     __E!!%( %r   c                    \         h)zzReturn a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes
r-   r)   s   &r   	cloneNodeNode.cloneNodek   s
     "!r   c                    \         h)zFReturn true if the node has children or text, false otherwise
        r-   r)   s   &r   
hasContentNode.hasContentq   s
     "!r   )r   r   r   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r&   r*   r1   r7   r6   r>   rC   rF   rI   __static_attributes____classdictcell____classdict__s   @r   r   r      s?     ((($"
"
"""" "r   r   c                   ,   a  ] tR t^wt o R tR tRtV tR# )ActiveFormattingElementsc                    ^ pV\         8w  d[   V RRR1,           FJ  pV\         8X  d    M>V P                  W14      '       d
   V^,          pV^8X  g   K9  V P                  V4        M	  \        P	                  W4       R# )z#Append node to the end of the list.N)Marker
nodesEqualremover   append)r   r0   
equalCountelements   &&  r   r\   ActiveFormattingElements.appendx   si    
6>"::f$??711!OJ?KK( & 	Dr   c                z    VP                   VP                   8X  g   R # VP                  VP                  8X  g   R # R# )FT)	nameTupler   )r   node1node2s   &&&r   rZ   #ActiveFormattingElements.nodesEqual   s/    %//15#3#33r    N)rL   rM   rN   rO   r\   rZ   rQ   rR   rS   s   @r   rV   rV   w   s       r   rV   c                      a  ] tR t^t o RtRtRtRtRtRt	R t
R tRR ltR tR tR tR	 tR
 tRR ltR tR tR t]! ]]4      tR tR tRR ltR tRR ltR tR tR tRt V t!R# )TreeBuilderzBase 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

Nc                T    V'       d	   RV n         MRV n         V P                  4        R# )z]Create a TreeBuilder

:arg namespaceHTMLElements: whether or not to namespace HTML elements

zhttp://www.w3.org/1999/xhtmlN)defaultNamespacereset)r   namespaceHTMLElementss   &&r   r   TreeBuilder.__init__   s      !$BD!$(D!

r   c                    . V n         \        4       V n        R V n        R V n        RV n        V P                  4       V n        R # )NF)openElementsrV   activeFormattingElementsheadPointerformPointerinsertFromTabledocumentClassdocumentr)   s   &r   rj   TreeBuilder.reset   s?    (@(B%  $**,r   c                   \        VR 4      pV'       g>   \        V\        4      '       d   \        R,          V3p\        V\        4      '       g   Q h\
        V,          w  rE\        V P                  4       FN  pV'       d
   Wa8X  d    R# V'       g   VP                  V8X  d    R# WVP                  V9   ,          '       g   KM   R# 	  Q h)ra   r   TF)	hasattr
isinstancestrr   tuplelistElementsMapreversedrn   ra   )r   targetvariant	exactNodelistElementsinvertr0   s   &&&    r   elementInScopeTreeBuilder.elementInScope   s     FK0	&#&&$V,f5fe,,,,.w7T../DT^4>>V#;NNl:;; 0 	ur   c           
     b   V P                   '       g   R # \        V P                   4      ^,
          pV P                   V,          pV\        8X  g   W P                  9   d   R # V\        8w  d9   W P                  9  d)   V^ 8X  d   RpMV^,          pV P                   V,          pKC   V^,          pV P                   V,          pVP	                  4       pV P                  RRRVP                  RVP                  RVP                  /4      pW@P                   V&   W@P                   R,          8X  g   K  R # )NtypeStartTagr   	namespacer5   rX   )	ro   lenrY   rn   rF   insertElementr   r   r   )r   ientrycloner^   s   &    r   #reconstructActiveFormattingElements/TreeBuilder.reconstructActiveFormattingElements   s    ,,, --.2--a0F?e'8'88 vo%/@/@"@AvFA11!4EFA 11!4EOO%E ((&**0%***5u*0%2B2B*D EG 07))!, 77;;r   c                    V P                   P                  4       pV P                   '       d*   V\        8w  d   V P                   P                  4       pK9  R # R # rK   )ro   poprY   )r   r   s   & r   clearActiveFormattingElements)TreeBuilder.clearActiveFormattingElements  sE    --113+++11557E 1@+r   c                    V P                   RRR1,           F&  pV\        8X  d    R# VP                  V8X  g   K$  Vu # 	  R# )zCheck if an element exists between the end of the active
formatting elements and the last marker. If it does, return it, else
return falseNFrX   )ro   rY   r   )r   r   items   && r   !elementInActiveFormattingElements-TreeBuilder.elementInActiveFormattingElements  sI    
 11$B$77D v~  d" 8 r   c                    V P                  V4      pV P                  P                  V4       V P                  P	                  V4       R # rK   )createElementrn   r\   rt   r1   )r   tokenr^   s   && r   
insertRootTreeBuilder.insertRoot  s8    $$U+  )!!'*r   c                    VR ,          pVR,          pVR,          pV P                  W#V4      pV P                  P                  V4       R# )r   publicIdsystemIdN)doctypeClassrt   r1   )r   r   r   r   r   doctypes   &&    r   insertDoctypeTreeBuilder.insertDoctype  sC    V}$$##DH=!!'*r   c                    Vf   V P                   R,          pVP                  V P                  VR,          4      4       R # )Nr5   rX   )rn   r1   commentClass)r   r   r   s   &&&r   insertCommentTreeBuilder.insertComment&  s4    >&&r*F4,,U6];<r   c                    VR,          pVP                  RV P                  4      pV P                  W#4      pVR,          Vn        V# )z.Create an element but don't insert it anywherer   r   r5   )getri   elementClassr   r   r   r   r   r^   s   &&   r   r   TreeBuilder.createElement+  sB    V}IIk4+@+@A	##D4"6]r   c                    V P                   # rK   )_insertFromTabler)   s   &r   _getInsertFromTableTreeBuilder._getInsertFromTable3  s    $$$r   c                j    Wn         V'       d   V P                  V n        R# V P                  V n        R# )zkSwitch the function used to insert an element from the
normal one to the misnested table one and back againN)r   insertElementTabler   insertElementNormal)r   r   s   &&r   _setInsertFromTableTreeBuilder._setInsertFromTable6  s)     !&!%!8!8D!%!9!9Dr   c                P   VR ,          p\        V\        4      '       g   Q RV,          4       hVP                  RV P                  4      pV P	                  W#4      pVR,          Vn        V P                  R,          P                  V4       V P                  P                  V4       V# )r   zElement %s not unicoder   r5   rX   )	rx   ry   r   ri   r   r   rn   r1   r\   r   s   &&   r   r   TreeBuilder.insertElementNormalA  s    V}$$$E&>&EE$IIk4+@+@A	##D4"6]"))'2  )r   c                >   V P                  V4      pV P                  R,          P                  \        9  d   V P	                  V4      # V P                  4       w  r4Vf   VP                  V4       MVP                  W$4       V P                  P                  V4       V# )z-Create an element and insert it into the treerX   )	r   rn   r   r   r   getTableMisnestedNodePositionr1   r6   r\   )r   r   r^   r   r6   s   &&   r   r   TreeBuilder.insertElementTableK  s    $$U+R %%-DD++E22 $(#E#E#G F#""7+##G:$$W-r   c                4   Vf   V P                   R,          pV P                  '       d9   V P                  '       d:   V P                   R,          P                  \        9  d   VP	                  V4       R# V P                  4       w  r#VP	                  W4       R# )zInsert text data.NrX   )rn   rr   r   r   r7   r   )r   r5   r   r6   s   &&& r   r7   TreeBuilder.insertText[  sz    >&&r*F$$$)=)=)=)-):):2)>)C)C0G*Hd# $(#E#E#G Fd1r   c                b   RpRpRpV P                   RRR1,           F  pVP                  R8X  g   K  Tp M	  V'       d[   VP                  '       d   VP                  pTpW#3# V P                   V P                   P                  V4      ^,
          ,          p W#3# V P                   ^ ,          pW#3# )zkGet the foster parent element, and sibling to insert before
(or None) when inserting a misnested table nodeNr   rX   )rn   r   r   index)r   	lastTablefosterParentr6   elms   &    r   r   )TreeBuilder.getTableMisnestedNodePositionj  s     	$$TrT**Cxx7"	 +  (//( ))	  $00%%++I6: < ))  ,,Q/L))r   c                    V P                   R,          P                  pV\        R4      9   d6   W!8w  d.   V P                   P                  4        V P	                  V4       R# R# R# )   NrX   )dddtlir   r   prprt)rn   r   	frozensetr   generateImpliedEndTags)r   excluder   s   && r   r   "TreeBuilder.generateImpliedEndTags  sX      $))IWXX!!# ''0	   Yr   c                    V P                   # )zReturn the final tree)rt   r)   s   &r   getDocumentTreeBuilder.getDocument  s    }}r   c                j    V P                  4       pV P                  ^ ,          P                  V4       V# )zReturn the final fragment)fragmentClassrn   rC   )r   fragments   & r   getFragmentTreeBuilder.getFragment  s0     %%'!--h7r   c                    \         h)zySerialize the subtree of node in the format required by unit tests

:arg node: the node from which to start serializing

r-   r/   s   &&r   testSerializerTreeBuilder.testSerializer  r3   r   )	r   ro   ri   rt   rq   rp   r   rr   rn   rK   )"rL   rM   rN   rO   rP   rs   r   r   r   r   r   rj   r   r   r   r   r   r   r   r   r   r   propertyrr   r   r   r7   r   r   r   r   r   rQ   rR   rS   s   @r   rg   rg      s      M L L L M

-,,\8
+
+=
%: 24GHO 2*41" "r   rg   )	constantsr   r   r   rY   r   r{   r   r   rV   rg   re   r   r   <module>r      s   L L
 
 	9_%u
-yZ-?,J+KKLeT
Y:f+=t*D+5f+=t*D*F F GHMOi*V,f5$V,g68 9:?Ay:f-z:%f-x8: ;<@B	`" `"Ft 2O" O"r   