관리-도구
편집 파일: compiler.cpython-39.opt-1.pyc
a �����`������������������� ���@���sB��d�Z�ddlmZ�ddlmZ�ddlmZ�ddlmZ �ddl mZ�ddl mZ�dd l mZ�dd lmZ�ddlmZ�ddlmZ�dd lmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddl m!Z!�ddl"m#Z#�ddl$m%Z%�dddddd d!d"d#�Z&e'e(d$��rLd$Z)nd%Z)d&gZ*ze+d'��e*�,d(��W�n�e-�y����Y�n0�ze+d)��W�n�e-�y����d*Z.Y�n0�d+Z.d,d-��Z/dCd/d0�Z0d1d2��Z1d3d4��Z2G�d5d6��d6e3�Z4G�d7d8��d8e3�Z5G�d9d:��d:e6�Z7G�d;d<��d<e%�Z8G�d=d>��d>e%�Z9G�d?d@��d@e:�Z;G�dAdB��dBe%�Z<d.S�)Dz0Compiles nodes from the parser into Python code.�����)� namedtuple��update_wrapper)�chain)� iskeyword)�escape)�Markup����)�nodes)�imap)� iteritems)�izip)�NativeStringIO)� range_type)�string_types)� text_type)�TemplateAssertionError)�Symbols)�VAR_LOAD_ALIAS)�VAR_LOAD_PARAMETER)�VAR_LOAD_RESOLVE)�VAR_LOAD_UNDEFINED)�EvalContext)� Optimizer)�concat)�NodeVisitorz==z!=�>z>=�<z<=�inznot in)�eq�ne�gtZgteq�ltZlteqr���Znotinr����itemsZdivisionz%from __future__ import generator_stopZgenerator_stopzdef f(): yield from x()FTc��������������������s�����fdd�}t�|���S�)Nc��������������������sF���|�j�r2|jjs2|�j�||j�}||kr2|��||�S���|�||fi�|��S��N)� optimized�eval_ctx�volatile� optimizer�visit)�self�node�frame�kwargsZnew_node��f���3/usr/lib/python3.9/site-packages/jinja2/compiler.py�new_funcC���s ����zoptimizeconst.<locals>.new_funcr���)r/���r2���r0���r.���r1���� optimizeconstB���s����r3���Nc�����������������C���sH���t�|�tj�std��|�||||||�}|�|���|du�rD|j���S�dS�)z+Generate the python source for a node tree.z Can't compile non template nodesN)� isinstancer ���ZTemplate� TypeErrorZcode_generator_classr)����stream�getvalue)r+����environment�name�filenamer6���� defer_initr%���� generatorr0���r0���r1����generateN���s����� r=���c�����������������C���s����|�du�s|�t�u�s|�tu�rdS�t|��ttttttft �v�r<dS�t|��t ttt fv�rl|�D�]}t|�sT�dS�qTdS�t|��tu�r�t|��D�]$\}}�t|�s��dS�t|��s��dS�q�dS�dS�)z)Does the node have a safe representation?NTF)�NotImplemented�Ellipsis�type�bool�int�float�complexr���r���r����tuple�list�set� frozenset� has_safe_repr�dictr���)�value�item�keyr0���r0���r1���rI���\���s"����rI���c�����������������C���s:���t�|�}z|�D�]}|�|��qW�n�ty2���Y�n0�|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 ����names�visitorr+���r0���r0���r1����find_undeclaredq���s����rS���c�������������������@���s���e�Zd�Zdd��ZdS�)�MacroRefc�����������������C���s���||�_�d|�_d|�_d|�_d�S�)NF)r+����accesses_caller�accesses_kwargs�accesses_varargs�r*���r+���r0���r0���r1����__init__���s����zMacroRef.__init__N)�__name__� __module__�__qualname__rY���r0���r0���r0���r1���rT���~���s���rT���c�������������������@���s8���e�Zd�ZdZddd�Zdd��Zd dd �Zd d��ZeZdS�)�Framez&Holds compile time information for us.Nc�����������������C���sf���||�_�t|r|jpd�|d�|�_d|�_d|�_|o2|j|�_d�|�_|rF|jpHd�|�_||�_|d�urb|j|�_d�S�)N��levelF) r&���r����symbols�toplevel� rootlevel�require_output_check�buffer�block�parent)r*���r&���rf���r_���r0���r0���r1���rY�������s����zFrame.__init__c�����������������C���s*���t��|�j�}|j�|�j��|�j���|_|S�)z!Create a copy of the current one.)�object�__new__� __class__�__dict__�updater`����copy�r*����rvr0���r0���r1���rl�������s����z Frame.copyFc�����������������C���s&���|rt�|�j|�jjd�d�S�t�|�j|��S�)zReturn an inner frame.r ���r^���)r]���r&���r`���r_���)r*����isolatedr0���r0���r1����inner����s����zFrame.innerc�����������������C���s���|�����}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. F)rl���rb���rm���r0���r0���r1����soft����s����z Frame.soft)NN)F) rZ���r[���r\����__doc__rY���rl���rp���rq����__copy__r0���r0���r0���r1���r]�������s��� r]���c�������������������@���s���e�Zd�ZdZdS�)rO���z?Exception used by the `UndeclaredNameVisitor` to signal a stop.N�rZ���r[���r\���rr���r0���r0���r0���r1���rO�������s���rO���c�������������������@���s0���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd S�)�DependencyFinderVisitorz.A visitor that collects filter and test calls.c�����������������C���s���t���|�_t���|�_d�S�r$���)rG����filters�tests�r*���r0���r0���r1���rY�������s����z DependencyFinderVisitor.__init__c�����������������C���s���|���|��|�j�|j��d�S�r$���)� generic_visitrv����addr9���rX���r0���r0���r1����visit_Filter����s���� z$DependencyFinderVisitor.visit_Filterc�����������������C���s���|���|��|�j�|j��d�S�r$���)ry���rw���rz���r9���rX���r0���r0���r1���� visit_Test����s���� z"DependencyFinderVisitor.visit_Testc�����������������C���s���dS�)zStop visiting at blocks.Nr0���rX���r0���r0���r1����visit_Block����s����z#DependencyFinderVisitor.visit_BlockN)rZ���r[���r\���rr���rY���r{���r|���r}���r0���r0���r0���r1���ru�������s ���ru���c�������������������@���s(���e�Zd�ZdZdd��Zdd��Zdd��ZdS�) rN���z�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. c�����������������C���s���t�|�|�_t���|�_d�S�r$���)rG���rQ���rP���)r*���rQ���r0���r0���r1���rY�������s���� zUndeclaredNameVisitor.__init__c�����������������C���sJ���|j�dkr8|j|�jv�r8|�j�|j��|�j|�jkrFt���n|�j�|j��d�S�)N�load)�ctxr9���rQ���rP���rz���rO����discardrX���r0���r0���r1���� visit_Name����s ����z UndeclaredNameVisitor.visit_Namec�����������������C���s���dS�)zStop visiting a blocks.Nr0���rX���r0���r0���r1���r}�������s����z!UndeclaredNameVisitor.visit_BlockN)rZ���r[���r\���rr���rY���r����r}���r0���r0���r0���r1���rN�������s���rN���c�������������������@���s���e�Zd�ZdZdS�)�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. Nrt���r0���r0���r0���r1���r��������s���r����c�������������������@���s���e�Zd�Zd�dd�Zdd��Zdd ��Zd d��Zd�dd �Zdd��Zd�dd�Z d�dd�Z dd��Zd�dd�Zdd��Z dd��Zd�dd�Zd�d d!�Zd�d"d#�Zd$d%��Zd&d'��Zd�d(d)�Zd*d+��Zd,d-��Zd.d/��Zd0d1��Zd2d3��Zd4d5��Zd6d7��Zd8d9��Zd:d;��Zd<d=��Zd>d?��Zd@dA��Z dBdC��Z!dDdE��Z"dFdG��Z#dHdI��Z$dJdK��Z%d�dLdM�Z&dNdO��Z'dPdQ��Z(dRdS��Z)dTdU��Z*dVdW��Z+dXdY��Z,dZd[��Z-d\d]��Z.d^d_��Z/d`da��Z0dbdc��Z1ddde��Z2e3dfdg�Z4e5Z6dZ7dhdi��Z8djdk��Z9dldm��Z:dndo��Z;dpdq��Z<drds��Z=dtdu��Z>dvdw��Z?dxdy��Z@dzd{��ZAd|d}��ZBd~d��ZCd�d���ZDd�d���ZEd�d���ZFd�d�d��ZGd�d�d��ZHeGd��ZIeGd��ZJeGd��ZKeGd��ZLeGd��ZMeGd��ZNeGd��ZOeGd�dd��ZPeGd�dd��ZQeHd��ZReHd��ZSeHd�dd��ZT[G[HeUd�d����ZVeUd�d����ZWd�d���ZXeUd�d����ZYeUd�d����ZZd�d���Z[eUd�d����Z\eUd�d����Z]eUd�d����Z^eUd�d�d���Z_d�d���Z`d�d���Zad�d���Zbd�d���Zcd�d���Zdd�d���Zed�d���Zfd�d���Zgd�d���Zhd�d���Zid�d���Zjd�d���Zkd�d�Zld�dĄ�Zmd�dƄ�ZndS�)�� CodeGeneratorNFTc�����������������C���s����|d�u�rt���}||�_||�_||�_||�_d|�_||�_||�_|rFt|�|�_ i�|�_ i�|�_d|�_d|�_ d|�_i�|�_i�|�_g�|�_d�|�_d|�_d|�_d|�_d|�_d|�_g�|�_g�|�_dg|�_d�S�)NFr���r ���T�context)r���r8���r9���r:���r6���Zcreated_block_contextr;���r%���r���r(����import_aliases�blocks�extends_so_far�has_known_extends�code_linenorw���rv���� debug_info�_write_debug_info� _new_lines� _last_line�_first_write�_last_identifier�_indentation� _assign_stack�_param_def_block�_context_reference_stack)r*���r8���r9���r:���r6���r;���r%���r0���r0���r1���rY�������s8���� zCodeGenerator.__init__c�����������������C���s���t�|||�j|�j��dS�)z*Fail with a :exc:`TemplateAssertionError`.N)r���r9���r:���)r*����msg�linenor0���r0���r1����fail<��s����zCodeGenerator.failc�����������������C���s���|��j�d7��_�d|�j��S�)zGet a new unique identifier.r ���zt_%d)r����rx���r0���r0���r1����temporary_identifier@��s����z"CodeGenerator.temporary_identifierc�����������������C���s���|�����|_|��d|j���dS�)z7Enable buffering for the frame from that point onwards.z%s = []N)r����rd���� writeline�r*���r,���r0���r0���r1���rd���E��s���� zCodeGenerator.bufferc�����������������C���s����|s�|j�jrd|��d��|�����|��d|j���|�����|��d��|�����|��d|j���|�����dS�|j�jr�|��d|j���dS�|��d|j���dS�)z(Return the buffer contents of the frame.zif context.eval_ctx.autoescape:zreturn Markup(concat(%s))�else:zreturn concat(%s)N)r&���r'���r�����indentrd����outdent� autoescape)r*���r,����force_unescapedr0���r0���r1����return_buffer_contentsJ��s���� z$CodeGenerator.return_buffer_contentsc�����������������C���s���|��j�d7��_�dS�)zIndent by one.r ���N�r����rx���r0���r0���r1���r����\��s����zCodeGenerator.indentr ���c�����������������C���s���|��j�|8��_�dS�)zOutdent by step.Nr����)r*����stepr0���r0���r1���r����`��s����zCodeGenerator.outdentc�����������������C���s.���|j�du�r|��d|��n|��d|j��|��dS�)z%Yield or write into the frame buffer.N�yield � %s.append()rd���r����)r*���r,���r+���r0���r0���r1����start_writed��s���� zCodeGenerator.start_writec�����������������C���s���|j�dur|��d��dS�)z1End the writing process started by `start_write`.N�))rd����writer����r0���r0���r1���� end_writek��s���� zCodeGenerator.end_writec�����������������C���s$���|���||��|��|��|��|��dS�)z4Simple shortcut for start_write + write + end_write.N)r����r����r����)r*����sr,���r+���r0���r0���r1����simple_writep��s���� zCodeGenerator.simple_writec�����������������C���s<���z$|���d��|D�]}|��||��qW�n�ty6���Y�n0�dS�)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+���r0���r0���r1���� blockvisitv��s���� zCodeGenerator.blockvisitc�����������������C���s����|�j�rp|�jsR|�j�d|�j����|��j|�j�7��_|�jdurR|�j�|�j|�jf��d|�_d|�_|�j�d|�j���d|�_�|�j�|��dS�)z&Write a string into the output stream.� NFz r���) r����r����r6���r����r����r����r�����appendr����)r*����xr0���r0���r1���r�������s���� zCodeGenerator.writer���c�����������������C���s���|���||��|��|��dS�)z!Combination of newline and write.N)�newliner����)r*���r����r+����extrar0���r0���r1���r�������s����zCodeGenerator.writelinec�����������������C���s:���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����r0���r0���r1���r�������s����zCodeGenerator.newlinec����������� ������C���s���d}t�dd��|jD��|pd�D�]}t|�rd}�q4q|jD�]}|��d��|��||��q:|s�|jD�]}|��d��|��||��q`|dur�t|�D�]\}}|��d||f���q�|jr�|��d ��|��|j|��|�r�|jdur�|��d ��n |��d��|jD�],}|��d|j ���|��|j |��|��d��q�|du�rPt|�D�]\}}|��d ||f����q2|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. Fc�����������������s���s���|�]}|j�V��qd�S�r$���)rM�����.0r����r0���r0���r1���� <genexpr>��������z*CodeGenerator.signature.<locals>.<genexpr>r0���T�, Nz, %s=%sz, *z , **dict({z, **{z%r: z%r: %s, z}, **r�����}z, **)r���r-����is_python_keyword�argsr����r)���r���Zdyn_argsZ dyn_kwargsrM���rK���) r*���r+���r,����extra_kwargsZkwarg_workaround�kwarg�argrM���rK���r0���r0���r1���� signature���sJ���� zCodeGenerator.signaturec�����������������C���sn���t���}|D�]}|�|��q dD�]J}t|�|�}t||�D�]0}||vrN|����||<�|��d||�||f���q6qdS�)zPull all the dependencies.)rv���rw���z%s = environment.%s[%r]N)ru���r)����getattrr����r����)r*���r ���rR���r+���Z dependency�mappingr9���r0���r0���r1����pull_dependencies���s���� �zCodeGenerator.pull_dependenciesc�����������������C���s����g�}t�|jj�D�]p\}\}}|tkr&q|tkrH|��d||����|f���q|tkrd|��d||f���q|tkrx|� |��qt d��q|r�|��dd�|����d�S�)Nz%s = %s(%r)�%s = %szunknown load instruction�%s = missing� = )r���r`����loadsr���r���r�����get_resolve_funcr���r���r�����NotImplementedError�join)r*���r,����undefs�target�actionZparamr0���r0���r1����enter_frame���s���� zCodeGenerator.enter_framec�����������������C���sD���|s@g�}t�|jj�D�]\}}|�|��q|r@|��dd�|����d�S�)Nr����r����)r���r`���r����r����r����r����)r*���r,����with_python_scoper����r�����_r0���r0���r1����leave_frame���s����zCodeGenerator.leave_framec�����������������C���s���|�j�jrd|�S�d|�S�)Nzasync def %szdef %s)r8����is_async)r*���r9���r0���r0���r1����func���s����zCodeGenerator.funcc�������������� ���C���s���|����}|j�|��t|�}d}t��}g�}t|j�D�]@\}}|jdkrJ|}|jdv�r`|�|j��|� |j� |j���q4t|jd�} d| v�r�|dur�z|j |t|j����W�q��ty����|��d|j��Y�q�0�n|� |j�d���d|_d| v��rd|v�r|� |j�d���d|_d| v��r>d|v�r>|� |j�d���d|_d |_|j�|��|��d |��d�d�|�f�|��|�����|��|��|��|��|��|��t|j�D�]�\}}|j� |j�} |��d | ���|�����z|j |t|j���}W�n0�t�y���|��d| d|j�|jf���Y�n0�|��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����Fz%s(%s):Zmacror�����if %s is missing:z%s = undefined(%r, name=%r)zparameter %r was not provided�%s = )r�����r����)%rp���r`����analyze_noderT���rG���� enumerater����r9���rz���r�����refrS����body�defaults�len� IndexErrorr����r�����declare_parameterrU���rV���rW���rc���r����r����r����r����rd���r�����push_parameter_definitionsr)����mark_parameter_storedr�����pop_parameter_definitionsr����r����r����)r*���r+���r,���� macro_refZexplicit_callerZskip_special_paramsr�����idxr����rP���r�����defaultr0���r0���r1���� macro_body���sv���� � �� zCodeGenerator.macro_bodyc�����������������C���s`���d��dd��|jjD���}t|jdd�}t|jj�dkr>|d7�}|��d|||j|j|jf���dS�) z<Dump the macro definition for the def created by macro_body.r����c�����������������s���s���|�]}t�|j�V��qd�S�r$���)�reprr9���r����r0���r0���r1���r����M��r����z*CodeGenerator.macro_def.<locals>.<genexpr>r9���Nr ����,zLMacro(environment, macro, %r, (%s), %r, %r, %r, context.eval_ctx.autoescape)) r����r+���r����r����r����r����rV���rW���rU���)r*���r����r,���Z arg_tupler9���r0���r0���r1���� macro_defK��s�������zCodeGenerator.macro_defc�����������������C���s*���d|j��}|�jdur&|dt|�j��7�}|S�)z.Return a human readable position for the node.zline %dN� in )r����r9���r����)r*���r+���rn���r0���r0���r1����position]��s���� zCodeGenerator.positionc�����������������C���s"���dd��dd��t|j����D����S�)Nz{%s}r����c�����������������s���s���|�]\}}d�||f�V��qdS���%r: %sNr0���)r����r9���r����r0���r0���r1���r����e��s����z3CodeGenerator.dump_local_context.<locals>.<genexpr>)r����r���r`���Zdump_storesr����r0���r0���r1����dump_local_contextd��s�����z CodeGenerator.dump_local_contextc�����������������C���s,���|���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.undefinedzcond_expr_undefined = Undefinedzif 0: yield NoneN�r����rx���r0���r0���r1���� write_commonsj��s���� zCodeGenerator.write_commonsc�����������������C���s���|�j��|j�����dS�)aQ��Pushes 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����r0���r0���r1���r����v��s����z(CodeGenerator.push_parameter_definitionsc�����������������C���s���|�j�����dS�)z+Pops the current parameter definitions set.N)r�����poprx���r0���r0���r1���r������s����z'CodeGenerator.pop_parameter_definitionsc�����������������C���s���|�j�r|�j�d��|��dS�)z�Marks a parameter in the current parameter definitions as stored. This will skip the enforced undefined checks. ���N)r����r�����r*���r����r0���r0���r1���r�������s����z#CodeGenerator.mark_parameter_storedc�����������������C���s���|�j��|��d�S�r$���)r����r����r����r0���r0���r1����push_context_reference���s����z$CodeGenerator.push_context_referencec�����������������C���s���|�j�����d�S�r$���)r����r����rx���r0���r0���r1����pop_context_reference���s����z#CodeGenerator.pop_context_referencec�����������������C���s ���|�j�d�S�)Nr�����r����rx���r0���r0���r1����get_context_ref���s����zCodeGenerator.get_context_refc�����������������C���s���|�j�d�}|dkrdS�d|�S�)Nr����r�����resolvez %s.resolver����r����r0���r0���r1���r�������s���� zCodeGenerator.get_resolve_funcc�����������������C���s���d|�����|��|�f�S�)Nz%s.derived(%s))r����r����r����r0���r0���r1����derive_context���s�����zCodeGenerator.derive_contextc�����������������C���s���|�j�s dS�||�j�d�v�S�)z4Checks if a given target is an undeclared parameter.Fr����)r����r����r0���r0���r1����parameter_is_undeclared���s����z%CodeGenerator.parameter_is_undeclaredc�����������������C���s���|�j��t����dS�)z+Pushes a new layer for assignment tracking.N)r����r����rG���rx���r0���r0���r1����push_assign_tracking���s����z"CodeGenerator.push_assign_trackingc�����������������C���s����|�j����}|jr|sdS�dd��|D��}t|�dkr^tt|��}|j�|�}|��d||f���nR|��d��t |�D�]4\}}|r�|�� d��|j�|�}|�� d||f���qp|�� d ��|r�t|�dkr�|��d |d����n|��dd�tt |�����dS�) zoPops the topmost level for assignment tracking and updates the context variables if necessary. Nc�����������������S���s ���g�|�]}|d�d��dkr|�qS�)Nr ���r����r0���r����r0���r0���r1���� <listcomp>���r����z5CodeGenerator.pop_assign_tracking.<locals>.<listcomp>r ����context.vars[%r] = %szcontext.vars.update({r����r����z})�context.exported_vars.add(%r)r���z"context.exported_vars.update((%s)))r����r����ra���r�����next�iterr`���r����r����r����r����r����r���r����)r*���r,����varsZpublic_namesr9���r����r����r0���r0���r1����pop_assign_tracking���s.���� ��z!CodeGenerator.pop_assign_trackingc�����������������C���s���t�|�j|�j�}ddlm}�|��dd�t����|��dd�|����|�jjrT|��d��|�j �r`dpbd}|� tj�d�u}|� tj�D�]0}|j|�jv�r�|��d |j�|j��||�j|j<�q�|� tj�D�]j}|j|�jvr�|j} |�����|�j| <�} d | v��r| �d d�\}}|��d||| f���q�|��d| | f���q�|��d |�j���|�jd|��d�|f�dd��|�����|�����t|�}dt|jd�v��r�|j�d�} |��d| ���|j�|��d�|_ |_!|�o�|�j"�|_#|�r�|��d��|��$|��|��%|j��|��&|j|��|�j'|dd��|��(���|�r�|�j"�s,|�����|��d��|�����t)�rP|�jj�sP|��d��n8|��d|�jj�rfd�phd���|�����|��d��|��(���|��(d|�j"����t*|�j�D�]�\}}|��d|��d|��|f�|d��|�����|�����t|�}t|jd�}d|v��r|j�d�} |��d| ���d|v��r>|j�d�} |��d| ||f���|j�|��||_+|��$|��|��%|j��|��&|j|��|�j'|dd��|��(����q�|�jd d�d!d"��|�jD����dd��|��d#d$�d%d"��|�j,D������d�S�)&Nr ���)�exportedzfrom __future__ import %sr����zfrom jinja2.runtime import zHfrom jinja2.asyncsupport import auto_await, auto_aiter, AsyncLoopContextz, environment=environment��zblock %r defined twice�.zfrom %s import %s as %szimport %s as %sz name = %rz%s(context, missing=missing%s):�root)r����r*���rx���z%s = TemplateReference(context)Tzparent_template = Noner�����if parent_template is not None:z4yield from parent_template.root_render_func(context)z9%sfor event in parent_template.root_render_func(context):zasync zyield eventZblock_)r*����superr��z %s = context.super(%r, block_%s)z blocks = {%s}c�����������������s���s���|�]}d�||f�V��qdS�)z%r: block_%sNr0���r����r0���r0���r1���r����;��r����z/CodeGenerator.visit_Template.<locals>.<genexpr>zdebug_info = %r�&c�����������������s���s���|�]}d�|�V��qdS�)z%s=%sNr0���r����r0���r0���r1���r����A��r����)-r���r8���r9���Zruntimer��r����r����� code_featuresr����r;����findr ���ZExtends�find_allZBlockr����r����r����ZImportedName� importnamer����r�����rsplitr����r����r����r]���rS���r����r`���r����r����ra���rb���r����rc���r����r����r����r����r�����supports_yield_fromr���re���r����)r*���r+���r,���r&���r��ZenvenvZhave_extendsre����import_�imp�alias�module�objr����r9����block_framerP���r0���r0���r1����visit_Template���s������ � �� �� ��zCodeGenerator.visit_Templatec�����������������C���s����d}|j�r8|�jrdS�|�jdkr8|��d��|�����|d7�}|jrJ|��|�}n|����}tr�|�j j s�|jdu�r�|��d|j|f�|��nD|�j j r�dp�d}|��d||j|f�|��|�����|�� d |��|�����|��|��dS�) z.Call a block and register it for the template.r���N�if parent_template is None:r ���z$yield from context.blocks[%r][0](%s)� async for�forz&%s event in context.blocks[%r][0](%s):�event)ra���r����r����r����r����Zscopedr����r����r ��r8���r����rd���r9���r����r����)r*���r+���r,���r_���r�����loopr0���r0���r1���r}���D��s:���� �����zCodeGenerator.visit_Blockc�����������������C���s����|j�s|��d|j��|�jdkrZ|�js6|��d��|�����|��dd���|�jrRt���n|�����|��d|��|�� |j |��|��d|�j���|��dt ���|�����|��d ��|�����|jr�d |�_|��jd7��_dS�) zCalls the extender.z,cannot use extend from a non top-level scoper���r���raise TemplateRuntimeError(%r)zextended multiple timesz+parent_template = environment.get_template(�, %r)z6for name, parent_block in parent_template.blocks.%s():z8context.blocks.setdefault(name, []).append(parent_block)Tr ���N)ra���r����r����r����r����r����r����r����r����r)����templater����r9����dict_item_iterrb����r*���r+���r,���r0���r0���r1���� visit_Extendsj��s,���� � zCodeGenerator.visit_Extendsc�����������������C���s���|j�r|��d��|�����d}t|jtj�rVt|jjt�r>d}qnt|jjt t f�rnd}nt|jtjtjf�rnd}|��d|�|��|�� |j|��|��d|�j���|j�r�|�����|��d��|�����|��d��|�����|��d ��|�����d }|j�r|�jjr�dp�d}|��d ||��|�f���n6|�jj�r,|��d��n t�rB|��d��d}n |��d��|�sn|�����|��d|��|�����|j��r~|�����dS�)zHandles includes.ztry:Zget_or_select_templateZget_templateZselect_templateztemplate = environment.%s(r��zexcept TemplateNotFound:r����r����Fr��r��zY%s event in template.root_render_func(template.new_context(context.get_all(), True, %s)):zGfor event in (await template._get_default_module_async())._body_stream:z6yield from template._get_default_module()._body_streamTz9for event in template._get_default_module()._body_stream:r��N)Zignore_missingr����r����r4���r��r ���ZConstrK���r���rE���rF����Tuple�Listr)���r����r9���r�����with_contextr8���r����r����r ��r����)r*���r+���r,���� func_nameZskip_event_yieldr��r0���r0���r1���� visit_Include���s\���� �� � �zCodeGenerator.visit_Includec�����������������C���s����|���d|j�|j��|��|jr0|��d|j���|�jjrB|��d��|��d��|��|j |��|��d|�j ���|jr�|��d|�jjr�dp�d|��|�f���n|�jjr�|��d ��n |��d ��|jr�|j� d�s�|���d|j���d S�)zVisit regular imports.r�����context.vars[%r] = �await zenvironment.get_template(�, %r).�*make_module%s(context.get_all(), True, %s)�_asyncr���_get_default_module_async()�_get_default_module()r�����!context.exported_vars.discard(%r)N)r����r`���r����r����ra���r����r8���r����r)���r��r9���r"��r����� startswithr��r0���r0���r1����visit_Import���s*���� ��� zCodeGenerator.visit_Importc�������������� ������s���|���|��|��d|�jjrdpd���|��|j����|��d|�j���|jrn|��d|�jjrZdp\d|�����f���n|�jjr�|��d��n |��d��g�}g�}|j D�]�}t |t�r�|\}}n|}|��d ��j �|�|f���|��d ��j �|����|�����|��d��j �|�d|��|�t|�f�|f���|�������jr�|�|��|�d �s�|�|��q�|�r�t|�dk�r�|d�}|��d|��j �|�f���n"|��dd���fdd�|D������|�r�t|�dk�r�|��d|d����n|��dd�tt|�����dS�)zVisit named imports.z/included_template = %senvironment.get_template(r&��r��r'��r(��r)��r*��r+��z,%s = getattr(included_template, %r, missing)r����z9%s = undefined(%r %% included_template.__name__, name=%r)zGthe template %%r (imported on %s) does not export the requested name %sr����r ���r���r����zcontext.vars.update({%s})r����c�����������������3���s"���|�]}d�|��j��|�f�V��qdS�r����)r`���r����)r����r9����r,���r0���r1���r����(��s���z1CodeGenerator.visit_FromImport.<locals>.<genexpr>r,��z-context.exported_vars.difference_update((%s))N)r����r����r8���r����r)���r��r9���r"��r����rQ���r4���rE���r����r`���r����r����r����r����r����ra���r����r-��r����r����r���)r*���r+���r,���Z var_namesZdiscarded_namesr9���r��r0���r/��r1����visit_FromImport���s����� ����� �� ���� ������zCodeGenerator.visit_FromImportc�����������������C���sN��|����}|����}|����}|jp2dt|jdd�d�v�}d�}|rH|j�d�}|jj|dd��|jrn|jj|dd��|j�rl|�� ��}|jj|dd��|�� d |��|��|j��|�����|�� |��|�� |�jjr�d p�d��|��|j|��|��d��|��|�jjr�d p�d��|��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�r|�� ��} |�� d| ���|�� |�jj�r$d �p&d|��|��|j|��|�rj|�jj�rZ|��d|���n|��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|��|�rd!�pd��|�����|�� |��|��|j|��|j�rR|�� d"| ���|�����|�j||j�on|j�d��|j�r�|�� d#| ���|�����|�� |��|��|j|��|��|��|�����|j�rJ|�� |��|�����|��!||��|�jj�r�|��d$��|��d%��|�jj�r|��d��|��|j|��|�jj�r6|��d��|��d&��|��"|��d�S�)'Nr��)r����)Zonly)r��r����)Z for_branch�else�testz %s(fiter):z async for zfor r����zauto_aiter(fiter)Zfiter�:�if r��������Tr����z'%s(reciter, loop_render_func, depth=0):r�����storez8Can't assign to special loop variable in for-loop targetz%s = 1z, %s in AsyncLoopContext(z, %s in LoopContext(z%s(Zreciterzauto_aiter(r����z&, undefined, loop_render_func, depth):z , undefined):z%s = 0zif %s:r&��zloop(z, loop))#rp���� recursiverS���Ziter_child_nodesr`���r����r�����else_r2��r����r����r����r����r����r8���r����r)���r����r����r����r����rd���r ��r ����Namer���r9���r����r����r����r����r����r����r����r����)r*���r+���r,���Z loop_frameZ test_frameZ else_frameZ extended_loopZloop_refZloop_filter_funcr9���Ziteration_indicatorr0���r0���r1���� visit_For5��s����� � � � � zCodeGenerator.visit_Forc�����������������C���s����|����}|��d|��|��|j|��|��d��|�����|��|j|��|�����|j D�]F}|��d|��|��|j|��|��d��|�����|��|j|��|�����qP|j r�|��d��|�����|��|j |��|�����d�S�)Nr4��r3��zelif r����)rq���r����r)���r2��r����r����r����r����r�����elif_r8��)r*���r+���r,���Zif_framer;��r0���r0���r1����visit_If���s&���� zCodeGenerator.visit_Ifc�����������������C���sr���|���||�\}}|�����|jrJ|j�d�s:|��d|j���|��d|j���|��d|j�|j����|�� ||��d�S�)Nr����r����r%��r����) r����r����ra���r9���r-��r����r����r`���r����r����)r*���r+���r,���Zmacro_framer����r0���r0���r1����visit_Macro���s����zCodeGenerator.visit_Macroc�����������������C���sR���|���||�\}}|��d��|��||��|��||��|�j|j|dd��|��|��d�S�)Nz caller = T)�forward_caller)r����r����r����r����� visit_Call�callr����)r*���r+���r,���Z call_framer����r0���r0���r1����visit_CallBlock���s���� zCodeGenerator.visit_CallBlockc�����������������C���sh���|����}|j�|��|��|��|��|��|��|j|��|��||��|��|j |��|�� |��|��|��d�S�r$���)rp���r`���r����r����rd���r����r����r����r{����filterr����r����)r*���r+���r,���Zfilter_framer0���r0���r1����visit_FilterBlock���s���� zCodeGenerator.visit_FilterBlockc�����������������C���s|���|����}|j�|��|��|��t|j|j�D�]2\}}|�����|��||��|�� d��|��||��q,|�� |j|��|��|��d�S��Nr����) rp���r`���r����r����r ����targets�valuesr����r)���r����r����r����r����)r*���r+���r,���Z with_framer�����exprr0���r0���r1���� visit_With���s���� zCodeGenerator.visit_Withc�����������������C���s���|���|��|��|j|��d�S�r$���)r����r)���r+���r��r0���r0���r1����visit_ExprStmt���s���� zCodeGenerator.visit_ExprStmt� _FinalizeInfo)�const�srcc��������������������s�����j�dur�j�S��j�}��d}�jjr�d}�jj����fdd�}t�dd�du�r^|d7�}d}nFt�d d�du�r||d 7�}d}n(t�dd�du�r�|d7�}����fd d�}��||��_��j�S�)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(c��������������������s������|���S�r$���r0����rK���)r�����env_finalizer0���r1����finalize��s����z.CodeGenerator._make_finalize.<locals>.finalizeZcontextfunctionFT� context, Zevalcontextfunction�context.eval_ctx, Zenvironmentfunction� environment, c��������������������s�������j�|���S�r$���)r8���rM���r����rN��r*���r0���r1���rO��'��s����)� _finalize�_default_finalizer8���rO��r����rJ��)r*���rO��rL��r0���rS��r1����_make_finalize��s&���� zCodeGenerator._make_finalizec�����������������C���s���t�t|��S�)z�Given a group of constant values converted from ``Output`` child nodes, produce a string to write to the template module source. )r����r���)r*����groupr0���r0���r1����_output_const_repr-��s����z CodeGenerator._output_const_reprc�����������������C���s:���|��|j�}|jjrt|�}t|tj�r0t|�S�|�|�S�)aC��Try 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����r���r4���r ����TemplateDatar���rK��)r*���r+���r,���rO��rK��r0���r0���r1����_output_child_to_const4��s����z$CodeGenerator._output_child_to_constc�����������������C���sL���|j�jr|��d��n|j�jr(|��d��n |��d��|jdurH|��|j��dS�)zXOutput extra source code before visiting a child of an ``Output`` node. z7(escape if context.eval_ctx.autoescape else to_string)(zescape(z to_string(N)r&���r'���r����r����rL���r*���r+���r,���rO��r0���r0���r1����_output_child_preG��s���� zCodeGenerator._output_child_prec�����������������C���s"���|���d��|jdur|���d��dS�)zWOutput extra source code after visiting a child of an ``Output`` node. r����N)r����rL��r\��r0���r0���r1����_output_child_postU��s���� z CodeGenerator._output_child_postc����������� ��� ���C���s���|j�r"|�jrd�S�|��d��|�����|����}g�}|jD�]�}z,|jsTt|tj�sTt� ���|�� |||�}W�n&�tj tfy����|�|��Y�q4Y�n0�|r�t|d�t �r�|d��|��q4|�|g��q4|jd�ur�t|�dkr�|��d|j���n|��d|j���|�����|D�]�}t|t ��rF|��|�}|jd�u��r6|��d|���n|��|d���nb|jd�u��r`|��d|��n |��|��|��|||��|��||��|��|||��|jd�u�r�|��d���q�|jd�u�r�|�����|��t|�dk�r�dnd ��|j��r�|�����d�S�) Nr��r����r ���r����z%s.extend((r����r����r�����)))rc���r����r����r����rV��r ���rK��r4���rZ��� Impossibler[��� Exceptionr����rF���rd���r����rX��r����r]��r)���r^��r����r����) r*���r+���r,���rO��r�����childrK��rL����valr0���r0���r1����visit_Output^��sZ���� � � zCodeGenerator.visit_Outputc�����������������C���sF���|������|��|��|��|j|��|��d��|��|j|��|��|��d�S�rD��)r����r����r)���r����r����r+���r���r��r0���r0���r1����visit_Assign���s���� zCodeGenerator.visit_Assignc�����������������C���s����|������|���}d|_|j�|��|��|��|��|��|��|j|��|�� |��|�� |j|��|��d��|j d�ur�|��|j |��n|��d|j���|��d��|��|��|��|��d�S�)NFz9 = (Markup if context.eval_ctx.autoescape else identity)(� concat(%s)r����)r����rp���rc���r`���r����r����rd���r����r����r����r)���r����r����rB��r{���r���r����)r*���r+���r,���r��r0���r0���r1����visit_AssignBlock���s ���� zCodeGenerator.visit_AssignBlockc�����������������C���s����|j�dkr(|jr(|�jr(|�jd��|j��|j�|j�}|j�dkr�|j�|�}|d�urj|d�tkrj|�� |�r�|�� d|j||f���d�S�|�� |��d�S�)Nr6��r����r~���r���z-(undefined(name=%r) if %s is missing else %s))r���ra���r����rz���r9���r`���r����Z find_loadr���r����r����)r*���r+���r,���r����r~���r0���r0���r1���r�������s&���� � �� ��zCodeGenerator.visit_Namec�����������������C���sR���|j��|j�}|��d|���|�����|��dd���|�����|��d||jf���d�S�)Nz!if not isinstance(%s, Namespace):r��z/cannot assign attribute on non-namespace objectz%s[%r])r`���r����r9���r����r����r�����attr)r*���r+���r,���r����r0���r0���r1����visit_NSRef���s������zCodeGenerator.visit_NSRefc�����������������C���s8���|��|j�}t|t�r&|��t|���n|��t|���d�S�r$���)rY��r&���r4���rC���r�����strr����)r*���r+���r,���rc��r0���r0���r1����visit_Const���s���� zCodeGenerator.visit_Constc�����������������C���sD���z|���t|�|j����W�n$�tjy>���|���d|j���Y�n0�d�S�)Nz9(Markup if context.eval_ctx.autoescape else identity)(%r))r����r����rY��r&���r ���r`���datar��r0���r0���r1����visit_TemplateData���s�����z CodeGenerator.visit_TemplateDatac�����������������C���sV���|���d��d}t|j�D�]"\}}|r.|���d��|��||��q|���|dkrLdpNd��d�S�)N�(r����r����r���z,)r�����r����r����r#���r)����r*���r+���r,���r����rL���r0���r0���r1����visit_Tuple��s���� zCodeGenerator.visit_Tuplec�����������������C���sF���|���d��t|j�D�]"\}}|r*|���d��|��||��q|���d��d�S�)N�[r�����]ro��rp��r0���r0���r1���� visit_List��s���� zCodeGenerator.visit_Listc�����������������C���s`���|���d��t|j�D�]<\}}|r*|���d��|��|j|��|���d��|��|j|��q|���d��d�S�)N�{r����z: r����)r����r����r#���r)���rM���rK���rp��r0���r0���r1���� visit_Dict��s���� zCodeGenerator.visit_Dictc��������������������s���t���fdd��}|S�)Nc��������������������s����|�j�jrJ��|�j�jv�rJ|��d�����|��|j|��|��d��|��|j|��n4|��d��|��|j|��|��d�����|��|j|��|��d��d�S�)Nz$environment.call_binop(context, %r, r����rn��� %s r����)r8���� sandboxedZintercepted_binopsr����r)����left�rightr����operatorr0���r1���rR�����s����� � z$CodeGenerator.binop.<locals>.visitor�r3����r|��� interceptablerR���r0���r{��r1����binop��s����zCodeGenerator.binopc��������������������s���t���fdd��}|S�)Nc��������������������s\���|�j�jr2��|�j�jv�r2|��d�����|��|j|��n|��d�����|��|j|��|��d��d�S�)Nz#environment.call_unop(context, %r, rn��r����)r8���rx��Zintercepted_unopsr����r)���r+���r��r{��r0���r1���rR���2��s����� �z#CodeGenerator.uaop.<locals>.visitorr}��r~��r0���r{��r1����uaop1��s����zCodeGenerator.uaop�+�-�*�/z//z**�%�and)r���orznot c�����������������C���s^���|j�jrd}n|j�jrd}nd}|��d|���|jD�]}|��||��|��d��q4|��d��d�S�)Nz;(context.eval_ctx.volatile and markup_join or unicode_join)Zmarkup_joinZunicode_joinz%s((r����r_��)r&���r'���r����r����r ���r)���)r*���r+���r,���r#��r����r0���r0���r1����visit_ConcatO��s���� zCodeGenerator.visit_Concatc�����������������C���s>���|���d��|��|j|��|jD�]}|��||��q|���d��d�S�)Nrn��r����)r����r)���rG���ops)r*���r+���r,����opr0���r0���r1���� visit_Compare]��s ���� zCodeGenerator.visit_Comparec�����������������C���s&���|���dt|j����|��|j|��d�S�)Nrw��)r����� operatorsr���r)���rG��r��r0���r0���r1���� visit_Operande��s����zCodeGenerator.visit_Operandc�����������������C���sP���|�j�jr|��d��|��d��|��|j|��|��d|j���|�j�jrL|��d��d�S�)N�(await auto_await(zenvironment.getattr(r��r_��)r8���r����r����r)���r+���rh��r��r0���r0���r1���� visit_Getattri��s���� zCodeGenerator.visit_Getattrc�����������������C���s����t�|jtj�r@|��|j|��|��d��|��|j|��|��d��n^|�jjrR|��d��|��d��|��|j|��|��d��|��|j|��|��d��|�jjr�|��d��d�S�)Nrr��rs��r���zenvironment.getitem(r����r����r_��) r4���r����r ���ZSlicer)���r+���r����r8���r����r��r0���r0���r1���� visit_Getitemu��s���� zCodeGenerator.visit_Getitemc�����������������C���s`���|j�d�ur|��|j�|��|��d��|jd�ur:|��|j|��|jd�ur\|��d��|��|j|��d�S�)Nr3��)�startr)���r�����stopr����r��r0���r0���r1����visit_Slice���s���� zCodeGenerator.visit_Slicec�����������������C���s8��|�j�jr|��d��|��|�j|j�d���|�j�j�|j�}|d�u�rT|��d|j�|j��t|dd�du�rp|��d��n6t|dd�du�r�|��d ��nt|d d�du�r�|��d��|j d�ur�|�� |j |��nJ|jjr�|��d|j |j f���n*|jjr�|��d |j ���n|��d|j ���|��||��|��d��|�j�j�r4|��d��d�S�)N�await auto_await(rn��zno filter named %rZ contextfilterFTrP��ZevalcontextfilterrQ��ZenvironmentfilterrR��zB(context.eval_ctx.autoescape and Markup(concat(%s)) or concat(%s))zMarkup(concat(%s))rf��r����)r8���r����r����rv���r9����getr����r����r����r+���r)���r&���r'���rd���r����r����)r*���r+���r,���r����r0���r0���r1���r{������s6���� �� zCodeGenerator.visit_Filterc�����������������C���s`���|���|�j|j�d���|j|�jjvr8|��d|j�|j��|��|j|��|��||��|���d��d�S�)Nrn��zno test named %rr����) r����rw���r9���r8���r����r����r)���r+���r����r��r0���r0���r1���r|������s����zCodeGenerator.visit_Testc��������������������s^�������fdd�}���d�����j�������d�����j�������d��|������d��d�S�)Nc����������������������s4����j�d�ur���j����S���dd��������d�S�)Nzcond_expr_undefined(%r)zRthe inline if-expression on %s evaluated to false and no else section was defined.)Zexpr2r)���r����r����r0����r,���r+���r*���r0���r1����write_expr2���s���� ���z1CodeGenerator.visit_CondExpr.<locals>.write_expr2rn��z if z else r����)r����r)���Zexpr1r2��)r*���r+���r,���r���r0���r���r1����visit_CondExpr���s���� zCodeGenerator.visit_CondExprc�����������������C���s|���|�j�jr|��d��|�j�jr&|��d��n |��d��|��|j|��|rJddipLd�}|��|||��|��d��|�j�jrx|��d��d�S�)Nr���zenvironment.call(context, z context.call(r����r����)r8���r����r����rx��r)���r+���r����)r*���r+���r,���r>��r����r0���r0���r1���r?�����s���� zCodeGenerator.visit_Callc�����������������C���s"���|���|jd���|��|j|��d�S�)N�=)r����rM���r)���rK���r��r0���r0���r1���� visit_Keyword���s����zCodeGenerator.visit_Keywordc�����������������C���s&���|���d��|��|j|��|���d��d�S�)NzMarkup(r�����r����r)���rG��r��r0���r0���r1����visit_MarkSafe���s���� zCodeGenerator.visit_MarkSafec�����������������C���s&���|���d��|��|j|��|���d��d�S�)Nz5(context.eval_ctx.autoescape and Markup or identity)(r����r���r��r0���r0���r1����visit_MarkSafeIfAutoescape���s���� z(CodeGenerator.visit_MarkSafeIfAutoescapec�����������������C���s���|���d|j���d�S�)Nzenvironment.�r����r9���r��r0���r0���r1����visit_EnvironmentAttribute���s����z(CodeGenerator.visit_EnvironmentAttributec�����������������C���s���|���d|j|jf���d�S�)Nzenvironment.extensions[%r].%s)r����Z identifierr9���r��r0���r0���r1����visit_ExtensionAttribute���s����z&CodeGenerator.visit_ExtensionAttributec�����������������C���s���|���|�j|j���d�S�r$���)r����r����r��r��r0���r0���r1����visit_ImportedName���s����z CodeGenerator.visit_ImportedNamec�����������������C���s���|���|j��d�S�r$���r���r��r0���r0���r1����visit_InternalName���s����z CodeGenerator.visit_InternalNamec�����������������C���s���|���d��d�S�)Nr����)r����r��r0���r0���r1����visit_ContextReference���s����z$CodeGenerator.visit_ContextReferencec�����������������C���s���|���|��|���d�S�r$���)r����r����r��r0���r0���r1����visit_DerivedContextReference��s����z+CodeGenerator.visit_DerivedContextReferencec�����������������C���s���|���d|��d�S�)N�continuer����r��r0���r0���r1����visit_Continue��s����zCodeGenerator.visit_Continuec�����������������C���s���|���d|��d�S�)N�breakr����r��r0���r0���r1����visit_Break��s����zCodeGenerator.visit_Breakc�����������������C���s:���|����}|j�|��|��|��|��|j|��|��|��d�S�r$���)rp���r`���r����r����r����r����r����)r*���r+���r,����scope_framer0���r0���r1����visit_Scope��s ���� zCodeGenerator.visit_Scopec�����������������C���s����|�����}|��d||��|�f���|��d|���|��|j|��|��|��|jdd�}|j�|��|�� |��|�� |j|��|��|��|�� ���d�S�)Nr����z %s.vars = T)ro���)r����r����r����r)���r����r����rp���r`���r����r����r����r����r����r����)r*���r+���r,���r���r���r0���r0���r1����visit_OverlayScope��s���� z CodeGenerator.visit_OverlayScopec�������������� ���C���sn���|j�D�]b}|��d|j���|��|j|��z|j�|j�}W�n�tjyV���d|j_ Y�q0�t |j|j|��qd�S�)Nzcontext.eval_ctx.%s = T)�optionsr����rM���r)���rK���rY��r&���r ���r`��r'����setattr)r*���r+���r,����keywordrc��r0���r0���r1����visit_EvalContextModifier ��s���� z'CodeGenerator.visit_EvalContextModifierc�����������������C���sb���|�����}|j���}|��d|���|��||��|jD�]}|��||��q2|j�|��|��d|���d�S�)Nz%s = context.eval_ctx.save()zcontext.eval_ctx.revert(%s))r����r&���Zsaver����r���r����r)���Zrevert)r*���r+���r,���Zold_ctx_nameZ saved_ctxrb��r0���r0���r1����visit_ScopedEvalContextModifier+��s���� z-CodeGenerator.visit_ScopedEvalContextModifier)NFT)F)r ���)N)N)Nr���)Nr���)N)F)N)T)T)F)orZ���r[���r\���rY���r����r����rd���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r���r��r}���r��r$��r.��r0��r:��r<��r=��rA��rC��rH��rI��r���rJ��r���rU��rT��rV��rX��r[��r]��r^��rd��re��rg��r����ri��rk��rm��rq��rt��rv��r���r���Z visit_AddZ visit_SubZ visit_MulZ visit_DivZvisit_FloorDivZ visit_PowZ visit_ModZ visit_AndZvisit_OrZ visit_PosZ visit_NegZ visit_Notr3���r���r���r���r���r���r���r{���r|���r���r?��r���r���r���r���r���r���r���r���r���r���r���r���r���r���r���r0���r0���r0���r1���r��������s������ D 5 P |&-:K� ) O r����)NFT)=rr����collectionsr���� functoolsr���� itertoolsr���r���r���r����Z markupsafer���r���r��r ���Z_compatr���r���r ���r���r���r���r���� exceptionsr���Z idtrackingr���r���r���r���r���r���r(���r���Zutilsr���rR���r���r����hasattrrJ���r��r���execr�����SyntaxErrorr ��r3���r=���rI���rS���rg���rT���r]����RuntimeErrorrO���ru���rN���ra��r����r����r0���r0���r0���r1����<module>���sv���� �� =