%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core/17212/usr/lib/python3/dist-packages/jinja2/__pycache__/
Upload File :
Create Path :
Current File : //snap/core/17212/usr/lib/python3/dist-packages/jinja2/__pycache__/debug.cpython-35.pyc



~�bU!-�@s�dZddlZddlZddlmZmZddlmZmZddl	m
Z
ddlmZm
Z
mZyddlmZWnek
r�dZYnXyed�Wn/ek
r�d	ZYnek
r�d
ZYnXGdd�de�Zd
d�ZGdd�de�Zddd�Zddd�Zddd�Zdd�Zdd�ZdZedkr�y
e�ZWnYnX[dS)aQ
    jinja2.debug
    ~~~~~~~~~~~~

    Implements the debug interface for Jinja.  This module does some pretty
    ugly stuff with the Python traceback system in order to achieve tracebacks
    with correct line numbers, locals and contents.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
�N)�
TracebackType�CodeType)�missing�
internal_code)�TemplateSyntaxError)�	iteritems�reraise�PY2)�tproxyzraise TypeError, 'foo'zraise __jinja_exception__[1]z4raise __jinja_exception__[0], __jinja_exception__[1]c@s^eZdZdZdd�Zedd��Zdd�Zedd	��Zd
d�Z	dS)
�TracebackFrameProxyzProxies a traceback frame.cCs||_d|_dS)N)�tb�_tb_next)�selfr�r�./usr/lib/python3/dist-packages/jinja2/debug.py�__init__'s	zTracebackFrameProxy.__init__cCs|jS)N)r
)rrrr�tb_next+szTracebackFrameProxy.tb_nextcCsQtdk	rDy#t|j|r'|jp*d�Wntk
rCYnX||_dS)N)�tb_set_nextr�	Exceptionr
)r�nextrrr�set_next/s#
zTracebackFrameProxy.set_nextcCsd|jjjkS)N�__jinja_template__)r�tb_frame�	f_globals)rrrr�is_jinja_frame:sz"TracebackFrameProxy.is_jinja_framecCst|j|�S)N)�getattrr)r�namerrr�__getattr__>szTracebackFrameProxy.__getattr__N)
�__name__�
__module__�__qualname__�__doc__r�propertyrrrrrrrrr$srcs;t|��tdkr�S�fdd�}tt|�S)NcsV|dkrt�|d�S|dkr<�j||�nt�|�||�SdS)N�__getattribute__rr�__setattr__)z__getattribute__z__getattr__)rr$)Z	operation�args�kwargs)�proxyrr�operation_handlerFs
z+make_frame_proxy.<locals>.operation_handler)rr
r)�framer(r)r'r�make_frame_proxyBs
r*c@sveZdZdZdd�Zddd�Zddd	�Zed
d��Zedd
��Z	edd��Z
dS)�ProcessedTracebackz?Holds a Jinja preprocessed traceback for printing or reraising.cCsw|std��||_||_||_d}x0|jD]%}|dk	r\|j|�|}q=W|jd�dS)Nzno frames for this traceback?)�AssertionError�exc_type�	exc_value�framesr)rr-r.r/Zprev_tbrrrrrSs			

zProcessedTraceback.__init__NcCs;tj|j|j|jdd|�}dj|�j�S)z#Return a string with the traceback.r�limit�)�	traceback�format_exceptionr-r.r/�join�rstrip)rr0�linesrrr�render_as_textasz!ProcessedTraceback.render_as_textFcCs<ddlm}d||d|�|j�jdd�fS)z<Return a unicode string with the traceback as rendered HTML.r)�render_tracebackz%s

<!--
%s
-->�fullzutf-8�replace)Zjinja2.debugrendererr8r7�decode)rr9r8rrr�render_as_htmlgsz!ProcessedTraceback.render_as_htmlcCst|jt�S)z*`True` if this is a template syntax error.)�
isinstancer.r)rrrr�is_template_syntax_errorosz+ProcessedTraceback.is_template_syntax_errorcCs|j|j|jdfS)z;Exception info tuple with a proxy around the frame objects.r)r-r.r/)rrrr�exc_infotszProcessedTraceback.exc_infocCs;|jd}t|�tk	r(|j}|j|j|fS)z'Standard python exc_info for re-raisingr)r/�typerrr-r.)rrrrr�standard_exc_infoys
	z$ProcessedTraceback.standard_exc_info)rrr r!rr7r<r"r>r?rArrrrr+Psr+cCsI|\}}}t|t�r6t||�}d}nd}t||�S)z7Creates a processed traceback object from the exc_info.r�)r=r�translate_syntax_error�translate_exception)r?Zsource_hintr-r.r�initial_skiprrr�make_traceback�s	rFcCsR||_d|_|j|df}|j}|dkr?d}t|||j�S)z4Rewrites a syntax error to please traceback systems.TNz	<unknown>)�sourceZ
translated�	__class__�filename�
fake_exc_info�lineno)�errorrGr?rIrrrrC�s			rCc	Cs,|d}g}x)t|�D]}|dk	r|j}qW|}x�|dk	r�|jjtkro|j}qE|j}|jjjd�}|dk	r�|j|j�}t	|dd�|f|j
|�d}|jt|��|}qEW|st
|d|d|d�t|d|d|�S)z�If passed an exc_info it will automatically rewrite the exceptions
    all the way down to the correct line numbers and frames.
    �NrrrB)�rangerr�f_coderr�getZget_corresponding_lineno�	tb_linenorJrI�appendr*rr+)	r?rErr/�xZ
initial_tbr�templaterKrrrrD�s*

		

rDcCs�|\}}}|dk	r�|jjj�}|jd�}|rQ|j�}ni}xIt|�D];\}	}
|	jd�rd|
tk	rd|
||	dd�<qdW|jdd�ni}d|d|d|dd�ddi}t	d	|d
t
|d�}y|dkrd}
nP|jjj}|d
kr>d}
n,|jd�rdd|dd�}
nd}
t
r�td|j|j|j|j|j|j|j||
|j|jff�}nTtd|j|j|j|j|j|j|j|j||
|j|jff�}Wn%tk
r=}zWYdd}~XnXyt|||�Wn!tj�}|dj}YnX|dd�|fS)z!Helper for `translate_exception`.N�contextZl_rMZ__jinja_exception__r�__file__r�
rB�execrT�rootztop-level template codeZblock_z
block "%s"�r)r�f_locals�copyrPZget_allr�
startswithr�pop�compile�raise_helperrO�co_namer	r�
co_nlocals�co_stacksize�co_flags�co_code�	co_consts�co_names�co_varnames�co_firstlineno�	co_lnotab�co_kwonlyargcountrrX�sysr?r)r?rIrKr-r.rZreal_localsZctx�localsr�value�globals�code�locationZfunction�eZnew_tbrrrrJ�s\				rJcsyddl�ddlm�trLt�jd�r@�j}qU�j}n	�j}Gdd�d�j	�}d|fd�j
|�fg|_ttd	�rGd
d�d�j	�}d�j
|�fd�j
|�fd|fd�j
|�fg|_Gd
d�d|��d�j
��fd�j
|�fd�jfd�jfg�_���fdd�}|S)z�This function implements a few ugly things so that we can patch the
    traceback objects.  The function returned allows resetting `tb_next` on
    any python traceback object.  Do not attempt to use this on non cpython
    interpreters
    rN)rZPy_InitModule4_64c@seZdZdS)z"_init_ugly_crap.<locals>._PyObjectN)rrr rrrr�	_PyObject(srs�	ob_refcnt�ob_typeZ
getobjectsc@seZdZdS)z"_init_ugly_crap.<locals>._PyObjectN)rrr rrrrrs1sZ_ob_nextZ_ob_prevc@seZdZdS)z#_init_ugly_crap.<locals>._TracebackN)rrr rrrr�
_Traceback:srvrr�tb_lastirQcs�t|��o'|dkp't|��s6td���jt|��}|jdk	r��jt|j��}|jd8_|dkr��j���|_n6�jt|��}|jd7_�j|�|_dS)z0Set the tb_next attribute of a traceback object.Nz/tb_set_next arguments must be traceback objectsrB)r=�	TypeErrorZfrom_address�idrrt�POINTERZpointer)rr�obj�old)rrv�ctypesrrrCsz$_init_ugly_crap.<locals>.tb_set_next)
r}�typesrr	�hasattrZ	pythonapiZc_int64Zc_intZ	c_ssize_tZ	StructurerzZ_fields_rl)Z_Py_ssize_trsrr)rrvr}r�_init_ugly_craps.			r�) r!rlr2r~rrZjinja2.utilsrrZjinja2.exceptionsrZjinja2._compatrrr	Z__pypy__r
�ImportErrorrX�SyntaxErrorr`rx�objectrr*r+rFrCrDrJr�rrrrr�<module>s>



4,ND


Zerion Mini Shell 1.0