ms_e<dZddlZddlmZddlmZddlmZddlmZGddZGd d eZGd d eZ Gd deZ GddeZ GddeZ GddeZ GddeZGddeeZGddeZGddeZGddeZGd d!eZGd"d#eZGd$d%eZGd&d'eZGd(d)eZGd*d+eZdS),z5defines the parse tree components for Mako templates.N)ast) exceptions)filters)utilc:eZdZdZdZedZdZdZdS)Nodez(base class for a Node in the parse tree.c>||_||_||_||_dSNsourcelinenoposfilename)selfr r rrs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/mako/parsetree.py__init__z Node.__init__s"    c8|j|j|j|jdS)Nr r rs rexception_kwargszNode.exception_kwargss'kk8    rcgSr rs r get_childrenzNode.get_children$ rcdfd}td|jjz|}||dS)Nc`|D]}|dSr )raccept_visitor)nodenvisitors rtraversez%Node.accept_visitor..traverse(s?&&(( * *  )))) * *rvisit)getattr __class____name__)rr r!methods ` rrzNode.accept_visitor'sJ * * * * *'DN,C"CXNNt rN) r% __module__ __qualname____doc__rpropertyrrrrrrrrsb22!!!   X rrc.eZdZdZfdZdZdZxZS) TemplateNodez?a 'container' node that stores the overall collection of nodes.cltddd|g|_i|_dS)Nr)superrnodespage_attributes)rrr$s rrzTemplateNode.__init__4s6 Q8,,, !rc|jSr r0rs rrzTemplateNode.get_children9 zrcLdtj|jd|jdS)Nz TemplateNode(, ))rsorted_dict_reprr1r0rs r__repr__zTemplateNode.__repr__<s.  !$"6 7 7 7 7 JJJ  r)r%r'r(r)rrr9 __classcell__r$s@rr,r,0s\II"""""        rr,cDeZdZdZdZfdZdZdZdZdZ dZ xZ S) ControlLinezdefines a control line, a line-oriented python line or end tag. e.g.:: % if foo: (markup) % endif Fc tjdi|||_||_||_|dv|_g|_|jrg|_g|_dStj |fi|j }|j |_|j |_dS)N)forifwhiletrywithr)r/rtextkeywordisend is_primaryr0_declared_identifiers_undeclared_identifiersrPythonFragmentrdeclared_identifiersundeclared_identifiers)rrErFrDkwargscoder$s rrzControlLine.__init__Qs""6"""   !%JJ : G)+D &+-D ( ( (%dDDd.CDDD)-)BD &+/+FD ( ( (rc|jSr r3rs rrzControlLine.get_children`r4rc|jSr )rHrs rrKz ControlLine.declared_identifierscs ))rc|jSr )rIrs rrLz"ControlLine.undeclared_identifiersfs ++rcjddhddhdhd}|||jtvS)zRreturn true if the given keyword is a ternary keyword for this ControlLineelseelifexceptfinally)r@rBr?)getrEset)rrEcasess r is_ternaryzControlLine.is_ternaryisF 6"i(8   %))DL#%%8888rc Vd|jd|jd|jd|j|jfd S)Nz ControlLine(r6r7)rErDrFr rrs rr9zControlLine.__repr__us; LLL III JJJ [$( # # #   r) r%r'r(r)has_loop_contextrrrKrLrZr9r:r;s@rr=r=Cs G G G G G***,,, 9 9 9       rr=c(eZdZdZfdZdZxZS)Textz#defines plain text in the template.c Htjdi|||_dSNr)r/rcontent)rrarMr$s rrz Text.__init__s+""6""" rc6d|jd|j|jfdS)NzText(r6r7)rar rrs rr9z Text.__repr__s$!% TX/F/F/FGGrr%r'r(r)rr9r:r;s@rr^r^~sT--HHHHHHHrr^c4eZdZdZfdZdZdZdZxZS)Codezdefines a Python code block, either inline or module level. e.g.:: inline: <% x = 12 %> module level: <%! import logger %> c tjdi|||_||_t j|fi|j|_dSr`)r/rrDismoduler PythonCoderrN)rrDrgrMr$s rrz Code.__init__sN""6"""   N4AA4+@AA rc|jjSr )rNrKrs rrKzCode.declared_identifierss y--rc|jjSr )rNrLrs rrLzCode.undeclared_identifierss y//rcFd|jd|jd|j|jfdS)NzCode(r6r7)rDrgr rrs rr9z Code.__repr__s2 III MMM [$( # # #  r r%r'r(r)rrKrLr9r:r;s@rrerest BBBBB ...000       rrec(eZdZdZfdZdZxZS)Commentz6defines a comment line. # this is a comment c Htjdi|||_dSr`)r/rrD)rrDrMr$s rrzComment.__init__s+""6""" rc6d|jd|j|jfdS)NzComment(r6r7)rDr rrs rr9zComment.__repr__s$$(III TX/F/F/FGGrrcr;s@rrnrnsX HHHHHHHrrnc4eZdZdZfdZdZdZdZxZS) Expressionz/defines an inline expression. ${x+y} c tjdi|||_||_t j|fi|j|_t j|fi|j|_ dSr`) r/rrDescapesr ArgumentListr escapes_coderhrN)rrDrtrMr$s rrzExpression.__init__sl""6"""  ,WNN8MNNN4AA4+@AA rcgSr rrs rrKzExpression.declared_identifiersrrc|jj|jjt j|jjSr )rNrLunionrv differencerDEFAULT_ESCAPESrKrs rrLz!Expression.undeclared_identifierssRy/55   4 ? ?'     *TY3 4 4  5rcPd|jd|jjd|j|jfdS)Nz Expression(r6r7)rDrvargsr rrs rr9zExpression.__repr__s8 III   " " " [$( # # #  rrlr;s@rrrrrst BBBBB555       rrrc,eZdZdZiZfdZdZxZS)_TagMetazImetaclass to allow Tag to produce a subclass according to its keywordct|dd||j|j<t|||dS)N __keyword__)r# _classmaprr/r)clsclsnamebasesdict_r$s rrz_TagMeta.__init__sE 3 t , , 8-0CM#/ * %/////rc Bd|vr2|d\}}tjt|||fi|S tj|}nB#t $r5tjd|z|d|d|d|dwxYwtj|||fi|S)N:zNo such tag: '%s'r r rrr ) splittype__call__CallNamespaceTagrrKeyErrorrCompileException)rrE attributesrMnsdefnames rrz_TagMeta.__call__s '>>!--,,KB= "gz=C  $W-CC   -#g-h'h'5M +   }S':@@@@@s A ?B )r%r'r(r)rrrr:r;s@rrrs_I00000 AAAAAAArrcJeZdZdZdZfdZdZdZdZdZ dZ d Z xZ S) Tagzabstract base class for tags. e.g.:: <%sometag/> <%someothertag> stuff Nc Htjdi||_|_||fd|D}t |r7t jddd|Dzfij 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) c&g|] }|jv |Sr)parsed_attributes).0rrs r z Tag.__init__..,s&JJJ!43I*I*I1*I*I*IrzMissing attribute(s): %s,c34K|]}t|VdSr )repr)rms r zTag.__init__..1s(881tAww888888rNr) r/rrEr_parse_attributeslenrrjoinrparentr0) rrEr expressionsnonexpressionsrequiredrMmissingr$s ` rrz Tag.__init__ s8 ""6""" $ {N;;;JJJJhJJJ w<< -.hh88888889 '    rc|jduSr )rrs ris_rootz Tag.is_root9s{d""rc|jSr r3rs rrzTag.get_children<r4rc t}i|_|jD]}||vrJg}tjdtj|j|D]}tjdtj|}|rtj | d fi|j }| |j}|d| dz|r"|t!|d|pt!d|j|<R||vrgtjd|j|r#t'jd|d |jd fi|j t!|j||j|<t'jd |jd |d fi|j ||_dS)Nz (\${.+?})z ^\${(.+?)}$z(%s)z + r.z\${.+?}z Attribute 'z ' in tag 'z%' does not allow embedded expressionszInvalid attribute for tag 'z': '')rXrrrecompileSrmatchrrhgrouprstriprryrLappendrrsearchrrrE!expression_undeclared_identifiers) rrrrLkeyexprxrrNs rrzTag._parse_attributes?s2!$!#?# # Ck!!L"$77==OC(--A >2488>>qAAA -"~GGAJJ--//  373H  2H1M1M 722. FQWWQZZ$78888- DGG,,,.3jj.>.>.J$r((&s++&&9Z)=>>$55),dlll</ /34?33G.H.H&s++ 11|||SSS*+ 2H...rcgSr rrs rrKzTag.declared_identifiershrrc|jSr )rrs rrLzTag.undeclared_identifiersks 55rc |jjd|jdtj|jd|j|jfd|jd S)N(r6r7) r$r%rErr8rr rr0rs rr9z Tag.__repr__nsT N # # # LLL  !$/ 2 2 2 2 [$( # # # JJJ   r) r%r'r(r)rrrrrrKrLr9r:r;s@rrrs  K+++++Z###'H'H'HR666       rr) metaclassc2eZdZdZfdZdZfdZxZS) IncludeTagincludec tj||dddfi|tjd|ddzfi|j|_dS)N)fileimportr}rrz __DUMMY(%s)r}r.)r/rrrhrWr page_argsrrErrMr$s rrzIncludeTag.__init__{s{   &          JNN6266 6  :>:O  rcgSr rrs rrKzIncludeTag.declared_identifiersrrc|jjdh|jj}|t S)N__DUMMY)rrLrzrKryr/)r identifiersr$s rrLz!IncludeTag.undeclared_identifierss]n;FF K  *T^8 9 9   !?!?!A!ABBBrr%r'r(rrrKrLr:r;s@rrrxsnK      CCCCCCCCCrrc(eZdZdZfdZdZxZS) NamespaceTag namespacec Ntj||dddfi||ddtt t |z|_d|vrd|vrtj d i|j d|vrd |vrtj d i|j dSdS) Nr)name inheritablermodulerrz __anon_%sr?'name' and/or 'import' attributes are required for <%namespace>rr4<%namespace> may only have one of 'file' or 'module')r)r) r/rrWhexabsidrrrrrs rrzNamespaceTag.__init__s    7        NN6;SD]]9K9K+KLL  # # (B(B-#'  Z  H $:$:-F'  $:$:rcgSr rrs rrKz!NamespaceTag.declared_identifiersrrr%r'r(rrrKr:r;s@rrrsLK.rrc(eZdZdZfdZdZxZS)TextTagrDc tj||dddfi|tj|ddfi|j|_dS)Nrfilterr.)r/rrrurWr filter_argsrs rrzTextTag.__init__sf*b8bKKFKKK+ NN8R ( (  ,0,A  rc|jjtj|jSr rrLrzrr{keysryrrs rrLzTextTag.undeclared_identifierssB6AA  # ( ( * *  %6 7 7 8r)r%r'r(rrrLr:r;s@rrrsLK     8888888rrcReZdZdZfdZdZdZedZdZ dZ dZ xZ S)DefTagdefc ddgd|Dz}tj|||ddfi||d}tjd|rt j di|jtjd |zd zfi|j|_ |j j |_ | d d |_ tj| d d fi|j|_dS)Nbufferedcachedc<g|]}|d|Scache_ startswithrcs rrz#DefTag.__init__..s90 0 0 Q\\(%;%;0 0 0 0 rrr decoratorrr^[\w_]+$Missing parenthesis in %defzdef z:passrr.r)r)r/rrrrrrr FunctionDecl function_declfuncnamerrWrrurrrErrMrrr$s rrzDefTag.__init__sD!8,0 0 !0 0 0       +        &! 8K & & --151F !- TMG #  '+'<  &/ # R88+ NN8R ( (  ,0,A  rFc|jjSr )rrrs rrzDefTag.funcnames!**rc &|jjdi|Sr`)rget_argument_expressionsrkws rrzDefTag.get_argument_expressionss:t!:@@R@@@rc|jjSr )r allargnamesrs rrKzDefTag.declared_identifierss!--rc g}|jjD].}|ttj|fi|jjz }/t||j j tj |j |jjSr )rdefaultslistrrhrrLrXryrrzrr{rrr)rresrs rrLzDefTag.undeclared_identifierss#,  A 4.( CC HH U 7BB+0022 U49 : : Z*6 7 7 r) r%r'r(rr is_anonymousis_blockr*rrrKrLr:r;s@rrrsK     6LH ++X+AAA...       rrcdeZdZdZfdZdZedZedZdZ dZ dZ xZ S) BlockTagblockc Ngdd|Dz}tj|||ddfi||d}|r,tjd|st j d i|j|s-|ddrt j di|jtj |dd fi|j|_ ||_ |d d |_ tj |d d fi|j|_dS)N)rrr}c<g|]}|d|Srrrs rrz%BlockTag.__init__..s98 8 8 Q\\(%;%;8 8 8 8 rrrrr,%block may not specify an argument signaturer}#Only named %blocks may specify argsr.rr)r )r )r/rrWrrrrrr FunctionArgs body_declrrrurrs rrzBlockTag.__init__s4448 8 !8 8 8       +        ~~f%%  d33 ->'   vt44 -59=9N ) NN62 & &  *.*?   # R88+ NN8R ( (  ,0,A  rTc|jduSr rrs rrzBlockTag.is_anonymous$syD  rc&|jp d|jfzS)Nz __M_anon_%d)rr rs rrzBlockTag.funcname(sy:MT[N::rc &|jjdi|Sr`)r rrs rrz!BlockTag.get_argument_expressions,s6t~6<<<< >',,..   %6 7 7  8r) r%r'r(rrrr*rrrrKrLr:r;s@rrrsK     BH !!X!;;X;===***8888888rrc.eZdZdZfdZdZdZxZS)CallTagcallc tj||dddfi||d|_tj|jfi|j|_tj|ddfi|j|_ dS)Nr})rrr.) r/r expressionrrhrrNr rWr rs rrzCallTag.__init__=s Z&9i  CI   %V,N4?LLd6KLL ) NN62 & &  *.*?  rcT|jj|jjSr rNrKryr rrs rrKzCallTag.declared_identifiersG y-33DN4NOOOrcT|jj|jjSr rNrLrzrKrs rrLzCallTag.undeclared_identifiersJ'y/:: I *   rrr;s@rrr:s^K     PPP       rrc*eZdZfdZdZdZxZS)rc tj|dz|z|t|dzddfi||d|ddd|jDd|_tj |jfi|j |_ tj | d d fi|j |_dS) Nr)r}r.rrc36K|]\}}|dk |d|VdS)r}=Nr)rkvs rrz,CallNamespaceTag.__init__..^sCAq;;11aa ;;;rr7r}r.)r/rtuplerrritemsrrrhrrNr rWr )rrrrrMr$s rrzCallNamespaceTag.__init__Qs Og %  *//## $ $y 0          II GG HH 288::     N4?LLd6KLL ) NN62 & &  *.*?  rcT|jj|jjSr rrs rrKz%CallNamespaceTag.declared_identifiersjrrcT|jj|jjSr rrs rrLz'CallNamespaceTag.undeclared_identifiersmrr)r%r'r(rrKrLr:r;s@rrrPsY     2PPP       rrc"eZdZdZfdZxZS) InheritTaginheritc Dtj||dddfi|dS)Nrr)r/rrs rrzInheritTag.__init__vs@ ZB   =C     r)r%r'r(rrr:r;s@rr,r,ss=K         rr,c(eZdZdZfdZdZxZS)PageTagpagec &gdd|Dz}tj|||ddfi|tj|ddfi|j|_tj|ddfi|j|_dS)N)rr}expression_filter enable_loopc<g|]}|d|Srrrs rrz$PageTag.__init__..s) = = =1all8&<&< =Q = = =rrr}r.r3) r/rrr rWrr rur)rrErrMrr$s rrzPageTag.__init__s   > = = = = >  *k2rLLVLLL) NN62 & &  *.*?  + NN. 3 3  7;7L  rc|jjSr rrs rrKzPageTag.declared_identifiersrrrr;s@rr0r0|sLK     *******rr0)r)rmakorrrrrr,r=r^rernrrrrrrrrrrrrr,r0rrrr8s<; >     4   &8 8 8 8 8 $8 8 8 vHHHHH4HHH" " " " " 4" " " J H H H H Hd H H H        BAAAAAtAAA>x x x x x $(x x x x vCCCCCCCC43< 8 8 8 8 8c 8 8 8< < < < < S< < < ~9898989898s989898x     c   ,      s    F        *****c*****r