%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���e�0��(�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�Zy)zexception classes�N)�compat)�utilc��eZdZy)�
MakoExceptionN��__name__�
__module__�__qualname__���1/usr/lib/python3/dist-packages/mako/exceptions.pyrr���rrc��eZdZy)�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�Zy)�CompileExceptionc	��tj||t|||�z�||_||_||_||_y�N�r�__init__rrrr�source��self�messagerrrrs      r
rzCompileException.__init__ �A������'�O�F�C��B�B�	
������� ��
���rN�rr	r
rrrr
rr���rrc��eZdZd�Zy)�SyntaxExceptionc	��tj||t|||�z�||_||_||_||_yrrrs      r
rzSyntaxException.__init__+r rNr!rrr
r$r$*r"rr$c��eZdZdZy)�UnsupportedErrorz&raised when a retired feature is used.N�rr	r
�__doc__rrr
r'r'5s��0rr'c��eZdZdZy)�NameConflictErrorz3raised when a reserved word is used inappropriatelyNr(rrr
r+r+:s��=rr+c��eZdZy)�TemplateLookupExceptionNrrrr
r-r-?rrr-c��eZdZy)�TopLevelLookupExceptionNrrrr
r/r/Crrr/c�j�eZdZdZdd�Zed��Zd�Zd�Zed��Z	ed��Z
ed	��Zd
�Zy)�
RichTracebackz�Pull the current exception from the ``sys`` traceback and extracts
    Mako-specific template information.

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

    Nc��d\|_|_|�|�tj�\}}}|�xs}|�}||_|j|�|_t|jttf�r=|jj|_|jj|_d|_
|j�y)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�l�n�O�A�u�e��=��J�Q�E����I���
��z�z�)�,����d�j�j�#3�_�"E�F��*�*�+�+�D�K��*�*�+�+�D�K�#�D�����rc�@�tj|j�Sr)r�exception_namer6�rs r
�	errornamezRichTraceback.errornamefs���$�$�T�Z�Z�0�0rc�X�	t|j�|_t
|jt�st|jdd�|_yy#t$rL	t|j�|_n-#t$r!|jj
d|_YnwxYwY��wxYw)z+Find a unicode representation of self.errorr�ascii�replaceN)�strr6r�UnicodeError�UnicodeEncodeError�argsr9rBs r
r;zRichTraceback._init_messagejs���	2��t�z�z�?�D�L��$�,�,��,��t�|�|�W�i�@�D�L�-���	2�
2�"�4�:�:�����%�
2� $�z�z���q�1���
2��	2�s5�A�	B)�A9�8B)�9'B#� B)�"B#�#B)�(B)c#�nK�|D],}|d�|d|d|d|df���t|dd����.y�w)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��C��!�H�o�%�		&�s�35c�J�t|j|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�J�t|j|j��S)z;Return the same data as traceback, except in reverse order.)rTrRrWrBs r
�reverse_tracebackzRichTraceback.reverse_traceback�s ���D�1�1�$�2F�2F�G�H�Hrc
��ddl}i}tj|�}g}|D]O\}}}}	|	sd}		||\}
}}|
|dz
}|t|�kr	||dz
}nd}|j||||	|||f��Q|js�tt|�dz
dd	�D]'}||d
s�||d|_||d
|_|S|r�	t#|d	dd�5}t%j&|�}|sd
}|j)d�|j+�|_ddd�r |jj-|�|_|d	d|_|S#t$r�	|jj|�}
|
j}|
j}|
jxs|
jxs|}n*#t$r|j||||	ddddf�YY���wxYwd}|jj}|j|d��}|d}
|jd�D�cgc]}|��ncc}w}}|
||f||<Y���wxYw#1swY��$xYw#t.$rd|_Y��wxYw)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\�
���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_linesrg�info�
module_source�template_source�template_ln�mtm�
source_map�line_�
template_line�l�fp�encodings                        r
r7zRichTraceback._init�s���	����)�)�'�2�
���0:�;	�,�H�f�h�����%
O�@D�X��=��>�+<�L#�6�A�:�.�K��c�.�1�1� .�{�Q�� ?�
� $�
��������%��!�#�	�
�a;	�x�{�{��3�{�+�a�/��B�7�
5���q�>�!�$�"-�a�.��"3�D�K�"-�a�.��"3�D�K�� ��)
5��)�!�+�b�/�!�"4�d�;�4�r�'+�':�':�2�'>�H�#+�+2���G�G�A�J�*,�'�'�)�D�K�4�$�*.�+�+�*<�*<�X�*F�D�K�#.�b�/�!�"4�D�K����Y�#
O���=�=�9�9�(�C�D�$(�I�I�M�&*�k�k�O��.�.�O�$�2C�2C�O�x�&�� ���&�&�$�"�$� � � � � �	�����  ���m�m�.�.�� �;�;�!��<��
�&�o�6��(7�'<�'<�T�'B�"�#�E�"��"��"�#+�N�<M�!N��X��G#
O��B4�4��#�)�&(���)�sn�	E�I�AH8�*I�	H5�AF+�*H5�+"G�
H5�G�AH5�	H"�!H5�4H5�8I�=I�I�I)NN)
rr	r
r)r�propertyrCr;rRr<rWrYr7rrr
r1r1Gsq����,�1��1�A�&��A��A��&��&��I��I�
\rr1c�@�ddl}|jjd�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}
)rard�Template)�lookuprvs  r
�text_error_templater��s#����=�=�!�!�	��rc��ddlmaddlmay)Nr)�syntax_highlight)�pygments_html_formatter)�mako.ext.pygmentpluginr�r�rrr
�_install_pygmentsr�
s��7�>rc�"��ddlm�dad�fd�	ay)Nr��html_escapec����Srr)r�languager�s  �r
r�r�s	����r)r3N)�mako.filtersr�r�r�r�s@r
�_install_fallbackr�s���(�"��rc�L�	t�y#t$r
t�YywxYwr)r��ImportErrorr�rrr
�_install_highlightingr�s"�����������s�

�#�#c�j�ddl}|jjdtj�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)rardr�r4�getdefaultencoding)rvs r
�html_error_templater�'s>����=�=�!�!�g	�P�.�.�0�+�U"�k�krr)r)r4r<rvrr�	Exceptionrrrrr$r'r+r-r/r1r�r�r�r�r�rrr
�<module>r�s����
����	�I�	�	�}�	�N��}���m��1�}�1�
>�
�>�
	�m�	�	�5�	�g�g�T�8?�����zr

Zerion Mini Shell 1.0