Your IP : 18.225.117.89


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

B

F��a.!�@s�ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
ddl	mZejrfddl
mZdejeed	�d
d�Zeejeeeed�d
d�Zejeejfejeejfd�dd�Zejdkr�eejeed�dd�Zn�e��dk�rJyddlZWn.ek
�r.eejeed�dd�ZYnXeejeed�dd�Zn2ddlZGdd�dej�Z eejeed�dd�ZdS)�N)�CodeType)�
TracebackType�)�TemplateSyntaxError)�
internal_code)�missing)�Context)�source�returnc	Cst��\}}}t�t|�}t�t|�}t|t�rd|jsdd|_||_	|�
d�t|d|jpZd|j
�}n|j}g}xn|dk	r�|jjtkr�|j}qp|jj�d�}|dk	r�|�|j�}t|||j|�}|�|�n
|�|�|j}qpWd}xt|�D]}t||�}q�W|�
|�S)axRewrite the current exception to replace any tracebacks from
    within compiled template code with tracebacks that look like they
    came from the template source.

    This must be called within an ``except`` block.

    :param source: For ``TemplateSyntaxError``, the original source if
        known.
    :return: The original exception with the rewritten traceback.
    TNz	<unknown>Z__jinja_template__)�sys�exc_info�t�cast�
BaseExceptionr�
isinstancerZ
translatedr	�with_traceback�fake_traceback�filename�lineno�tb_next�tb_frame�f_coder�	f_globals�getZget_corresponding_lineno�	tb_lineno�append�reversed�tb_set_next)	r	�_�	exc_value�tb�stack�templaterZfake_tbr�r#�=/opt/alt/python37/lib/python3.7/site-packages/jinja2/debug.py�rewrite_traceback_stacks4



r%)rr rrr
c	Cs|dk	r"t|jj�}|�dd�ni}|||d�}td|dd|d�}d}|dk	r�|jjj}|d	krnd
}n|�d�r�d|d
d���}tj	dkr�|j
|d�}n@t|j|j
|j|j|j|j|j|j|j|j||j|j|j|j�}yt|||�Wn tk
�rt��djSXdS)a,Produce a new traceback object that looks like it came from the
    template source instead of the compiled code. The filename, line
    number, and location name will point to the template, and the local
    variables will be the current template context.

    :param exc_value: The original exception to be re-raised to create
        the new traceback.
    :param tb: The original traceback to get the local variables and
        code info from.
    :param filename: The template filename.
    :param lineno: The line number in the template source.
    N�__jinja_exception__)�__name__�__file__r&�
rzraise __jinja_exception__�execr"�rootztop-level template codeZblock_zblock �)��)�co_name�)�get_template_localsr�f_locals�pop�compilerr/�
startswithr�version_info�replacer�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flags�co_code�	co_consts�co_names�co_varnames�co_filename�co_firstlineno�	co_lnotab�co_freevars�co_cellvarsr*rrr)	rr rr�locals�globals�code�location�functionr#r#r$rLsL


r)�real_localsr
c
	Cs�|�d�}|dk	r |����}ni}i}x�|��D]v\}}|�d�r2|tkrNq2y|�dd�\}}}t|�}Wntk
r�w2YnX|�|d�d}	|	|kr2||f||<q2Wx6|��D]*\}\}}|tkr�|�	|d�q�|||<q�W|S)zlBased on the runtime locals, get the context that would be
    available at that point in the template.
    �contextNZl_rr0)���r)
rZget_all�copy�itemsr5r�split�int�
ValueErrorr3)
rKZctx�dataZlocal_overrides�name�valuerZ	depth_strZdepthZ	cur_depthr#r#r$r1�s*
r1)r-�)r rr
cCs
||_|S)N)r)r rr#r#r$r�srZPyPycCs|S)Nr#)r rr#r#r$r�scs�fdd�}tj||d�S)Ncs$|jdkr|jddkr�S|��S)N�__getattribute__rr)�opname�argsZdelegate)�op)rr#r$�
controller�sztb_set_next.<locals>.controller)�obj)�tputilZ
make_proxy)r rr[r#)rr$r�sc@s*eZdZdeje���fdejfgZdS)�_CTracebackZ
PyObject_HEADrN)	r'�
__module__�__qualname__�ctypesZc_byte�object�
__sizeof__�	py_objectZ_fields_r#r#r#r$r^�sr^cCsbt�t|��}|jdk	r:t�|j�}t��|_tj�|�|dk	r^t�|�}tj�|�||_|S)N)	r^Zfrom_address�idrrardZ	pythonapiZ	Py_DecRefZ	Py_IncRef)r rZc_tbZ	c_tb_nextr#r#r$r�s


)N)!�platformr�typingr
�typesrr�
exceptionsrZutilsrrZ
TYPE_CHECKINGZruntimerZOptional�strrr%rQr�MappingZAnyZDictr1r6rZpython_implementationr]�ImportErrorraZ	Structurer^r#r#r#r$�<module>s8>H(,




	


?>