Edit File: pygen.cpython-311.pyc
� ����v�d�(�����������������������>�����d�Z�ddlZddlmZ��G�d��d������������Zd��ZdS�)z<utilities for generating and formatting literal Python code.�����N)� exceptionsc��������������������`�����e�Zd�Zd��Zd��Zd��Zd��Zdd�Zd��Zd��Z d ��Z d ��Zdd�Zd ��Z d��Zd��ZdS�)� PythonPrinterc�����������������������d|�_���������g�|�_��������d|�_��������||�_��������d|�_��������g�|�_��������d|�_��������|�������������������������������������i�|�_��������t����������j ��������d������������|�_��������t����������j ��������d������������|�_��������t����������j ��������d������������|�_ ��������t����������j ��������d������������|�_��������t����������j ��������d ������������|�_��������t����������j ��������d ������������|�_��������d�S�)Nr���z ����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���s��� �A/opt/cloudlinux/venv/lib64/python3.11/site-packages/mako/pygen.py�__init__zPythonPrinter.__init__���s���������� � ����#���������������$����$�$�&�&�&�����!#��H�!5�!5�����H�-�-����*�%8�9�9����J�'J�K�K���"$�*�7�# ��# ����!�j�)N�O�O���������c������������������&�����|�xj���������|z ��c_���������d�S��N)r����r����nums��� r����_update_linenozPythonPrinter._update_lineno7���s���������s�����r���c������������������D�����|�j���������|�j��������vr||�j��������|�j���������<���d�S�d�S�r���)r���r���)r���r���s��� r����start_sourcezPythonPrinter.start_source:���s-�������;�d�o�-�-�+1�D�O�D�K�(�(�(��.�-r���c������������������j�����|�j������������������������������d|z���������������|����������������������|�������������d�S�)N� )r����writer!���r���s��� r����write_blankszPythonPrinter.write_blanks>���s6����������$��*�%�%�%����C� � � � � r���Nc�����������������������d|�_���������t����������t����������j��������d|������������������������D�]N\��}}|�j�����������������������������|�������������|�|����������������������||z����������������|����������������������d��������������OdS�)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_blockB���s������� � %����b�h�x��7�7�8�8�� #�� #�D�A�q���#�#�A�&�&�&��*��!�!�/�A�"5�6�6�6�����"�"�"�"� #�� #r���c������������������:�����|D�]}|�����������������������|��������������dS�)z"print a series of lines of python.N)� writeline)r����lines�lines��� r���� writelineszPythonPrinter.writelinesN���s0�������� !�� !�D��N�N�4� � � � � !�� !r���c������������������D����|�j���������s|�������������������������������������d|�_���������|�4|�j�����������������������������|������������s|�j�����������������������������|������������rd}nd}|ot����������|������������o|d���������dk����}|sw|r|����������������������|������������r`|�j��������dk����rU|�xj��������dz��c_��������t����������|�j��������������������dk����rt����������j ��������d�������������|�j��������������������������������������������|�dS�|�j��������� ��������������������|����������������������|������������dz����������������|����������������������t����������|���������������������d�������������������������������������|�j�����������������������������|������������r�|�j�����������������������������|������������}|rA|���������������������d������������}|�xj��������dz ��c_��������|�j�����������������������������|�������������dS�d}|�j�����������������������������|������������}|r.|�xj��������dz ��c_��������|�j�����������������������������|�������������dS�dS�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����#r���zToo many whitespace closuresr%���)r����_flush_adjusted_linesr����matchr����len�_is_unindentorr���r ���r���� MakoException�popr���r&����_indent_liner!���r+���r����searchr����groupr,���r���)r���r5����hastext� is_commentr:����indentor�m2s��� r���r3���zPythonPrinter.writelineS���sI�������#�� (��&�&�(�(�(�#'�D� �� �L��%�+�+�D�1�1�� ��~�#�#�D�)�)�� ���G�G��G��:�c�$�i�i�:�D��G�s�N� ��� %�� %� $� 3� 3�D� 9� 9� %����a����K�K�1��K�K���4�%�&�&�!�+�+� �.�/M�N�N�N���"�"�$�$�$��<��F�� ����$�+�+�D�1�1�D�8�9�9�9����C�� � �4� 0� 0�1�1�2�2�2���?�!�!�$�'�'�� 8� ��%�+�+�D�1�1�E��� 8� �;�;�q�>�>�����q� ����"�)�)�(�3�3�3�3�3�����,�2�2�4�8�8����8��K�K�1�$�K�K��&�-�-�h�7�7�7�7�7�' 8�� 8�"8��8r���c������������������.�����|��������������������������������������dS�)z1close this printer, flushing any remaining lines.N)r9����r���s��� r����closezPythonPrinter.close����s�������"�"�$�$�$�$�$r���c�����������������������t����������|�j��������������������dk����rdS�|�j��������d���������}|�dS�|�j�����������������������������|������������}t ����������|������������S�)zqreturn true if the given line is an 'unindentor', relative to the last 'indent' event received. r���F���)r;���r ���r���r:����bool)r���r5���rD���r:���s��� r���r<���zPythonPrinter._is_unindentor����s_��������t�!�"�"�a�'�'��5��%�b�)������5���#�)�)�$�/�/����E�{�{�r�����c������������������~�����|dk����r|�j���������|�j��������z��|z���S�t����������j��������d|z��|�j���������|�j��������z��|������������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.rL����^%s)r ���r���r����sub)r���r5���� stripspaces��� r���r?���zPythonPrinter._indent_line����sN������ ������$�t�{�2�T�9�9��v��Z���!2�T�[�!@�$� �� �� r���c������������������$�����d\��|�_���������|�_��������dS�)z^reset the flags which would indicate we are in a backslashed or triple-quoted section.)FFN)�backslashed�triplequotedrG���s��� r���r���z%PythonPrinter._reset_multi_line_flags����s�������/;�+���$�+�+�+r���c������������������������|�j���������p|�j��������}t����������t����������j��������d|������������������������|�_���������t����������t����������j��������d|������������������������}|dk����s |dz��dk����r |�j���������|�_��������|S�)zcreturn true if the given line is part of a multi-line block, via backslash or triple-quote.�\\$� \"\"\"|\'\'\'r�������r���)rR���rS���rK���r���r@���r;����findall)r���r5���� current_state�tripless��� r����_in_multi_linezPythonPrinter._in_multi_line����su��������(�=�D�,=� ��� �&�$� 7� 7�8�8����b�j�!1�4�8�8�9�9���a�<�<�7�Q�;�!�+�+�$(�$5� 5�D���r���c�����������������������d�}|��������������������������������������|�j��������D�]�}|����������������������|������������r|�j�����������������������������|dz�����������������5|�����������������������������������}|�=t ����������j��������d|������������r(t ����������j��������d|������������� ��������������������d������������}|�j�����������������������������|�� ��������������������||������������dz������������������g�|�_��������|��������������������������������������d�S�)Nr%����^[ \t]*[^# \t]� ^([ \t]*)r���)r���r ���r[���r���r&���� expandtabsr���r@���r:���rA���r?���)r���rP����entrys��� r���r9���z#PythonPrinter._flush_adjusted_lines����s�������� ��$�$�&�&�&��%�� O�� O�E��"�"�5�)�)�� O���!�!�%�$�,�/�/�/�/��(�(�*�*���%�"�)�4E�u�*M�*M�%�!#��,��!>�!>�!D�!D�Q�!G�!G�J���!�!�$�"3�"3�E�:�"F�"F��"M�N�N�N�N�����$�$�&�&�&�&�&r���r����rL���)�__name__� __module__�__qualname__r���r!���r#���r'���r1���r6���r3���rH���r<���r?���r���r[���r9�����r���r���r���r������s���������������&P��&P��&P�P�����2��2��2�!��!��!� #�� #�� #�� #�!��!��!� E8��E8��E8�N%��%��%������P �� �� �� �;��;��;������&'��'��'��'��'r���r���c�������������������������ddg�d\�������fd�}dd�}g�}d}t����������j��������d|�������������D�]�}�||������������r|���������������������|��������������#|�����������������������������������}|�=t����������j��������d|������������r(t����������j��������d |���������������������������������d ������������}|����������������������|||���������������������������d���������������������|������������S�) z<remove the left-whitespace margin of a block of Python code.F)r���r���c����������������������������������p�����������}t����������j��������d|�������������rd��<���nd��<���d��}|�r������������r9�|d�����������z��|�������������\��}}�|rd��<���ne�|d�����������z��|�������������\��}}�nL�|d|�������������\��}}�|r|S��|d|�������������\��}}�|r|���������������������d ��������������<������|d |�������������\��}}�|���|S�)NrU���TFc�����������������������t����������j��������|�|������������}|r,||t����������|���������������������d������������������������d�����������fS�d�|fS�)Nr���)r���r:���r;���rA���)�reg�t�ms��� r���r:���z7adjust_whitespace.<locals>.in_multi_line.<locals>.match��sJ���������a� � �A��� ��!�C����� � �O�O�-�-�.�.�.��Q�w�r���z%sz.*?(?=%s|$)r8���rV���r���z.*?(?=\"\"\"|\'\'\'|#|$))r���r@���rA���)r5����start_stater:���rk���rR����staterS���s��� ���r���� in_multi_linez(adjust_whitespace.<locals>.in_multi_line��sA�������K�(�?�E�,�,?�� �9�V�T�"�"�� '�!%�E�+���!&�E�+�� �� �� ���� C��\�"�� C��%���l�(;� ;�T�B�B���4���P�*/�E�,�'�'�#�e�N�U�<�5H�$H�$�O�O�G�A�t�t��%��d�+�+���4���'�&�&��%� 0�$�7�7���4����*+�'�'�!�*�*�E�,�'���%� ;�T�B�B���4�#��� C�&��r���rL���c������������������4�����t����������j��������d|z��d|�������������S�)NrN���rL���)r���rO���)r5���rP���s��� r���r?���z'adjust_whitespace.<locals>._indent_line'��s�������v�f�z�)�2�t�4�4�4r���Nr)���r]���r^���r���r%���ra���)r���r+���r,���r_���r@���r:���rA����join) �textrn���r?���r4���rP���r5���rR���rm���rS���s ��� @@@r����adjust_whitespacerr�������s����������E�N�E�"(��[�,�"��"��"��"��"��"��"�H5��5��5��5�� �E��J����4�(�(��9��9���=����� 9��L�L�������?�?�$�$�D��!�b�i�0A�4�&H�&H�!��X�l�D�9�9�?�?��B�B� ��L�L���d�J�7�7�8�8�8�8��9�9�U���r���)�__doc__r����makor���r���rr���re���r���r����<module>ru������ss������C��B�� � � � �������������l'��l'��l'��l'��l'��l'��l'��l'�^8��8��8��8��8r���