ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/mako/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/mako/__pycache__/exceptions.cpython-311.pyc

�

�܋f�0��f�dZddlZddlZddlmZddlmZGd�de��ZGd�de��Zd	�Z	Gd
�de��Z
Gd�d
e��ZGd�de��ZGd�de��Z
Gd�de��ZGd�de��ZGd�d��Zdd�Zd�Zd�Zd�Ze��d�ZdS)zexception classes�N)�compat)�utilc��eZdZdS)�
MakoExceptionN��__name__�
__module__�__qualname__���F/opt/cloudlinux/venv/lib64/python3.11/site-packages/mako/exceptions.pyrr��������Drrc��eZdZdS)�RuntimeExceptionNrrrr
rrrrrc�$�|�d||fzSd|||fzS)Nz at line: %d char: %dz" in file '%s' at line: %d char: %dr)�lineno�pos�filenames   r
�_format_fileposrs)����&�&�#��6�6�3�x���6M�M�Mrc��eZdZd�ZdS)�CompileExceptionc	��t�||t|||��z��||_||_||_||_dS�N�r�__init__rrrr�source��self�messagerrrrs      r
rzCompileException.__init__ �R������'�O�F�C��B�B�B�	
�	
�	
������� ��
�����rN�rr	r
rrrr
rr�#����������rrc��eZdZd�ZdS)�SyntaxExceptionc	��t�||t|||��z��||_||_||_||_dSrrrs      r
rzSyntaxException.__init__+r rNr!rrr
r$r$*r"rr$c��eZdZdZdS)�UnsupportedErrorz&raised when a retired feature is used.N�rr	r
�__doc__rrr
r'r'5s������0�0�0�0rr'c��eZdZdZdS)�NameConflictErrorz3raised when a reserved word is used inappropriatelyNr(rrr
r+r+:s������=�=�=�=rr+c��eZdZdS)�TemplateLookupExceptionNrrrr
r-r-?rrr-c��eZdZdS)�TopLevelLookupExceptionNrrrr
r/r/Crrr/c��eZdZdZdd�Zed���Zd�Zd�Zed���Z	ed���Z
ed	���Zd
�ZdS)�
RichTracebackz�Pull the current exception from the ``sys`` traceback and extracts
    Mako-specific template information.

    See the usage examples in :ref:`handling_exceptions`.

    Nc�l�d\|_|_|�|�tj��\}}}|�|p|}|�|}||_|�|��|_t|jttf��r)|jj|_|jj|_d|_
|���dS)N)�rT)rr�sys�exc_info�error�_init�records�
isinstancerr$�_has_source�
_init_message)rr6�	traceback�t�value�tbacks      r
rzRichTraceback.__init__Ps���#(� ���T�[��=�I�-�!�l�n�n�O�A�u�e��=��J�Q�E����I���
��z�z�)�,�,����d�j�#3�_�"E�F�F�	$��*�+�D�K��*�+�D�K�#�D���������rc�4�tj|j��Sr)r�exception_namer6�rs r
�	errornamezRichTraceback.errornamefs���$�T�Z�0�0�0rc�N�	t|j��|_nR#t$rE	t|j��|_n'#t$r|jjd|_YnwxYwYnwxYwt
|jt��st|jdd��|_dSdS)z+Find a unicode representation of self.errorr�ascii�replaceN)�strr6r�UnicodeError�UnicodeEncodeError�argsr9rBs r
r;zRichTraceback._init_messagejs���	2��t�z�?�?�D�L�L���	2�	2�	2�
2�"�4�:�������%�
2�
2�
2� $�z��q�1�����
2������	2�����$�,��,�,�	A��t�|�W�i�@�@�D�L�L�L�	A�	As2��
A+�A�A+�!A%�"A+�$A%�%A+�*A+c#�K�|D]D}|d�!|d|d|d|dfV��+t|dd���V��EdS)N����r)�tuple)rr8�recs   r
�_get_reformatted_recordsz&RichTraceback._get_reformatted_recordsxsn�����	&�	&�C��1�v�!��1�v�s�1�v�s�1�v�s�1�v�6�6�6�6�6��C��!��H�o�o�%�%�%�%�		&�	&rc�P�t|�|j����S)z�Return a list of 4-tuple traceback records (i.e. normal python
        format) with template-corresponding lines remapped to the originating
        template.

        )�listrRr8rBs r
r<zRichTraceback.tracebacks"���D�1�1�$�,�?�?�@�@�@rc�*�t|j��Sr)�reversedr8rBs r
�reverse_recordszRichTraceback.reverse_records�s�����%�%�%rc�P�t|�|j����S)z;Return the same data as traceback, except in reverse order.)rTrRrWrBs r
�reverse_tracebackzRichTraceback.reverse_traceback�s#���D�1�1�$�2F�G�G�H�H�Hrc
��ddl}i}tj|��}g}|D�]/\}}}}	|	sd}		||\}
}}n�#t$r�	|j�|��}
|
j}|
j}|
jp|
j	p|}n.#t$r!|�
||||	ddddf��YY��wxYwd}|jj}|�|d���}|d}
d�|�
d	��D��}|
||f||<YnwxYw|
|dz
}|t|��kr||dz
}nd}|�
||||	||||f����1|j�s#tt|��dz
dd
��D]8}||dr(||d|_||d|_nʌ9|r�	t#|d
dd
��5}t%j|��}|sd}|�d��|���|_ddd��n#1swxYwY|r|j�|��|_n#t.$r
d|_YnwxYw|d
d|_|S)aformat a traceback from sys.exc_info() into 7-item tuples,
        containing the regular four traceback tuple items, plus the original
        template filename, the line number adjusted relative to the template
        source, and code line from that line number of the template.rNr3�T)�
full_line_mapr\c��g|]}|��Srr)�.0�line_s  r
�
<listcomp>z'RichTraceback._init.<locals>.<listcomp>�s%��"�"�"�#�E�"�"�"r�
���rN��rbzutf-8)�
mako.templater<�
extract_tb�KeyError�template�_get_module_info�coder�template_filename�template_uri�append�
ModuleInfo�get_module_source_metadata�split�len�ranger�openr�parse_encoding�seek�read�decode�IOError)r�trcback�mako�mods�
rawrecords�new_trcbackrr�function�line�line_map�template_linesrk�info�
module_source�template_source�template_ln�mtm�
source_map�
template_line�l�fp�encodings                       r
r7zRichTraceback._init�s���	�������)�'�2�2�
���0:�;	�;	�,�H�f�h���
���%
O�@D�X��=��>�+<�+<���#
O�#
O�#
O���=�9�9�(�C�C�D�$(�I�M�&*�k�O��.�O�$�2C�O�x�&�%�� �����&�&�$�"�$� � � � � �	�����H�H�����  ���m�.�� �;�;�!��<���
�&�o�6��"�"�'6�'<�'<�T�'B�'B�"�"�"��#+�N�<M�!N��X����G#
O����J#�6�A�:�.�K��c�.�1�1�1�1� .�{�Q�� ?�
�
� $�
��������%��!�#�	�
�
�
�
��{�	5��3�{�+�+�a�/��B�7�7�
5�
5���q�>�!�$��"-�a�.��"3�D�K�"-�a�.��"3�D�K��E��
�
5�)�!�+�b�/�!�"4�d�;�;�4�r�'+�':�2�'>�'>�H�#+�3�+2���G�G�A�J�J�J�*,�'�'�)�)�D�K�4�4�4�4�4�4�4�4�4�4�4����4�4�4�4�$�G�*.�+�*<�*<�X�*F�*F�D�K���"�)�)�)�&(�����)����"-�b�/�!�"4�D�K��sk�9�
D�8A=�<D�='B(�$D�'B(�(AD�D�5I�AH$�I�$H(�(I�+H(�,$I�I%�$I%)NN)
rr	r
r)r�propertyrCr;rRr<rWrYr7rrr
r1r1Gs�������������,�1�1��X�1�A�A�A�&�&�&��A�A��X�A��&�&��X�&��I�I��X�I�
\�\�\�\�\rr1c�>�ddl}|j�d��S)z�Provides a template that renders a stack trace in a similar format to
    the Python interpreter, substituting source template filenames, line
    numbers and code for that of the originating source template, as
    applicable.

    rNa�
<%page args="error=None, traceback=None"/>
<%!
    from mako.exceptions import RichTraceback
%>\
<%
    tback = RichTraceback(error=error, traceback=traceback)
%>\
Traceback (most recent call last):
% for (filename, lineno, function, line) in tback.traceback:
  File "${filename}", line ${lineno}, in ${function or '?'}
    ${line | trim}
% endfor
${tback.errorname}: ${tback.message}
)rerh�Template)�lookuprzs  r
�text_error_templater��s/�������=�!�!�	���rc��ddlmaddlmadS)Nr)�syntax_highlight)�pygments_html_formatter)�mako.ext.pygmentpluginr�r�rrr
�_install_pygmentsr�
s,��7�7�7�7�7�7�>�>�>�>�>�>�>�>rc�$��ddlm�dad�fd�	adS)Nr��html_escaper3c����Srr)r�languager�s  �r
r�r�s	����r)r3N)�mako.filtersr�r�r�r�s@r
�_install_fallbackr�sC���(�(�(�(�(�(�"���������rc�b�	t��dS#t$rt��YdSwxYwr)r��ImportErrorr�rrr
�_install_highlightingr�sI������������������������s��.�.c�f�ddl}|j�dtj��d���S)aProvides a template that renders a stack trace in an HTML format,
    providing an excerpt of code as well as substituting source template
    filenames, line numbers and code for that of the originating source
    template, as applicable.

    The template's default ``encoding_errors`` value is
    ``'htmlentityreplace'``. The template has two options. With the
    ``full`` option disabled, only a section of an HTML document is
    returned. With the ``css`` option disabled, the default stylesheet
    won't be included.

    rNa�
<%!
    from mako.exceptions import RichTraceback, syntax_highlight,\
            pygments_html_formatter
%>
<%page args="full=True, css=True, error=None, traceback=None"/>
% if full:
<html>
<head>
    <title>Mako Runtime Error</title>
% endif
% if css:
    <style>
        body { font-family:verdana; margin:10px 30px 10px 30px;}
        .stacktrace { margin:5px 5px 5px 5px; }
        .highlight { padding:0px 10px 0px 10px; background-color:#9F9FDF; }
        .nonhighlight { padding:0px; background-color:#DFDFDF; }
        .sample { padding:10px; margin:10px 10px 10px 10px;
                  font-family:monospace; }
        .sampleline { padding:0px 10px 0px 10px; }
        .sourceline { margin:5px 5px 10px 5px; font-family:monospace;}
        .location { font-size:80%; }
        .highlight { white-space:pre; }
        .sampleline { white-space:pre; }

    % if pygments_html_formatter:
        ${pygments_html_formatter.get_style_defs()}
        .linenos { min-width: 2.5em; text-align: right; }
        pre { margin: 0; }
        .syntax-highlighted { padding: 0 10px; }
        .syntax-highlightedtable { border-spacing: 1px; }
        .nonhighlight { border-top: 1px solid #DFDFDF;
                        border-bottom: 1px solid #DFDFDF; }
        .stacktrace .nonhighlight { margin: 5px 15px 10px; }
        .sourceline { margin: 0 0; font-family:monospace; }
        .code { background-color: #F8F8F8; width: 100%; }
        .error .code { background-color: #FFBDBD; }
        .error .syntax-highlighted { background-color: #FFBDBD; }
    % endif

    </style>
% endif
% if full:
</head>
<body>
% endif

<h2>Error !</h2>
<%
    tback = RichTraceback(error=error, traceback=traceback)
    src = tback.source
    line = tback.lineno
    if src:
        lines = src.split('\n')
    else:
        lines = None
%>
<h3>${tback.errorname}: ${tback.message|h}</h3>

% if lines:
    <div class="sample">
    <div class="nonhighlight">
% for index in range(max(0, line-4),min(len(lines), line+5)):
    <%
       if pygments_html_formatter:
           pygments_html_formatter.linenostart = index + 1
    %>
    % if index + 1 == line:
    <%
       if pygments_html_formatter:
           old_cssclass = pygments_html_formatter.cssclass
           pygments_html_formatter.cssclass = 'error ' + old_cssclass
    %>
        ${lines[index] | syntax_highlight(language='mako')}
    <%
       if pygments_html_formatter:
           pygments_html_formatter.cssclass = old_cssclass
    %>
    % else:
        ${lines[index] | syntax_highlight(language='mako')}
    % endif
% endfor
    </div>
    </div>
% endif

<div class="stacktrace">
% for (filename, lineno, function, line) in tback.reverse_traceback:
    <div class="location">${filename}, line ${lineno}:</div>
    <div class="nonhighlight">
    <%
       if pygments_html_formatter:
           pygments_html_formatter.linenostart = lineno
    %>
      <div class="sourceline">${line | syntax_highlight(filename)}</div>
    </div>
% endfor
</div>

% if full:
</body>
</html>
% endif
�htmlentityreplace)�output_encoding�encoding_errors)rerhr�r4�getdefaultencoding)rzs r
�html_error_templater�'sK�������=�!�!�g	�P�.�0�0�+�U"�k�k�krr)r)r4r<rzrr�	Exceptionrrrrr$r'r+r-r/r1r�r�r�r�r�rrr
�<module>r�sJ����
�
�
�
�����������������	�	�	�	�	�I�	�	�	�	�	�	�	�	�}�	�	�	�N�N�N������}���������m����1�1�1�1�1�}�1�1�1�
>�>�>�>�>�
�>�>�>�
	�	�	�	�	�m�	�	�	�	�	�	�	�	�5�	�	�	�g�g�g�g�g�g�g�g�T����8?�?�?������������z�z�z�z�zr

Zerion Mini Shell 1.0