Re$2ddlmZmZmZddlmZddlZddlmZddlm Z ddlm Z dd lm Z dd l m Z dd l mZejd ZddZeeZdS))absolute_importdivisionunicode_literals) text_typeN)copy)base) _ihatexml) constants) namespaces)moduleFactoryFactoryz {([^}]*)}(.*)Fc v dj G fddtjG fddGfddGfdd Gfd d  fd  fd }G fddtj}t S)NasdceZdZdfd ZdZdZdZeeeZdZ dZ ee e Z dZ d Z ee e Zd Zd ZeeeZd Zd ZdZdZddZdZdZdS) getETreeBuilder..ElementNc||_||_||||_|t d|jf|_n|j|jf|_d|_g|_g|_ dS)Nhtml) _name _namespaceElement _getETreeTag_elementr nameTupleparent _childNodes_flags)selfname namespace ElementTrees /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/html5lib/treebuilders/etree.py__init__z)getETreeBuilder..Element.__init__sDJ'DO'//0A0A$BK1M1MNNDM !+F!3TZ!?!%$*!<DK!D DKKKc ||}nd|d|}|S)N{})rrr etree_tags r"rz-getETreeBuilder..Element._getETreeTag%s,  !)2 448  r$ch||_||j|j|j_dSN)rrrrtag)rrs r"_setNamez)getETreeBuilder..Element._setName,s-DJ $ 1 1$*do N NDM   r$c|jSr+)rrs r"_getNamez)getETreeBuilder..Element._getName0s : r$ch||_||j|j|j_dSr+)rrrrr,)rr s r" _setNamespacez.getETreeBuilder..Element._setNamespace5s-'DO $ 1 1$*do N NDM   r$c|jSr+)rr/s r" _getNamespacez.getETreeBuilder..Element._getNamespace9s ? "r$c|jjSr+)rattribr/s r"_getAttributesz/getETreeBuilder..Element._getAttributes>s =' 'r$c|jj}||rK|D]8\}}t |t rd|dd|d}n|}|||<7dSdS)Nr&r r'r)rr6clearitems isinstancetuple)r attributes el_attribkeyvaluers r"_setAttributesz/getETreeBuilder..Element._setAttributesAs ,I OO    ,#-"2"2"4"4,,JC!#u--##+.q6663q66:"&+IdOO , ,,,r$c|jSr+)rr/s r"_getChildNodesz/getETreeBuilder..Element._getChildNodesPs # #r$c\|jdd=g|_|D]}||dSr+)rr insertChild)rr@elements r"_setChildNodesz/getETreeBuilder..Element._setChildNodesSsH aaa !D   * *  )))) * *r$c\t|jjpt|jS)z,Return true if the node has children or text)boolrtextlenr/s r" hasContentz+getETreeBuilder..Element.hasContent[s$ *@c$-.@.@AA Ar$c|j||j|j||_dSr+)rappendrrrnodes r" appendChildz,getETreeBuilder..Element.appendChild_<   # #D ) ) ) M  / / /DKKKr$ct|j|j}|j||j||_dSr+)listrindexinsertr)rrPrefNoderUs r" insertBeforez-getETreeBuilder..Element.insertBeforedsG''--g.>??E M  6 6 6DKKKr$c|j||j|jd|_dSr+)rremoverrrOs r" removeChildz,getETreeBuilder..Element.removeChildirRr$cht|js/|jjs d|j_|jxj|z c_dS|A|jdjsd|jd_|jdxj|z c_dSt |j}||j}|dkrJ|j|dz jsd|j|dz _|j|dz xj|z c_dS|jjs d|j_|jxj|z c_dS)Nrr)rKrrJtailrTrU)rdatarXchildrenrUs r" insertTextz+getETreeBuilder..Element.insertTextns>t}%% /}),)+DM& ""d*""""%}R(-0-/DM"%* b!&&$.&&&&  .. |'<==199=38;8: eai05M%!),11T91111=-0-/ *M&&$.&&&&r$ct||j|j}|jjr#t |jj|j_|Sr+)typerr rr6r)rrFs r" cloneNodez*getETreeBuilder..Element.cloneNodesH d4jjDN;;G}# E*.t}/C*D*D 'Nr$cH|jr+|jdjxj|jjz c_nC|jjs d|j_|jj|jxj|jjz c_d|j_tj||dS)Nr^r]) childNodesrr_rJr NodereparentChildren)r newParents r"riz1getETreeBuilder..Element.reparentChildrens# B$R(166$-:LL666 ).1.0I&+=%1&++t}/AA++!#DM  I & &tY 7 7 7 7 7r$r+)__name__ __module__ __qualname__r#rr-r0propertyrr2r4r r7rAr=rCrGrgrLrQrXr[rbrerir!sr"rrs}          O O O   x(++ O O O # # #H]M::  ( ( ( , , ,Xnn==  $ $ $ * * * Xnn==  B B B             / / / /.    8 8 8 8 8r$rc>eZdZfdZdZdZeeeZdS) getETreeBuilder..Commentcf||_d|_g|_g|_dSr+)Commentrrrr)rr`r!s r"r#z)getETreeBuilder..Comment.__init__s4(//55DMDK!D DKKKr$c|jjSr+rrJr/s r"_getDataz)getETreeBuilder..Comment._getDatas =% %r$c||j_dSr+rurr@s r"_setDataz)getETreeBuilder..Comment._setDatas!&DM   r$N)rkrlrmr#rvryrnr`rosr"rsrqsY      & & & ' ' 'x(++r$rscbeZdZfdZdZdZeeeZdZdZ eee Z dS)%getETreeBuilder..DocumentTypech|d||j_||_||_dS)N )r#rrJpublicIdsystemId)rrr~rrs r"r#z.getETreeBuilder..DocumentType.__init__s5   T< 0 0 0!%DM $DM$DMMMr$c8|jddS)Nr~r]rgetr/s r" _getPublicIdz2getETreeBuilder..DocumentType._getPublicId=$$Z44 4r$cD||jd|dSdS)Nr~rsetrxs r" _setPublicIdz2getETreeBuilder..DocumentType._setPublicId.  !!*e44444! r$c8|jddS)Nrr]rr/s r" _getSystemIdz2getETreeBuilder..DocumentType._getSystemIdrr$cD||jd|dSdS)Nrrrxs r" _setSystemIdz2getETreeBuilder..DocumentType._setSystemIdrr$N) rkrlrmr#rrrnr~rrrrsr" DocumentTyper{s % % % % %  5 5 5 5 5 58L,77 5 5 5 5 5 58L,77r$rceZdZfdZdS)!getETreeBuilder..Documentc4|ddS)N DOCUMENT_ROOTr#rrs r"r#z*getETreeBuilder..Document.__init__s   T? 3 3 3 3 3r$Nrkrlrmr#rsr"Documentrs. 4 4 4 4 4 4 4r$rceZdZfdZdS))getETreeBuilder..DocumentFragmentc4|ddS)NDOCUMENT_FRAGMENTrrs r"r#z2getETreeBuilder..DocumentFragment.__init__s   T#6 7 7 7 7 7r$Nrrsr"DocumentFragmentrs. 8 8 8 8 8 8 8r$rc^gdfd |ddS)Nrc 0t|ds|}|jdkr|ds|drT|dpd}|dpd} d|jd|d|d n d|jd n|jd kr d |j' d d|dzzd|jd|jtdt|dr#t|j rtdn|j kr& d d|zd|jdnt|jts'Jdt|jd|jt|j}||j}n0|\}}t j|}|d|} d d|zd|d t|drg}|j D]k\}} t|}|1|\}}t j|}|d|} n|} || | flt'|D])\}} d d|dzz|d| d*|jr' d d|dzzd|jd|dz }|D]} | ||jr) d d|dz zd|jddSdS)Nr,r}r~rr] >rz #document| r "Document node cannot have tailr6$Document node cannot have attributeszzExpected unicode, got z, <=")hasattrgetrootr,rrNrJr_ TypeErrorrKr6r;rrd tag_regexpmatchgroupsr prefixesr:sorted)rFindentr~rnsmatchrnsprefixr=r@ attr_stringchildElementTreeCommentTypervserializeElements r"rzAgetETreeBuilder..testSerializer..serializeElements,7E** ,!//++{l**;;z**Agkk*.E.EA&{{:66<"H&{{:66<"HIII&|||XXXxxxABBBBIII?@@@@// +&&&<+IIISFQJ-?-?-?NOOO<+#$DEEE7H--L#gn2E2EL#$JKKK 666 cFlllGLLLIJJJJ!'+y99VVV6:7;6G6G6G6GUVVV$**7;77?";DD&~~//HB&/3F&,ffdd3D sV|||TTT:;;;7H-- T!#J'.~';';'='=@@ e","2"24"8"8".'.~~'7'7HB%.%7%;F5;VVTT*BKK*.K"));*>????'-j'9'9TT e #!2D2DdddEEE"RSSSS<PIIISFQJ-?-?-?NOOO aKF  0 0  ////| L  );););W\\\JKKKKK L Lr$ )r)join)rFrrrs @@r"testSerializerz'getETreeBuilder..testSerializers` 6 L6 L6 L6 L6 L6 L6 L6 Ln !$$$yy}}r$cgtjfd|dS)z4Serialize an element and its child nodes to a stringc t|jr|}|jdkr|ds|drT|dpd}|dpd}d|jd|d|dnd|jd n|jd kr||j|j|jtd t|d r#t|j rtd |D] } |n |jkrd|jdn|j s2d |jd nYd fd|j D}d|jd|d |jr|j|D] } |d|jd |jr|jdSdS)Nr}r~rr]rz PUBLIC "rrrrrr6rzrrcLg|] \}}|d|d!S)rr) fromXmlName).0rr@filters r" zOgetETreeBuilder..tostring..serializeElement..)sR%C%C%C'D%**40000%%%&9%C%C%Cr$z.tostring..serializeElement s';#:;; ,!//++{l**;;z**Agkk*.E.EA&{{:66<"H&{{:66<"HIII&|||XXXxxxABBBBIII?@@@@//<+IIgl+++<+#$DEEE7H--L#gn2E2EL#$JKKK$,,E$$U++++, 666 78888~?III(:(:7;(G(G(G(GIJJJJ88%C%C%C%C+2>+?+?+A+A%C%C%CDDDIII7;;;=>>><,IIgl+++$,,E$$U++++ W[[[2333| ( ',''''' ( (r$r])r InfosetFilterr)rFrrrr!rs @@@r"tostringz!getETreeBuilder..tostringsj (**+ (+ (+ (+ (+ (+ (+ (+ (+ (Z !!!wwr{{r$cBeZdZZZZZZZfdZ fdZ dZ dS)$getETreeBuilder..TreeBuilderc|Sr+r()rrFrs r"rz3getETreeBuilder..TreeBuilder.testSerializerDs!>'** *r$cr |jjS|j'|jjd|jzS|jjdS)Nz{%s}htmlr)documentrdefaultNamespacefind)rfullTrees r" getDocumentz0getETreeBuilder..TreeBuilder.getDocumentGsb ?}--(4=166"T%::<<< =166v>>>r$cJtj|jSr+)r TreeBuilder getFragmentrr/s r"rz0getETreeBuilder..TreeBuilder.getFragmentQs#//55> >r$N) rkrlrm documentClass doctypeClass elementClass commentClass fragmentClassimplementationrrr)rsrrrrElementTreeImplementationrrsr"rr<st #   ( 2 + + + + + ? ? ? ? ? ? ? ? ? ?r$r)rsr,r rhrlocals) rrrrrsrrrrr!rrs `` @@@@@@@@r"getETreeBuilderrs+K(0077;}8}8}8}8}8}8}8$)}8}8}8~,,,,,,,',,,"8888888w88824444444744488888887888<<<<<|444444l??????????????d&???0 88Or$)F) __future__rrrpip._vendor.sixrrerr]r r r r _utilsrcompilerrgetETreeModuler(r$r"rsBBBBBBBBBB&%%%%% """""")))))) RZ ( ( AAAAH &%o66r$