ReddlmZmZmZddlmZddlmZddlm Z ddl m Z ddl m Z dd l mZd ZGd d eZGd deZGddeZGddeZGdde jZdS))absolute_importdivisionunicode_literals) text_type) OrderedDict)etree) tag_regexp)base) _ihatexmlcd|dSt|tr|S|ddS)Nasciistrict) isinstancerdecode)ss /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py ensure_strrs7yt Ay ! !+xx***c&eZdZdZdZdZdZdS)Rootc ||_g|_ |jjro|jt |t |jjt |jjt |jj n#t$rYnwxYw | }n#t$r|}YnwxYw| (| }| (|0|j|| }|0d|_d|_dSN) elementtreechildrendocinfo internalDTDappendDoctyper root_name public_id system_urlAttributeErrorgetroot getpreviousgetnexttexttail)selfetnodes r__init__z Root.__init__sZ  z% Q $$WT-7 8L-M-M-7 8L-M-M-7 8M-N-N&P&PQQQ    D  ::<>D  s$A;B BBB22 CCc|j|Sr)rr*keys r __getitem__zRoot.__getitem__3s}S!!rcdSrr*s rr'z Root.getnext6trcdSNr r3r4s r__len__z Root.__len__9sqrN)__name__ __module__ __qualname__r-r1r'r8r3rrrrsP6"""rrceZdZdZdZdS)r cZ||_||_||_||_d|_d|_dSr) root_nodenamer" system_idr(r))r*r>r?r"r@s rr-zDoctype.__init__>s0" ""  rc&|jjdSr7)r>rr4s rr'zDoctype.getnextGs~&q))rNr9r:r;r-r'r3rrr r =s2*****rr ceZdZdZdZdS) FragmentRootcJfd|D_dx__dS)Nc0g|]}t|Sr3)FragmentWrapper).0childr*s r z)FragmentRoot.__init__..Ms#LLL%u55LLLr)rr(r))r*rs` rr-zFragmentRoot.__init__Ls0LLLL8LLL $$ DIIIrcdSrr3r4s rr'zFragmentRoot.getnextPr5rNrBr3rrrDrDKs2%%%rrDcDeZdZdZdZdZdZdZdZdZ dZ d Z d S) rGc||_||_t|jdrt|jj|_nd|_t|jdr t|jj|_dSd|_dS)Nr(r))r>objhasattrrr(r))r* fragment_rootrNs rr-zFragmentWrapper.__init__Usv& 48V $ $ "48=11DIIDI 48V $ $ "48=11DIIIDIIIrc,t|j|Sr)getattrrN)r*r?s r __getattr__zFragmentWrapper.__getattr__astx&&&rc|jj}||}|t|dz kr ||dzSdSr7)r>rindexlen)r*siblingsidxs rr'zFragmentWrapper.getnextdsG>*nnT"" X" " "C!G$ $4rc|j|Sr)rNr/s rr1zFragmentWrapper.__getitem__lsx}rc*t|jSr)boolrNr4s r__bool__zFragmentWrapper.__bool__osDH~~rcdSrr3r4s r getparentzFragmentWrapper.getparentrr5rc*t|jSrstrrNr4s r__str__zFragmentWrapper.__str__u48}}rc*t|jSrr`r4s r __unicode__zFragmentWrapper.__unicode__xrcrc*t|jSr)rVrNr4s rr8zFragmentWrapper.__len__{rcrN) r9r:r;r-rSr'r1r\r^rbrer8r3rrrGrGTs   '''rrGc,eZdZdZdZdZdZdZdS) TreeWalkerc,t|tr$t||_t |}n"t|_t |}t j||tj |_ dSr) rlistsetfragmentChildrenrDrr NonRecursiveTreeWalkerr-r InfosetFilterfilter)r*trees rr-zTreeWalker.__init__su dD ! ! $'IID !%%DD$'EED !::D #,,T4888-// rc8t|tr?|\}}|dvs Jd|ztjt t ||fSt|t r tjfSt|trtj |j |j |j fSt|tr0t|ds tjt |jfS|jt"jkr tjt |jfS|jt"jkr(tjt |jddfSt/jt |j}|r|\}}nd}t |j}t5}t7|jD]n\}}t |}t |}t/j|}|r.|||d|df<g||d|f<otj||j !||tE|dkp|jfS)Nr(r)%Text nodes are text or tail, found %stagr r r)#rtupler TEXTrrRrDOCUMENTr DOCTYPEr?r"r@rGrOrNrtrCommentCOMMENTr(EntityENTITYr matchgroupsrrjattribitemsgroupELEMENTro fromXmlNamerV) r*r,r0r~ namespacertattrsr?values rgetNodeDetailszTreeWalker.getNodeDetailssQ dE " "& 7ID#****,SVY,Y***9js););<<< < d # #! 7M# # g & & 7<DNDNJ J o . . 7wtU7K7K 79j222 2 X & &<DI!6!66 6 X % %; 49 5 5ad ;; ;$Z%9%9::E +!& 33  **MME#DK$5$5$7$788 0 0 e!$''"5))"(..0>CE5;;q>>5;;q>>:;;*/E4,''L)T[-D-DS-I-I3t99q=5DI7 7rct|tr Jdt|s|js Jd|jr|dfS|dS)NzText nodes have no childrenzNode has no childrenr(r)rrvrVr()r*r,s r getFirstChildzTreeWalker.getFirstChilds`dE**II,IIII4yy=DI=='==== 9 &> !7Nrct|trI|\}}|dvs Jd|z|dkrt|r|dSdS|S|jr|dfn|S)Nrrrsr(rr))rrvrVr'r)r*r,r0s rgetNextSiblingzTreeWalker.getNextSiblings dE " " &ID#****,SVY,Y***f}}t99 7N4||~~%!%>f~~ >rct|tr|\}}|dvs Jd|z|dkr|Sn ||jvrdS|S)Nrrrsr()rrvrlr^rs r getParentNodezTreeWalker.getParentNodesv dE " " ID#****,SVY,Y***f}} T* * *4~~rN)r9r:r;r-rrrrr3rrrhrhs` 0 0 0'7'7'7R???      rrhN) __future__rrrpip._vendor.sixr collectionsrlxmlrtreebuilders.etreer r r robjectrr rDrGrmrhr3rrrsBBBBBBBBBB%%%%%%######+++++++++#####6###L * * * * *f * * *4(((((f(((VX X X X X ,X X X X X r