ó vÆ_c@`sudZddlmZmZmZddlZddlZddlZyddlm Z Wn!e k r}ddl m Z nXddl m Z ddlmZdd l mZdd l mZdd l mZddljZdd lmZmZeZejd ƒZejdƒjZdefd„ƒYZdefd„ƒYZ d„Z!d„Z"de j#fd„ƒYZ#dS(uÃModule for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause problems: Text or comments as siblings of the root element Docypes with no name When any of these things occur, we emit a DataLossWarning i(tabsolute_importtdivisiontunicode_literalsN(tMutableMappingi(tbasei(tDataLossWarning(t constants(tetree(t _ihatexml(tPY3t binary_typeu {([^}]*)}(.*)uasdt DocumentTypecB`seZd„ZRS(cC`s||_||_||_dS(N(tnametpublicIdtsystemId(tselfR R R((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt__init__)s  (t__name__t __module__R(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR (stDocumentcB`s/eZd„Zd„Zd„ZeeƒZRS(cC`sd|_g|_dS(N(tNonet _elementTreet _childNodes(R((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR0s cC`sC|jjƒ}x|jjƒjƒD]}q%W|j|jƒdS(N(Rtgetroott itersiblingstaddnextt_element(Rtelementtlast((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt appendChild4scC`s|jS(N(R(R((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt_getChildNodes;s(RRRRRtpropertyt childNodes(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyR/s   c`sJg‰tjdtƒ‰d‡‡‡fd†‰ˆ|dƒdjˆƒS(NtpreventDoubleDashCommentsic `s t|dƒs{t|dƒr ˆjdƒ|jjr©|jjpL|jjsbd|jj}n%d|jj|jj|jjf}ˆjdd|d|fƒn|jƒ}x"|jƒdk rÙ|jƒ}q¸Wx›|dk r ˆ||dƒ|j ƒ}qÝWq t |t ƒs+t |t ƒrIˆjd d||fƒq ˆjd ƒx°|D]}ˆ||dƒq]WnŽ|jtkräˆjd d||jfƒt|d ƒr |jr ˆjd d||jfƒq n%tjj|jƒ}|dk rZ|jd ƒ}|jdƒ}tj|}ˆjdd||ˆj|ƒfƒn'ˆjdd|ˆj|jƒfƒt|dƒrvg}x›|jjƒD]Š\} } tj| ƒ}|dk r|jƒ\}} ˆj| ƒ} tj|}d|| f} nˆj| ƒ} |j| | fƒq¦Wx?t|ƒD].\} } ˆjdd|d| | fƒqAWn|jr¤ˆjd d|d|jfƒn|d7}x|D]} ˆ| |ƒqµWt|d ƒr |jr ˆjd d|d|jfƒndS(Nutagugetrootu #documentu uu|%s%su iu|%s"%s"u#document-fragmentu|%sutailiu |%s<%s %s>u|%s<%s>uattribu%s %su |%s%s="%s"(thasattrtappendtdocinfot internalDTDt public_idt system_urlt root_nameRt getpreviousRtgetnextt isinstancetstrtbytesttagt comment_typettextttailtetree_builderst tag_regexptmatchtgroupRtprefixest fromXmlNametattribtitemstgroupstsorted( Rtindenttdtd_strt next_elementtnsmatchtnsR.tprefixt attributesR tvaluet attr_stringtchild(t infosetFiltertrvtserializeElement(s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRHEsp      "   $    ) %  u (Rt InfosetFiltertTruetjoin(R((RFRGRHs]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttestSerializerAs F c`s/g‰‡‡fd†‰ˆ|ƒdjˆƒS(u4Serialize an element and its child nodes to a stringc`s‡t|dƒsi|jjrV|jjr6|jj}nd|jj}ˆj|ƒnˆ|jƒƒnï|jtkr’ˆjd|j fƒnÆ|j sµˆjd|jfƒnUdj g|j j ƒD]\}}d||f^q˃}ˆjd|j|fƒ|j r&ˆj|j ƒnx|D]}ˆ|ƒq-Wˆjd|jfƒt|d ƒrƒ|j rƒˆj|j ƒndS( Nutagu u u<%s>u u%s="%s"u<%s %s>uutail(R"R$R%tdoctypeR(R#RR.R/R0R8RKR9R1(RR=R RCtattrRE(RGRH(s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRH”s*    2  u(RK(R((RGRHs]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyttostrings t TreeBuildercB`s†eZeZeZd Zd ZeZ e Z e d„Z d„Zd„Zd„Zd„Zd„Zd d„Zd d„Zd„ZRS( c`sÃtjtd|ƒ‰tjdtƒ‰|_||_dtf‡fd†ƒY‰dˆj f‡‡‡fd†ƒY}dˆj f‡‡fd†ƒY}||_ ||_ t jj||ƒdS( NtfullTreeR!t Attributesc`sVeZd„Z‡fd†Zd„Zd„Zd„Zd„Zd„Zd„Z RS(cS`s ||_dS(N(R(RR((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRÇsc`sFt|tƒr3d|dˆj|dƒf}nˆj|ƒ}|S(Nu{%s}%sii(R+ttupletcoerceAttribute(RtkeyR (RF(s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt _coerceKeyÊs$cS`sH|jjj|j|ƒ}t rDt|tƒrD|jdƒ}n|S(Nuascii(RR8RVR R+R tdecode(RRURC((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt __getitem__ÑscS`s ||jjj|j|ƒunameuGlxml cannot represent doctype with a different name to the root elementu$udatau namespaceu{%s}%s(RMR R RRRFt coercePubidtfindR†R‡RtreplaceRt fromstringR~Rzt addpreviousRt documentClassRt getroottreeRtgettdefaultNamespaceR.RyRR#RRŽR}( RR‰tdocStrtsysidtroott comment_tokentcommentR Rat etree_tagt root_element((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt insertRootQsJ    *        N(RRRR”R RˆRRyRzt fragmentClassRtimplementationtFalseRR{RLR€R…R‹R|RŽRŸ(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRP¹s \      ($t__doc__t __future__RRRR†tretsystcollections.abcRt ImportErrort collectionstRRRRR2Rt lxml.etreetpip._vendor.sixR R RJRQtcompileR3RsR.R/tobjectR RRLRORP(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt s.     O )