bg:MdZddlmZmZmZmZddlTddlmZddl Z ddl Z e j dZ e j dZ e j dZe j d Ze j d Ze j d Ze j d Ze j d Ze j dZe j dZe j dZe j de jZe j de jZe j d Ze j dZGddeZGddejZdS)zLA parser for HTML and XHTML. Backported for python-future from Python 3.3. )absolute_importdivisionprint_functionunicode_literals)*) _markupbaseNz[&<]z &[a-zA-Z#]z%&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]z)&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]z <[a-zA-Z]>z--\s*>z(([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*z[a-zA-Z][^ />]*zJ\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*(\'[^\']*\'|"[^"]*"|[^\s"\'=<>`]*))?z]((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*a <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name (?:\s+ # whitespace before attribute name (?:[a-zA-Z_][-.:a-zA-Z0-9_]* # attribute name (?:\s*=\s* # value indicator (?:'[^']*' # LITA-enclosed value |\"[^\"]*\" # LIT-enclosed value |[^'\">\s]+ # bare value ) )? ) )* \s* # trailing whitespace aF <[a-zA-Z][-.a-zA-Z0-9:_]* # tag name (?:[\s/]* # optional whitespace before attribute name (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name (?:\s*=+\s* # value indicator (?:'[^']*' # LITA-enclosed value |"[^"]*" # LIT-enclosed value |(?!['"])[^>\s]* # bare value ) (?:\s*,)* # possibly followed by a comma )?(?:\s|/(?!>))* )* )? \s* # trailing whitespace z#c eZdZdZddZdZdS)HTMLParseErrorz&Exception raised for all parse errors.NNcP|sJ||_|d|_|d|_dS)Nrmsglinenooffset)selfrpositions m/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/future/backports/html/parser.py__init__zHTMLParseError.__init__Us, sqk qk cj|j}|j |d|jzz}|j|d|jdzzz}|S)Nz , at line %dz , column %drr)rresults r__str__zHTMLParseError.__str__[sD ; "nt{::F ; "mt{Q??F rN)r )__name__ __module__ __qualname____doc__rrrrr r Rs=00"""" rr ceZdZdZdZd dZdZdZdZdZ d Z d Z d Z d Z d ZdZd!dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd S)" HTMLParseraFind tags and other markup and call handler functions. Usage: p = HTMLParser() p.feed(data) ... p.close() Start tags are handled by calling self.handle_starttag() or self.handle_startendtag(); end tags by self.handle_endtag(). The data between tags is passed from the parser to the derived class by calling self.handle_data() with the data as argument (the data may be split up in arbitrary chunks). Entity references are passed by calling self.handle_entityref() with the entity reference as the argument. Numeric character references are passed to self.handle_charref() with the string containing the reference as the argument. )scriptstyleFcx|rtjdtd||_|dS)zInitialize and reset this instance. If strict is set to False (the default) the parser will parse invalid markup, otherwise it will raise an error. Note that the strict mode is deprecated. zThe strict mode is deprecated.) stacklevelN)warningswarnDeprecationWarningstrictreset)rr*s rrzHTMLParser.__init__zsE  < M:, < < < <  rcd|_d|_t|_d|_t j|dS)z1Reset this instance. Loses all unprocessed data.z???N)rawdatalasttaginteresting_normal interesting cdata_elemr ParserBaser+rs rr+zHTMLParser.resets<  -$$T*****rcN|j|z|_|ddS)zFeed data to the parser. Call this as often as you want, with as little or as much text as you want (may include '\n'). rN)r.goaheadrdatas rfeedzHTMLParser.feeds% |d*  Qrc0|ddS)zHandle any buffered data.rN)r6r4s rclosezHTMLParser.closes QrcFt||N)r getpos)rmessages rerrorzHTMLParser.errorsWdkkmm444rNc|jS)z)Return full source of start tag: '<...>'.)_HTMLParser__starttag_textr4s rget_starttag_textzHTMLParser.get_starttag_texts ##rc||_tjd|jztj|_dS)Nz )lowerr2recompileIr1)relems rset_cdata_modezHTMLParser.set_cdata_modes4**,,:nt&FMMrc,t|_d|_dSr=)r0r1r2r4s rclear_cdata_modezHTMLParser.clear_cdata_modes-rc |j}d}t|}||kri|j||}|r|}n |jrn.|}||kr|||||||}||krn|j}|d|rt ||r| |}n|d|r| |}n|d|r| |}n|d|r||}ne|d|r3|jr||}n<||}n&|dz|kr|d|dz}nn|dkr|sn|jr|d|d |dz}|dkr%|d|dz}|dkr|dz}n|dz }|||||||}n0|d |rt( ||}|rq|d d } || |}|d |dz s|dz }|||}d ||dvr3||dd ||d }n\|d|r>t0 ||}|rj|d} || |}|d |dz s|dz }|||}t4 ||}|ra|r^|||dkr>|jr|dn!||kr|}|||dz}nJ|dz|kr/|d|||dz}n nJd||ki|r@||kr:|js3|||||||}||d|_dS)Nr<>D))$/// A%:c1Q3//"Eq!,,A"((!449u{{}} ;;;9 JJ'LMMMM Avv$% $q!a% 8 8A!eq[[$$S)))q!a%00AA5555qu!eex  %1q555   WQqS\ * * *q!$$Aqrr{ rc|j}|||dzdks Jd|||dzdkr||S|||dzdkr||S|||dzd krF|d |dz}|d krd S|||dz||d zS||S) Nr%rRz+unexpected call to parse_html_declaration()rPzV # #%%a(( ( QqsU^u $ $,,Q// / QqsU^ ! ! # #{ 2 2LLac**E{{r   WQqSY/ 0 0 07N++A.. .rrc|j}|||dzdvs Jd|d|dz}|dkrdS|r |||dz||dzS)Nr%)rRrOz"unexpected call to parse_comment()r rTr)r.rehandle_comment)rrmreportr.poss rrxzHTMLParser.parse_bogus_comment-s,q1u~---1B---ll3!$$ "992  2   !C 0 1 1 1Qwrc|j}|||dzdks Jdt||dz}|sdS|}|||dz||}|S)Nr%rQzunexpected call to parse_pi()rT)r.picloserXrY handle_piri)rrmr.r^ros rrbzHTMLParser.parse_pi9s,q1u~%%%'F%%%w!,, 2 KKMM wqsAv''' IIKKrcd|_||}|dkr|S|j}||||_g}t||dz}|s Jd|}|dx|_}||kr|j rt||}nt||}|sn|ddd\} } } | sd} nI| dddcxkr| ddks"n| dddcxkr| ddkr nn | dd} | r| | } | | | f|}||k|||} | d vr|\} }d |jvrM| |jd z} t#|j|jd z }n|t#|jz}|j r(|d |||dd |||||S| d r|||n4|||||jvr|||S)Nrrz#unexpected call to parse_starttag()r%rt'rT")r /> zjunk characters in start tag: r)rBcheck_for_whole_start_tagr.tagfindr^rirgrEr/r*attrfindattrfind_tolerantunescapeappendstripr>countrWrfindr@rZendswithhandle_startendtaghandle_starttagCDATA_CONTENT_ELEMENTSrJ)rrmendposr.attrsr^rptagmattrnamerest attrvaluerirrs rr_zHTMLParser.parse_starttagEsE#//22 A::M,&qx0 gqs++;;;;;u IIKK"[[^^11333 s&jj{ 8NN7A..%++GQ77 ()1a(8(8 %HdI , 2A2$8888)BCC.88882A2#777723377777%adO  5 MM)44 LL(..**I6 7 7 7A!&jj$ah%%'' k ! !![[]]NFFt+++$"6"<"Ds{{1u s{{%%dA..!q5L%%c1--2;<NN1a!e,,,JJ:;;;q55Hq5Lrzzr566r{ 2q!$$$ 01111uu1u 6777rc|j}|||dzdks Jdt||dz}|sdS|}t||}|s|j|||||S|jr | d|||t||dz}|s+|||dzdkr|dzS| |S| }|d |}|||dzS| d }|j*||jkr|||||S|| ||S) Nr%rOzunexpected call to parse_endtagrrTz bad end tag: rtzr )r. endendtagrXri endtagfindr^r2rZr*r@tagfind_tolerantrxrgrEre handle_endtagrL)rrmr.r^ry namematchtagnamerIs rr`zHTMLParser.parse_endtags,q1u~%%%'H%%%  !A#.. 2   !,, *  5!1222 { D %0@0@BCCC(..w!<U**Q3J33A666oo''--//G LLimmoo66E   w ' ' '7N{{1~~##%% ? &t&&  5!1222  4::<<(((  rc\|||||dSr=)rrrrrs rrzHTMLParser.handle_startendtags2 S%((( 3rcdSr=rrs rrzHTMLParser.handle_starttag rcdSr=r)rrs rrzHTMLParser.handle_endtagrrcdSr=rrrqs rrhzHTMLParser.handle_charrefrrcdSr=rrs rrkzHTMLParser.handle_entityrefrrcdSr=rr7s rrZzHTMLParser.handle_datarrcdSr=rr7s rr{zHTMLParser.handle_commentrrcdSr=r)rdecls rrwzHTMLParser.handle_declrrcdSr=rr7s rrzHTMLParser.handle_pirrcH|jr|d|dSdS)Nzunknown declaration: )r*r@r7s r unknown_declzHTMLParser.unknown_decls5 ; < JJJDD: ; ; ; ; ; < .replaceEntitiess^ 1 A #Q43;;!""Aty((!"" S 1 1266 ..q66M A@@@@@:: 8OZZ__#7Nq#a&&))##A!u~~$QrrU|ae3333&7N   ax sArs%::::::::::::((((((  RZ'' RZ % % BJ> ? ? "*@ A Arz+&& "*S//rz)$$ "*? @ @2:;<< 2:, - -BJ=>>BJ Z  (RZ)Z BJsOO RZ= > > Y$t*t*t*t*t*'t*t*t*t*t*r