%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/mako/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/mako/__pycache__/codegen.cpython-312.pyc

�

���e˸��:�dZddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZd	Zd
dhZ
dd
hje
�Zddddddddde�f
d�ZGd�d�ZGd�d�ZGd�d�Zej"d�Zd�ZGd�d�Zy)zVprovides functionality for rendering a parsetree constructing into module
source code.�N)�ast)�
exceptions)�filters)�	parsetree)�util)�
PythonPrinter�
�	UNDEFINED�STOP_RENDERING�context�loopTFc��tj�}t|�}
t|
t	|||||||||	|
|�|�|j�S)zYGenerate module source code given a parsetree node,
    uri, and optional source filename)r�FastEncodingBufferr�_GenerateRenderMethod�_CompileContext�getvalue)�node�uri�filename�default_filters�buffer_filters�imports�future_imports�source_encoding�generate_magic_comment�strict_undefined�enable_loop�reserved_names�buf�printers              �./usr/lib/python3/dist-packages/mako/codegen.py�compiler"sc��"�
!�
!�
#�C��C� �G�����������"����	
�	
��"�<�<�>��c��eZdZd�Zy)rc��||_||_||_||_||_||_||_||_|	|_|
|_	||_
y�N)rrrrrrrrrrr)�selfrrrrrrrrrrrs            r!�__init__z_CompileContext.__init__HsY����� ��
�.���,������,���.���&<��#� 0���&���,��r#N)�__name__�
__module__�__qualname__r(�r#r!rrGs��-r#rc��eZdZdZd�Zd�Zed��Zd�Zd�Z	d�Z
d�Zd	�Zdd�Z
d�Zd
�Z	dd�Z		dd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy
)rzZA template visitor object which generates the
    full module source for a template.

    c��||_||_||_dg|_t	|t
jt
jf�|_|jr�d|jz}|j�}t|jj�dkD}t|jj!dd��}t|jj!dd��}d}	d}
|j"r�|j$s�|dgz
}n�|j'�}	|jj(}
d}|
��|
j*j�}|
j*j,s|dgz
}t|
jj!dd��}|jj.xs%t|
jj!dd��|j_ndg}d	}d	x}}|�d
g}nd
g|zD�cgc]}|��}}|j1|
xs||||||�|	�|	D]}t3|||��|js|j5�yycc}w)Nz	render_%sr�buffered�False�cached�
**pageargs�render_bodyrFr)r �compilerr�identifier_stack�
isinstancer�DefTag�BlockTag�in_def�funcname�get_argument_expressions�len�filter_args�args�eval�
attributes�get�is_block�is_anonymous�write_toplevel�pagetag�	body_decl�kwargsr�write_render_callabler�write_metadata_struct)r'r r4r�namer>�filteredr/r1�defsrE�as            r!r(z_GenerateRenderMethod.__init__js%����� ��
���	�!%���� ��	�(8�(8�)�:L�:L�'M�N����;�;�����.�D��0�0�2�D��4�+�+�0�0�1�A�5�H��D�O�O�/�/�
�G�D�E�H��$�/�/�-�-�h��@�A�F��D��G��}�}�T�%6�%6����&���&�&�(�D��m�m�+�+�G� �D��"��(�(�A�A�C���(�(�/�/��\�N�*�D��g�0�0�4�4�X�w�G�H��,0�M�M�,E�,E�-���&�&�*�*�=�'�B�J��
�
�)�%�~����"'�'�H�x��<��;�D� )�{�T�1�2�!�A�2�D�2��"�"��O�t�T�4��8�V�	
����
?��%�g�x��>�
?��{�{��&�&�(���3s�0	I	c��t|jj�|jj|jj<|jj
|jj|jj|jjd�}|jjddtj|�d�y)N)rrr�line_mapz"""�__M_BEGIN_METADATAz__M_END_METADATA
""")�maxr �
source_map�linenor4rrr�
writelines�json�dumps)r'�structs  r!rIz+_GenerateRenderMethod.write_metadata_struct�s���7:��L�L�#�#�8
��������� 3� 3�4��
�
�.�.��=�=�$�$�#�}�}�<�<����/�/�	
��	
������ ��J�J�v��&�		
r#c� �|jdS)N���)r5�r's r!�identifiersz!_GenerateRenderMethod.identifiers�s���$�$�R�(�(r#c�8
����
�g�i�
g�d�j_G���
�fd�d�}|�}�jjD]}|j	|���
�j_t
�}�D]!}|j|j��}�#t�j�}||_
�jjrH�jjr2�jjd�jjz��jjrA�jjddj!�jj�����jjd��jjd��jjd	��jjd
��jjd��jjdt"z��jjd
t%j$�z��jjd�jj&z��jjd�jj(z��jjd�jj*z��jjd�jjz��jj,r[d}�jj,D]%}||dzz
}�jj|��'t/j0|dddd��}nd}|j3�j�}	|j4}
|
j|	j4�|_|jj7t8�|r%|jj7|j�|�j_�jjd|	j4j=�D�cgc]}|j>��c}z��jjAd�tC��r�jE��tC��r&�jG�
��jI�d�ntC�
�r�jG�
�tK|	j4j=��Scc}w)zxTraverse a template structure for module-level directives and
        generate the start of module-level code.

        Nc�6��eZdZ�fd�Z�fd�Z�fd�Z�fd�Zy)�:_GenerateRenderMethod.write_toplevel.<locals>.FindTopLevelc�(���j|�yr&)�append)�sr�inherits  �r!�visitInheritTagzJ_GenerateRenderMethod.write_toplevel.<locals>.FindTopLevel.visitInheritTag�s������t�$r#c�$��|�|j<yr&�rJ)rar�
namespacess  �r!�visitNamespaceTagzL_GenerateRenderMethod.write_toplevel.<locals>.FindTopLevel.visitNamespaceTag�s���(,�
�4�9�9�%r#c�(��|�j_yr&)r4rE)rarr's  �r!�visitPageTagzG_GenerateRenderMethod.write_toplevel.<locals>.FindTopLevel.visitPageTag�s���(,��
�
�%r#c�B��|jr�j|�yyr&)�ismoduler`)rar�module_codes  �r!�	visitCodezD_GenerateRenderMethod.write_toplevel.<locals>.FindTopLevel.visitCode�s����=�=��&�&�t�,�!r#N)r)r*r+rcrgrirm)rbrlrfr's����r!�FindTopLevelr^�s���
%�
-�
-�
-r#rnz# -*- coding:%s -*-zfrom __future__ import �, z(from mako import runtime, filters, cachezUNDEFINED = runtime.UNDEFINEDz'STOP_RENDERING = runtime.STOP_RENDERINGz__M_dict_builtin = dictz__M_locals_builtin = localsz_magic_number = %rz_modified_time = %rz_enable_loop = %rz_template_filename = %rz_template_uri = %rz_source_encoding = %r��
rztemplate defined imports)�sourcerS�posrz
_exports = %r�rY)&r4rEr�nodes�accept_visitorrf�set�union�declared_identifiers�_Identifiers�declaredrrr �	writeliner�join�MAGIC_NUMBER�timerrrrr�
PythonCode�branch�topleveldefs�update�TOPLEVEL_DECLAREDr[�valuesrJ�write_blanksr<�write_module_code�write_namespaces�
write_inherit�list)r'rn�f�n�module_ident�module_identifiersr�imp�impcode�main_identifiers�mitrbrlrfs`          @@@r!rDz$_GenerateRenderMethod.write_toplevel�s���
���
��� $��
�
��	-�	-�
�N�������	 �A�
���Q��	 �$.��
�
� ��u���	H�A�'�-�-�a�.D�.D�.F�G�L�	H�*�$�-�-�8��&2��#�
�M�M�0�0��
�
�-�-��L�L�"�"�%��
�
�(E�(E�E�
��=�=�'�'��L�L�"�"��9�9�T�]�]�9�9�:�=�
�	
�����I�J������>�?������H�I������8�9������<�=������3�l�B�C������4�t�y�y�{�B�C������2�T�]�]�5N�5N�N�O������%��
�
�(>�(>�>�	
�	
�����3�d�m�m�6G�6G�G�H������#�d�m�m�&C�&C�C�	
��=�=� � ��C��}�}�,�,�
,���s�T�z�!�����&�&�s�+�
,��n�n�����3��G��G�-�4�4�T�Y�Y�?�� �-�-��*-�)�)��)�)�+
��'�	�#�#�*�*�+<�=���'�'�.�.�w�/K�/K�L�$6��
�
�!�������/�<�<�C�C�E�F�!�q�v�v�F�
G�	
�	
���!�!�!�$��{���"�"�;�/��w�<��!�!�*�-����w�r�{�+�
��_��!�!�*�-��$�1�1�8�8�:�;�;��Gs�T
c�f�|jr,|j}|r|jjd|z�|jj	|j
�|jj
d|�ddj|��d�dd�|s|s|r|jjd�|jj|jjj|j��|jr|jjr,d	|vr(|jd
jj!d�|js�t#|jj$�dkDs"t#|jj�dkDrT|jjd
dj|jjD�cgc]	}|�d|����c}�z�|j'|jd��|jj(D]}	|	j+|��|j-|j|||�|jjd�|jj/d�|r"|j1|||||jd��yycc}w)znwrite a top-level render callable.

        this could be the main render() method or that of a top-level def.z@runtime._decorate_toplevel(%s)�def �(�,�):�/__M_caller = context.caller_stack._push_frame()�try:�context._push_buffer()r2rY�pageargsrz!__M_locals = __M_dict_builtin(%s)�=T)�toplevelNrt)r9�	decoratorr r|�start_sourcerSrTr}r5r`r4r[r�rrB�argument_declared�addr<�locally_assigned�write_variable_declaresrurv�write_def_finishr��write_cache_decorator)
r'rrJr>r/rKr1r��xr�s
          r!rHz+_GenerateRenderMethod.write_render_callables1���;�;����I�����&�&�5�	�A��	
���!�!�$�+�+�.������!�3�8�8�D�>�2�=��		
��x�6��L�L�"�"�#;�<����$�$��M�M�%�%�,�,�T�Y�Y�7�	
����t�y�y�1�1�|�t�7K��!�!�"�%�7�7�;�;�J�G��{�{��� � �1�1�2�Q�6��4�#�#�5�5�6��:��L�L�"�"�3��(�(�"&�!1�!1�!C�!C���$%�a�(����
�	
�$�$�T�%5�%5��$�E������	#�A�
���T�"�	#�	
���d�i�i��8�V�D������t�$����!�!�!�$���&�&��d�D�(�D�,<�,<�t�
'�
���s�J.c�t�|D]3}|jj|j|j���5y)zewrite module-level template code, i.e. that which
        is enclosed in <%! %> tags in the template.��starting_linenoN)r �write_indented_block�textrS)r'rlr�s   r!r�z'_GenerateRenderMethod.write_module_codeVs4���	P�A��L�L�-�-�a�f�f�a�h�h�-�O�	Pr#c�`�|jjddd|jdzd�y)z:write the module-level inheritance-determination callable.z%def _mako_inherit(template, context):�"_mako_generate_namespaces(context)z8return runtime._inherit_from(context, %s, _template_uri)�fileN)r rT�parsed_attributes�r'rs  r!r�z#_GenerateRenderMethod.write_inherit\s5��	
�����3�0�F��%�%�f�-�
/��	
r#c�x�����jjdddddddd��jjd�|j�D�]�}d|jvrd	�j
_�jj|j�t|j�r҉jjd
�g��j
jj|��d	�_
G���fd�d�}|�}|jD]}|j|���jjd
dj��z��jjd�d�_
d}nd}d|j vrJ�jjd|j"�d|j j%dd��d|�d��n�d|j vrJ�jjd|j"�d|�d|j j%dd��d��n,�jjd|j"�d|�d��t'|jj%dd��r(�jjd |j"z��jjd!t)|j"�z��jj+d"����t|�s�jjd#��jjd�y)$z5write the module-level namespace-generating callable.z'def _mako_get_namespace(context, name):r�z+return context.namespaces[(__name__, name)]�except KeyError:r�Nz'def _mako_generate_namespaces(context):�importTzdef make_namespace():c�(��eZdZd�Zd�Z���fd�Zy)�<_GenerateRenderMethod.write_namespaces.<locals>.NSDefVisitorc�&�|j|�yr&��visitDefOrBase�rars  r!�visitDefTagzH_GenerateRenderMethod.write_namespaces.<locals>.NSDefVisitor.visitDefTag�����(�(��.r#c�&�|j|�yr&r�r�s  r!�
visitBlockTagzJ_GenerateRenderMethod.write_namespaces.<locals>.NSDefVisitor.visitBlockTag�r�r#c���|jr tj	di|j����j	|�d���j|j�y)NF��nested)z.Can't put anonymous blocks inside <%namespace>)rCr�CompileException�exception_kwargs�write_inline_defr`r:)rar�exportr[r's  ���r!r�zK_GenerateRenderMethod.write_namespaces.<locals>.NSDefVisitor.visitDefOrBase�s[����,�,�",�"=�"=�!/�#�#'�"7�"7�#��
�-�-�d�K��-�N��
�
�d�m�m�4r#N�r)r*r+r�r�r�)r�r[r's���r!�NSDefVisitorr�s���/�/�5r#r��return [%s]r�Fzmake_namespace()�Noner�zns = runtime.TemplateNamespace(z3, context._clean_inheritance_tokens(), templateuri=z, callables=z,  calling_uri=_template_uri)�modulezns = runtime.ModuleNamespace(z1, context._clean_inheritance_tokens(), callables=z$, calling_uri=_template_uri, module=�)zns = runtime.Namespace(z, calling_uri=_template_uri)�inheritabler0zcontext['self'].%s = nsz'context.namespaces[(__name__, %s)] = ns��pass)r rTr|r�r@r4�has_ns_importsr�rSr<rur[r�r9rvr}r�rJrAr?�reprr�)	r'rfrr��visr��
callable_namer�r[s	`      @@r!r�z&_GenerateRenderMethod.write_namespacesgs���������5��9��0�9���		
�	
�����H�I��%�%�'�J	)�D��4�?�?�*�/3��
�
�,��L�L�%�%�d�k�k�2��4�:�:�����&�&�'>�?���"�m�m�7�7�>�>�t�D��"���5�5�"#�n�����*�A��$�$�S�)�*����&�&�}�����8H�'I�J����&�&�t�,�#��� 2�
� &�
���/�/�/����&�&��	�	��.�.�2�2�6�6�B�%��
��T�3�3�3����&�&��	�	�%��.�.�2�2�8�V�D��
����&�&��y�y�-�1���D�O�O�'�'�
�w�?�@����&�&�'@�D�I�I�'N�O��L�L�"�"�9�D����O�K�
�
�L�L�%�%�a�(�UJ	)�V�:���L�L�"�"�6�*������t�$r#Nc�l�|jD�cic]}|j|��}}t�}|j|j�}|j|j
j
�D�cgc]}|j��c}�}|j|j�}|j|j�}|jjrd|v}|jd�nd}|�|j|�}|r�t|jdd�r�|jj!d�d|j_|jj$j'�D]W\}}	d|	j(vs�|jj!d|�d	t+j,d
|	j(d��d���Y|r|jj!d�|D�]�}||vr}||}
|
j.r4|
j0s|j3|
|��8|j5|
|d�
��M|
j7�r|j3|
|��p|j5|
|d�
���||jj$vr"|jj!|�d|�d����t|jdd�rr|jj8r6|jj;|�d|�d�d|zd|�d|�d�dd|zdd���"|jj!|�d|�d|�d����H|jj8r*|jj;d|�d|�d�dd|zd����|jj!|�d|�d�����|jj!d�ycc}wcc}w)awrite variable declarations at the top of a function.

        the variable declarations are in the form of callable
        definitions for defs and/or name lookup within the
        function's context argument. the names declared are based
        on the names that are referenced in the function body,
        which don't otherwise have any explicit assignment
        operation. names that are assigned within the body are
        assumed to be locally-scoped variables and are not
        separately declared.

        for def callable definitions, if the def is a top-level
        callable then a 'stub' callable is generated which wraps
        the current Context into a closure. if the def is not
        top-level, it is fully rendered as a local closure.

        r
FNr�z_import_ns = {}Tr�z_mako_get_namespace(context, z)._populate(_import_ns, z\s*,\s*r�z%loop = __M_loop = runtime.LoopStack()r�z  = _mako_get_namespace(context, z = _import_ns.get(z, UNDEFINED)zif %s is UNDEFINED:r�z = context[�]r�z&raise NameError("'%s' is not defined")z, context.get(z
, UNDEFINED))z = context.get(z__M_writer = context.writer())rLr:rwrx�
undeclared�closuredefsr��
differencer��locally_declaredr4r�discard�intersection�getattrr r|�has_importsrf�itemsr@�re�splitrBrC�write_def_declr��is_rootrrT)r'r[r��limit�c�comp_idents�to_write�has_loop�ident�ns�comps           r!r�z-_GenerateRenderMethod.write_variable_declares�s@��(/:�.>�.>�?��q�z�z�1�}�?��?��5���>�>�+�"8�"8�9���>�>�!,�!8�!8�!?�!?�!A�B�A�Q�Z�Z�B�
���&�&�{�'D�'D�E���&�&�{�'C�'C�D���=�=�$�$���)�H����V�$��H����,�,�U�3�H����
�
�/?��G��L�L�"�"�#4�5�(,�D�M�M�%�!�]�]�5�5�;�;�=�	
�	��r��r�}�}�,��L�L�*�*�"��H�H�Z����x�1H�I�	��	
���L�L�"�"�#J�K��2	�E���#�"�5�)���=�=��,�,��+�+�D�+�>��-�-�d�K��-�M��|�|�~��+�+�D�+�>��-�-�d�K��-�M��$�-�-�2�2�2����&�&�?D�e�L���4�=�=�*:�E�B��}�}�5�5����/�/�$�e�-�1�E�9�"�27��?�.�F��N� � �
����.�.� %�e�U�4���}�}�5�5����/�/�"�27��?�.�F��N� �����.�.�AF��N��a2	�h	
�����>�?��Q@��
Cs�N,�1N1c�D�|j}|j�}|jd��}|jsWt|jj
�dkDs"t|jj�dkDr|jdd�n|jdd�|jjd|�ddj|��d	��|jjd
|�ddj|��d��|jjd�y)
z>write a locally-available callable referencing a top-level defT��as_callrzcontext._locals(__M_locals)rr�r�r�r�zreturn render_r�N)r:r;r9r<r[r�r��insertr r|r})r'rr[r:�	namedecls�nameargss      r!r�z$_GenerateRenderMethod.write_def_declBs����=�=���1�1�3�	��0�0��0�>���{�{��� � �1�1�2�Q�6��4�#�#�5�5�6��:��O�O�A�<�=��O�O�A�y�)�������#�(�(�9�:M�N�O������&.�����0B�C�	
�	
�����t�$r#c	���|j�}|j}|r|jjd|z�|jjd|j�ddj|��d��t
|jj�dkD}t|jjdd��}t|jjd	d��}|jjd
d�|s|s|r|jjd�|j||�
�}|j|�|jj!|�|j"D]}	|	j%|��|jj'�|j)||||�|jjd�|r#|j+||j|d|dd��yy)z?write a locally-available def callable inside an enclosing def.z&@runtime._decorate_inline(context, %s)r�r�r�r�rr/r0r1r�r�r�r�NFT)�inliner�)r;r�r r|r:r}r<r=r>r?r@rArTr�r�r5r`rurv�popr�r�)
r'rr[r�r�r�rKr/r1r�s
          r!r�z&_GenerateRenderMethod.write_inline_defUs����1�1�3�	��N�N�	���L�L�"�"�8�9�D�
�	
�����!�]�]�C�H�H�Y�,?�@�	
��t�'�'�,�,�-��1������+�+�J��@�A���d�o�o�)�)�(�G�<�=�������=��	
�
�x�6��L�L�#�#�$<�=�!�(�(��f�(�=���$�$�[�1����$�$�[�1����	#�A�
���T�"�	#����!�!�#����d�H�h��?������t�$���&�&���
�
������
'�
�r#c��|s>|s<|s:|jjd�|r|jjddd�|s|s|�r|s|r|jjdd�n|jjdd�|r|jjd�d}|r'|j|jj
|d�}|jjd�|r)|s'|j|jj|d�}|s|r|jjd	|z�y|jjd
|zd�yy)aJwrite the end section of a rendering function, either outermost or
        inline.

        this takes into account if the rendering function was filtered,
        buffered, etc.  and closes the corresponding try: block if any, and
        writes code to retrieve captured content, apply filters, send proper
        return value.�	return ''�finally:z!context.caller_stack._pop_frame()Nz__M_buf = context._pop_buffer()�6__M_buf, __M_writer = context._pop_buffer_and_writer()�__M_buf.getvalue()Fz	return %s�__M_writer(%s))r r|rT�create_filter_callabler=r>r4r)r'rr/rKr1�	callstackras       r!r�z&_GenerateRenderMethod.write_def_finish�s5����x��L�L�"�"�;�/�����'�'�� C�T���x�6��6�
���'�'�� A�����'�'��L��
����&�&�'J�K�$�A���/�/��$�$�)�)�1�e���
�L�L�"�"�4�(����/�/��M�M�0�0�!�U����6����&�&�{�Q��7����'�'�(8�1�(<�k�J�?$*r#c�����jjd|�d|����jjdt	|��}i}	�j
j�8|	j�fd��j
jjD��|	j�fd��jD��d|	vrtt|	d��|	d<�jjd|�d	d
j|��d��|D�
cgc]#}
d|
vrd
|
jd�dfdzzn|
��%}}
�j||�j���|r�d|�d|�d	d
j|��ddj|	j�D��
cgc]
\}}
|�d|
�d���c}
}��d|�d�}�j�j
j |d�}�jj#d|zd�y�jj#d|�d|�d	d
j|��ddj|	j�D��
cgc]
\}}
|�d|
�d���c}
}��d|�d�dd�ycc}
wcc}
}wcc}
}w)zhwrite a post-function decorator to replace a rendering
        callable with a cached version of itself.�__M_z = �	cache_keyNc3��K�|]B}|jd�r/|dk7r*|dd�jjj|f���Dy�w��cache_r��N)�
startswithr4rEr�)�.0�par's  �r!�	<genexpr>z>_GenerateRenderMethod.write_cache_decorator.<locals>.<genexpr>�sL��������=�=��*�r�[�/@��A�B�����.�.�@�@��D�E��s�AAc3�r�K�|].}|jd�r|dk7r|dd�j|f���0y�wr�)rr�)rr�node_or_pagetags  �r!rz>_GenerateRenderMethod.write_cache_decorator.<locals>.<genexpr>�sB�����
���}�}�X�&�2��+<����V�_�6�6�r�:�;�
�s�47�timeoutr�r�r�r�r�z%s=%srrt)r�r�z.context.get('local').cache._ctx_get_or_create(z
, lambda:__M_z
),  context, rproz__M_defname=r�Fzreturn z9__M_writer(context.get('local').cache._ctx_get_or_create(z), context, z))r�)r r|r�rAr�r4rEr��intr?r}r�r��undeclared_identifiersr�r�rrT)r'rrJr>r/r[r�r��cachekey�
cache_argsrM�	pass_args�k�vras``             r!r�z+_GenerateRenderMethod.write_cache_decorator�sQ���	
������d�;�<�"�4�4�8�8���d��
���
��=�=� � �,������-�-�/�/�A�A��
�
	���
�%�7�7�
�	
�
�
�"�$'��Z�	�-B�(C�$D�J�y�!�������c�h�h�t�n�E�F�LP�
�FG�#��(�G������Q��)�A�-�.��A�
�	�
�	
�$�$���!�8�8�:�	%�	
�
����H�H�Y�'��G�G�8B�8H�8H�8J�K���1�a��+�K����
��+�+��
�
�,�,�a���A�
�L�L�#�#�I��M�4�8��L�L�#�#�
���H�H�Y�'��G�G�8B�8H�8H�8J�K���1�a��+�K������
��=
��&L��(Ls�(I/�I4�I:c��d�}d|vrx|rv|jjr-|jjjj|z}|jjrd|vr|jj|z}|D]W}|dk(r�	tjd|�}|r#|jdd�\}}||�}	|	|z}n||�}|�J�|�d|�d�}�Y|S)z�write a filter-applying expression based on the filters
        present in the given filter names, adjusting for the global
        'default' filter aliases as needed.c�x�tjd|�rd|zStjj	||�S)Nz
decode\..+zfilters.)r��matchr�DEFAULT_ESCAPESrAres r!�
locate_encodezC_GenerateRenderMethod.create_filter_callable.<locals>.locate_encodes4���x�x�
�t�,�!�D�(�(��.�.�2�2�4��>�>r#r�z
(.+?)(\(.*\))r�rtr�r�)r4rEr=r>rr�r�group)
r'r>�target�
is_expressionr�e�mr��fargsr�s
          r!r�z,_GenerateRenderMethod.create_filter_callable	s���
	?��d�?���=�=�(�(��=�=�0�0�<�<�A�A�D�H�D��=�=�0�0�S��_��=�=�8�8�4�?�D��	,�A��C�x�����)�1�-�A�� �w�w�q�!�}���u�!�%�(����I��!�!�$���}�$�}�!"�F�+�F�	,��
r#c�>�|jj|j�t|j�sh|j
j�3t|j
jjj�st|j
j�rS|j|jjd|jzd�}|jjd|z�y|jjd|jz�y)Nz%sTr�)r r�rSr<�escapesr4rEr=r>rr��escapes_coder�r|)r'rras   r!�visitExpressionz%_GenerateRenderMethod.visitExpression)s������!�!�$�+�+�.�������
�
�%�%�1���
�
�-�-�9�9�>�>�?��4�=�=�0�0�1��+�+��!�!�&�&��t�y�y�(8�$��A�
�L�L�"�"�#3�a�#7�8��L�L�"�"�#3�d�i�i�#?�@r#c�����jrz|jjd��jrR|jjd�|jjd�|jjd�yy|jj	�j
�|jjr&�jdk(rt�|j�}n�j}|jj|��j�}|r&td�|D��r1t�fd�|D��r|jjd�yyy)Nr�zloop = __M_loop._exit()�forc3�pK�|].}t|tjtjf����0y�wr&)r6r�Comment�ControlLine)rr�s  r!rz9_GenerateRenderMethod.visitControlLine.<locals>.<genexpr>Os0�������q�9�#4�#4�i�6K�6K�"L�M��s�46c3��K�|]G}t|tj�r+�j|j�xs|j
���Iy�wr&)r6rr"�
is_ternary�keyword�isend)rr�rs  �r!rz9_GenerateRenderMethod.visitControlLine.<locals>.<genexpr>SsB�������!�!�Y�%:�%:�;��_�_�Q�Y�Y�/�:�1�7�7�:��s�A
Ar�)
r&r r|�has_loop_contextr�rSr4rr%�mangle_mako_loopr��get_children�all)r'rr��childrens `  r!�visitControlLinez&_GenerateRenderMethod.visitControlLine:s����:�:��L�L�"�"�4�(��$�$����&�&�z�2����&�&�'@�A����&�&�t�,�%�

�L�L�%�%�d�k�k�2��}�}�(�(�T�\�\�U�-B�'��d�l�l�;���y�y���L�L�"�"�4�(��(�(�*�H����%�����%������&�&�v�.�
�	r#c��|jj|j�|jjdt	|j
�z�y)Nr�)r r�rSr|r��contentr�s  r!�	visitTextz_GenerateRenderMethod.visitText[s9�����!�!�$�+�+�.������/�$�t�|�|�2D�D�Er#c
�Z�t|jj�dkD}|r|jj	dd�|j
D]}|j
|��|rG|jj	ddd|j|jjdd�zd�yy)	Nrz#__M_writer = context._push_writer()r�r�r�r�r�F)r<r=r>r rTrurvr�)r'rrKr�s    r!�visitTextTagz"_GenerateRenderMethod.visitTextTag_s����t�'�'�,�,�-��1����L�L�#�#�5�v�
����	#�A�
���T�"�	#���L�L�#�#��H� ��-�-��$�$�)�)�+?�����
�r#c���|js�|jj|j|j��|j
s�t
|jj�dkDrn|jjd�|jjddj|j�D�cgc]
}t|���c}�z�yyyycc}w)Nr�rz0__M_locals_builtin_stored = __M_locals_builtin()z�__M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in [%s] if __M_key in __M_locals_builtin_stored]))r�)
rkr r�r�rSr9r<r[r�r|r}ryr�)r'rr�s   r!rmz_GenerateRenderMethod.visitCoders����}�}��L�L�-�-��	�	�4�;�;�
.�
��;�;�3�t�'7�'7�'H�'H�#I�A�#M�
���&�&�F�����&�&�G��h�h��1J�1J�1L�M�A��Q��M�N�O��$N�;���" Ns�:Cc�>�|jj|j�|jj	d�}|r0|jjd|jd�d|�d��y|jjd|jdz�y)Nr>zruntime._include_file(context, r�z, _template_uri, r�z1runtime._include_file(context, %s, _template_uri))r r�rSr@rAr|r�)r'rr>s   r!�visitIncludeTagz%_GenerateRenderMethod.visitIncludeTag�s������!�!�$�+�+�.����"�"�6�*����L�L�"�"��)�)�&�1�4�9�
�

�L�L�"�"�C��)�)�&�1�3�
r#c��yr&r,r�s  r!rgz'_GenerateRenderMethod.visitNamespaceTag����r#c��yr&r,r�s  r!r�z!_GenerateRenderMethod.visitDefTag�r6r#c��|jr)|jjd|jz�y|j	d��}|dgz
}|jjd|jz�|jjd|j�ddj|��d	��|jjd
�y)Nz%s()Tr�r2zOif 'parent' not in context._data or not hasattr(context._data['parent'], '%s'):zcontext['self'].r�r�r�rq)rCr r|r:r;r})r'rr�s   r!r�z#_GenerateRenderMethod.visitBlockTag�s�������L�L�"�"�6�D�M�M�#9�:��4�4�T�4�B�H����&�H��L�L�"�"�>�@D�
�
�N�
�
�L�L�"�"�,0�M�M�3�8�8�H�;M�N�
�
�L�L�"�"�4�(r#c�&�|j|�yr&��visitCallTagr�s  r!�visitCallNamespaceTagz+_GenerateRenderMethod.visitCallNamespaceTag�s��	
���$�r#c������	��jjd�dg�	�jj|d����j|d����j	d��j
j
��G���	�fd�d�}|�}|jD]}|j|���j
j�|jj�}�jjd	d
j|�z�d}|r�jjdd��j���j
j
��|jD]}|j����j
j��j||ddd�
��jjddd
j�	�zd��jjdd��jj!|j"��jjd�j%g|j&d�zddd�y)Nzdef ccall(caller):�bodyTr�F�callerc�*��eZdZd�Zd�Z����fd�Zy)�6_GenerateRenderMethod.visitCallTag.<locals>.DefVisitorc�&�|j|�yr&r�r�s  r!r�zB_GenerateRenderMethod.visitCallTag.<locals>.DefVisitor.visitDefTag����� � ��&r#c�&�|j|�yr&r�r�s  r!r�zD_GenerateRenderMethod.visitCallTag.<locals>.DefVisitor.visitBlockTag�rCr#c�����j|�d��|js�j|j�|j�jvr�j|j=yy)NFr�)r�rCr`r:r�)rar�body_identifiers�callable_identifiersr�r's  ����r!r�zE_GenerateRenderMethod.visitCallTag.<locals>.DefVisitor.visitDefOrBase�s_����%�%�d�,@��%�O��(�(��M�M�$�-�-�0��=�=�$4�$@�$@�@�(�4�4�T�]�]�C�Ar#Nr�)rFrGr�r's����r!�
DefVisitorrA�s���
'�
'�
D�
Dr#rHz
def body(%s):r�r�r�)r�r�zccontext.caller_stack.nextcaller = runtime.Namespace('caller', context, callables=ccall(__M_caller))r�r�z&context.caller_stack.nextcaller = None)r r|r[r��add_declaredr5r`rurvr�rFr;r}rTr�r�r�rSr��
expression)
r'rrHr�r��bodyargsr/rFrGr�s
`      @@@r!r;z"_GenerateRenderMethod.visitCallTag�s��������3�4����#�/�/�6�6�t�D�6�I��/�6�6�t�E�6�J��
	�%�%�h�/����$�$�%5�6�	D�	D� �l�����	"�A�
���S�!�	"����!�!�#��>�>�:�:�<�����������(�1C�C�D�����L�L�#�#�$<�f�E��$�$�%5�6����$�$�%5�6����	#�A�
���T�"�	#����!�!�#����d�H�e�U�e��L�������m�s�x�x��7G�&H�$�O������
+�
�	
�	
���!�!�$�+�+�.��������)�)�"�d�o�o�t�D�
E��4��	
r#)FN)T)FF)r)r*r+�__doc__r(rI�propertyr[rDrHr�r�r�r�r�r�r�r�r�rr,r/r1rmr4rgr�r�r<r;r,r#r!rrcs����
/)�b
�"�)��)�k<�Z7�rP�	
�[%�z|@�|%�&,�^;?�1K�t��Q�f�@A�"/�BF��&�*�
�
�
)� �B
r#rc��eZdZdZdd�Zd�Zed��Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)rzzCtracks the status of identifier names as template code is rendered.Nc�@�|�� t|tj�r*t�|_tj�|_�nt|j�j|jj�D�cgc]}|j��c}�j|j�j|j�|_|r*|jj|j�|_tjdi|j��|_n(t�|_tj�|_||_t�|_t�|_t�|_t�|_
tj�|_	||_|�|j%|�|jj&j)|j�}|r't+j,ddj/|�z��ycc}w)Nz'Reserved words declared in template: %sror,)r6r�NamespaceTagrwr{r�SetLikeDictr�rxr�r�rJr�r�r�r4r�rrvrr�r�NameConflictErrorr})r'r4r�parentr�r��
illegal_namess       r!r(z_Identifiers.__init__�s������$�	� 6� 6�7� #���
�$(�$4�$4�$6��!�
����(��U�F�,>�,>�,E�,E�,G�H�q�A�F�F�H�I��U�6�2�2�3��U�6�3�3�4�	�
��$(�M�M�$7�$7��8I�8I�$J�D�M�%)�$4�$4�$K�v�7J�7J�$K��!��E�D�M� $� 0� 0� 2�D�� ��
��%���
!$����
!$����"%���� �+�+�-�����	�������%��
�
�4�4�A�A��!�!�
�
���.�.�9��)�)�M�*�+��
���cIs�Hc�2�t|j||fi|��S)zUcreate a new Identifiers for a new Node, with
        this Identifiers as the parent.)rzr4)r'rrGs   r!r�z_Identifiers.branch<s���D�M�M�4��@��@�@r#c�z�t|jj|j�j	��Sr&)rwr�rxr�r�rZs r!rLz_Identifiers.defsBs-���4�$�$�*�*�4�+;�+;�<�C�C�E�F�Fr#c
��dt|j��dt|j��dt|j��d|jj�D�cgc]}|j��c}�d|jj�D�cgc]}|j��c}�d|j�d�
Scc}wcc}w)NzIdentifiers(declared=z, locally_declared=z
, undeclared=z, topleveldefs=z, closuredefs=z, argumentdeclared=r�)	r�r{r�r�r�r�rJr�r�)r'r�s  r!�__repr__z_Identifiers.__repr__Fs����T�]�]�#��T�*�*�+��T�_�_�%�!%�!2�!2�!9�!9�!;�<�A����<�!%�!1�!1�!8�!8�!:�;�A����;��&�&�

�	
��=��;s� B9�B>c� �|j�D]K}|dk7s�	||jj|j�vs�1|jj|��M|j
�D]}|jj|��y)zlupdate the state of this Identifiers with the undeclared
        and declared identifiers of the given node.rN)r	r{rxr�r�r�ry�r'rr�s   r!�check_declaredz_Identifiers.check_declaredUs����0�0�2�	+�E��	�!�e�4�=�=�3F�3F��%�%�4�'����#�#�E�*�		+�
�.�.�0�	-�E��!�!�%�%�e�,�	-r#c��|jj|�||jvr|jj|�yyr&)r{r�r��remove)r'r�s  r!rIz_Identifiers.add_declaredas7���
�
���%� ��D�O�O�#��O�O�"�"�5�)�$r#c�&�|j|�yr&�r[r�s  r!rz_Identifiers.visitExpressionf������D�!r#c�&�|j|�yr&r_r�s  r!r,z_Identifiers.visitControlLineir`r#c��|js@|j|�|jj|j	��|_yyr&)rkr[r�rxryr�s  r!rmz_Identifiers.visitCodelsA���}�}�����%�$(�$9�$9�$?�$?��)�)�+�%�D�!�r#c�f�|j|ur#|jD]}|j|��yyr&)rrurv�r'rr�s   r!rgz_Identifiers.visitNamespaceTagss6���9�9����Z�Z�
'��� � ��&�
'�r#c���|j|j�}|||j<|�K||urF|js|jr-tjd|jzfi|j
���yyy)Nz<%%def or %%block named '%s' already exists in this template.)rAr:rBrr�r�)r'�
collectionr�existings    r!�_check_name_existsz_Identifiers._check_name_exists{s����>�>�$�-�-�0��$(�
�4�=�=�!�� ���$����(�"3�"3��-�-�+�-1�]�]�;���'�'��
�#4�%�
!r#c�H�|j�r)|js|j|j|�n*||jur|j|j
|�|j
�D]K}|dk7s�	||jj|j�vs�1|jj|��M||jurS|j�D]}|jj|��|jD]}|j|��yy�Nr)r�rCrhr�rr�r	r{rxr�r�r�ryr�rurv�r'rr�r�s    r!r�z_Identifiers.visitDefTag�s���<�<�>�$�"3�"3��#�#�D�$5�$5�t�<�
����
"��#�#�D�$4�$4�d�;��0�0�2�	+�E��	�!�e�4�=�=�3F�3F��%�%�4�'����#�#�E�*�		+��4�9�9���2�2�4�
2���&�&�*�*�5�1�
2��Z�Z�
'��� � ��&�
'�	r#c��||jur�|js�t|jtj�rEtjd|j�d|jj�d�fi|j���t|jtjtjf�r.tjd|j�d�fi|j���|j�D]K}|dk7s�	||jj|j�vs�1|jj!|��M|jsB|j#|j$|�|jj!|j&�n*||jur|j#|j(|�|j+�D]}|j,j!|��|j.D]}|j1|��y)Nz
Named block 'z' not allowed inside of def '�'z#' not allowed inside of <%call> tagr)rrCr6rr7rr�rJr��CallTag�CallNamespaceTagr	r{rxr�r�r�rhr�r:r�ryr�rurvrks    r!r�z_Identifiers.visitBlockTag�s����t�y�y� ��):�):��$�)�)�Y�%5�%5�6� �1�1��y�y�$�)�)�.�.�2���+�+���
��	�	�I�-�-�y�/I�/I�J��!�1�1��y�y�#���+�+����0�0�2�	+�E��	�!�e�4�=�=�3F�3F��%�%�4�'����#�#�E�*�		+�� � ��#�#�D�$5�$5�t�<��O�O����
�
�.�
����
"��#�#�D�$4�$4�d�;��.�.�0�	.�E��"�"�&�&�u�-�	.����	#�A�
���T�"�	#r#c��|j�D]K}|dk7s�	||jj|j�vs�1|jj|��Myrj)r	r{rxr�r�r�rZs   r!r1z_Identifiers.visitTextTag�sW���0�0�2�	+�E��	�!�e�4�=�=�3F�3F��%�%�4�'����#�#�E�*�		+r#c�&�|j|�yr&r_r�s  r!r4z_Identifiers.visitIncludeTag�r`r#c��|j�D]}|jj|��|j|�yr&)ryr�r�r[rZs   r!riz_Identifiers.visitPageTag�s<���.�.�0�	.�E��"�"�&�&�u�-�	.����D�!r#c�&�|j|�yr&r:r�s  r!r<z"_Identifiers.visitCallNamespaceTag�s�����$�r#c�>�||jur�|j�D]K}|dk7s�	||jj|j�vs�1|j
j
|��M|j�D]}|jj
|��|jD]}|j|��y|j�D]K}|dk7s�	||jj|j�vs�1|j
j
|��Myrj)rr	r{rxr�r�r�ryr�rurvrks    r!r;z_Identifiers.visitCallTag�s	���4�9�9���4�4�6�
/���I�%�%�t�}�}�7J�7J��)�)�8�+��O�O�'�'��.�	
/�
�2�2�4�
2���&�&�*�*�5�1�
2��Z�Z�
'��� � ��&�
'��4�4�6�
/���I�%�%�t�}�}�7J�7J��)�)�8�+��O�O�'�'��.�	
/r#)NNF)r)r*r+rLr(r�rMrLrXr[rIrr,rmrgrhr�r�r1r4rir<r;r,r#r!rzrz�st��M�A�FA��G��G�

�
-�*�
"�"��'��'�(#�B+�"�"�
 �/r#rzz�^for\s+((?:\(?)\s*(?:\(?)\s*[A-Za-z_][A-Za-z_0-9]*(?:\s*,\s*(?:[A-Za-z_][A-Za-z_0-9]*),??)*\s*(?:\)?)(?:\s*,\s*(?:(?:\(?)\s*[A-Za-z_][A-Za-z_0-9]*(?:\s*,\s*(?:[A-Za-z_][A-Za-z_0-9]*),??)*\s*(?:\)?)),??)*\s*(?:\)?))\s+in\s+(.*):c�z�t�}|j|�|jr�d|jd_t
j
|j�}|r:|jd|jd�zd�d|jd�z}|Std|jz��|j}|S)	z�converts a for loop into a context manager wrapped around a for loop
    when access to the `loop` variable has been detected in the for loop body
    TrYzloop = __M_loop._enter(%s)rtr�zfor %s in loop:r�zCouldn't apply loop context: %s)�LoopVariablerv�detectedrur'�	_FOR_LOOPrr�rTr�SyntaxError)rr �
loop_variablerr�s     r!r(r(�s���!�N�M����
�&����*.��
�
�2��'�����	�	�*������,�u�{�{�1�~�=��
�
%�u�{�{�1�~�5�D�
�K��?�$�)�)�K�L�L��y�y���Kr#c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)rvzQA node visitor which looks for the name 'loop' within undeclared
    identifiers.c��d|_y)NF)rwrZs r!r(zLoopVariable.__init__
s	����
r#c��d|j�vrd|_y|j�D]}|j|��y)Nr
T)r	rwr)rvrds   r!�_loop_reference_detectedz%LoopVariable._loop_reference_detected
s@���T�0�0�2�2� �D�M��&�&�(�
'��� � ��&�
'r#c�&�|j|�yr&�r~r�s  r!r,zLoopVariable.visitControlLine����%�%�d�+r#c�&�|j|�yr&r�r�s  r!rmzLoopVariable.visitCoder�r#c�&�|j|�yr&r�r�s  r!rzLoopVariable.visitExpressionr�r#N)	r)r*r+rLr(r~r,rmrr,r#r!rvrvs ����'�,�,�,r#rv)rLrUr�r�makorrrrr�
mako.pygenrr~r�rx�RESERVED_NAMES�	frozensetr"rrrzrxr(rvr,r#r!�<module>r�s�����	�������$���
!�"2�3���V�$�*�*�+<�=������������;�%�P-�-�8O
�O
�dk/�k/�\
�B�J�J�&�
�	��.,�,r#

Zerion Mini Shell 1.0