%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/mako/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyc

�
�ǚPc@sadZddlZddlZddlmZddlmZdefd��YZd�ZdS(s<utilities for generating and formatting literal Python code.i����N(tStringIO(t
exceptionst
PythonPrintercBsneZd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�ZRS(cCsDd|_g|_d|_||_g|_t|_|j�dS(Nis    (tindentt
indent_detailtindentstringtstreamtline_buffertFalsetin_indent_linest_reset_multi_line_flags(tselfR((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyt__init__s						cCs|jj|�dS(N(Rtwrite(Rttext((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR
&scCs:t|_x*tjd|�D]}|jj|�qWdS(s�print a line or lines of python which already contain indentation.

        The indentation of the total block of lines will be adjusted to that of
        the current indent level.s\r?\nN(RR	tretsplitRtappend(Rtblocktl((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pytwrite_indented_block)s	cGs"x|D]}|j|�qWdS(s"print a series of lines of python.N(t	writeline(Rtlinestline((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyt
writelines2s
c	Cs�|js|j�t|_n|dksOtjd|�sOtjd|�rXt}nt}|o}t|�o}|ddk}|r�|s�|j|�r�|j	dkr�|j	d8_	t|j
�dkr�tjd��n|j
j
�q�n|dkrdS|jj|j|�d�tjd	|�r�tjd
|�}|r}|jd�}|j	d7_	|j
j|�q�d}tjd|�}|r�|j	d7_	|j
j|�q�ndS(s�print a line of python, indenting it according to the current
        indent level.

        this also adjusts the indentation counter according to the
        content of the line.

        s^\s*#s^\s*$it#isToo many whitespace closuresNs
s:[ \t]*(?:#.*)?$s ^\s*(if|try|elif|while|for|with)s(^\s*(def|class|else|elif|except|finally)(R	t_flush_adjusted_linestTruetNoneRtmatchRtlent_is_unindentorRRRtSyntaxExceptiontpopRR
t_indent_linetsearchtgroupR(RRthastextt
is_commentRtindentortm2((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR7s@		
	"		cCs|j�dS(s1close this printer, flushing any remaining lines.N(R(R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pytclose}scCsVt|j�dkrtS|jd}|dkr6tStjd|�}|sRtStS(sqreturn true if the given line is an 'unindentor',
        relative to the last 'indent' event received.

        ii����s"^\s*(else|elif|except|finally).*\:N(RRRRRRR(RRR'R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR�s
tcCs!tjd||j|j|�S(s�indent the given line according to the current indent level.

        stripspace is a string of space that will be truncated from the
        start of the line before indenting.s^%s(RtsubRR(RRt
stripspace((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR"�scCstt|_|_dS(s^reset the flags which would indicate we are in a backslashed
        or triple-quoted section.N(Rtbackslashedttriplequoted(R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR
�scCs�|jp|j}tjd|�r0t|_n	t|_ttjd|��}|dksm|ddkr}|j|_n|S(screturn true if the given line is part of a multi-line block,
        via backslash or triple-quote.s\\$s
\"\"\"|\'\'\'iii(R-R.RR#RRRtfindall(RRt
current_statettriples((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyt_in_multi_line�s
	cCs�d}|j�x�|jD]�}|j|�rF|jj|d�q|j�}|dkr�tjd|�r�tj	d|�j
d�}n|jj|j||�d�qWg|_|j�dS(Ns
s^[ \t]*[^# \t]s	^([ \t]*)i(RR
RR2RR
t
expandtabsRR#RR$R"(RR,tentry((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR�s
$	(
t__name__t
__module__RR
RRRR)RR"R
R2R(((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR
s						F		+			cs�ttg�d
\�����fd�}dd�}g}d}x�tjd|�D]�}||�rz|j|�qX|j�}|dkr�tjd|�r�tjd|�jd�}n|j|||��qXWd	j	|�S(s<remove the left-whitespace margin of a block of Python code.iics��p��}tjd|�r3t��<n
t��<d�}x�|r��r�|d��|�\}}|r�t��<q|d��|�\}}qI|d|�\}}|r�|S|d|�\}}|r�|jd���<qIn|d|�\}}qIW|S(	Ns\\$cSsCtj||�}|r5||t|jd��fSd|fSdS(Ni(RRRR$R(tregtttm((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR�ss%ss.*?(?=%s|$)Rs
\"\"\"|\'\'\'is.*?(?=\"\"\"|\'\'\'|#|$)(RR#RRR$(Rtstart_stateRR9(R-tstateR.(s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyt
in_multi_line�s(

		

 R*cSstjd|d|�S(Ns^%sR*(RR+(RR,((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyR"
ss\r?\ns^[ \t]*[^# \t]s	^([ \t]*)s
(iiN(
RRRRRR3R#RR$tjoin(RR<R"RR,R((R-R;R.s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pytadjust_whitespace�s$(	t__doc__RtstringRtmakoRtobjectRR>(((s;/opt/alt/python27/lib/python2.7/site-packages/mako/pygen.pyt<module>s
�

Zerion Mini Shell 1.0