ó •abc@`s³ddlmZmZmZddlmZddlZddlmZddlm Z ddlm Z dd l m Z dd l m Z ejd ƒZed „Ze eƒZdS( i(tabsolute_importtdivisiontunicode_literals(t text_typeNi(tbasei(t _ihatexml(t constants(t namespaces(tmoduleFactoryFactoryu {([^}]*)}(.*)c `sˆ‰ˆjdƒj‰dtjf‡fd†ƒY‰dˆf‡fd†ƒY‰dˆf‡fd†ƒY‰dˆf‡fd †ƒY‰d ˆf‡fd †ƒY‰‡fd †‰ ‡‡fd †}dtjf‡‡‡‡‡‡‡‡ fd†ƒY}tƒS(NuasdtElementc`séeZd‡fd†Zd„Zd„Zd„ZeeeƒZd„Z d„Z ee e ƒZ d„Z d„Z ee e ƒZd„Zd „ZeeeƒZd „Zd „Zd „Zd „Zdd„Zd„Zd„ZRS(c`s‰||_||_ˆj|j||ƒƒ|_|dkrUtd|jf|_n|j|jf|_d|_g|_ g|_ dS(Nuhtml( t_namet _namespaceR t _getETreeTagt_elementtNoneRt nameTupletparentt _childNodest_flags(tselftnamet namespace(t ElementTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt__init__s     cS`s)|dkr|}nd||f}|S(Nu{%s}%s(R(RRRt etree_tag((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR #s  cS`s+||_|j|j|jƒ|j_dS(N(R R R R ttag(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setName*s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getName.scS`s+||_|j|j|jƒ|j_dS(N(R R R R R(RR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setNamespace3s cS`s|jS(N(R (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getNamespace7scS`s |jjS(N(R tattrib(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getAttributes<scS`s”x-t|jjjƒƒD]}|jj|=qWx]|jƒD]O\}}t|tƒrsd|d|df}n|}|jj||ƒq=WdS(Nu{%s}%sii(tlistR Rtkeystitemst isinstancettupletset(Rt attributestkeytvalueR((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setAttributes?scS`s|jS(N(R(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getChildNodesMscS`s2|j2g|_x|D]}|j|ƒqWdS(N(R Rt insertChild(RR(telement((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setChildNodesPs  cS`st|jjpt|jƒƒS(u,Return true if the node has children or text(tboolR ttexttlen(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt hasContentXscS`s0|jj|ƒ|jj|jƒ||_dS(N(RtappendR R(Rtnode((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt appendChild\scS`s>t|jƒj|jƒ}|jj||jƒ||_dS(N(R R tindextinsertR(RR3trefNodeR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertBeforeascS`s0|jj|ƒ|jj|jƒd|_dS(N(RtremoveR RR(RR3((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt removeChildfscS`s-t|jƒs?|jjs*d|j_n|jj|7_nê|dkr‡|jdjsnd|jd_n|jdj|7_n¢t|jƒ}|j|jƒ}|dkrü|j|djsßd|j|d_n|j|dj|7_n-|jjsd|j_n|jj|7_dS(Nuiÿÿÿÿii(R0R R/RttailR R5(RtdataR8tchildrenR5((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt insertTextks"    cS`sLt|ƒ|j|jƒ}x*|jjƒD]\}}||j|R@RC((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR s*               tCommentc`s8eZ‡fd†Zd„Zd„ZeeeƒZRS(c`s1ˆj|ƒ|_d|_g|_g|_dS(N(RHR RRRR(RR<(R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR”s  cS`s |jjS(N(R R/(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_getDataœscS`s||j_dS(N(R R/(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt_setDataŸs(RERFRRIRJRGR<((R(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRH“s  t DocumentTypec`sYeZ‡fd†Zd„Zd„ZeeeƒZd„Zd„ZeeeƒZ RS(c`s2ˆj|dƒ||j_||_||_dS(Nu (RR R/tpublicIdtsystemId(RRRLRM(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR¥s  cS`s|jjddƒS(NupublicIdu(R tget(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getPublicId«scS`s&|dk r"|jjd|ƒndS(NupublicId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setPublicId®s cS`s|jjddƒS(NusystemIdu(R RN(R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _getSystemId´scS`s&|dk r"|jjd|ƒndS(NusystemId(RR R%(RR(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt _setSystemId·s ( RERFRRORPRGRLRQRRRM((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRK¤s    tDocumentc`seZ‡fd†ZRS(c`sˆj|dƒdS(Nu DOCUMENT_ROOT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyR¾s(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRS½stDocumentFragmentc`seZ‡fd†ZRS(c`sˆj|dƒdS(NuDOCUMENT_FRAGMENT(R(R(R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRÂs(RERFR((R (sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRTÁsc`s8g‰d‡‡‡fd†‰ˆ|dƒdjˆƒS(Nic `sŠt|dƒs|jƒ}n|jdkr¯|jdƒsK|jdƒr•|jdƒp]d}|jdƒprd}ˆjd|j||fƒq0ˆjd|jfƒn|jdkrMˆjd ƒ|jdk rÿˆjd d |d |jfƒn|jdk rtd ƒ‚nt|dƒr0t |j ƒr0tdƒ‚q0nã|jˆkr}ˆjdd ||jfƒn³t |jt ƒs±t dt|jƒ|jfƒ‚tj|jƒ}|dkrÛ|j}n/|jƒ\}}tj|}d||f}ˆjdd ||fƒt|dƒrg}xƒ|j jƒD]r\}} tj|ƒ}|dk r£|jƒ\}}tj|}d||f} n|} |j| | fƒqJWx?t|ƒD].\}} ˆjdd |d || fƒqÍWn|jr0ˆjd d |d |jfƒn|d 7}x|D]} ˆ| |ƒqAW|jr†ˆjd d |d |jfƒndS(Nutagu upublicIdusystemIduuu u DOCUMENT_ROOTu #documentu|%s"%s"u iuDocument node cannot have tailuattribu$Document node cannot have attributesu|%suExpected unicode, got %s, %su%s %su|%s<%s>u |%s%s="%s"(thasattrtgetrootRRNR2R/RR;t TypeErrorR0RR#RtAssertionErrorR?t tag_regexptmatchtgroupsRtprefixesR"tsorted( R,tindentRLRMtnsmatchRtnstprefixR&R(t attr_stringtchild(tElementTreeCommentTypetrvtserializeElement(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRfÈs^  %!     ) %   u (tjoin(R,(Rd(ReRfsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttestSerializerÅs7 c`sDg‰tjƒ‰‡‡‡‡‡fd†‰ˆ|ƒdjˆƒS(u4Serialize an element and its child nodes to a stringc`smt|ˆjƒr!|jƒ}n|jdkr²|jdƒsN|jdƒr˜|jdƒp`d}|jdƒpud}ˆjd|j||fƒqMˆjd|jfƒn›|jdkrL|jdk rãˆj|jƒn|jdk rt dƒ‚nt |d ƒr.t |j ƒr.t d ƒ‚nx|D]}ˆ|ƒq5Wn|jˆkruˆjd |jfƒnØ|j s¡ˆjd ˆj |jƒfƒn^d jg|j jƒD]%\}}dˆj |ƒ|f^q·ƒ}ˆjd|j|fƒ|jrˆj|jƒnx|D]}ˆ|ƒq"Wˆjd|jfƒ|jriˆj|jƒndS(Nu upublicIdusystemIduuu u DOCUMENT_ROOTuDocument node cannot have tailuattribu$Document node cannot have attributesu u<%s>u u%s="%s"u<%s %s>u(R#RRVRRNR2R/RR;RWRUR0Rt fromXmlNameRgR"(R,RLRMRcRR(tattr(RRdtfilterReRf(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRfs@   # ;   u(Rt InfosetFilterRg(R,(RRd(RkReRfsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyttostrings  - t TreeBuilderc`sSeZˆZˆZˆZˆZˆZˆZ‡fd†Z‡fd†Z d„Z RS(c`s ˆ|ƒS(N((RR,(Rh(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRhAsc`sPˆr|jjS|jdk r9|jjjd|jƒS|jjjdƒSdS(Nu{%s}htmluhtml(tdocumentR tdefaultNamespaceRtfind(R(tfullTree(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyt getDocumentDs   cS`stjj|ƒjS(N(RRnt getFragmentR (R((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRtNs( RERFt documentClasst doctypeClasst elementClasst commentClasst fragmentClasstimplementationRhRsRt((RHRSRTRKR tElementTreeImplementationRrRh(sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyRn9s (RHRRRBRntlocals(R{RrRmRn(( RHRSRTRKR RRdR{RrRhsK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pytgetETreeBuilders~>64(t __future__RRRtpip._vendor.sixRtretRRRRt_utilsRtcompileRYtFalseR}tgetETreeModule(((sK/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/etree.pyts  ÿD