%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/mako/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/mako/__pycache__/pygen.cpython-312.pyc

�

���e�(��6�dZddlZddlmZGd�d�Zd�Zy)z<utilities for generating and formatting literal Python code.�N)�
exceptionsc�^�eZdZd�Zd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Zd�Zy)�
PythonPrinterc���d|_g|_d|_||_d|_g|_d|_|j�i|_tjd�|_tjd�|_tjd�|_
tjd�|_tjd	�|_tjd
�|_y)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)�selfrs  �,/usr/lib/python3/dist-packages/mako/pygen.py�__init__zPythonPrinter.__init__s������
 ���#������������$����$�$�&����!#���H�!5������H�-����*�*�%8�9����J�J�'J�K���"$�*�*�7�#
���!�j�j�)N�O���c�.�|xj|z
c_y�N)r�r�nums  r�_update_linenozPythonPrinter._update_lineno7s�����s��rc�h�|j|jvr||j|j<yyr)rr)rrs  r�start_sourcezPythonPrinter.start_source:s)���;�;�d�o�o�-�+1�D�O�O�D�K�K�(�.rc�b�|jjd|z�|j|�y)N�
)r�writer!rs  r�write_blankszPythonPrinter.write_blanks>s&�������$��*�%����C� rNc���d|_ttjd|��D]G\}}|jj|�|�|j
||z�|jd��Iy)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
�appendr#r!)r�block�starting_lineno�i�ls     r�write_indented_blockz"PythonPrinter.write_indented_blockBsj��
 %����b�h�h�x��7�8�	#�D�A�q����#�#�A�&��*��!�!�/�A�"5�6�����"�		#rc�4�|D]}|j|��y)z"print a series of lines of python.N)�	writeline)r�lines�lines   r�
writelineszPythonPrinter.writelinesNs���	!�D��N�N�4� �	!rc�>�|js|j�d|_|�6|jj|�s|jj|�rd}nd}|xrt|�xr|ddk(}|s~|r|j
|�rk|jdkDr\|xjdzc_t|j�dk(rtjd��|jj�|�y|jj|j|�dz�|jt|j!d���|j"j%|�r�|j&j|�}|rB|j)d�}|xjdz
c_|jj+|�yd}|j,j|�}|r1|xjdz
c_|jj+|�yyy)	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_unindentorrr	r�
MakoException�poprr&�_indent_liner!r+r�searchr�groupr,r)rr5�hastext�
is_commentr:�indentor�m2s       rr3zPythonPrinter.writelineSs����#�#��&�&�(�#'�D� �
�L��%�%�+�+�D�1��~�~�#�#�D�)��G��G��:�c�$�i�:�D��G�s�N�
���� 3� 3�D� 9����a���K�K�1��K��4�%�%�&�!�+� �.�.�/M�N�N����"�"�$��<��	
�����$�+�+�D�1�D�8�9����C��
�
�4� 0�1�2��?�?�!�!�$�'�
�%�%�+�+�D�1�E�� �;�;�q�>�����q� ���"�"�)�)�(�3����,�,�2�2�4�8����K�K�1�$�K��&�&�-�-�h�7��#(rc�$�|j�y)z1close this printer, flushing any remaining lines.N)r9�rs r�closezPythonPrinter.close�s���"�"�$rc��t|j�dk(ry|jd}|�y|jj|�}t	|�S)zqreturn true if the given line is an 'unindentor',
        relative to the last 'indent' event received.

        rF���)r;r	rr:�bool)rr5rDr:s    rr<zPythonPrinter._is_unindentor�sY���t�!�!�"�a�'���%�%�b�)������#�#�)�)�$�/���E�{�rc��|dk(r|j|jz|zStjd|z|j|jz|�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.��^%s)r
rr�sub)rr5�
stripspaces   rr?zPythonPrinter._indent_line�sR��
����$�$�t�{�{�2�T�9�9��v�v��Z���!2�!2�T�[�[�!@�$�
�	
rc�"�d\|_|_y)z^reset the flags which would indicate we are in a backslashed
        or triple-quoted section.)FFN)�backslashed�triplequotedrGs rrz%PythonPrinter._reset_multi_line_flags�s��/;�+���$�+rc��|jxs|j}ttjd|��|_ttjd|��}|dk(s|dzdk7r|j|_|S)zcreturn true if the given line is part of a multi-line block,
        via backslash or triple-quote.�\\$�
\"\"\"|\'\'\'r�r)rRrSrKrr@r;�findall)rr5�
current_state�tripless    r�_in_multi_linezPythonPrinter._in_multi_line�sq���(�(�=�D�,=�,=�
���	�	�&�$� 7�8����b�j�j�!1�4�8�9���a�<�7�Q�;�!�+�$(�$5�$5� 5�D���rc���d}|j�|jD]�}|j|�r|jj	|dz��3|j�}|�;t
jd|�r%t
jd|�jd�}|jj	|j||�dz���g|_|j�y)Nr%�^[ \t]*[^# \t]�	^([ \t]*)r)rr
r[rr&�
expandtabsrr@r:rAr?)rrP�entrys   rr9z#PythonPrinter._flush_adjusted_lines�s����
��$�$�&��%�%�	O�E��"�"�5�)����!�!�%�$�,�/��(�(�*���%�"�)�)�4E�u�*M�!#���,��!>�!D�!D�Q�!G�J����!�!�$�"3�"3�E�:�"F��"M�N�	O�����$�$�&rr�rM)�__name__�
__module__�__qualname__rr!r#r'r1r6r3rHr<r?rr[r9�rrrrsH��&P�P�2�!�
#�!�
E8�N%��P
�;��&'rrc�����ddg�d\�����fd�}dd�}g}d}tjd|�D]�}||�r|j|��|j�}|�;tjd|�r%tj
d|�j
d	�}|j|||����d
j|�S)z<remove the left-whitespace margin of a block of Python code.F)rrc�T����xs��}tjd|�rd��<nd��<d�}|rt��r-|d��z|�\}}|rd��<nR|d��z|�\}}n?|d|�\}}|r|S|d|�\}}|r|jd	���<�g|d
|�\}}|r�t|S)NrUTFc�x�tj||�}|r||t|jd��dfSd|fS)Nr)rr:r;rA)�reg�t�ms   rr:z7adjust_whitespace.<locals>.in_multi_line.<locals>.matchs=������a� �A���!�C�����
�O�-�.�.�.��Q�w�rz%sz.*?(?=%s|$)r8rVrz.*?(?=\"\"\"|\'\'\'|#|$))rr@rA)r5�start_stater:rkrR�staterSs    ���r�
in_multi_linez(adjust_whitespace.<locals>.in_multi_lines�����K�(�?�E�,�,?��
�9�9�V�T�"�!%�E�+��!&�E�+��	���\�"����l�(;� ;�T�B���4��*/�E�,�'�#�N�U�<�5H�$H�$�O�G�A�t���d�+���4��&�&�� 0�$�7���4��*+�'�'�!�*�E�,�'��� ;�T�B���4�#�&�rc�6�tjd|zd|�S)NrNrM)rrO)r5rPs  rr?z'adjust_whitespace.<locals>._indent_line's���v�v�f�z�)�2�t�4�4rNr)r]r^rr%ra)rr+r,r_r@r:rA�join)	�textrnr?r4rPr5rRrmrSs	      @@@r�adjust_whitespacerr�s�����E�N�E�"(��[�,�"�H5�
�E��J�����4�(�9������L�L����?�?�$�D��!�b�i�i�0A�4�&H��X�X�l�D�9�?�?��B�
��L�L��d�J�7�8�9��9�9�U��r)�__doc__r�makorrrrrerr�<module>rus#��C�	��l'�l'�^8r

Zerion Mini Shell 1.0