OwlCyberSecurity - MANAGER
Edit File: pygen.cpython-312.pyc
� ����e��g�(�����������������������6�����d�Z�ddlZddlmZ��G�d��d�������Zd��Zy)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��Zy)� PythonPrinterc�����������������������d|�_���������g�|�_��������d|�_��������||�_��������d|�_��������g�|�_��������d|�_��������|�j���������������������������i�|�_��������t��������j������������������d�������|�_��������t��������j������������������d�������|�_��������t��������j������������������d�������|�_ ��������t��������j������������������d�������|�_��������t��������j������������������d �������|�_��������t��������j������������������d �������|�_��������y�)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��� �9/opt/hc_python/lib/python3.12/site-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_lineno7���s���������s��r���c������������������h�����|�j�������������������|�j������������������vr||�j������������������|�j�������������������<���y�y�r���)r���r���)r���r���s��� r����start_sourcezPythonPrinter.start_source:���s)�������;�;�d�o�o�-�+1�D�O�O�D�K�K�(��.r���c������������������b�����|�j�������������������j������������������d|z����������|�j������������������|��������y�)N� )r����writer!���r���s��� r����write_blankszPythonPrinter.write_blanks>���s&�����������$��*�%����C� r���Nc������������������������d|�_���������t��������t��������j������������������d|��������������D�]G��\��}}|�j������������������j������������������|��������|�|�j ������������������||z�����������|�j������������������d���������I�y)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���se������ � %����b�h�h�x��7�8�D�A�q����#�#�A�&��*��!�!�/�A�"5�6�����"� �9r���c������������������4�����|D�]��}|�j������������������|����������y)z"print a series of lines of python.N)� writeline)r����lines�lines��� r���� writelineszPythonPrinter.writelinesN���s�������D��N�N�4� ��r���c������������������>����|�j�������������������s|�j���������������������������d|�_���������|�6|�j������������������j������������������|�������s|�j������������������j������������������|�������rd}nd}|xr�t��������|�������xr�|d���dk(��}|s~|r|�j ������������������|�������rk|�j������������������dkD��r\|�xj������������������dz��c_��������t��������|�j�������������������������dk(��rt��������j������������������d��������|�j������������������j���������������������������|�y|�j������������������j������������������|�j������������������|�������dz�����������|�j������������������t��������|j!������������������d����������������������|�j"������������������j%������������������|�������r�|�j&������������������j������������������|�������}|rB|j)������������������d�������}|�xj������������������dz ��c_��������|�j������������������j+������������������|��������yd}|�j,������������������j������������������|�������}|r1|�xj������������������dz ��c_��������|�j������������������j+������������������|��������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����#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���s��������#�#��&�&�(�#'�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���#�(r���c������������������$�����|�j���������������������������y)z1close this printer, flushing any remaining lines.N)r9����r���s��� r����closezPythonPrinter.close����s�������"�"�$r���c�����������������������t��������|�j�������������������������dk(��ry|�j������������������d���}|�y|�j������������������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����sY��������t�!�!�"�a�'���%�%�b�)��������#�#�)�)�$�/����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.���^%s)r ���r���r����sub)r���r5���� stripspaces��� r���r?���zPythonPrinter._indent_line����sR������ �����$�$�t�{�{�2�T�9�9��v�v��Z���!2�!2�T�[�[�!@�$� �� r���c������������������"�����d\��|�_���������|�_��������y)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�������������������xs�|�j������������������}t��������t��������j������������������d|��������������|�_���������t��������t��������j������������������d|��������������}|dk(��s|dz��dk7��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����sq��������(�(�=�D�,=�,=� ��� � �&�$� 7�8����b�j�j�!1�4�8�9���a�<�7�Q�;�!�+�$(�$5�$5� 5�D���r���c�����������������������d�}|�j���������������������������|�j������������������D�]���}|�j������������������|�������r|�j������������������j ������������������|dz������������3|j��������������������������}|�;t ��������j������������������d|�������r%t ��������j������������������d|�������j������������������d�������}|�j������������������j ������������������|�j������������������||�������dz��������������g�|�_��������|�j���������������������������y�)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�������� ��$�$�&��%�%�E��"�"�5�)����!�!�%�$�,�/��(�(�*���%�"�)�)�4E�u�*M�!#���,��!>�!D�!D�Q�!G�J����!�!�$�"3�"3�E�:�"F��"M�N��&������$�$�&r���r����rM���)�__name__� __module__�__qualname__r���r!���r#���r'���r1���r6���r3���rH���r<���r?���r���r[���r9�����r���r���r���r������sH������&P�P�2�!� #�!� E8�N%��P �;��&'r���r���c�������������������������ddg�d\�������fd�}dd�}g�}d}t��������j������������������d|��������D�]���}�||�������r|j������������������|���������|j��������������������������}|�;t��������j������������������d|�������r%t��������j ������������������d|�������j ������������������d �������}|j�������������������|||������������������d j������������������|�������S�)z<remove the left-whitespace margin of a block of Python code.F)r���r���c������������������T����������xs������}t��������j������������������d|��������rd��<���nd��<���d��}|�rt�����r-�|d�����z��|��������\��}}�|rd��<���nR�|d�����z��|��������\��}}�n?�|d|��������\��}}�|r|S��|d|��������\��}}�|r|j������������������d ���������<����g�|d |��������\��}}�|�r�t|S�)NrU���TFc������������������x�����t��������j������������������|�|�������}|r||t��������|j������������������d��������������d��fS�d�|fS�)Nr���)r���r:���r;���rA���)�reg�t�ms��� r���r:���z7adjust_whitespace.<locals>.in_multi_line.<locals>.match��s=����������a� �A���!�C����� �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��s���������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�#��&��r���c������������������6�����t��������j������������������d|z��d|��������S�)NrN���rM���)r���rO���)r5���rP���s��� r���r?���z'adjust_whitespace.<locals>._indent_line'��s�������v�v�f�z�)�2�t�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�� �E��J�����4�(������L�L����?�?�$�D��!�b�i�i�0A�4�&H��X�X�l�D�9�?�?��B� ��L�L��d�J�7�8��)���9�9�U��r���)�__doc__r����makor���r���rr���re���r���r����<module>ru������s#������C�� ���l'��l'�^8r���