%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__/parsetree.cpython-312.pyc

�

���e?J����dZddlZddlmZddlmZddlmZddlmZGd�d�ZGd	�d
e�ZGd�de�Z	Gd
�de�Z
Gd�de�ZGd�de�ZGd�de�Z
Gd�de�ZGd�dee��ZGd�de�ZGd�de�ZGd�de�ZGd �d!e�ZGd"�d#e�ZGd$�d%e�ZGd&�d'e�ZGd(�d)e�ZGd*�d+e�Zy),z5defines the parse tree components for Mako templates.�N)�ast)�
exceptions)�filters)�utilc�2�eZdZdZd�Zed��Zd�Zd�Zy)�Nodez(base class for a Node in the parse tree.c�<�||_||_||_||_y�N��source�lineno�pos�filename)�selfrr
rrs     �0/usr/lib/python3/dist-packages/mako/parsetree.py�__init__z
Node.__init__s����������� ��
�c�`�|j|j|j|jd�S)Nrr�rs r�exception_kwargszNode.exception_kwargss*���k�k��k�k��8�8��
�
�	
�	
rc��gSr
�rs r�get_childrenzNode.get_children$����	rc�h���fd�}t�d|jjz|�}||�y)Nc�R��|j�D]}|j���yr
)r�accept_visitor)�node�n�visitors  �r�traversez%Node.accept_visitor.<locals>.traverse(s)����&�&�(�
*��� � ��)�
*r�visit)�getattr�	__class__�__name__)rr r!�methods `  rrzNode.accept_visitor's.���	*���'�D�N�N�,C�,C�"C�X�N���t�rN)	r%�
__module__�__qualname__�__doc__r�propertyrrrrrrrrs(��2�!��
��
��rrc�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�TemplateNodez?a 'container' node that stores the overall collection of nodes.c�F��t�|�ddd|�g|_i|_y)N�r)�superr�nodes�page_attributes)rrr$s  �rrzTemplateNode.__init__4s%���
����Q��8�,���
�!��rc��|jSr
�r0rs rrzTemplateNode.get_children9����z�z�rc�b�dtj|j��d|j�d�S)Nz
TemplateNode(�, �))r�sorted_dict_reprr1r0rs r�__repr__zTemplateNode.__repr__<s'���!�!�$�"6�"6�7��J�J�
�	
r)r%r'r(r)rrr9�
__classcell__�r$s@rr,r,0s���I�"�
�
rr,c�D��eZdZdZdZ�fd�Zd�Zd�Zd�Zd�Z	d�Z
�xZS)	�ControlLinez�defines a control line, a line-oriented python line or end tag.

    e.g.::

        % if foo:
            (markup)
        % endif

    Fc�(��t�|�di|��||_||_||_|dv|_g|_|jrg|_g|_ytj|fi|j��}|j|_|j|_y)N)�for�if�while�try�withr)r/r�text�keyword�isend�
is_primaryr0�_declared_identifiers�_undeclared_identifiersr�PythonFragmentr�declared_identifiers�undeclared_identifiers)rrErFrD�kwargs�coder$s      �rrzControlLine.__init__Qs����
���"�6�"���	������
�!�%J�J�����
��:�:�)+�D�&�+-�D�(��%�%�d�D�d�.C�.C�D�D�)-�)B�)B�D�&�+/�+F�+F�D�(rc��|jSr
r3rs rrzControlLine.get_children`r4rc��|jSr
)rHrs rrKz ControlLine.declared_identifierscs���)�)�)rc��|jSr
)rIrs rrLz"ControlLine.undeclared_identifiersfs���+�+�+rc�d�ddhddhdhd�}||j|jt��vS)zRreturn true if the given keyword is a ternary keyword
        for this ControlLine�else�elif�except�finally)r@rBr?)�getrE�set)rrE�casess   r�
is_ternaryzControlLine.is_ternaryis>��
�6�"��i�(��8�
���%�)�)�D�L�L�#�%�8�8�8rc	��d|j�d|j�d|j�d|j|jf�d�	S)NzControlLine(r6r7)rErDrFr
rrs rr9zControlLine.__repr__us1���L�L��I�I��J�J�
�[�[�$�(�(�#�	
�	
r)r%r'r(r)�has_loop_contextrrrKrLrZr9r:r;s@rr=r=Cs/������
G��*�,�
9�
rr=c�(��eZdZdZ�fd�Zd�Z�xZS)�Textz#defines plain text in the template.c�2��t�|�di|��||_y�Nr)r/r�content)rrarMr$s   �rrz
Text.__init__�s���
���"�6�"���rc�T�d|j�d|j|jf�d�S)NzText(r6r7)rar
rrs rr9z
Text.__repr__�s��!%������T�X�X�/F�G�Gr�r%r'r(r)rr9r:r;s@rr^r^~s���-��Hrr^c�4��eZdZdZ�fd�Zd�Zd�Zd�Z�xZS)�Codez�defines a Python code block, either inline or module level.

    e.g.::

        inline:
        <%
            x = 12
        %>

        module level:
        <%!
            import logger
        %>

    c���t�|�di|��||_||_t	j
|fi|j��|_yr`)r/rrD�ismoduler�
PythonCoderrN)rrDrgrMr$s    �rrz
Code.__init__�s<���
���"�6�"���	� ��
��N�N�4�A�4�+@�+@�A��	rc�.�|jjSr
)rNrKrs rrKzCode.declared_identifiers�s���y�y�-�-�-rc�.�|jjSr
)rNrLrs rrLzCode.undeclared_identifiers�s���y�y�/�/�/rc�n�d|j�d|j�d|j|jf�d�S)NzCode(r6r7)rDrgr
rrs rr9z
Code.__repr__�s*���I�I��M�M�
�[�[�$�(�(�#�
�	
r�	r%r'r(r)rrKrLr9r:r;s@rrere�s���� B�.�0�
rrec�(��eZdZdZ�fd�Zd�Z�xZS)�Commentz6defines a comment line.

    # this is a comment

    c�2��t�|�di|��||_yr`)r/rrD)rrDrMr$s   �rrzComment.__init__�s���
���"�6�"���	rc�T�d|j�d|j|jf�d�S)NzComment(r6r7)rDr
rrs rr9zComment.__repr__�s��$(�I�I����T�X�X�/F�G�Grrcr;s@rrnrn�s�����Hrrnc�4��eZdZdZ�fd�Zd�Zd�Zd�Z�xZS)�
Expressionz/defines an inline expression.

    ${x+y}

    c����t�|�di|��||_||_t	j
|fi|j��|_t	j|fi|j��|_	yr`)
r/rrD�escapesr�ArgumentListr�escapes_coderhrN)rrDrtrMr$s    �rrzExpression.__init__�sZ���
���"�6�"���	�����,�,�W�N��8M�8M�N����N�N�4�A�4�+@�+@�A��	rc��gSr
rrs rrKzExpression.declared_identifiers�rrc���|jjj|jjj	t
j��j	|jj�Sr
)rNrL�unionrv�
differencer�DEFAULT_ESCAPESrKrs rrLz!Expression.undeclared_identifiers�sX���y�y�/�/�5�5����4�4�?�?��'�'�
�
��*�T�Y�Y�3�3�
4�		5rc��d|j�d|jj�d|j|jf�d�S)NzExpression(r6r7)rDrv�argsr
rrs rr9zExpression.__repr__�s2���I�I����"�"�
�[�[�$�(�(�#�
�	
rrlr;s@rrrrr�s����B��5�
rrrc�,��eZdZdZiZ�fd�Zd�Z�xZS)�_TagMetazImetaclass to allow Tag to produce a subclass according to
    its keywordc�t��t|dd��||j|j<t�|�|||�y)N�__keyword__)r#�	_classmapr�r/r)�cls�clsname�bases�dict_r$s    �rrz_TagMeta.__init__�s5����3�
�t�,�8�-0�C�M�M�#�/�/�*�
����%��/rc	�0�d|vr1|jd�\}}tjt|||fi|��S	tj
|}tj|||fi|��S#t$r*tjd|z|d|d|d|d���wxYw)N�:zNo such tag: '%s'rr
rrr)	�split�type�__call__�CallNamespaceTagrr��KeyErrorr�CompileException)r�rE�
attributesrM�ns�defnames      rr�z_TagMeta.__call__�s����'�>�!�-�-��,�K�B���=�=� �"�g�z��=C��
�		��$�$�W�-�C��}�}�S�'�:�@��@�@���	��-�-�#�g�-��h�'��h�'��5�M��
�+��
�	�s�A"�"3B)r%r'r(r)r�rr�r:r;s@rrr�s�����I�0�
Arrc�J��eZdZdZdZ�fd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)
�Tagz�abstract base class for tags.

    e.g.::

        <%sometag/>

        <%someothertag>
            stuff
        </%someothertag>

    Nc�N��t�	|�di|��||_||_|j	||�|D�cgc]}||j
vs�|��}}t
|�r9tjddjd�|D��zfi|j���d|_g|_ycc}w)aVconstruct a new Tag instance.

        this constructor not called directly, and is only called
        by subclasses.

        :param keyword: the tag keyword

        :param attributes: raw dictionary of attribute key/value pairs

        :param expressions: a set of identifiers that are legal attributes,
         which can also contain embedded expressions

        :param nonexpressions: a set of identifiers that are legal
         attributes, which cannot contain embedded expressions

        :param \**kwargs:
         other arguments passed to the Node superclass (lineno, pos)

        zMissing attribute(s): %s�,c3�2K�|]}t|����y�wr
)�repr)�.0�ms  r�	<genexpr>zTag.__init__.<locals>.<genexpr>1s����8�1�t�A�w�8�s�Nr)
r/rrEr��_parse_attributes�parsed_attributes�lenrr��joinr�parentr0)
rrEr��expressions�nonexpressions�requiredrM�r�missingr$s
         �rrzTag.__init__s����8	���"�6�"����$������{�N�;�&�J��!�4�3I�3I�*I�1�J��J��w�<��-�-�.��h�h�8��8�8�9��
�'�'��
������
��Ks�B"�	B"c��|jduSr
)r�rs r�is_rootzTag.is_root9s���{�{�d�"�"rc��|jSr
r3rs rrzTag.get_children<r4rc�D�t�}i|_|jD�]�}||v�rBg}tjdtj
�j
|j|�D]�}tjdtj
�j|�}|r|tj|jd�j�fi|j��}|j|j�}|jd|jd�z���|s��|jt!|����dj#|�xst!d�|j|<��K||vr{tj$d|j|�r1t'j(d|�d	|j*�d
�fi|j���t!|j|�|j|<���t'j(d|j*�d|�d
�fi|j���||_y)Nz	(\${.+?})z^\${(.+?)}$�z(%s)z + r.z\${.+?}zAttribute 'z
' in tag 'z%' does not allow embedded expressionszInvalid attribute for tag 'z': '�')rXr�r��re�compile�Sr��matchrrh�group�rstriprryrL�appendr�r��searchrr�rE�!expression_undeclared_identifiers)	rr�r�rL�key�expr�xr�rNs	         rr�zTag._parse_attributes?s���!$���!#����?�?�#	�C��k�!������L�"�$�$�7�=�=��O�O�C�(��-�A��
�
�>�2�4�4�8�>�>�q�A�A��"�~�~��G�G�A�J�-�-�/� �37�3H�3H� ��2H�1M�1M� �7�7�2�.����F�Q�W�W�Q�Z�$7�8�����D��G�,�#-�$/4�j�j��.>�.J�$�r�(��&�&�s�+���&��9�9�Z�����)=�>�$�5�5�),�d�l�l�<���/�/���
/3�4�?�?�3�3G�.H��&�&�s�+� �1�1��|�|�S�*���+�+���?#	�H2H��.rc��gSr
rrs rrKzTag.declared_identifiershrrc��|jSr
)r�rs rrLzTag.undeclared_identifiersks���5�5�5rc
���|jj�d|j�dtj|j
��d|j|jf�d|j�d�
S)N�(r6r7)	r$r%rErr8r�r
rr0rs rr9zTag.__repr__nsI���N�N�#�#��L�L��!�!�$�/�/�2�
�[�[�$�(�(�#��J�J�
�	
r)
r%r'r(r)r�rr�rr�rKrLr9r:r;s@rr�r��s5���
��K�+�Z#��'H�R�6�
rr�)�	metaclassc�2��eZdZdZ�fd�Zd�Z�fd�Z�xZS)�
IncludeTag�includec���t�|�||dddfi|��tjd|j	dd�zfi|j
��|_y)N)�file�importr}r�r�z__DUMMY(%s)r}r.)r/rrrhrWr�	page_args�rrEr�rMr$s    �rrzIncludeTag.__init__{s\���
�����&���	
��
	
�����J�N�N�6�2�6�6�
�:>�:O�:O�
��rc��gSr
rrs rrKzIncludeTag.declared_identifiers�rrc����|jjjdh�j|jj�}|j	t
�|���S)N�__DUMMY)r�rLrzrKryr/)r�identifiersr$s  �rrLz!IncludeTag.undeclared_identifiers�sT����n�n�;�;�F�F�
�K�
�
�*�T�^�^�8�8�
9�	�� � ���!?�!A�B�Br�r%r'r(r�rrKrLr:r;s@rr�r�xs����K�
��C�Crr�c�(��eZdZdZ�fd�Zd�Z�xZS)�NamespaceTag�	namespacec�:��t�|�||dddfi|��|jddtt	t|���z�|_d|vr$d|vr tj	d	i|j���d|vr%d|vr tj	d
i|j���yy)Nr�)�name�inheritabler��modulerr�z	__anon_%sr�r�r�)z?'name' and/or 'import' attributes are required for <%namespace>)z4<%namespace> may only have one of 'file' or 'module')
r/rrW�hex�abs�idr�rr�rr�s    �rrzNamespaceTag.__init__�s����
������7��	
��
	
��N�N�6�;��S��D��]�9K�+K�L��	���#��
�(B��-�-�#���'�'��
�
�Z��H�
�$:��-�-�F���'�'��
�%;�rc��gSr
rrs rrKz!NamespaceTag.declared_identifiers�rr�r%r'r(r�rrKr:r;s@rr�r��s����K��.rr�c�(��eZdZdZ�fd�Zd�Z�xZS)�TextTagrDc���t�|�||dddfi|��tj|j	dd�fi|j
��|_y)Nr�filterr.)r/rrrurWr�filter_argsr�s    �rrzTextTag.__init__�sL���
����*�b�8�b�K�F�K��+�+��N�N�8�R�(�
�,0�,A�,A�
��rc��|jjjtjj��j
|j�Sr
�r�rLrzrr{�keysryr�rs rrLzTextTag.undeclared_identifiers�sC�����6�6�A�A��#�#�(�(�*�
�
�%��6�6�
7�	8r)r%r'r(r�rrLr:r;s@rr�r��s����K�
�8rr�c�L��eZdZdZ�fd�ZdZdZed��Zd�Z	d�Z
d�Z�xZS)�DefTag�defc� ��ddg|D�cgc]}|jd�s�|��c}z}t�|�|||ddfi|��|d}tjd|�r tj	d
i|j���tjd|zd	zfi|j��|_
|jj|_|jd
d�|_tj|jdd�fi|j��|_ycc}w)N�buffered�cached�cache_�r�r��	decorator�r�r��^[\w_]+$zdef z:passr�r.r�)zMissing parenthesis in %def)�
startswithr/rr�r�rr�rr�FunctionDecl�
function_decl�funcnamer�rWr�rur��rrEr�rM�cr�r�r$s       �rrzDefTag.__init__�s ���!�8�,�!�0
��Q�\�\�(�%;�A�0
�
��	������+��	
��
	
��&�!��
�8�8�K��&��-�-�-��15�1F�1F��
�!�-�-��T�M�G�#�
�'+�'<�'<�
����&�&�/�/��	�#����R�8����+�+��N�N�8�R�(�
�,0�,A�,A�
����-0
s
�D�DFc�.�|jjSr
)r�r�rs rr�zDefTag.funcname�s���!�!�*�*�*rc�:�|jjdi|��Sr`)r��get_argument_expressions�r�kws  rr�zDefTag.get_argument_expressions�s��:�t�!�!�:�:�@�R�@�@rc�.�|jjSr
)r��allargnamesrs rrKzDefTag.declared_identifiers�s���!�!�-�-�-rc	���g}|jjD]8}|ttj|fi|j
��j�z
}�:t|�j|jjjtjj���j|j�j|jj�Sr
)r��defaults�listrrhrrLrXryr�rzrr{r�r�r�)r�resr�s   rrLzDefTag.undeclared_identifiers�s������#�#�,�,�	�A��4�������.�.��(�(��
�C�	�
��H�
�U�� � �7�7�B�B��+�+�0�0�2���
�U�4�9�9�
:�
�Z��*�*�6�6�
7�		
r)
r%r'r(r�r�is_anonymous�is_blockr*r�r�rKrLr:r;s@rr�r��s;����K�
�6�L��H�
�+��+�A�.�
rr�c�X��eZdZdZ�fd�ZdZed��Zed��Zd�Z	d�Z
d�Z�xZS)	�BlockTag�blockc���gd�|D�cgc]}|jd�s�|��c}z}t�|�|||ddfi|��|jd�}|r6t	j
d|�s t
j	di|j���|s2|jdd�r t
j	di|j���tj|jdd�fi|j��|_||_|jd	d�|_
tj|jd
d�fi|j��|_ycc}w)
N)r�r�r}r�r�rr�r�r}r.r�r�)z,%block may not specify an argument signature)z#Only named %blocks may specify args)r�r/rrWr�r�rr�rr�FunctionArgs�	body_declr�r�rur�r�s       �rrzBlockTag.__init__sL���4�!�8
��Q�\�\�(�%;�A�8
�
��	������+��	
��
	
��~�~�f�%�������d�3��-�-�>���'�'��
��
���v�t�4��-�-�5��9=�9N�9N��
��)�)��N�N�6�2�&�
�*.�*?�*?�
�����	�#����R�8����+�+��N�N�8�R�(�
�,0�,A�,A�
����98
s
�E�ETc��|jduSr
r�rs rr�zBlockTag.is_anonymous$s���y�y�D� � rc�>�|jxsd|jfzS)Nz__M_anon_%d)r�r
rs rr�zBlockTag.funcname(s���y�y�:�M�T�[�[�N�:�:rc�:�|jjdi|��Sr`)rr�r�s  rr�z!BlockTag.get_argument_expressions,s��6�t�~�~�6�6�<��<�<rc�.�|jjSr
�rr�rs rrKzBlockTag.declared_identifiers/����~�~�)�)�)rc��|jjjtjj��j
|j�Sr
r�rs rrLzBlockTag.undeclared_identifiers2sE�����3�3�>�>��'�'�,�,�.�
��%��6�6�
7�		8r)
r%r'r(r�rr�r*r�r�r�rKrLr:r;s@rr�r��sJ����K�
�B�H�
�!��!��;��;�=�*�8rr�c�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�CallTag�callc�
��t�|�||dddfi|��|d|_tj|jfi|j
��|_tj|jdd�fi|j
��|_	y)Nr})r�r�r.)
r/r�
expressionrrhrrNrrWrr�s    �rrzCallTag.__init__=s~���
����Z�&�9�i�	
�CI�	
�%�V�,����N�N�4�?�?�L�d�6K�6K�L��	��)�)��N�N�6�2�&�
�*.�*?�*?�
��rc�t�|jjj|jj�Sr
�rNrKryrr�rs rrKzCallTag.declared_identifiersG�'���y�y�-�-�3�3�D�N�N�4N�4N�O�Orc�t�|jjj|jj�Sr
�rNrLrzrKrs rrLzCallTag.undeclared_identifiersJ�,���y�y�/�/�:�:��I�I�*�*�
�	
rr�r;s@rr
r
:s����K�
�P�
rr
c�*��eZdZ�fd�Zd�Zd�Z�xZS)r�c	���t�|�|dz|z|t|j��dzddfi|��|�d|�ddj	d�|j
j
�D���d�|_tj|jfi|j��|_tj|jd	d
�fi|j��|_y)Nr�)r}r�.r�r�c3�:K�|]\}}|dk7r	|�d|�����y�w)r}�=Nr)r��k�vs   rr�z,CallNamespaceTag.__init__.<locals>.<genexpr>^s(������A�q���;��a� ��s�r7r}r.)r/r�tupler�r�r��itemsr
rrhrrNrrWr)rr�r�r�rMr$s     �rrzCallNamespaceTag.__init__Qs����
�����O�g�%���*�/�/�#�$�y�0���	
��
	
�
���H�H�� �2�2�8�8�:��
�
����N�N�4�?�?�L�d�6K�6K�L��	��)�)��N�N�6�2�&�
�*.�*?�*?�
��rc�t�|jjj|jj�Sr
rrs rrKz%CallNamespaceTag.declared_identifiersjrrc�t�|jjj|jj�Sr
rrs rrLz'CallNamespaceTag.undeclared_identifiersmrr)r%r'r(rrKrLr:r;s@rr�r�Ps���
�2P�
rr�c�"��eZdZdZ�fd�Z�xZS)�
InheritTag�inheritc�.��t�|�||dddfi|��y)Nr�r)r/rr�s    �rrzInheritTag.__init__vs#���
����Z��B�	�	
�=C�	
r)r%r'r(r�rr:r;s@rr r ss����K�
�
rr c�(��eZdZdZ�fd�Zd�Z�xZS)�PageTag�pagec�Z��gd�|D�cgc]}|jd�s�|��c}z}t�|�|||ddfi|��tj|jdd�fi|j��|_tj|jdd�fi|j��|_	ycc}w)N)r�r}�expression_filter�enable_loopr�rr}r.r')
r�r/rrrrWrrrur�)rrEr�rMr�r�r$s      �rrzPageTag.__init__s����
�
#�=�1�a�l�l�8�&<�Q�=�>��	����*�k�2�r�L�V�L��)�)��N�N�6�2�&�
�*.�*?�*?�
����+�+��N�N�.��3�
�7;�7L�7L�
����

>s
�B(�B(c�.�|jjSr
rrs rrKzPageTag.declared_identifiers�rrr�r;s@rr$r$|s����K�
� *rr$)r)r��makorrrrrr,r=r^rernrrr�rr�r�r�r�r�r�r
r�r r$rrr�<module>r+s��<�	�������>
�4�
�&8
�$�8
�vH�4�H�"
�4�"
�JH�d�H�
��
�BA�t�A�>x
�$�(�x
�vC��C�4�3��<8�c�8�<
�S�<
�~98�s�98�x
�c�
�, 
�s� 
�F
��
�*�c�*r

Zerion Mini Shell 1.0