Your IP : 18.226.180.81


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/htmllib.pyo

�
�mec@s�dZddlmZeddd�[ddlZddlmZdd	gZd	ejfd
��YZdej	fd��YZ
ed�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
�Zd�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.pythandle_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 <A> tag with
        the same names.  The default implementation maintains a list of
        hyperlinks (defined by the HREF attribute for <A> 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�scCsdS(N((R
((s/usr/lib64/python2.7/htmllib.pytend_html�scCsdS(N((R
R0((s/usr/lib64/python2.7/htmllib.pyt
start_head�scCsdS(N((R
((s/usr/lib64/python2.7/htmllib.pytend_head�scCsdS(N((R
R0((s/usr/lib64/python2.7/htmllib.pyt
start_body�scCsdS(N((R
((s/usr/lib64/python2.7/htmllib.pytend_body�scCs|j�dS(N(R (R
R0((s/usr/lib64/python2.7/htmllib.pytstart_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.pytend_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.pytend_addressscCs$|jjd�|jjd�dS(Nit
blockquote(RRAtpush_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_citeYscCs|j�dS(N(tend_i(R
((s/usr/lib64/python2.7/htmllib.pytend_citeZscCs|j|�dS(N(tstart_tt(R
R0((s/usr/lib64/python2.7/htmllib.pyt
start_code\scCs|j�dS(N(tend_tt(R
((s/usr/lib64/python2.7/htmllib.pytend_code]scCs|j|�dS(N(R�(R
R0((s/usr/lib64/python2.7/htmllib.pytstart_em_scCs|j�dS(N(R�(R
((s/usr/lib64/python2.7/htmllib.pytend_em`scCs|j|�dS(N(R�(R
R0((s/usr/lib64/python2.7/htmllib.pyt	start_kbdbscCs|j�dS(N(R�(R
((s/usr/lib64/python2.7/htmllib.pytend_kbdcscCs|j|�dS(N(R�(R
R0((s/usr/lib64/python2.7/htmllib.pyt
start_sampescCs|j�dS(N(R�(R
((s/usr/lib64/python2.7/htmllib.pytend_sampfscCs|j|�dS(N(tstart_b(R
R0((s/usr/lib64/python2.7/htmllib.pytstart_stronghscCs|j�dS(N(tend_b(R
((s/usr/lib64/python2.7/htmllib.pyt
end_strongiscCs|j|�dS(N(R�(R
R0((s/usr/lib64/python2.7/htmllib.pyt	start_varkscCs|j�dS(N(R�(R
((s/usr/lib64/python2.7/htmllib.pytend_varlscCs |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(\RRRthtmlentitydefsRRRRRR 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.pyt<module>s	��'