?????????????? ?????????????? ?????????????? ?????????????? ó zfc@s©dZddlmZedddƒ[ddlZddlmZdd gZd ejfd „ƒYZdej fd „ƒYZ e d „Z e d kr¥e ƒndS(svHTML 2.0 parser. See the HTML 2.0 specification: http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html iÿÿÿÿ(twarnpy3ks1the htmllib module has been removed in Python 3.0t stackleveliN(tAS_ISt HTMLParsertHTMLParseErrorcBseZdZRS(s3Error raised when an HTML document can't be parsed.(t__name__t __module__t__doc__(((s/usr/lib64/python2.7/htmllib.pyRscBs3eZdZddlmZdd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z!d!„Z"d"„Z#d#„Z$d$„Z%d%„Z&d&„Z'd'„Z(d(„Z)d)„Z*d*„Z+d+„Z,d,„Z-d-„Z.d.„Z/d/„Z0d0„Z1d1„Z2d2„Z3d3„Z4d4„Z5d5„Z6d6„Z7d7„Z8d8„Z9d9„Z:d:„Z;d;„Z<d<„Z=d=„Z>dd>„Z?d?„Z@d@„ZAdA„ZBdB„ZCdC„ZDdD„ZEdE„ZFdF„ZGdG„ZHdH„ZIdI„ZJdJ„ZKdK„ZLdL„ZMdM„ZNdN„ZOdO„ZPdP„ZQdQ„ZRdR„ZSdS„ZTdT„ZUdU„ZVdV„ZWdW„ZXdX„ZYdY„ZZdZ„Z[RS([sÌThis is the basic HTML parser class. It supports all entity names required by the XHTML 1.0 Recommendation. It also defines handlers for all HTML 2.0 and many HTML 3.0 and 3.2 elements. iÿÿÿÿ(t entitydefsicCs tjj||ƒ||_dS(s•Creates an instance of the HTMLParser class. The formatter parameter is the formatter instance associated with the parser. N(tsgmllibt SGMLParsert__init__t formatter(tselfR tverbose((s/usr/lib64/python2.7/htmllib.pyR "scCst|ƒ‚dS(N(R(R tmessage((s/usr/lib64/python2.7/htmllib.pyterror,scCs\tjj|ƒd|_d|_d|_d|_d|_g|_ d|_ g|_ dS(Ni( R R tresettNonetsavedatatisindexttitletbasetanchort anchorlisttnofillt list_stack(R ((s/usr/lib64/python2.7/htmllib.pyR/s       cCsR|jdk r"|j||_n,|jr>|jj|ƒn|jj|ƒdS(N(RRRR tadd_literal_datatadd_flowing_data(R tdata((s/usr/lib64/python2.7/htmllib.pyt handle_data?s  cCs d|_dS(sêBegins saving character data in a buffer instead of sending it to the formatter object. Retrieve the stored data via the save_end() method. Use of the save_bgn() / save_end() pair may not be nested. tN(R(R ((s/usr/lib64/python2.7/htmllib.pytsave_bgnJscCs7|j}d|_|js3dj|jƒƒ}n|S(sHEnds buffering character data and returns all data saved since the preceding call to the save_bgn() method. If the nofill flag is false, whitespace is collapsed to single spaces. A call to this method without a preceding call to the save_bgn() method will raise a TypeError exception. t N(RRRtjointsplit(R R((s/usr/lib64/python2.7/htmllib.pytsave_endTs   cCs)||_|jr%|jj|ƒndS(s}This method is called at the start of an anchor region. The arguments correspond to the attributes of the tag with the same names. The default implementation maintains a list of hyperlinks (defined by the HREF attribute for tags) within the document. The list of hyperlinks is available as the data attribute anchorlist. N(RRtappend(R threftnamettype((s/usr/lib64/python2.7/htmllib.pyt anchor_bgnes  cCs3|jr/|jdt|jƒƒd|_ndS(sØThis method is called at the end of an anchor region. The default implementation adds a textual footnote marker using an index into the list of hyperlinks created by the anchor_bgn()method. s[%d]N(RRtlenRR(R ((s/usr/lib64/python2.7/htmllib.pyt anchor_endss cGs|j|ƒdS(s–This method is called to handle images. The default implementation simply passes the alt value to the handle_data() method. N(R(R tsrctalttargs((s/usr/lib64/python2.7/htmllib.pyt handle_image€scCsdS(N((R tattrs((s/usr/lib64/python2.7/htmllib.pyt start_html‹RcCsdS(N((R ((s/usr/lib64/python2.7/htmllib.pytend_htmlŒRcCsdS(N((R R0((s/usr/lib64/python2.7/htmllib.pyt start_headŽRcCsdS(N((R ((s/usr/lib64/python2.7/htmllib.pytend_head�RcCsdS(N((R R0((s/usr/lib64/python2.7/htmllib.pyt start_body‘RcCsdS(N((R ((s/usr/lib64/python2.7/htmllib.pytend_body’RcCs|jƒdS(N(R (R R0((s/usr/lib64/python2.7/htmllib.pyt start_title–scCs|jƒ|_dS(N(R$R(R ((s/usr/lib64/python2.7/htmllib.pyt end_title™scCs3x,|D]$\}}|dkr||_qqWdS(NR&(R(R R0tatv((s/usr/lib64/python2.7/htmllib.pytdo_baseœs cCs d|_dS(Ni(R(R R0((s/usr/lib64/python2.7/htmllib.pyt do_isindex¡scCsdS(N((R R0((s/usr/lib64/python2.7/htmllib.pytdo_link¤scCsdS(N((R R0((s/usr/lib64/python2.7/htmllib.pytdo_meta§scCsdS(N((R R0((s/usr/lib64/python2.7/htmllib.pyt do_nextidªscCs$|jjdƒ|jjdƒdS(Nith1i(R@iii(R t end_paragrapht push_font(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h1±scCs!|jjdƒ|jjƒdS(Ni(R RAtpop_font(R ((s/usr/lib64/python2.7/htmllib.pytend_h1µscCs$|jjdƒ|jjdƒdS(Nith2i(RFiii(R RARB(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h2¹scCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pytend_h2½scCs$|jjdƒ|jjdƒdS(Nith3i(RIiii(R RARB(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h3ÁscCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pytend_h3ÅscCs$|jjdƒ|jjdƒdS(Nith4i(RLiii(R RARB(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h4ÉscCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pytend_h4ÍscCs$|jjdƒ|jjdƒdS(Nith5i(ROiii(R RARB(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h5ÑscCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pytend_h5ÕscCs$|jjdƒ|jjdƒdS(Nith6i(RRiii(R RARB(R R0((s/usr/lib64/python2.7/htmllib.pytstart_h6ÙscCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pytend_h6ÝscCs|jjdƒdS(Ni(R RA(R R0((s/usr/lib64/python2.7/htmllib.pytdo_pãscCs@|jjdƒ|jjtttdfƒ|jd|_dS(Ni(R RARBRR(R R0((s/usr/lib64/python2.7/htmllib.pyt start_preæscCs:|jjdƒ|jjƒtd|jdƒ|_dS(Nii(R RARDtmaxR(R ((s/usr/lib64/python2.7/htmllib.pytend_preës cCs|j|ƒ|jdƒdS(Ntxmp(RVt setliteral(R R0((s/usr/lib64/python2.7/htmllib.pyt start_xmpðs cCs|jƒdS(N(RX(R ((s/usr/lib64/python2.7/htmllib.pytend_xmpôscCs|j|ƒ|jdƒdS(Ntlisting(RVRZ(R R0((s/usr/lib64/python2.7/htmllib.pyt start_listing÷s cCs|jƒdS(N(RX(R ((s/usr/lib64/python2.7/htmllib.pyt end_listingûscCs0|jjdƒ|jjtdttfƒdS(Nii(R RARBR(R R0((s/usr/lib64/python2.7/htmllib.pyt start_addressþscCs!|jjdƒ|jjƒdS(Ni(R RARD(R ((s/usr/lib64/python2.7/htmllib.pyt end_addressscCs$|jjdƒ|jjdƒdS(Nit blockquote(R RAt push_margin(R R0((s/usr/lib64/python2.7/htmllib.pytstart_blockquotescCs!|jjdƒ|jjƒdS(Ni(R RAt pop_margin(R ((s/usr/lib64/python2.7/htmllib.pytend_blockquote scCsA|jj|j ƒ|jjdƒ|jjdddgƒdS(Ntult*i(R RARRcR%(R R0((s/usr/lib64/python2.7/htmllib.pytstart_ulscCs;|jr|jd=n|jj|j ƒ|jjƒdS(Niÿÿÿÿ(RR RARe(R ((s/usr/lib64/python2.7/htmllib.pytend_uls cCsk|jjdƒ|jrH|jd\}}}}|d|d<}n d\}}|jj||ƒdS(NiiÿÿÿÿiiRh(Rhi(R RARtadd_label_data(R R0tdummytlabeltcounterttop((s/usr/lib64/python2.7/htmllib.pytdo_lis   cCs’|jj|j ƒ|jjdƒd}xH|D]@\}}|dkr1t|ƒdkrh|d}n|}q1q1W|jjd|dgƒdS(Ntols1.R(it.i(R RARRcR*R%(R R0RmR9R:((s/usr/lib64/python2.7/htmllib.pytstart_ol#s   cCs;|jr|jd=n|jj|j ƒ|jjƒdS(Niÿÿÿÿ(RR RARe(R ((s/usr/lib64/python2.7/htmllib.pytend_ol-s cCs|j|ƒdS(N(Ri(R R0((s/usr/lib64/python2.7/htmllib.pyt start_menu2scCs|jƒdS(N(Rj(R ((s/usr/lib64/python2.7/htmllib.pytend_menu5scCs|j|ƒdS(N(Ri(R R0((s/usr/lib64/python2.7/htmllib.pyt start_dir8scCs|jƒdS(N(Rj(R ((s/usr/lib64/python2.7/htmllib.pytend_dir;scCs-|jjdƒ|jjdddgƒdS(NitdlRi(R RARR%(R R0((s/usr/lib64/python2.7/htmllib.pytstart_dl>scCs'|jdƒ|jr#|jd=ndS(Niiÿÿÿÿ(tddpopR(R ((s/usr/lib64/python2.7/htmllib.pytend_dlBs  cCs|jƒdS(N(R{(R R0((s/usr/lib64/python2.7/htmllib.pytdo_dtFscCs7|jƒ|jjdƒ|jjdddgƒdS(NtddRi(R{R RcRR%(R R0((s/usr/lib64/python2.7/htmllib.pytdo_ddIs cCsQ|jj|ƒ|jrM|jdddkrM|jd=|jjƒqMndS(NiÿÿÿÿiR~(R RARRe(R tbl((s/usr/lib64/python2.7/htmllib.pyR{Ns   cCs|j|ƒdS(N(tstart_i(R R0((s/usr/lib64/python2.7/htmllib.pyt start_citeYRcCs|jƒdS(N(tend_i(R ((s/usr/lib64/python2.7/htmllib.pytend_citeZRcCs|j|ƒdS(N(tstart_tt(R R0((s/usr/lib64/python2.7/htmllib.pyt start_code\RcCs|jƒdS(N(tend_tt(R ((s/usr/lib64/python2.7/htmllib.pytend_code]RcCs|j|ƒdS(N(R�(R R0((s/usr/lib64/python2.7/htmllib.pytstart_em_RcCs|jƒdS(N(Rƒ(R ((s/usr/lib64/python2.7/htmllib.pytend_em`RcCs|j|ƒdS(N(R…(R R0((s/usr/lib64/python2.7/htmllib.pyt start_kbdbRcCs|jƒdS(N(R‡(R ((s/usr/lib64/python2.7/htmllib.pytend_kbdcRcCs|j|ƒdS(N(R…(R R0((s/usr/lib64/python2.7/htmllib.pyt start_sampeRcCs|jƒdS(N(R‡(R ((s/usr/lib64/python2.7/htmllib.pytend_sampfRcCs|j|ƒdS(N(tstart_b(R R0((s/usr/lib64/python2.7/htmllib.pyt start_stronghRcCs|jƒdS(N(tend_b(R ((s/usr/lib64/python2.7/htmllib.pyt end_strongiRcCs|j|ƒdS(N(R�(R R0((s/usr/lib64/python2.7/htmllib.pyt start_varkRcCs|jƒdS(N(Rƒ(R ((s/usr/lib64/python2.7/htmllib.pytend_varlRcCs |jjtdttfƒdS(Ni(R RBR(R R0((s/usr/lib64/python2.7/htmllib.pyR�pscCs|jjƒdS(N(R RD(R ((s/usr/lib64/python2.7/htmllib.pyRƒrscCs |jjttdtfƒdS(Ni(R RBR(R R0((s/usr/lib64/python2.7/htmllib.pyR�uscCs|jjƒdS(N(R RD(R ((s/usr/lib64/python2.7/htmllib.pyR‘wscCs |jjtttdfƒdS(Ni(R RBR(R R0((s/usr/lib64/python2.7/htmllib.pyR…zscCs|jjƒdS(N(R RD(R ((s/usr/lib64/python2.7/htmllib.pyR‡|scCs‘d}d}d}xe|D]]\}}|jƒ}|dkrF|}n|dkr[|}n|dkr|jƒ}qqW|j|||ƒdS(NRR&R'R((tstriptlowerR)(R R0R&R'R(tattrnametvalue((s/usr/lib64/python2.7/htmllib.pytstart_as      cCs|jƒdS(N(R+(R ((s/usr/lib64/python2.7/htmllib.pytend_a�scCs|jjƒdS(N(R tadd_line_break(R R0((s/usr/lib64/python2.7/htmllib.pytdo_br’scCs|jjƒdS(N(R t add_hor_rule(R R0((s/usr/lib64/python2.7/htmllib.pytdo_hr—sc Csd}d}d}d}d}d}xÎ|D]Æ\}} |dkrL| }n|dkra| }n|dkrv| }n|dkr‹| }n|dkr¾yt| ƒ}Wq¾tk rºq¾Xn|d kr+yt| ƒ}Wqñtk ríqñXq+q+W|j||||||ƒdS( NRs(image)italignR-tismapR,twidththeight(tintt ValueErrorR/( R R0RŸR-R R,R¡R¢R—R˜((s/usr/lib64/python2.7/htmllib.pytdo_imgœs4            cCs|j|ƒ|jƒdS(N(RVt setnomoretags(R R0((s/usr/lib64/python2.7/htmllib.pyt do_plaintext¶s cCsdS(N((R ttagR0((s/usr/lib64/python2.7/htmllib.pytunknown_starttag¼scCsdS(N((R R¨((s/usr/lib64/python2.7/htmllib.pytunknown_endtag¿s(\RRRthtmlentitydefsRR RRRR R$R)R+R/R1R2R3R4R5R6R7R8R;R<R=R>R?RCRERGRHRJRKRMRNRPRQRSRTRURVRXR[R\R^R_R`RaRdRfRiRjRpRsRtRuRvRwRxRzR|R}RR{R‚R„R†RˆR‰RŠR‹RŒR�RŽR�R’R“R”R�RƒR�R‘R…R‡R™RšRœRžR¥R§R©Rª(((s/usr/lib64/python2.7/htmllib.pyRs²                                                                              c CsAddl}ddl}|s.|jd}n|oA|ddk}|rT|d=n|rg|d}nd}|dkr…|j}nCyt|dƒ}Wn-tk rÇ}|GdG|GH|jdƒnX|jƒ}||jk rð|jƒn|r|j ƒ}n|j |j ƒƒ}t |ƒ}|j |ƒ|jƒdS( Niÿÿÿÿiis-ss test.htmlt-trt:(tsysR targvtstdintopentIOErrortexittreadtcloset NullFormattertAbstractFormattert DumbWriterRtfeed( R.R¯R tsilenttfiletftmsgRtp((s/usr/lib64/python2.7/htmllib.pyttestÃs2         t__main__(RtwarningsRR R Rt__all__tSGMLParseErrorRR RRRÀR(((s/usr/lib64/python2.7/htmllib.pyts   ÿ­ '