Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Aøªj¢9ã @sdZddlmZmZmZddlZddlZddlZyddlm Z Wn e k r`ddl m Z YnXddl m Z ddlmZdd l mZdd l mZdd l mZddljZdd lmZmZd ZejdƒZejdƒjZGdd„deƒZGdd„deƒZdd„Z dd„Z!Gdd„de j"ƒZ"dS)aÃ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 é)Úabsolute_importÚdivisionÚunicode_literalsN)ÚMutableMappingé)Úbaseé)ÚDataLossWarning)Ú constants)Úetree)Ú _ihatexml)ÚPY3Ú binary_typeTz {([^}]*)}(.*)Úasdc@seZdZdd„ZdS)Ú DocumentTypecCs||_||_||_dS)N)ÚnameÚpublicIdÚsystemId)Úselfrrr©rúD/tmp/pip-build-_d5lkt3n/html5lib/html5lib/treebuilders/etree_lxml.pyÚ__init__)szDocumentType.__init__N)Ú__name__Ú __module__Ú __qualname__rrrrrr(src@s,eZdZdd„Zdd„Zdd„ZeeƒZdS)ÚDocumentcCsd|_g|_dS)N)Ú _elementTreeÚ _childNodes)rrrrr0szDocument.__init__cCs2|jjƒ}x|jjƒjƒD]}qW|j|jƒdS)N)rÚgetrootZ itersiblingsZaddnextÚ_element)rÚelementÚlastrrrÚ appendChild4s zDocument.appendChildcCs|jS)N)r)rrrrÚ_getChildNodes;szDocument._getChildNodesN)rrrrr"r#ÚpropertyÚ childNodesrrrrr/srcs6g‰tjdd�‰d‡‡‡fdd„ ‰ˆ|dƒdjˆƒS)NT)ÚpreventDoubleDashCommentsrc sDt|dƒ�s8t|dƒrˆjdƒ|jjrz|jjp6|jjsFd|jj}nd|jj|jj|jjf}ˆjdd|d|fƒ|jƒ}x|jƒdk rš|jƒ}q„Wx–|dk r¾ˆ||dƒ|j ƒ}qžWnrt |t ƒsØt |t ƒ�r t |t ƒsôt jd dksôt‚ˆjd d||fƒn(ˆjd ƒx|D]}ˆ||dƒ�qW�n|jtk�rŒˆjd d||jfƒt|d ƒ�r@|j�r@ˆjd d||jfƒ�n´t |tjƒ�sžt‚tjj|jƒ}|dk �rô|jdƒ}|jdƒ}tj|}ˆjdd||ˆj|ƒfƒnˆjdd|ˆj|jƒfƒt|dƒ�rÊg}xr|jjƒD]d\} } tj| ƒ}|dk �rx|jƒ\}} ˆj| ƒ} tj|}d|| f} n ˆj| ƒ} |j| | fƒ�q.Wx2t |ƒD]&\} } ˆjdd|d| | fƒ�q W|j�rîˆjd d|d|jfƒ|d7}x|D]} ˆ| |ƒ�qüWt|d ƒ�r@|j�r@ˆjd d|d|jfƒdS)NÚtagrz #documentz zz|%s%sú rrz|%s"%s"z#document-fragmentz|%sÚtailrz |%s<%s %s>z|%s<%s>Úattribz%s %sz |%s%s="%s")!ÚhasattrÚappendÚdocinfoÚ internalDTDÚ public_idZ system_urlÚ root_namerZ getpreviousZgetnextÚ isinstanceÚstrÚbytesÚsysÚ version_infoÚAssertionErrorr'Ú comment_typeÚtextr)r Z_ElementÚetree_buildersÚ tag_regexpÚmatchÚgroupr ÚprefixesÚ fromXmlNamer*ÚitemsÚgroupsÚsorted) r ÚindentÚdtd_strZ next_elementÚnsmatchÚnsr'ÚprefixÚ attributesrÚvalueÚ attr_stringÚchild)Ú infosetFilterÚrvÚserializeElementrrrMEst                     " z(testSerializer..serializeElementÚ )r)r Ú InfosetFilterÚjoin)r r)rKrLrMrÚtestSerializerAs  F rQcs$g‰‡‡fdd„‰ˆ|ƒdjˆƒS)z4Serialize an element and its child nodes to a stringcs t|dƒsH|jjr:|jjr$|jj}n d|jj}ˆj|ƒˆ|jƒƒn |jtkrfˆjd|j fƒn‚|j s€ˆjd|jfƒn.dj dd„|j j ƒDƒƒ}ˆjd|j|fƒ|j rÀˆj|j ƒx|D] }ˆ|ƒqÆWˆjd |jfƒt|d ƒoö|j �rˆj|j ƒdS) Nr'z z z<%s>r(cSsg|]\}}d||f‘qS)z%s="%s"r)Ú.0rrHrrrú ¦sz6tostring..serializeElement..z<%s %s>zr))r+r-r.Údoctyper0r,rr'r7r8r*rPr?r))r rCÚattrrJ)rLrMrrrM”s*         z"tostring..serializeElementÚ)rP)r r)rLrMrÚtostring�s rWcszeZdZeZeZdZdZeZ e Z ddd„Z dd„Z dd„Zd d „Zd d „Zd d„Zddd„Zd‡fdd„ Zdd„Z‡ZS)Ú TreeBuilderNFcsŠtjt|d�‰tjdd�‰|_||_G‡fdd„dtƒ‰G‡‡‡fdd„dˆjƒ}G‡‡fdd „d ˆj ƒ}||_ ||_ t j j||ƒdS) N)ÚfullTreeT)r&csPeZdZdd„Z‡fdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dS)z(TreeBuilder.__init__..AttributescSs ||_dS)N)r)rr rrrrÇsz1TreeBuilder.__init__..Attributes.__init__cs4t|tƒr&d|dˆj|dƒf}n ˆj|ƒ}|S)Nz{%s}%srr)r1ÚtupleÚcoerceAttribute)rÚkeyr)rKrrÚ _coerceKeyÊs  z3TreeBuilder.__init__..Attributes._coerceKeycSs2|jjj|j|ƒ}t r.t|tƒr.|jdƒ}|S)NÚascii)rr*r]r r1rÚdecode)rr\rHrrrÚ __getitem__Ñs z4TreeBuilder.__init__..Attributes.__getitem__cSs||jjj|j|ƒ<dS)N)rr*r])rr\rHrrrÚ __setitem__×sz4TreeBuilder.__init__..Attributes.__setitem__cSs|jjj|j|ƒ=dS)N)rr*r])rr\rrrÚ __delitem__Úsz4TreeBuilder.__init__..Attributes.__delitem__cSst|jjjƒS)N)Úiterrr*)rrrrÚ__iter__Ýsz1TreeBuilder.__init__..Attributes.__iter__cSst|jjjƒS)N)Úlenrr*)rrrrÚ__len__àsz0TreeBuilder.__init__..Attributes.__len__cSs|jjjjƒS)N)rr*Úclear)rrrrrgãsz.TreeBuilder.__init__..Attributes.clearN) rrrrr]r`rarbrdrfrgr)rKrrÚ AttributesÆs rhcspeZdZ‡‡‡fdd„Z‡fdd„Z‡fdd„ZeeeƒZdd„Zd d „Z eee ƒZ d‡‡fd d „ Z dd„Z d S)z%TreeBuilder.__init__..Elementcs*ˆj|ƒ}ˆjj|||d�ˆ|ƒ|_dS)N)Ú namespace)Ú coerceElementÚElementrÚ _attributes)rrri)rhÚbuilderrKrrrçs z.TreeBuilder.__init__..Element.__init__cs$ˆj|ƒ|_|j|j|jƒ|j_dS)N)rjÚ_nameÚ _getETreeTagÚ _namespacerr')rr)rKrrÚ_setNameìs z.TreeBuilder.__init__..Element._setNamecs ˆj|jƒS)N)r>rn)r)rKrrÚ_getNameñsz.TreeBuilder.__init__..Element._getNamecSs|jS)N)rl)rrrrÚ_getAttributesösz4TreeBuilder.__init__..Element._getAttributescSs|j}|jƒ|j|ƒdS)N)rGrgÚupdate)rrHrGrrrÚ_setAttributesùsz4TreeBuilder.__init__..Element._setAttributesNcsˆj|ƒ}ˆjj|||ƒdS)N)ÚcoerceCharactersrkÚ insertText)rÚdataÚ insertBefore)rmrKrrrws z0TreeBuilder.__init__..Element.insertTextcSs0t|ƒ|j|jƒ}|jjr,|jjj|jjƒ|S)N)Útyperrirr*rt)rr rrrÚ cloneNodesz/TreeBuilder.__init__..Element.cloneNode)N) rrrrrqrrr$rrsrurGrwr{r)rhrmrKrrrkæs    rkcs8eZdZ‡‡fdd„Z‡fdd„Zdd„ZeeeƒZdS)z%TreeBuilder.__init__..Commentcsˆj|ƒ}ˆjj||ƒdS)N)Ú coerceCommentÚCommentr)rrx)rmrKrrr s z.TreeBuilder.__init__..Comment.__init__csˆj|ƒ}||j_dS)N)r|rr8)rrx)rKrrÚ_setDatas z.TreeBuilder.__init__..Comment._setDatacSs|jjS)N)rr8)rrrrÚ_getDatasz.TreeBuilder.__init__..Comment._getDataN)rrrrr~rr$rxr)rmrKrrr} s r})r9ÚgetETreeModuler r rOrKÚnamespaceHTMLElementsrrkr}Ú elementClassÚ commentClassrrXr)rr�rYrkr}r)rhrmrKrrÁs $zTreeBuilder.__init__cCs$tjj|ƒ|j|_g|_d|_dS)N)rrXÚresetÚinsertCommentInitialÚ insertCommentÚinitial_commentsrT)rrrrr„s zTreeBuilder.resetcCst|ƒS)N)rQ)rr rrrrQ#szTreeBuilder.testSerializercCstr |jjS|jjjƒSdS)N)rYÚdocumentrr)rrrrÚ getDocument&szTreeBuilder.getDocumentcCsFg}|jdj}|jr"|j|jƒ|jt|ƒƒ|jrB|j|jƒ|S)Nr)Ú openElementsrr8r,ÚextendÚlistr))rÚfragmentr rrrÚ getFragment,s   zTreeBuilder.getFragmentcCsh|d}|d}|d}|s0tjdtƒd|_n4|jj|ƒ}||krPtjdtƒ|j|||ƒ}||_dS)Nrrrz#lxml cannot represent empty doctypez%lxml cannot represent non-xml doctype)ÚwarningsÚwarnr rTrKrjÚ doctypeClass)rÚtokenrrrZ coercedNamerTrrrÚ insertDoctype6s   zTreeBuilder.insertDoctypecCs6|dks||jkst‚|jjdks&t‚|jj|ƒdS)N)rˆr6rr‡r,)rrxÚparentrrrr…Fsz TreeBuilder.insertCommentInitialcsB||jkr,|jjjƒdjtkr,tjdtƒtt |ƒj ||ƒdS)Nrz@lxml cannot represent adjacent comments beyond the root elementséÿÿÿÿ) rˆrrr'r7r�r�r ÚsuperrXr†)rrxr”)Ú __class__rrÚinsertCommentMainKs  zTreeBuilder.insertCommentMainc Cs¸d}|jrô|jjst‚|d|jj7}|jjdk s>|jjdk rÐ|d|jj|jjpRdƒ7}|jjrÈ|jj}|jdƒdkrž|jdƒdkržtj dt ƒ|j ddƒ}|jdƒdkrº|d |7}qÐ|d |7}n|d 7}|d 7}|jj|d krôtj dt ƒ|d7}t j |ƒ}x*|jD] }|j|dƒ}|j|jƒ�qW|jƒ|_|jƒ|j_|d }|jd|jƒ}|dk�rn|} n d||f} | |_|j||ƒ} || _|jjj| ƒ|jj| ƒ|j|_dS)NrVz rzGlxml cannot represent doctype with a different name to the root elementz$rxriz{%s}%s)rTrr6rrrKÚ coercePubidÚfindr�r�r Úreplacer Ú fromstringr‡rƒZ addpreviousrÚ documentClassrˆZ getroottreerÚgetÚdefaultNamespacer'r‚rr,rŠr˜r†) rr’ZdocStrÚsysidÚrootÚ comment_tokenÚcommentrriÚ etree_tagZ root_elementrrrÚ insertRootQsL              zTreeBuilder.insertRoot)F)N)N)rrrrr rr‘r‚rƒÚ fragmentClassr Úimplementationrr„rQr‰rŽr“r…r˜r¨Ú __classcell__rr)r—rrX¹s \  rX)#Ú__doc__Ú __future__rrrr�Úrer4Úcollections.abcrÚ ImportErrorÚ collectionsrVrr r r r9r Z lxml.etreeÚsixr rrYÚcompiler:r}r'r7ÚobjectrrrQrWrXrrrrÚ s.        O)