%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/debug.cpython-37.pyc

B

��R�*�@s8dZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZmZm
Z
yddlmZWnek
rxdZYnXyed�Wn.ek
r�d	ZYnek
r�d
ZYnXGdd�de�Zd
d�ZGdd�de�Zddd�Zddd�Zddd�Zdd�Zdd�ZdZedk�r4y
e�ZWnYnX[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)�missing�
internal_code)�TemplateSyntaxError)�	iteritems�reraise�	code_type)�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�=/opt/alt/python37/lib/python3.7/site-packages/jinja2/debug.py�__init__'szTracebackFrameProxy.__init__cCs|jS)N)r)r
rrr�tb_next+szTracebackFrameProxy.tb_nextcCsBtdk	r8yt|j|r|jpd�Wntk
r6YnX||_dS)N)�tb_set_nextr�	Exceptionr)r
�nextrrr�set_next/szTracebackFrameProxy.set_nextcCsd|jjjkS)N�__jinja_template__)r�tb_frame�	f_globals)r
rrr�is_jinja_frame:sz"TracebackFrameProxy.is_jinja_framecCst|j|�S)N)�getattrr)r
�namerrr�__getattr__>szTracebackFrameProxy.__getattr__N)
�__name__�
__module__�__qualname__�__doc__r�propertyrrrrrrrrr
$sr
cs*t|��tdkr�S�fdd�}tt|�S)Ncs@|dkrt�|d�S|dkr,�j||�nt�|�||�SdS)N)�__getattribute__rr�__setattr__)rr#)Z	operation�args�kwargs)�proxyrr�operation_handlerFs
z+make_frame_proxy.<locals>.operation_handler)r
r	r)�framer'r)r&r�make_frame_proxyBs
r)c@sPeZdZdZdd�Zddd�Zddd	�Zed
d��Zedd
��Z	edd��Z
dS)�ProcessedTracebackz?Holds a Jinja preprocessed traceback for printing or reraising.cCsV|std��||_||_||_d}x$|jD]}|dk	r@|�|�|}q*W|�d�dS)Nzno frames for this traceback?)�AssertionError�exc_type�	exc_value�framesr)r
r,r-r.Zprev_tbrrrrrSs
zProcessedTraceback.__init__NcCs*tj|j|j|jd|d�}d�|���S)z#Return a string with the traceback.r)�limit�)�	traceback�format_exceptionr,r-r.�join�rstrip)r
r/�linesrrr�render_as_textasz!ProcessedTraceback.render_as_textFcCs,ddlm}d|||d�|���dd�fS)z<Return a unicode string with the traceback as rendered HTML.r)�render_tracebackz%s

<!--
%s
-->)�fullzutf-8�replace)Zjinja2.debugrendererr7r6�decode)r
r8r7rrr�render_as_htmlgs
z!ProcessedTraceback.render_as_htmlcCst|jt�S)z*`True` if this is a template syntax error.)�
isinstancer-r)r
rrr�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.)r
rrr�exc_infotszProcessedTraceback.exc_infocCs*|jd}t|�tk	r|j}|j|j|fS)z'Standard python exc_info for re-raisingr)r.�typerrr,r-)r
rrrr�standard_exc_infoys
z$ProcessedTraceback.standard_exc_info)N)F)rrrr rr6r;r!r=r>r@rrrrr*Ps

r*cCs2|\}}}t|t�r$t||�}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


rEcCs8||_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)�errorrFr>rHrrrrB�srBc	Cs�|d}g}xt|�D]}|dk	r|j}qW|}xz|dk	r�|jjtkrN|j}q2|j}|jj�d�}|dk	r�|�|j�}t	|dd�|f|j
|�d}|�t|��|}q2W|s�t
|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.
    �NrrrA)�rangerr�f_coderr�getZget_corresponding_lineno�	tb_linenorIrH�appendr)rr*)	r>rDrr.�xZ
initial_tbr�templaterJrrrrC�s*


rCcCs�|\}}}|dk	r�|jj��}|�d�}|r6|��}ni}x6t|�D]*\}	}
|	�d�rD|
tk	rD|
||	dd�<qDW|�dd�ni}|||dd�dd�}t	d|dt
|d	�}y~|dkr�d
}
n8|jjj}|dkr�d}
n |�d
�r�d|dd�}
nd
}
t
d|j|j|j|j|j|j|j||
|j|jdd�}WnYnXyt|||�Wnt��}|dj}YnX|dd�|fS)z!Helper for `translate_exception`.N�contextZl_rL�__jinja_exception__)r�__file__rUr�
rA�execrS�rootztop-level template codeZblock_z
block "%s"�rr)r�f_locals�copyrOZget_allr�
startswithr�pop�compile�raise_helperrN�co_namer�
co_nlocals�co_stacksize�co_flags�co_code�	co_consts�co_names�co_varnames�co_firstlineno�	co_lnotabrX�sysr>r)r>rHrJr,r-rZreal_localsZctx�localsr�value�globals�code�locationZfunctionZnew_tbrrrrI�sN






rIcs�ddl�ddlm�t�jd�r(�j}n�j}Gdd�d�j�}d|fd��|�fg|_	tt
d	�r�Gd
d�d�j�}d��|�fd��|�fd|fd��|�fg|_	Gd
d�d|��d����fd��|�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@seZdZdS)z"_init_ugly_crap.<locals>._PyObjectN)rrrrrrr�	_PyObjectsrq�	ob_refcnt�ob_typeZ
getobjectsc@seZdZdS)z"_init_ugly_crap.<locals>._PyObjectN)rrrrrrrrq$sZ_ob_nextZ_ob_prevc@seZdZdS)z#_init_ugly_crap.<locals>._TracebackN)rrrrrrr�
_Traceback-srtrr�tb_lastirPcs�t|��r|dks$t|��s$td����t|��}|jdk	rZ��t|j��}|jd8_|dkrr�����|_n(��t|��}|jd7_��|�|_dS)z0Set the tb_next attribute of a traceback object.Nz/tb_set_next arguments must be traceback objectsrA)r<�	TypeErrorZfrom_address�idrrr�POINTERZpointer)rr�obj�old)rrt�ctypesrrr6s

z$_init_ugly_crap.<locals>.tb_set_next)r{�typesr�hasattrZ	pythonapiZc_int64Zc_intZ	StructurerxZ_fields_rk)Z_Py_ssize_trqrr)rrtr{r�_init_ugly_craps*
r~)N)N)r)r rkr1r|rZjinja2.utilsrrZjinja2.exceptionsrZjinja2._compatrrrZ__pypy__r	�ImportErrorrX�SyntaxErrorr`rv�objectr
r)r*rErBrCrIr~rrrrr�<module>s>

4


,E@



Zerion Mini Shell 1.0