Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/mako/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/mako/__pycache__/parsetree.cpython-38.pyc
U

O��gMJ�@sbdZddlZddlmZddlmZddlmZddlmZGdd�d�ZGd	d
�d
e�ZGdd�de�Z	Gd
d�de�Z
Gdd�de�ZGdd�de�ZGdd�de�Z
Gdd�de�ZGdd�deed�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�ZGd*d+�d+e�ZdS),z5defines the parse tree components for Mako templates.�N)�ast)�
exceptions)�filters)�utilc@s4eZdZdZdd�Zedd��Zdd�Zdd	�Zd
S)�Nodez(base class for a Node in the parse tree.cCs||_||_||_||_dS�N��source�lineno�pos�filename)�selfr	r
rr�r�;/opt/cppython/lib/python3.8/site-packages/mako/parsetree.py�__init__sz
Node.__init__cCs|j|j|j|jd�S)Nrr�r
rrr�exception_kwargss
�zNode.exception_kwargscCsgSrrrrrr�get_children$szNode.get_childrencs,�fdd�}t�d|jj|�}||�dS)Ncs|��D]}|���qdSr)r�accept_visitor)�node�n��visitorrr�traverse(sz%Node.accept_visitor.<locals>.traverse�visit)�getattr�	__class__�__name__)r
rr�methodrrrr'szNode.accept_visitorN)	r�
__module__�__qualname__�__doc__r�propertyrrrrrrrrs
rcs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�TemplateNodez?a 'container' node that stores the overall collection of nodes.cs"t��ddd|�g|_i|_dS)N�r)�superr�nodes�page_attributes)r
r�rrrr4szTemplateNode.__init__cCs|jSr�r&rrrrr9szTemplateNode.get_childrencCsdt�|j�|jfS)NzTemplateNode(%s, %r))r�sorted_dict_reprr'r&rrrr�__repr__<s
�zTemplateNode.__repr__)rrr r!rrr+�
__classcell__rrr(rr#0sr#csLeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
�ZS)�ControlLinez�defines a control line, a line-oriented python line or end tag.

    e.g.::

        % if foo:
            (markup)
        % endif

    Fcsht�jf|�||_||_||_|dk|_g|_|jrDg|_g|_n t	j
|f|j�}|j|_|j
|_dS)N)�for�if�while�try�with)r%r�text�keyword�isendZ
is_primaryr&�_declared_identifiers�_undeclared_identifiersrZPythonFragmentr�declared_identifiers�undeclared_identifiers)r
r4r5r3�kwargs�coder(rrrQs
zControlLine.__init__cCs|jSrr)rrrrr`szControlLine.get_childrencCs|jSr)r6rrrrr8csz ControlLine.declared_identifierscCs|jSr)r7rrrrr9fsz"ControlLine.undeclared_identifierscCs*ddhddhdhd�}||�|jt��kS)zRreturn true if the given keyword is a ternary keyword
        for this ControlLine�else�elif�except�finally)r/r1r.)�getr4�set)r
r4Zcasesrrr�
is_ternaryis
�zControlLine.is_ternarycCsd|j|j|j|j|jffS)NzControlLine(%r, %r, %r, %r))r4r3r5r
rrrrrr+us
�zControlLine.__repr__)rrr r!Zhas_loop_contextrrr8r9rBr+r,rrr(rr-Cs
r-cs(eZdZdZ�fdd�Zdd�Z�ZS)�Textz#defines plain text in the template.cst�jf|�||_dSr)r%r�content)r
rDr:r(rrr�sz
Text.__init__cCsd|j|j|jffS)NzText(%r, %r))rDr
rrrrrr+�sz
Text.__repr__�rrr r!rr+r,rrr(rrC~srCcs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�Codez�defines a Python code block, either inline or module level.

    e.g.::

        inline:
        <%
            x = 12
        %>

        module level:
        <%!
            import logger
        %>

    cs0t�jf|�||_||_tj|f|j�|_dSr)r%rr3�ismoduler�
PythonCoderr;)r
r3rGr:r(rrr�sz
Code.__init__cCs|jjSr)r;r8rrrrr8�szCode.declared_identifierscCs|jjSr)r;r9rrrrr9�szCode.undeclared_identifierscCsd|j|j|j|jffS)NzCode(%r, %r, %r))r3rGr
rrrrrr+�s

�z
Code.__repr__�	rrr r!rr8r9r+r,rrr(rrF�s
rFcs(eZdZdZ�fdd�Zdd�Z�ZS)�Commentz6defines a comment line.

    # this is a comment

    cst�jf|�||_dSr)r%rr3)r
r3r:r(rrr�szComment.__init__cCsd|j|j|jffS)NzComment(%r, %r))r3r
rrrrrr+�szComment.__repr__rErrr(rrJ�srJcs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�
Expressionz/defines an inline expression.

    ${x+y}

    csBt�jf|�||_||_tj|f|j�|_tj|f|j�|_	dSr)
r%rr3�escapesr�ArgumentListr�escapes_coderHr;)r
r3rLr:r(rrr�s
zExpression.__init__cCsgSrrrrrrr8�szExpression.declared_identifierscCs$|jj�|jj�tj���|jj�Sr)r;r9�unionrN�
differencer�DEFAULT_ESCAPESr8rrrrr9�s���z!Expression.undeclared_identifierscCsd|j|jj|j|jffS)NzExpression(%r, %r, %r))r3rN�argsr
rrrrrr+�s

�zExpression.__repr__rIrrr(rrK�s
rKcs,eZdZdZiZ�fdd�Zdd�Z�ZS)�_TagMetazImetaclass to allow Tag to produce a subclass according to
    its keywordcs0t|dd�dk	r||j|j<t��|||�dS)N�__keyword__)r�	_classmaprTr%r)�clsZclsname�basesZdict_r(rrr�sz_TagMeta.__init__c
Ks�d|kr*|�d�\}}tjt|||f|�Sztj|}Wn<tk
rttjd||d|d|d|dd��YnXtj|||f|�S)N�:zNo such tag: '%s'r	r
rrr)	�split�type�__call__�CallNamespaceTagrSrU�KeyErrorr�CompileException)rVr4�
attributesr:�ns�defnamerrrr[�s*���z_TagMeta.__call__)rrr r!rUrr[r,rrr(rrS�srScsTeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Z�ZS)�Tagz�abstract base class for tags.

    e.g.::

        <%sometag/>

        <%someothertag>
            stuff
        </%someothertag>

    Ncstt�jf|�|�_|�_��||��fdd�|D�}t|�rdtjdd�dd�|D��f�j	��d�_
g�_dS)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)

        csg|]}|�jkr|�qSr)�parsed_attributes)�.0�rrrr�
<listcomp>,s
z Tag.__init__.<locals>.<listcomp>zMissing attribute(s): %s�,css|]}t|�VqdSr)�repr)rd�mrrr�	<genexpr>1szTag.__init__.<locals>.<genexpr>N)r%rr4r_�_parse_attributes�lenrr^�joinr�parentr&)r
r4r_�expressions�nonexpressions�requiredr:�missingr(rrrs���zTag.__init__cCs
|jdkSr)rnrrrr�is_root9szTag.is_rootcCs|jSrr)rrrrr<szTag.get_childrenc	Cs6t�}i|_|jD�]}||kr�g}t�dtj��|j|�D]j}t�dtj��|�}|r�tj	|�
d���f|j�}|�
|j�}|�d|�
d��q>|r>|�t|��q>d�|�p�td�|j|<q||k�rt�d|j|�r�tjd||jff|j��t|j|�|j|<qtjd	|j|ff|j��q||_dS)
Nz(\${(?:[^$]*?{.+|.+?)})z^\${(.+?)}$�z(%s)z + r$z\${.+?}z>Attribute '%s' in tag '%s' does not allow embedded expressionsz$Invalid attribute for tag '%s': '%s')rArcr_�re�compile�SrY�matchrrH�group�rstriprrOr9�appendrhrm�searchrr^r4�!expression_undeclared_identifiers)	r
rorpr9�key�expr�xrir;rrrrk?sP����
������zTag._parse_attributescCsgSrrrrrrr8hszTag.declared_identifierscCs|jSr)r}rrrrr9kszTag.undeclared_identifierscCs*d|jj|jt�|j�|j|jf|jfS)Nz%s(%r, %s, %r, %r))	rrr4rr*r_r
rr&rrrrr+ns

�zTag.__repr__)
rrr r!rTrrsrrkr8r9r+r,rrr(rrb�s-)rb)�	metaclasscs4eZdZdZ�fdd�Zdd�Z�fdd�Z�ZS)�
IncludeTag�includecs:t�j||dddf|�tjd|�dd�f|j�|_dS)N)�file�importrRr�r�z__DUMMY(%s)rRr$)r%rrrHr@r�	page_args�r
r4r_r:r(rrr{s����zIncludeTag.__init__cCsgSrrrrrrr8�szIncludeTag.declared_identifierscs*|jj�dh��|jj�}|�t����S)NZ__DUMMY)r�r9rPr8rOr%)r
Zidentifiersr(rrr9�s��z!IncludeTag.undeclared_identifiers�rrr rTrr8r9r,rrr(rr�xs
r�cs(eZdZdZ�fdd�Zdd�Z�ZS)�NamespaceTag�	namespacecsvt�j||dddf|�|�ddttt|����|_d|krTd|krTtjd|j	��d|krrd	|krrtjd|j	��dS)
Nr�)�name�inheritabler��modulerr�z	__anon_%sr��?'name' and/or 'import' attributes are required for <%namespace>r�r��4<%namespace> may only have one of 'file' or 'module')r�)r�)
r%rr@�hex�abs�idr�rr^rr�r(rrr�s,��	����zNamespaceTag.__init__cCsgSrrrrrrr8�sz!NamespaceTag.declared_identifiers�rrr rTrr8r,rrr(rr��sr�cs(eZdZdZ�fdd�Zdd�Z�ZS)�TextTagr3cs6t�j||dddf|�tj|�dd�f|j�|_dS)Nr�filterr$)r%rrrMr@r�filter_argsr�r(rrr�s
��zTextTag.__init__cCs|jj�tj����|j�Sr�r�r9rPrrQ�keysrOr}rrrrr9�s
��zTextTag.undeclared_identifiers)rrr rTrr9r,rrr(rr��sr�csLeZdZdZ�fdd�ZdZdZedd��Zdd�Z	d	d
�Z
dd�Z�ZS)
�DefTag�defcs�ddgdd�|D�}t�j|||ddf|�|d}t�d|�rPtjd|j��tjd
|df|j�|_	|j	j
|_|�dd
�|_
tj|�dd
�f|j�|_dS)N�buffered�cachedcSsg|]}|�d�r|�qS�Zcache_��
startswith�rd�crrrrf�s
z#DefTag.__init__.<locals>.<listcomp>�r�r��	decorator�r�r��^[\w_]+$�Missing parenthesis in %defzdef z:passr�r$r�)r�)r%rrurxrr^rrZFunctionDecl�
function_decl�funcnamer�r@r�rMr��r
r4r_r:ror�r(rrr�s>�����
��

��zDefTag.__init__FcCs|jjSr)r�r�rrrrr��szDefTag.funcnamecKs|jjf|�Sr)r��get_argument_expressions�r
�kwrrrr��szDefTag.get_argument_expressionscCs|jjSr)r��allargnamesrrrrr8�szDefTag.declared_identifierscCs\g}|jjD]}|ttj|f|j�j�7}qt|��|j	j�
tj�
����|j��
|jj�Sr)r��defaults�listrrHrr9rArOr�rPrrQr�r}r�)r
�resr�rrrr9�s&��������zDefTag.undeclared_identifiers)
rrr rTr�is_anonymous�is_blockr"r�r�r8r9r,rrr(rr��s
r�csTeZdZdZ�fdd�ZdZedd��Zedd��Zd	d
�Z	dd�Z
d
d�Z�ZS)�BlockTag�blockcs�dddgdd�|D�}t�j|||ddf|�|�d�}|rXt�d	|�sXtjd|j��|sv|�dd�rvtjd|j��tj	|�dd�f|j�|_
||_|�d
d�|_tj
|�dd�f|j�|_dS)Nr�r�rRcSsg|]}|�d�r|�qSr�r�r�rrrrfs
z%BlockTag.__init__.<locals>.<listcomp>r�rr�r��,%block may not specify an argument signature�#Only named %blocks may specify argsr$r�r�)r�)r�)r%rr@rurxrr^rr�FunctionArgs�	body_declr�r�rMr�r�r(rrrsJ���
����
��
��zBlockTag.__init__TcCs
|jdkSrr�rrrrr�$szBlockTag.is_anonymouscCs|jpd|jfS)Nz__M_anon_%d)r�r
rrrrr�(szBlockTag.funcnamecKs|jjf|�Sr)r�r�r�rrrr�,sz!BlockTag.get_argument_expressionscCs|jjSr�r�r�rrrrr8/szBlockTag.declared_identifierscCs|jj�tj����|j�Srr�rrrrr92s���zBlockTag.undeclared_identifiers)
rrr rTrr�r"r�r�r�r8r9r,rrr(rr��s!

r�cs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�CallTag�callcsTt�j||dddf|�|d|_tj|jf|j�|_tj|�dd�f|j�|_	dS)NrR)rrr$)
r%r�
expressionrrHrr;r�r@r�r�r(rrr=s ��

��zCallTag.__init__cCs|jj�|jj�Sr�r;r8rOr�r�rrrrr8GszCallTag.declared_identifierscCs|jj�|jj�Sr�r;r9rPr8rrrrr9Js�zCallTag.undeclared_identifiersr�rrr(rr�:s
r�cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)r\cs�t�j|d||t|���dddf|�d||d�dd�|j��D��f|_tj	|jf|j
�|_tj|�
dd	�f|j
�|_dS)
NrX)rRrz	%s.%s(%s)rgcss&|]\}}|dkrd||fVqdS)rRz%s=%sNr)rd�k�vrrrrj^s�z,CallNamespaceTag.__init__.<locals>.<genexpr>rRr$)r%r�tupler�rmrc�itemsr�rrHrr;r�r@r�)r
r�rar_r:r(rrrQs,
��	
��

��zCallNamespaceTag.__init__cCs|jj�|jj�Srr�rrrrr8jsz%CallNamespaceTag.declared_identifierscCs|jj�|jj�Srr�rrrrr9ms�z'CallNamespaceTag.undeclared_identifiers)rrr rr8r9r,rrr(rr\Psr\cs eZdZdZ�fdd�Z�ZS)�
InheritTag�inheritcst�j||dddf|�dS)Nr�r)r%rr�r(rrrvs��zInheritTag.__init__)rrr rTrr,rrr(rr�ssr�cs(eZdZdZ�fdd�Zdd�Z�ZS)�PageTag�pagecsjddddgdd�|D�}t�j|||ddf|�tj|�dd�f|j�|_tj|�dd�f|j�|_dS)	Nr�rRZexpression_filterZenable_loopcSsg|]}|�d�r|�qSr�r�r�rrrrf�s
z$PageTag.__init__.<locals>.<listcomp>rr$)	r%rrr�r@rr�rMr�)r
r4r_r:ror(rrrs$��
��
��zPageTag.__init__cCs|jjSrr�rrrrr8�szPageTag.declared_identifiersr�rrr(rr�|sr�)r!ru�makorrrrrr#r-rCrFrJrKrZrSrbr�r�r�r�r�r�r\r�r�rrrr�<module>s.;%!{?<#	

F1le Man4ger