`M^[fdZddlZddlZddlmZddlmZGddeZGddeZd Z Gd d eZ Gd d eZ GddeZ GddeZ GddeZGddeZGddZddZdZdZdZedZdS)zexception classesN)compat)utilceZdZdS) MakoExceptionN__name__ __module__ __qualname__/srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/mako/exceptions.pyrrDr rceZdZdS)RuntimeExceptionNrr r r rrrr rc$|d||fzSd|||fzS)Nz at line: %d char: %dz" in file '%s' at line: %d char: %dr )linenoposfilenames r _format_fileposrs)&&#663x6MMMr ceZdZdZdS)CompileExceptionc t||t|||z||_||_||_||_dSNr__init__rrrrsourceselfmessagerrrrs r rzCompileException.__init__ R 'OFCBBB       r Nrr r rr r r rr#r rceZdZdZdS)SyntaxExceptionc t||t|||z||_||_||_||_dSrrrs r rzSyntaxException.__init__+r r Nr!r r r r$r$*r"r r$ceZdZdZdS)UnsupportedErrorz&raised when a retired feature is used.Nrr r __doc__r r r r'r'5s0000r r'ceZdZdZdS)NameConflictErrorz3raised when a reserved word is used inappropriatelyNr(r r r r+r+:s====r r+ceZdZdS)TemplateLookupExceptionNrr r r r-r-?rr r-ceZdZdS)TopLevelLookupExceptionNrr r r r/r/Crr r/ceZdZdZd dZedZdZdZedZ edZ ed Z d Z dS) RichTracebackzPull the current exception from the ``sys`` traceback and extracts Mako-specific template information. See the usage examples in :ref:`handling_exceptions`. Ncld\|_|_||tj\}}}||p|}||}||_|||_t|jttfr)|jj|_|jj|_d|_ | dS)N)rT) rrsysexc_infoerror_initrecords isinstancerr$ _has_source _init_message)rr6 tracebacktvaluetbacks r rzRichTraceback.__init__Ps#(  T[ =I-!lnnOAue =JQE  I zz),, dj#3_"E F F $*+DK*+DK#D  r c4tj|jSr)rexception_namer6rs r errornamezRichTraceback.errornamefs$TZ000r cN t|j|_nR#t$rE t|j|_n'#t$r|jjd|_YnwxYwYnwxYwt |jtst|jdd|_dSdS)z+Find a unicode representation of self.errorrasciireplaceN)strr6r UnicodeErrorUnicodeEncodeErrorargsr9rBs r r;zRichTraceback._init_messagejs 2tz??DLL 2 2 2 2"4: % 2 2 2 $zq1  2 2$,,, At|Wi@@DLLL A As2 A+AA+!A%"A+$A%%A+*A+c#K|D]D}|d!|d|d|d|dfV+t|ddVEdS)Nr)tuple)rr8recs r _get_reformatted_recordsz&RichTraceback._get_reformatted_recordsxsn & &C1v!1vs1vs1vs1v66666C!Hoo%%%%  & &r cPt||jS)zReturn 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"D11$,??@@@r c*t|jSr)reversedr8rBs r reverse_recordszRichTraceback.reverse_recordss %%%r cPt||jS)z;Return the same data as traceback, except in reverse order.)rTrRrWrBs r reverse_tracebackzRichTraceback.reverse_tracebacks#D11$2FGGHHHr c ddl}i}tj|}g}|D]/\}}}} | sd} ||\} } } n#t$r |j|} | j}| j}| jp| j p|} n.#t$r!| |||| ddddfYYwxYwd}|jj }| |d}|d} d| d D} | | | f||<YnwxYw| |dz }|t| kr | |dz }nd}| |||| | |||f1|js#tt|dz dd D]8}||d r(||d |_||d |_nʌ9|r t#|d dd 5}t%j|}|sd}|d||_dddn #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.rNr3T) full_line_mapr\cg|]}|Sr r ).0line_s r z'RichTraceback._init..s%"""#E"""r  rNrbzutf-8) mako.templater< extract_tbKeyErrortemplate_get_module_infocodertemplate_filename template_uriappend ModuleInfoget_module_source_metadatasplitlenrangeropenrparse_encodingseekreaddecodeIOError)rtrcbackmakomods rawrecords new_trcbackrrfunctionlineline_maptemplate_linesrkinfo module_sourcetemplate_source template_lnmtm source_map template_linelfpencodings r r7zRichTraceback._inits )'22  0:; ;  ,Hfh % O@DX=>+<+<# O# O# O=99(CCD$(IM&*kO.O$2COx&% &&$"$         HH  m. ;;!< &o6""'6'<'!$"-a."3DK"-a."3DKE  5 )!+b/!"4d;;4r'+':2'>'>H#+3+2GGAJJJ*,''))DK 444444444444444 $G*.+*<*ddl}|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} )rerhTemplate)lookuprzs r text_error_templaters/ = ! !   r cddlmaddlmadS)Nr)syntax_highlight)pygments_html_formatter)mako.ext.pygmentpluginrrr r r _install_pygmentsr s,777777>>>>>>>>r c$ddlmdadfd adS)Nr html_escaper3cSrr )rlanguagers r rrs r )r3N) mako.filtersrrrrs@r _install_fallbackrsC(((((("r cb tdS#t$rtYdSwxYwr)r ImportErrorrr r r _install_highlightingrsI s ..cfddl}|jdtjdS)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: Mako Runtime Error % endif % if css: % endif % if full: % endif

Error !

<% tback = RichTraceback(error=error, traceback=traceback) src = tback.source line = tback.lineno if src: lines = src.split('\n') else: lines = None %>

${tback.errorname}: ${tback.message|h}

% if lines:
% 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
% endif
% for (filename, lineno, function, line) in tback.reverse_traceback:
${filename}, line ${lineno}:
<% if pygments_html_formatter: pygments_html_formatter.linenostart = lineno %>
${line | syntax_highlight(filename)}
% endfor
% if full: % endif htmlentityreplace)output_encodingencoding_errors)rerhrr4getdefaultencoding)rzs r html_error_templater'sK = ! !g P.00+U "k k kr r)r)r4r<rzrr Exceptionrrrrr$r'r+r-r/r1rrrrrr r r rsJ      I        }   NNN}m11111}111 >>>>> >>>      m        5   ggggggggT8??? zzzzzr