• File: exceptions.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/mako/__pycache__/exceptions.cpython-37.pyc
  • Date Modified: 06/27/2022 10:09 PM
  • File size: 11.48 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

C]f3@sdZddlZddlZddlmZddlmZGdddeZGdddeZd	d
Z	GdddeZ
Gd
ddeZGdddeZGdddeZ
GdddeZGdddeZGdddeZd#ddZddZddZdd Zed!d"ZdS)$zexception classesN)compat)utilc@seZdZdS)
MakoExceptionN)__name__
__module____qualname__rr@/opt/alt/python37/lib/python3.7/site-packages/mako/exceptions.pyrsrc@seZdZdS)RuntimeExceptionN)rrrrrrr	r
sr
cCs&|dkrd||fSd|||fSdS)Nz at line: %d char: %dz" in file '%s' at line: %d char: %dr)linenoposfilenamerrr	_format_filepossrc@seZdZddZdS)CompileExceptioncCs4t||t|||||_||_||_||_dS)N)r__init__rrrr
source)selfmessagerrrr
rrr	r szCompileException.__init__N)rrrrrrrr	rsrc@seZdZddZdS)SyntaxExceptioncCs4t||t|||||_||_||_||_dS)N)rrrrrr
r)rrrrrr
rrr	r+szSyntaxException.__init__N)rrrrrrrr	r*src@seZdZdZdS)UnsupportedErrorz&raised when a retired feature is used.N)rrr__doc__rrrr	r5src@seZdZdZdS)NameConflictErrorz3raised when a reserved word is used inappropriatelyN)rrrrrrrr	r:src@seZdZdS)TemplateLookupExceptionN)rrrrrrr	r?src@seZdZdS)TopLevelLookupExceptionN)rrrrrrr	rCsrc@sbeZdZdZdddZeddZddZd	d
ZeddZ	ed
dZ
eddZddZdS)
RichTracebackzPull the current exception from the ``sys`` traceback and extracts
    Mako-specific template information.

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

    NcCsd\|_|_|dks|dkr*t\}}}|dkr:|p8|}|dkrF|}||_|||_t|jtt	fr|jj|_|jj|_d|_
|dS)N)rT)rrsysexc_infoerror_initrecords
isinstancerrZ_has_source
_init_message)rr	tracebacktvalueZtbackrrr	rPs

zRichTraceback.__init__cCst|jS)N)rZexception_namer)rrrr		errornamefszRichTraceback.errornamecCsyt|j|_WnHtk
rZyt|j|_Wn"tk
rT|jjd|_YnXYnXt|jtjs|t|jdd|_dS)z+Find a unicode representation of self.errorrasciireplaceN)	rZ	text_typerrUnicodeErrorstrUnicodeEncodeErrorargsr!)rrrr	r"jszRichTraceback._init_messageccsPxJ|D]B}|ddk	r6|d|d|d|dfVqt|ddVqWdS)Nr)tuple)rr Zrecrrr	_get_reformatted_recordsxs
 z&RichTraceback._get_reformatted_recordscCst||jS)zReturn a list of 4-tuple traceback records (i.e. normal python
        format) with template-corresponding lines remapped to the originating
        template.

        )listr2r )rrrr	r#szRichTraceback.tracebackcCs
t|jS)N)reversedr )rrrr	reverse_recordsszRichTraceback.reverse_recordscCst||jS)zDReturn the same data as traceback, except in reverse order.
        )r3r2r5)rrrr	reverse_tracebackszRichTraceback.reverse_tracebackcCsddl}i}t|}g}x|D]\}}}}	|	s8d}	y||\}
}}Wntk
rby,|j|}
|
j}|
j}|
jp|
j	p|}Wntk
rt
jsy t|d}t
|}|Wntk
rd}YnX|r|	|}	n|	dd}	|||||	ddddfw"YnXd}|jj}|j|dd	}|d
}
dd|d
D}|
||f||<YnX|
|d}|t|kr||d}nd}|||||	||||fq"W|jsxtt|dddD]2}||dr||d|_||d|_PqW|rybt|ddd}t
|}t
jr8|s8d}|d||_||rh|j||_Wntk
rd|_YnX|dd|_|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.rNrrbr'r(T)
full_line_mapr9cSsg|]}|qSrr).0Zline_rrr	
<listcomp>sz'RichTraceback._init.<locals>.<listcomp>
r/zutf-8)
mako.templater#
extract_tbKeyErrortemplateZ_get_module_infocodertemplate_filenameZtemplate_urirZpy3kopenrZparse_encodingcloseIOErrordecodeappendZ
ModuleInfoZget_module_source_metadatasplitlenrangerseekread)rZtrcbackmakoZmodsZ
rawrecordsZnew_trcbackr
rZfunctionlineZline_mapZtemplate_linesrDinfoZ
module_sourceZtemplate_sourcefpencodingZtemplate_lnZmtmZ
source_mapZ
template_linelrrr	rs







zRichTraceback._init)NN)
rrrrrpropertyr&r"r2r#r5r6rrrrr	rGs
	rcCsddl}|jdS)zProvides 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}
)r?rBTemplate)lookuprOrrr	text_error_templatesrXcCsddlmaddlmadS)Nr)syntax_highlight)pygments_html_formatter)Zmako.ext.pygmentpluginrYrZrrrr	_install_pygmentssr[cs"ddlmdadfdd	adS)Nr)html_escapercsS)Nr)r
Zlanguage)r\rr	rY(srY)rN)Zmako.filtersr\rZrYrr)r\r	_install_fallback"sr]cCs*y
tWntk
r$tYnXdS)N)r[ImportErrorr]rrrr	_install_highlighting,s
r_cCsddl}|jjdtddS)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
Zhtmlentityreplace)Zoutput_encodingZencoding_errors)r?rBrVrgetdefaultencoding)rOrrr	html_error_template6s

hra)N)rrr#rOrr	Exceptionrr
rrrrrrrobjectrrXr[r]r_rarrrr	<module>s*: