Re@sddlmZmZmZddlmZddlmZddlm Z ddl m Z ddl m Z dd l mZd d ZGd d d eZGdddeZGdddeZGdddeZGddde jZdS))absolute_importdivisionunicode_literals) text_type) OrderedDict)etree) tag_regexp)base) _ihatexmlcCs7|dkrdSt|tr#|S|jddSdS)Nasciistrict) isinstancerdecode)sr/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py ensure_strs  rc@s@eZdZddZddZddZddZd S) RootcCs||_g|_yS|jjrd|jjt|t|jjt|jjt|jj Wnt k ryYnXy|j }Wnt k r|}YnXx"|j dk r|j }qWx,|dk r|jj||j }qWd|_d|_dS)N)Z elementtreechildrenZdocinfoZ internalDTDappendDoctyperZ root_name public_idZ system_urlAttributeErrorgetrootZ getpreviousgetnexttexttail)selfetnoderrr__init__s*       z Root.__init__cCs |j|S)N)r)rkeyrrr __getitem__3szRoot.__getitem__cCsdS)Nr)rrrrr6sz Root.getnextcCsdS)Nr r)rrrr__len__9sz Root.__len__N)__name__ __module__ __qualname__r"r$rr%rrrrrs    rc@s(eZdZddZddZdS)rcCs:||_||_||_||_d|_d|_dS)N) root_nodenamer system_idrr)rr)r*rr+rrrr">s      zDoctype.__init__cCs|jjdS)Nr )r)r)rrrrrGszDoctype.getnextN)r&r'r(r"rrrrrr=s  rc@s(eZdZddZddZdS) FragmentRootcs0fdd|D_d__dS)Ncsg|]}t|qSr)FragmentWrapper).0child)rrr Ms z)FragmentRoot.__init__..)rrr)rrr)rrr"LszFragmentRoot.__init__cCsdS)Nr)rrrrrPszFragmentRoot.getnextN)r&r'r(r"rrrrrr,Ks  r,c@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)r-cCs|||_||_t|jdr<t|jj|_n d|_t|jdrot|jj|_n d|_dS)Nrr)r)objhasattrrrr)rZ fragment_rootr1rrrr"Us   zFragmentWrapper.__init__cCst|j|S)N)getattrr1)rr*rrr __getattr__aszFragmentWrapper.__getattr__cCsE|jj}|j|}|t|dkr=||dSdSdS)Nr )r)rindexlen)rZsiblingsidxrrrrds   zFragmentWrapper.getnextcCs |j|S)N)r1)rr#rrrr$lszFragmentWrapper.__getitem__cCs t|jS)N)boolr1)rrrr__bool__oszFragmentWrapper.__bool__cCsdS)Nr)rrrr getparentrszFragmentWrapper.getparentcCs t|jS)N)strr1)rrrr__str__uszFragmentWrapper.__str__cCs t|jS)N)r;r1)rrrr __unicode__xszFragmentWrapper.__unicode__cCs t|jS)N)r6r1)rrrrr%{szFragmentWrapper.__len__N) r&r'r(r"r4rr$r9r:r<r=r%rrrrr-Ts        r-c@sLeZdZddZddZddZddZd d Zd S) TreeWalkercCskt|tr-t||_t|}nt|_t|}tjj||t j |_ dS)N) rlistsetfragmentChildrenr,rr NonRecursiveTreeWalkerr"r Z InfosetFilterfilter)rtreerrrr"s  zTreeWalker.__init__c Cs:t|trS|\}}|dks7td|tjtt||fSt|trltjfSt|t rtj |j |j |j fSt|trt|d rtjt|jfS|jtjkrtjt|jfS|jtjkr&tjt|jdd fStjt|j}|rY|j\}}nd}t|j}t}xt|jjD]n\}}t|}t|}tj|}|r|||jd|jdfs  ) r>N) __future__rrrZpip._vendor.sixr collectionsrlxmlrZtreebuilders.etreer r r robjectrrr,r-rBr>rrrrs & +