ó •abc@`sÖddlmZmZmZyddlmZWn?ek rqyddlmZWqrek rmeZqrXnXddl Z ddl m Z ddl m Z ddlmZe jd ƒZd „ZeeƒZdS( i(tabsolute_importtdivisiontunicode_literals(t OrderedDictN(t string_typesi(tbasei(tmoduleFactoryFactoryu {([^}]*)}(.*)c`s>|}|jdƒj‰dtjf‡fd†ƒY}tƒS(Nuasdt TreeWalkerc`s8eZdZ‡fd†Zd„Zd„Zd„ZRS(uËGiven the particular ElementTree representation, this implementation, to avoid using recursion, returns "nodes" as tuples with the following content: 1. The current element 2. The index of the element relative to its parent 3. A stack of ancestor elements 4. A flag "text", "tail" or None to indicate if the current node is a text node; either the text or tail of the current element (1) c `sÞt|tƒrL|\}}}}|d krCtjt||ƒfS|}nt|dƒsj|jƒ}n|jd krƒtjfS|jdkrºtj |j |j dƒ|j dƒfS|jˆkrÙtj |j fSt|jt ƒstt|jƒƒ‚tj|jƒ}|r-|jƒ\}}nd}|j}tƒ}xmt|jjƒƒD]V\} } tj| ƒ}|r¡| ||jd ƒ|jd ƒfupublicIdusystemIdii(utextutail(u DOCUMENT_ROOTuDOCUMENT_FRAGMENT(t isinstancettupleRtTEXTtgetattrthasattrtgetrootttagtDOCUMENTtDOCTYPEttexttgettCOMMENTRtAssertionErrorttypet tag_regexptmatchtgroupstNoneRtlisttattribtitemstgrouptELEMENTtlen( tselftnodeteltt_tflagRt namespaceRtattrstnametvalue(tElementTreeCommentType(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNodeDetails's8    '  "% cS`s t|tƒr$|\}}}}n|dgdf\}}}}|dkrRdS|jrk|||dfSt|ƒr˜|j|ƒ|dd|dfSdSdS(Nutextutaili(utextutail(RR RRRtappend(R R!telementtkeytparentsR$((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getFirstChildOs    cS`sÏt|tƒr$|\}}}}ndS|dkrht|ƒra|j|ƒ|dd|dfSdSnc|jr|dkr|||dfS|t|dƒdkrÇ|d|d|d|dfSdSdS(Nutextiutailiÿÿÿÿi(RR RRR+ttail(R R!R,R-R.R$((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetNextSibling`s    cS`s³t|tƒr$|\}}}}ndS|dkrQ|s>|S|||dfSn^|jƒ}|sg|St|dƒj|ƒdksŒt‚|t|dƒj|ƒ|dfSdS(Nutextiÿÿÿÿi(RR RtpopRtcountRtindex(R R!R,R-R.R$tparent((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyt getParentNodets  %(t__name__t __module__t__doc__R*R/R1R6((R)(sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyRs  (  (tCommentRRtNonRecursiveTreeWalkertlocals(tElementTreeImplementationt ElementTreeR((R)sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pytgetETreeBuildersn(t __future__RRRt collectionsRt ImportErrort ordereddicttdicttretpip._vendor.sixRtRt_utilsRtcompileRR?tgetETreeModule(((sJ/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.pyts    t