ó 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 `sMt|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ÝWqIt |t ƒs+t |t ƒrqt |t ƒsStjd dksSt‚ˆjd d||fƒqIˆjd ƒxÈ|D]}ˆ||dƒq…Wn¦|jtkr ˆjd d||jfƒt|d ƒrI|jrIˆjd d||jfƒqIn=t |tjƒs$t‚tjj|jƒ}|dk rš|jdƒ}|jdƒ}tj|}ˆjdd||ˆj|ƒfƒn'ˆjdd|ˆj|jƒfƒt|dƒr¶g}x›|jjƒD]Š\} } tj| ƒ}|dk rN|j ƒ\}} ˆj| ƒ} tj|}d|| f} nˆj| ƒ} |j| | fƒqæWx?t!|ƒD].\} } ˆjdd|d| | fƒqWn|jräˆjd d|d|jfƒn|d7}x|D]} ˆ| |ƒqõWt|d ƒrI|jrIˆjd d|d|jfƒndS(Nutagugetrootu #documentu uu|%s%su iiu|%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 isinstancetstrtbytestsyst version_infotAssertionErrorttagt comment_typettextttailRt_Elementtetree_builderst tag_regexptmatchtgroupRtprefixest fromXmlNametattribtitemstgroupstsorted( Rtindenttdtd_strt next_elementtnsmatchtnsR1tprefixt attributesR tvaluet attr_stringtchild(t infosetFiltertrvtserializeElement(s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRLEst      " (  $    ) %  u (Rt InfosetFiltertTruetjoin(R((RJRKRLs]/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#RR1R2R3R<ROR=R4(RRAR RGtattrRI(RKRL(s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRL”s*    2  u(RO(R((RKRLs]/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 (RJ(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(RR<RZR R+R tdecode(RRYRG((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( RQR R0R RRRJt coercePubidtfindRŠR‹RtreplaceRt fromstringR‚R~t addpreviousRt documentClassRƒt getroottreeRtgettdefaultNamespaceR1R}RR#R…R’R( RRtdocStrtsysidtroott comment_tokentcommentR Ret etree_tagt root_element((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt insertRootQsL    *        N(RRRR˜R RŒRR}R~t fragmentClassRtimplementationtFalseRRRPR„R‰RR€R’R£(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyRT¹s \      ($t__doc__t __future__RRRRŠtreR.tcollections.abcRt ImportErrort collectionstRRRRR6Rt lxml.etreetpip._vendor.sixR R RNRUtcompileR7RwR1R2tobjectR RRPRSRT(((s]/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.pyt s.     O )