fO dZddlZddlmZddlmZddlmZddl m Z ddl m Z ddlmZdd lmZd d lmZd d lmZd d lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlm Z d dl!m"Z"ejFr ddl$Z%d dl&m'Z'ejPdejRdejTfZ+dddddd d!d"d#Z,d$e+d%e+fd&Z-d'e.d%ejRd(ej^d)gdffd*Z0d'e.d%ejRd(ejbd)gdffd+Z2 dFd,ejfd-d.d/ejhe.d0ejhe.d1ejhejjd2e6d3e6d%ejhe.fd4Z7d5ejTd%e6fd6Z8d7ejrejtd8ejre.d%ejve.fd9Z<Gd:d;Z=Gd<d)Z>Gd=d>e?Z@Gd?d@e"ZAGdAdBe"ZBGdCdDeCZDGdEd(e"ZEy)Gz0Compiles nodes from the parser into Python code.N)contextmanager)update_wrapper)StringIO)chain) iskeyword)escape)Markup)nodes)TemplateAssertionError)Symbols)VAR_LOAD_ALIAS)VAR_LOAD_PARAMETER)VAR_LOAD_RESOLVE)VAR_LOAD_UNDEFINED) EvalContext) Optimizer)_PassArg)concat) NodeVisitor) EnvironmentF.)boundz==z!=>z>=.new_func.sb >> %enn.E.E~~++D%..AH4zz(E22tU-f--)r ExprtAnyrcastr)r$r5s` r4 optimizeconstr;-sV . .%*ZZ .8? .KL55 .  . !&&H-q 11r6opr(r+c Ztdddtjdtddffd }|S)Nr'r(r)r*r%c|jjrw|jjvr_|jdd|j |j ||jd|j |j |n^|jd|j |j ||jdd|j |j ||jdy)Nz environment.call_binop(context, , ( )) environment sandboxedintercepted_binopswriter2leftrightr'r)r*r<s r4visitorz_make_binop..visitor>s    & &21A1A1T1T+T JJ9"rB C JJtyy% ( JJt  JJtzz5 ) JJsO JJtyy% ( JJ2$ay ! JJtzz5 ) 3r6)r;r BinExprr+r<rJs` r4 _make_binoprM=s<oU]]5T Nr6c Ztdddtjdtddffd }|S)Nr'r(r)r*r%cH|jjrJ|jjvr2|jdd|j |j |n0|jdz|j |j ||jdy)Nzenvironment.call_unop(context, r?r@rB)rCrDintercepted_unopsrFr2r)rIs r4rJz_make_unop..visitorUs|    & &21A1A1S1S+S JJ8bA B JJtyy% ( JJsRx JJtyy% ( 3r6)r;r UnaryExprr+rLs` r4 _make_unoprRRs> o U__ U t   Nr6r)rCrnamefilenamestream defer_init optimizedct|tjs td|j ||||||}|j |||j jSy)z+Generate the python source for a node tree.z Can't compile non template nodesN) isinstancer Template TypeErrorcode_generator_classr2rUgetvalue)r)rCrSrTrUrVrW generators r4generater_esf dENN +:;;00T8VZIOOD ~((** r6valuecT||tus|turyt|ttt t ttthvryt|tttthvrtd|DSt|tur td|j!DSy)z)Does the node have a safe representation?Tc32K|]}t|ywr. has_safe_repr).0vs r4 z has_safe_repr..s3=#3sc3RK|]\}}t|xr t|!ywr.rcrekrfs r4rgz has_safe_repr..s&STQ=#8 a(88Ss%'F)NotImplementedEllipsistypeboolintfloatcomplexrangestrr tuplelistset frozensetalldictitemsr`s r4rdrd}s }/5H3D E{tS%%fEE E{udC333U333 E{dSU[[]SSS r6r namesct|} |D]}|j| |jS#t$rY|jSwxYw)zCheck if the names passed are accessed undeclared. The return value is a set of all the undeclared names from the sequence of names found. )UndeclaredNameVisitorr2 VisitorExit undeclared)r r|rJr)s r4find_undeclaredrsW $E*G D MM$          s2 A A cbeZdZdejej ejfddfdZy)MacroRefr)r%Nc<||_d|_d|_d|_yNF)r)accesses_calleraccesses_kwargsaccesses_varargsr'r)s r4__init__zMacroRef.__init__s! $$ %r6) __name__ __module__ __qualname__r8Unionr Macro CallBlockrr6r4rrs+&QWWU[[%//%AB&t&r6rc eZdZdZ d dedej ddej eddfdZd dZ dd e ddfd Z d d Z e Z y)r+z&Holds compile time information for us.Nr0parentlevelr%cV||_||_|'t||_d|_d|_d|_nOt|j||_|j|_|j |_|j |_d|_d|_d|_ d|_ d|_ y)NrF) r0rr symbolsrequire_output_checkbufferblocktoplevel rootlevel loop_frame block_frame soft_frame)r'r0rrs r4rzFrame.__init__s !  >"/DL).D % ,0DK+/DJ#6>>?DL(.(C(CD % --DKDJ     r6ctj|j}|jj |j|j j |_|S)z!Create a copy of the current one.)object__new__ __class____dict__updatercopyr'rvs r4rz Frame.copysC ^^DNN + 4==)\\&&(  r6isolatedc|r.t|j|jjdzSt|j|S)zReturn an inner frame.r r)r+r0rr)r'rs r4innerz Frame.inners6 dll.@.@1.DE ET]]D))r6cB|j}d|_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 and conditional expressions. FT)rrrrs r4softz Frame.softs"YY[   r6)NN)r%r+F)rrr__doc__rr8Optionalrorrrnrr__copy__rr6r4r+r+sn0 '+!% 1 1  7#1 zz# 1  1 f*d*w* Hr6ceZdZdZy)rz?Exception used by the `UndeclaredNameVisitor` to signal a stop.Nrrrrrr6r4rrsIr6rceZdZdZd dZdej ddfdZdejddfdZ dejddfdZ y) DependencyFinderVisitorz.A visitor that collects filter and test calls.r%Nc@t|_t|_yr.)rvfilterstestsr's r4rz DependencyFinderVisitor.__init__s#&5 !$ r6r)cp|j||jj|jyr.) generic_visitraddrSrs r4 visit_Filterz$DependencyFinderVisitor.visit_Filters& 4  #r6cp|j||jj|jyr.)rrrrSrs r4 visit_Testz"DependencyFinderVisitor.visit_Tests$ 4  tyy!r6cy)zStop visiting at blocks.Nrrs r4 visit_Blockz#DependencyFinderVisitor.visit_Block r6r%N) rrrrrr FilterrTestrBlockrrr6r4rrsO8'$$$$"uzz"d"' ''r6rceZdZdZdej eddfdZdejddfdZ dejddfdZ y) r~zA 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. r|r%NcBt||_t|_yr.)rvr|r)r'r|s r4rzUndeclaredNameVisitor.__init__sZ &)er6r)c.|jdk(ra|j|jvrI|jj |j|j|jk(r t y|jj |jy)Nload)ctxrSr|rrrdiscardrs r4 visit_Namez UndeclaredNameVisitor.visit_Namesh 88v $))tzz"9 OO   *$**,!m#- JJ  tyy )r6cy)zStop visiting a blocks.Nrrs r4rz!UndeclaredNameVisitor.visit_Block!rr6) rrrrr8Iterablersrr Namerrrrr6r4r~r~sP ,ajjo,$,*uzz*d*& &&r6r~ceZdZdZy) CompilerExitzRaised 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. Nrrr6r4rr%sr6rcZeZdZU ddddejedejedejej deded dfd Ze d efd Z d ed e d dfdZ d efdZ ded dfdZ ddeded dfdZddZdde d dfdZddedejej(d dfdZded dfdZ ddededejej(d dfdZdej0ej(ded dfdZded dfd Z ddedejej(d!e d dfd"Zddejej(d!e d dfd#Z ddej:ej<ej>ej@fded$ejejBeejDfd dfd%Z#dej0ej(d dfd&Z$ded dfd'Z%dded(ed dfd)Z&dd*ed+ed efd,Z'ded efd-Z(dej:ejRejTfded ejVee,ffd.Z-d/e,ded dfd0Z.dej(d efd1Z/ded efd2Z0dd3Z1ded dfd4Z2dd5Z3d6ed dfd7Z4d6ed dfd8Z5dd9Z6d efd:Z7d efd;Z8ded efd<Z9d6ed efd=Z:dd>Z;ded dfd?Z< ddejzdejed dfd@Z>dej~ded dfdAZ@dejded dfdBZBdejded dfdCZDdej:ejejfded dfdDZGdejded dfdEZHdejded dfdFZIdejded dfdGZKdejded dfdHZMdejRded dfdIZNdejTded dfdJZOdejded dfdKZQdejded dfdLZSdejded dfdMZUGdNdOejZWeXdPejDd ejDfdQZYdZZejeWe[dR<d eWfdSZ\dTej0ejDd efdUZ]dejdedVeWd efdWZ_dejdedVeWd dfdXZ`dejdedVeWd dfdYZadejded dfdZZcdejded dfd[Zedejded dfd\Zgdejded dfd]Zidejded dfd^Zkdejded dfd_Zmdejded dfd`ZodejVded dfdaZpdejded dfdbZrdejded dfdcZteuddZveudeZweudfZxeudgZyeudhZzeudiZ{eudjZ|eudkZ}eudlZ~eddZedeZedmZedejded dfdnZedej ded dfdoZdejded dfdpZedejded dfdqZedejded dfdrZdejded dfdsZedej:ej>ej@fdedted ej"dfduZedej>ded dfdvZedej@ded dfdwZedej*ded dfdxZe ddej<dedyed dfdzZdej0ded dfd{Zdej4ded dfd|Zdej8ded dfd}Zdej<ded dfd~Zdej@ded dfdZdejDded dfdZdejHded dfdZdejLded dfdZdejPded dfdZdejTded dfdZdejXded dfdZdej\ded dfdZdej`ded dfdZdejdded dfdZdejhded dfdZy)r(NrCrrSrTrUrVrWr%c| t}||_||_||_||_d|_||_d|_|rt||_i|_ i|_ d|_ d|_ d|_ i|_i|_g|_d|_d|_d|_d|_d|_d|_g|_g|_dg|_y)NFrr Tcontext)rrCrSrTrUcreated_block_contextrVr/rimport_aliasesblocksextends_so_farhas_known_extends code_linenorr debug_info_write_debug_info _new_lines _last_line _first_write_last_identifier _indentation _assign_stack_param_def_block_context_reference_stack)r'rCrSrTrUrVrWs r4rzCodeGenerator.__init__-s >ZF&    %*"$04 &{3DN1313   "'(* )+ 6826!!"2457*3 %r6c|jduSr.)r/rs r4rWzCodeGenerator.optimizedvs~~T))r6msglinenoz te.NoReturncFt|||j|j)z*Fail with a :exc:`TemplateAssertionError`.)r rSrT)r'rrs r4failzCodeGenerator.fail|s$S&$))T]]KKr6cJ|xjdz c_d|jS)zGet a new unique identifier.r t_)rrs r4temporary_identifierz"CodeGenerator.temporary_identifiers' "D))*++r6r*cj|j|_|j|jdy)z7Enable buffering for the frame from that point onwards.z = []N)rr writeliner'r*s r4rzCodeGenerator.buffers)002  %,,u-.r6force_unescapedc |s|jjr|jd|j|jd|jd|j |jd|j|jd|jd|j y|jj r |jd|jdy|jd|jdy)z(Return the buffer contents of the frame.zif context.eval_ctx.autoescape:zreturn Markup(concat())else:zreturn concat(rBN)r0r1rindentroutdent autoescape)r'r*rs r4return_buffer_contentsz$CodeGenerator.return_buffer_contentss~~&&@A !6u||nBGH w'  ~Q?@ **!6u||nBGH  ~Q78r6c.|xjdz c_y)zIndent by one.r Nrrs r4rzCodeGenerator.indents Qr6stepc.|xj|zc_y)zOutdent by step.Nr)r'rs r4rzCodeGenerator.outdents T!r6r)c|j|jd|y|j|jd|y)z%Yield or write into the frame buffer.Nyield .append()rr)r'r*r)s r4 start_writezCodeGenerator.start_writes3 <<  NN8T * NNell^84d ;r6c@|j|jdyy)z1End the writing process started by `start_write`.NrB)rrFrs r4 end_writezCodeGenerator.end_writes << # JJsO $r6scl|j|||j||j|y)z4Simple shortcut for start_write + write + end_write.N)rrFr)r'rr*r)s r4 simple_writezCodeGenerator.simple_writes+ % 1  ur6r cx |jd|D]}|j||y#t$rYywxYw)zVisit 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)rr2r)r'r r*r)s r4 blockvisitzCodeGenerator.blockvisits=  NN6 " 4'   s *- 99xc|jr|js|jjd|jz|xj|jz c_|j 8|j j|j |jfd|_d|_|jjd|jzd|_|jj|y)z&Write a string into the output stream. NFz r) rrrUrFrrrappendr)r'r s r4rFzCodeGenerator.writes ??$$ !!$"89  DOO3 ))5OO**D,B,BDDTDT+UV-1D* %D  KK  ft'8'88 9DO !r6extracJ|j|||j|y)z!Combination of newline and write.N)newlinerF)r'r r)r s r4rzCodeGenerator.writelines T5! 1 r6ct|jd|z|_|=|j|jk7r#|j|_|j|_yyy)z/Add one or more newlines before the next write.r N)maxrrrr)r'r)r s r4rzCodeGenerator.newlinesLdooq5y9   t >%)[[D ""kkDO!? r6 extra_kwargsctdtd|jD|xsdD}|jD]%}|j d|j ||'|se|jD]%}|j d|j ||'|/|j D]\}}|j d|d||jr-|j d|j |j||r|j|j dn|j d |jD]M}|j |jd |j |j||j dO|/|j D]\}}|j |d |d|j?|j d |j |j||j d y|j d y|j.|j d|j |j|yy)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. c3bK|]'}ttjt|)ywr.)is_python_keywordr8r:rs)rerjs r4rgz*CodeGenerator.signature..s'  affS!n - s-/c34K|]}|jywr.)keyrer s r4rgz*CodeGenerator.signature..s7aAEE7rr?N=z, *z , **dict({z, **{: z}, **rB}z, **) anyrr,argsrFr2rzdyn_args dyn_kwargsrr`) r'r)r*rkwarg_workaroundargkwargrr`s r4 signaturezCodeGenerator.signatures 74;;79KL   99C JJt  JJsE "  4  5%(%'"."4"4"6JCJJC5%12#7 == JJu  JJt}}e , * <( 7# eii]"-. 5;;. 4 %'"."4"4"6JCJJ#5'45#7* 7# 4??E2 3 3 __ ( JJv  JJt .)r6c t}|D]}|j||j|jdf|j|jdffD]\}}}t |D]}||vr|j ||<|j d|j|j ||d|d|d|j|j d|j|j d|j d ||d |j|j d |d d d|d|j|jy )aFind all filter and test names used in the template and assign them to variables in the compiled namespace. Checking that the names are registered with the environment is done when compiling the Filter and Test nodes. If the node is in an If or CondExpr node, the check is done at runtime instead. .. versionchanged:: 3.0 Filters and tests in If and CondExpr nodes are checked at runtime instead of compile time. rrtry:z = environment.[]zexcept KeyError:z @internalcodedef z (*unused):zraise TemplateRuntimeError("No N named z found.")) rr2rrsortedrrrr)r'r rJr)id_mapr| dependencyrSs r4pull_dependencieszCodeGenerator.pull_dependenciessM*+D MM$ \\7??I 6   * %FE:u v%#'#<#<#>F4Lv& &,zl!D8STUV 12 /fTl^:>? 5j"o5FdXY0  )&* r6c g}|jjjD]\}\}}|tk(r|tk(r)|j |d|j d|dE|tk(r|j |d|e|tk(r|j|td|r$|j dj|dyy)N = r@rBzunknown load instruction = missing) rloadsrzrrrget_resolve_funcrrr NotImplementedErrorjoin)r'r*undefstargetactionparams r4 enter_framezCodeGenerator.enter_frameHs',}}':':'@'@'B #FOVU++++&T-B-B-D,EQuiqQR>)&UG45-- f%)*DEE(C  NNejj01< = r6with_python_scopec|sUg}|jjD]}|j||r$|jdj |dyyy)Nr1r2)rr3r rr6)r'r*r<r7r8s r4 leave_framezCodeGenerator.leave_frameXsT F---- f%.%**V"4!5Z@A !r6 async_value sync_valuec6|jjr|S|Sr.)rCis_async)r'r?r@s r4 choose_asynczCodeGenerator.choose_async`s"..77{GZGr6c,|jd|S)Nr))rC)r'rSs r4funczCodeGenerator.funccs##%&d4&11r6c |j}|jj|t|}d}t }g}t |j D]s\}}|jdk(r|}|jdvr|j|j|j|jj|jut|jd} d| vrZ|' |j|t|j z n*|j|jj%dd|_d| vr5d|vr1|j|jj%dd|_d| vr5d|vr1|j|jj%dd|_d |_|jj||j/|j1d d d j3|d ||j5|j7||j9||j;|t |j D]\}}|jj|j} |j/d| d|j5 |j|t|j z } |j/| d|j=| ||j?| |jA|jC|jE|j||jG|d|jI|d|jA||fS#t$r |j!d|j"YvwxYw#t$r1|j/| d|jd|jdYwxYw)z/Dump the function def of a macro or call block.Ncaller)r,varargs)rGr,rHzhWhen defining macros or call blocks the special "caller" argument must be omitted or be given a default.Tr,rHFmacror@r?):if is missing:r1z = undefined("parameter z was not provided", name=rB)rr<)%rr analyze_noderrv enumeraterrSrr refrbodydefaultslen IndexErrorrrdeclare_parameterrrrrrrEr6rrr;push_parameter_definitionsr2mark_parameter_storedrpop_parameter_definitionsrrr>) r'r)r* macro_refexplicit_callerskip_special_paramsridxr"rrPdefaults r4 macro_bodyzCodeGenerator.macro_bodyfsX  ""4(TN !e!$)),HCxx8#"%xx00#''1 KK ))#((3 4 -%TYY0OP z !*MM/C N"BC EMM;;HEF(,I % z !h6I&I KK 77A B(,I %  "y8K'K KK 77 B C)-I &&+" ""4( $))G,-Qtyy.?rBDI  E  ''.!$)),HC--##CHH-C NNS\2 3 KKM +--c$))n(<=#c{+ 7E*  & &s + LLN- &&(  5) ##E4#@ $7 ie"II1 B e3CHH<@ XXL+ s$-%N 7%N7 %N43N477O10O1rYc Vdjd|jjD}t|jdd}t |jjdk(r|dz }|j d|d|d |j d|jd|jd y) z.sHqd166lHs!rSNr ,zMacro(environment, macro, z, (z), z, context.eval_ctx.autoescape)) r6r)rgetattrrSrFrrr)r'rYr* arg_tuplerSs r4 macro_defzCodeGenerator.macro_defsIIHINN4G4GHH y~~vt4 y~~"" #q (  I (I;?)),By/I/I.LM)),,J L r6c^d|j}|j|d|j}|S)z.Return a human readable position for the node.zline  in )rrS)r'r)rs r4positionzCodeGenerator.positions5T[[M " 99 4tDII=)B r6cdjd|jjjD}d|dS)Nr?c30K|]\}}|d|ywrNr)rerSr8s r4rgz3CodeGenerator.dump_local_context..s' fhb ! {r)r6r dump_storesrz)r'r*items_kvs r4dump_local_contextz CodeGenerator.dump_local_contextsD99 % 9 9 ; A A C  H:R  r6c|jd|jd|jd|jd|jdy)zWrites 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.undefinedzconcat = environment.concatzcond_expr_undefined = Undefinedzif 0: yield NoneNrrs r4 write_commonszCodeGenerator.write_commonssG => :; 45 89 )*r6cj|jj|jjy)aQPushes 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)rr rdump_param_targetsrs r4rVz(CodeGenerator.push_parameter_definitionss% $$U]]%E%E%GHr6c8|jjy)z+Pops the current parameter definitions set.N)rpoprs r4rXz'CodeGenerator.pop_parameter_definitionss !!#r6r8cZ|jr|jdj|yy)zMarks a parameter in the current parameter definitions as stored. This will skip the enforced undefined checks. r*N)rrr'r8s r4rWz#CodeGenerator.mark_parameter_storeds+   ! !" % - -f 5 !r6c:|jj|yr.)rr rys r4push_context_referencez$CodeGenerator.push_context_references %%,,V4r6c8|jjyr.)rrwrs r4pop_context_referencez#CodeGenerator.pop_context_references %%))+r6c |jdS)Nr*rrs r4get_context_refzCodeGenerator.get_context_refs,,R00r6c6|jd}|dk(ry|dS)Nr*rresolvez.resolverrys r4r4zCodeGenerator.get_resolve_funcs*..r2 Y ""r6cL|jd|j|dS)Nz .derived(rB)rrprs r4derive_contextzCodeGenerator.derive_contexts,&&()43J3J53Q2RRSTTr6c>|jsy||jdvS)z4Checks if a given target is an undeclared parameter.Fr*)rrys r4parameter_is_undeclaredz%CodeGenerator.parameter_is_undeclareds$$$..r222r6cJ|jjty)z+Pushes a new layer for assignment tracking.N)rr rvrs r4push_assign_trackingz"CodeGenerator.push_assign_tracking s !!#%(r6cT|jj}|js|js |jr|sy|Dcgc] }|dddk7s |}}t |dk(rt t|}|jj|}|jr|jd|d|y|jr|jd|d|y|jd|d|n|jr|jdn/|jr|jd n|jd t|D]I\}}|r|jd |jj|}|j|d |K|jd |jsl|js_|r\t |dk(r|jd|ddyd jtt|}|jd|dyyyycc}w)zoPops the topmost level for assignment tracking and updates the context variables if necessary. Nr _z _loop_vars[] = z _block_vars[ context.vars[z_loop_vars.update({z_block_vars.update({context.vars.update({r?r})context.exported_vars.add(rrBzcontext.exported_vars.update((r)rrwrrrrSnextiterrrPrrOrFr6mapra) r'r*varsr  public_namesrSrPr\ names_strs r4pop_assign_trackingz!CodeGenerator.pop_assign_trackings!!%%'!!$$NN #'8a1Ra5C<8 8 t9>T #D--##D)CTHD>?  dXT#?@ NN]4($se< =45""5667&t_ TJJt$mm''- dXRu-. - JJt   )9)9l< A%!;LO;NaPQ IIc$ &=> !? {"MN ?K)9 19s  H%H%c t |Jdt|j|j}ddlm}ddlm}|jj rt||z}n t|}|jddj|z|jrdnd}|jtjdu}|jtjD]]} | j|j vr*|j#d | jd | j$| |j | j<_|jtj&D]} | j(|j*vs| j(} |j-x|j*| <} d | vr0| j/d d\} }|jd | d |d| {|jd| d| |jd|j|j|j1dd|dd|j3|j5t7|}dt9|j:dvr/|j<j?d}|j|d|j<jA|dx|_!|_"|xr |jF |_$|r|jd|jK||jM|j:|jO|j:||jQ|d|jS|r|jFs!|j3|jd|j3|jj s|jdnB|jd|j3|jd|jS|jSd|jF z|j jUD]\}} |j|j1d|zd|d| d|j3|j5t7|}d|_+t9| j:d }d|vr/|j<j?d}|j|dd!|vr5|j<j?d!}|j|d"|d#|d$|j<jA| ||_,|jd%|jK||jM| j:|jO| j:||jQ|d|jSdjd&|j D}|jd'|d(dd)jd*|jZD}|jd+|y),Nzno root frame allowedr )async_exported)exportedzfrom jinja2.runtime import r?z, environment=environmentzblock z defined twice.zfrom z import z as zimport zname = rootz(context, missing=missingrJ)r r'rz = TemplateReference(context)Tzparent_template = NonerMif parent_template is not None:z4yield from parent_template.root_render_func(context)z=async for event in parent_template.root_render_func(context):z yield eventblock_)r'superrz = context.super(z, block_rBz_block_vars = {}c3*K|] }|d| yw)z: block_Nrrs r4rgz/CodeGenerator.visit_Template..s!K!QE!"5!Ksz blocks = {r&c30K|]\}}|d|yw)rNrris r4rgz/CodeGenerator.visit_Template..sGtq!1#Qqc Grlz debug_info = ).rrCrSruntimerrrBr,rr6rVfindr Extendsfind_allrrrr ImportedName importnamerrrsplitrErrsr+rrQrrUrNrrrrr;r/rr>rrzrrr)r'r)r*r0rrexported_namesenvenv have_extendsrimport_impaliasmoduleobjrPrSrr blocks_kv_str debug_kv_strs r4visit_TemplatezCodeGenerator.visit_Template=s<}555}t//;+%    $ $#H~$=>N#H-N 4tyy7PPQ,Gyy/t; ]]5;;/EzzT[[( F5::.?N&+DKK #0 }}U%7%78G!!)<)<<((373L3L3NN##C(5#:"%**S!"4KFCNNU6((3%tE7#KLNNWSEeW#=>9  ./ yy !!:6(" EQ    h _TYY : :--11&9C NNcU"?@ A ""4(+//%1%P$:P:P6P"  NN3 4  tyy)  5) $7  )) @A KKM##,,UVS }-  LL$"8"889 : ;;,,.KD% NN99X_-..GxrR  KKM     /K&*K #(5FGJ#!));;FC#&CDE*$!));;GD#&7xxvQOP    , ,U 3 $K  NN- .   [ )  " "5:: . OOEJJ 4   [D  A LLN7/: !Kt{{!KK  ]O26a@xxGtGG  |&678r6cPd}|jrB|jry|jdkDr&|jd|j |dz }|j r|j |}n|j}|jr`|jd|jd||j |jd|jd||j|jjs0|j$|jd |jd |d |ne|j|jd |jd |d ||j |jd||j|j|y)z.Call a block and register it for the template.rNif parent_template is None:r zif len(context.blocks[z]) <= 1:z+raise TemplateRuntimeError("Required block z not found")zyield from context.blocks[z][0](rBzfor event in context.blocks[rJevent)rrrrrscopedrrrequiredrSrrCrBrrCr)r'r)r*rrs r4rzCodeGenerator.visit_Blocksl >>%%""Q&<=   ;;))%0G**,G == NN3DII=I4 P KKM NN=dii],W  LLN((U\\-A NN,TYYMwiqI4  NN$$&'(##'99-uWIRA  KKM   gu - LLN Ur6c|js|jd|j|jdkDrd|js!|j d|j |j d|jr t|j|j d||j|j||jd|jd|j d|j |j d |j|jrd |_|xjd z c_y ) zCalls the extender.z,cannot use extend from a non top-level scoperrz5raise TemplateRuntimeError("extended multiple times")z+parent_template = environment.get_template(r?rBz9for name, parent_block in parent_template.blocks.items():z8context.blocks.setdefault(name, []).append(parent_block)Tr N)rrrrrrrrrr2templaterFrSrr'r)r*s r4 visit_ExtendszCodeGenerator.visit_Extendss~~ IIDdkk R    " ))@A NNR S%%"n$  DdK 4==%( R }A&' RS  QR  ??%)D " q r6c|jr!|jd|jd}t|jt j rTt|jjtrd}nct|jjttfr9d}n6t|jt jt jfrd}|jd|d||j|j||jd|jd|jrs|j!|jd |j|jd |j!|jd |jd }|j"r5|j|j%d |j'|dn;|j(j*r|jdn|jdd}|s2|j|j-d||j!|jr|j!yy)zHandles includes.r&get_or_select_template get_templateselect_templateztemplate = environment.r@r?rBzexcept TemplateNotFound:rrFzUfor event in template.root_render_func(template.new_context(context.get_all(), True, z)):zGfor event in (await template._get_default_module_async())._body_stream:z6yield from template._get_default_module()._body_streamTrN)ignore_missingrrrYrr Constr`rsrtruTupleListr2rFrSr with_contextrCrprCrBr)r'r)r* func_nameskip_event_yields r4 visit_IncludezCodeGenerator.visit_Include s    NN6 " KKM, dmmU[[ 1$----s3* DMM//%?-   UZZ'@ A)I 0 1=tD 4==%( R }A&'    LLN NN5 6 KKM NN6 " LLN NN7 # KKM     NN$$&'(++E2338     & & NN!  NNS T#  KKM   gu - LLN    LLN r6c|j|jdd|j|j||jd|jd|j r;d|jd}|j|d|j |dy|jd |jdd y) Nawait zenvironment.get_template(r?z). make_module_asyncz(context.get_all(), True, rB_get_default_modulez (context))rFrCr2rrSrrp)r'r)r*f_names r4_import_commonzCodeGenerator._import_common<s d''122KLM 4==%( R }B'(   "4#4#4X#>"?@F JJ(4T5L5LU5S4TTUV  JJ,T->->x-H,IS Tr6c~|j|jj|jd||jr|j d|jd|j |||jr<|jjds |jd|jdyyy)zVisit regular imports.r1rrrcontext.exported_vars.discard(rBN)rrrPr8rrFr startswithrs r4 visit_ImportzCodeGenerator.visit_ImportKs %--++DKK89=tD >> JJt{{oT: ; D%( >>$++"8"8"= NN;DKK?!L M#>>r6c |j||jd|j|g}g}|jD]%}t |t r|\}}n|}|j jj|d|d|j djj|d|jd|j|d|}|j jj|d|d |d |jjs|j||jd r|j|(|rst|d k(r6|d }|j d|djj|n/dj!fd|D}|j d|d|r\t|d k(r|j d|d d ydj!t#t$|} |j d| dyy)zVisit named imports.zincluded_template = z = getattr(included_template, z , missing)rKrLz9the template {included_template.__name__!r} (imported on z%) does not export the requested name z = undefined(fz, name=rBrr rrrr?c3^K|]$}|djj|&ywrk)rrP)rerSr*s r4rgz1CodeGenerator.visit_FromImport..{s1%?Cthb!2!24!8 9:%s*-rrrz)context.exported_vars.difference_update((rN)rrFrr|rYrtrrrPrrhrrr rrSr6rra) r'r)r* var_namesdiscarded_namesrSrmessagenames_kvrs ` r4visit_FromImportzCodeGenerator.visit_FromImportVs/ T )* D%( JJD$&" e NN==$$U+,-//3hjB  NNS!2!25!9 :,G H KKM!!%t!4 5677;h@  NN==$$U+,N7+WTHTUV  LLN~~  ''',#**51/2 9~" |thd5==;L;LT;R:STU99%GP%!7zEF ?#q(!?PQ@R?UUVWX IIc$&@A ? {"M r6c"|j}d|_|j}|j}|jxsOdt|j ddvxs/t d|j tjD}d}|r|jjd}|jj|d|jr|jj|d |jr|j}|jj|d |j|j!|d |j|j#|j%||j|j'd d |j)|j*||j-d|j-|j'dd|j-d|j#|jd|j|j)|j||j-d|j#|jd|j)|j*||j/d|j1|d|jrV|j|j!dd||j#|j3||j2|_|r|j|d|j tj4D]>} | j6dk(s| j8dk(s#|j;d| j<@|jr$|j} |j| d|j|j'd d ||j)|j*||r(|j-d|d|j'ddn|j-d|jr|j-d|jr|j-dnn|j>j@r|s|j-d |j)|jB||j>j@r|s|j-d!|jr|j-d!|jr|j-d"n|j-|rd#nd|j#|j%||jd$|jE|jF||jr|j d%|j/|j1||jxr |j |jrs|jd d|j#|j%||jE|j||j1||j/|jr|jI||j/|jK|||j-|j'd&d'|j>j@r|j-d |j)|jB||j>j@r|j-d!|j-d(|jM||jNr3|jNd)jQ|jjRyy)*NTloop)rQ)only)rc34K|]}|jywr.)r)rers r4rgz*CodeGenerator.visit_For..sHE5<<HrrQ) for_branchelsetestz(fiter):z async for zfor rgzauto_aiter(fiter)fiter:rKrrMz%(reciter, loop_render_func, depth=0):r2storez8Can't assign to special loop variable in for-loop targetz = 1r?Asyncz LoopContext(r@reciterz auto_aiter(rBz&, undefined, loop_render_func, depth):z , undefined):z_loop_vars = {}z = 0rzloop(z, loop)r*)*rr recursiveriter_child_nodesrrr rrrUrNelse_rrrrErr;rCr2r8rFrr>rrrrSrrrCrBrrrQrrrrdifference_updatestores) r'r)r*r test_frame else_frame extended_looploop_refloop_filter_funcrSiteration_indicators r4 visit_ForzCodeGenerator.visit_Fors[[] $ [[] [[] NN It44)4DiPQ IHT]]5;;-GHH  !));;FCH'''@ ::    + +DV + D 99#88:     + +DV + D NNdii(89:(CTYY O KKM   Z ( NN4,,\6B C JJt{{J / JJv  JJt(()> NN99V$%%JKT  KKM KK #!+ 1 1J   NNhZz2 3MM%**-Dxx7"tyyF': NKK. ::"&";";"=  NN12$7 8 t((v>E 4;; +  JJH:T$*;*;G*D)E\R S JJv  99 JJ*+1- . >> JJy !(( =) JJtyy% ((( 3 99 JJsO >> JJ? @ JJ-S A  $ ()  :. :: NN12$7 8   $..*K^   :: NNS!4 5Q7 8 KKM   Z ( OODJJ 3   Z ( LLN >>  ' ' 3 LLN   UD ) JJ$++H56e< =(( =) JJtyy% ((( 3 JJy ! NN5 !      r " 4 4Z5G5G5N5N O r6c|j}|jd||j|j||j d|j |j |j||j|jD]}}|jd||j|j||j d|j |j |j||j|jrN|jd|j |j |j||jyy)NrKrzelif r) rrr2rrFrrrQrelif_r)r'r)r*if_framers r4visit_IfzCodeGenerator.visit_Ifs::< ud# 499h' 3   8, ZZE NN7E * JJuzz8 , JJsO KKM OOEJJ 1 LLN   :: NN7 # KKM OODJJ 1 LLN r6c|j||\}}|j|jrY|jj ds|j d|jd|j d|jd|j |jj|jd|j||y)NrrrBrrr1) r^rrrSrrFrrrPre)r'r)r* macro_framerYs r4 visit_MacrozCodeGenerator.visit_Macro(s!%u!= Y  >>99'', 7 }AFG NN]499-t< = emm'' 23378 y+.r6c|j||\}}|jd|j|||j|||j |j |d|j |y)Nz caller = T)forward_caller)r^rrer visit_Callcallr)r'r)r* call_framerYs r4visit_CallBlockzCodeGenerator.visit_CallBlock2sc $e < I {# y*- %  5> ur6cv|j}|jj||j||j ||j |j ||j|||j|j||j||j|yr.) rrrNr;rrrQrrfilterrr>)r'r)r* filter_frames r4visit_FilterBlockzCodeGenerator.visit_FilterBlock:s{{} ))$/ & L!  <0 % $++|4 u &r6c|j}|jj||j|t |j |j D]J\}}|j|j|||jd|j||L|j|j||j|yNr1) rrrNr;ziptargetsvaluesrr2rFrrQr>)r'r)r* with_framer8exprs r4 visit_WithzCodeGenerator.visit_WithEs[[] ''- $ dkk:LFD LLN JJvz * JJu  JJtU # ;  :. $r6c^|j||j|j|yr.)rr2r)rs r4visit_ExprStmtzCodeGenerator.visit_ExprStmtQs  T 499e$r6cteZdZUejej defed<ejeed<y)CodeGenerator._FinalizeInfo.constsrcN)rrrr8rCallablers__annotations__rr6r4 _FinalizeInforUs,zz!**S#X.// ZZ_r6rr`ct|S)zThe default finalize function if the environment isn't configured with one. Or, if the environment has one, this is called on that function's output for constants. )rsr{s r4_default_finalizezCodeGenerator._default_finalizeYs 5zr6 _finalizecbj jSjx}d}jjrd}jjtj dtj dtjdijt j}d}|(dtjdtjffd }n4||d }|dk(r(dtjdtjffd }j||_jS) aBuild 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(rcontext.eval_ctxrCr`r%c |Sr.r)r`r] env_finalizes r4finalizez.CodeGenerator._make_finalize..finalizes"<#677r6r?c6j|Sr.)rC)r`r]rr's r4rz.CodeGenerator._make_finalize..finalizes&|D4D4De'LMMr6) rrrCrrr eval_contextgetfrom_objr8r9r)r'rrpass_argr]rs` @@r4_make_finalizezCodeGenerator._make_finalizecs >> %>> !"3337    $ $)C++44L  )%%'9$$mc!!,/ H8AEE8aee8hZr*},NN!%%N++Hc:~~r6groupc*tt|S)zGiven a group of constant values converted from ``Output`` child nodes, produce a string to write to the template module source. )rar)r'r%s r4_output_const_reprz CodeGenerator._output_const_reprs F5M""r6rc|j|j}|jjr t|}t |t j r t|S|j|S)aCTry 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_constr0rrrYr TemplateDatarsr)r'r)r*rrs r4_output_child_to_constz$CodeGenerator._output_child_to_constsW enn- >> $ $5ME dE.. /u: ~~e$$r6c|jjr|jdn9|jjr|jdn|jd|j|j|jyy)zXOutput extra source code before visiting a child of an ``Output`` node. z1(escape if context.eval_ctx.autoescape else str)(zescape(zstr(N)r0r1rFrrr'r)r*rs r4_output_child_prezCodeGenerator._output_child_presb >> " " JJJ K ^^ & & JJy ! JJv  << # JJx|| $ $r6cb|jd|j|jdyy)zWOutput extra source code after visiting a child of an ``Output`` node. rBN)rFrr-s r4_output_child_postz CodeGenerator._output_child_posts) 3 << # JJsO $r6c~|jr.|jry|jd|j|j }g}|j D]} |j s.t|t jst j|j|||}|r(t|dtr|dj|{|j|g|j[t|dk(r|j|jdn|j|jd|j|D]}t|trG|j!|}|j|jd|zE|j|dzZ|j|jd|n|j#||j%||||j'|||j)||||j|j+d|j1|j-|jt|dk(rdnd |jr|j-yy#t jtf$r|j|YbwxYw) Nrr*r rz .extend((rrbrBr)rrrrr$r rrYr* Impossibler+ Exceptionr rurrSr'rr.r2r0rFr) r'r)r*rrQchildritemvals r4 visit_OutputzCodeGenerator.visit_Outputs>  % %%% NN8 9 KKM&&(;= ZZE NN"%););<**,,33E5(K 48T2R& UG$/ 2 << #4yA~%,,x89%,,y9: KKMD$%--d3<<'NN8c>2NN39-<<'NN8T2LL&&&tUH= 4'''eX><<+JJsO+. << # LLN NN#d)q.3d ;  % % LLN &_$$i0  E"  sA J*J<;J<c|j|j||j|j||j d|j|j ||j |yr)rrr2r8rFr)rrs r4 visit_AssignzCodeGenerator.visit_AssignsX !!# T 4;;& 5 499e$   'r6cv|j|j}d|_|jj ||j ||j ||j|j||j||j|j||jd|j|j|j|n|jd|j d|jd|j||j!|y)NFz9 = (Markup if context.eval_ctx.autoescape else identity)(concat(rB)rrrrrNr;rrrQrr2r8rFrrrr>)r'r)r*rs r4visit_AssignBlockzCodeGenerator.visit_AssignBlock!s !!#kkm ,1 (((. % K   ;/ T 4;;& NO ;; "   dkk; 7 JJ!3!3 4A6 7 3   ' %r6c |jdk(rX|js|js |jr4|jr(|jdj |j |jj|j }|jdk(r`|jj|}||dtk(r|j|r&|jd|j d|d|dy|j|y) Nrr*rrz(undefined(name=z) if z is missing else rB) rrrrrrrSrrP find_loadrrrF)r'r)r*rPrs r4rzCodeGenerator.visit_Name9s 88w  NNe..%2C2C!!""2&**4995mm * 88v ==**3/D G1144S9 &tyym5=NseSTU 3r6c|jj|j}|jd|d|j |jd|j |j|d|j dy)Nzif not isinstance(z , Namespace):zMraise TemplateRuntimeError("cannot assign attribute on non-namespace object")r'r()rrPrSrrrattr)r'r)r*rPs r4 visit_NSRefzCodeGenerator.visit_NSRefRsumm * +C5 >?   B   #a }A./r6c|j|j}t|tr|j t |y|j t |yr.)r)r0rYrprFrsra)r'r)r*r6s r4 visit_ConstzCodeGenerator.visit_Const`s>mmENN+ c5 ! JJs3x JJtCy !r6c |jt|j|jy#tj $r"|jd|j dYywxYwNz6(Markup if context.eval_ctx.autoescape else identity)(rB)rFrar)r0r r2datars r4visit_TemplateDataz CodeGenerator.visit_TemplateDatagsW  JJtDMM%..9: ;  JJH UVW  s362A+*A+c|jdd}t|jD]*\}}|r|jd|j||,|j|dk(rdydy)Nr@r*r?rz,)rBrFrOrzr2r'r)r*r\r5s r4 visit_TuplezCodeGenerator.visit_Tupleos_ 3"4::.IC 4 JJtU #/ 3!84--r6c|jdt|jD]*\}}|r|jd|j||,|jdy)Nr'r?r(rIrJs r4 visit_ListzCodeGenerator.visit_ListxsN 3"4::.IC 4 JJtU #/ 3r6c:|jdt|jD]a\}}|r|jd|j|j||jd|j|j |c|jdy)Nrmr?rr)rFrOrzr2rr`rJs r4 visit_DictzCodeGenerator.visit_Dictsp 3"4::.IC 4 JJtxx ' JJt  JJtzz5 ) / 3r6+-*/z//z**%andorznot c|jjrd}n|jjrd}nd}|j|d|jD]%}|j |||jd'|jdy)Nz8(markup_join if context.eval_ctx.volatile else str_join) markup_joinstr_joinz((r?r)r0r1rrFr r2)r'r)r*rr"s r4 visit_ConcatzCodeGenerator.visit_Concatst >> " "RI ^^ & &%I"I i[#$::C JJsE " JJt  4r6c|jd|j|j||jD]}|j|||jdy)Nr@rB)rFr2r opsrIs r4 visit_ComparezCodeGenerator.visit_ComparesF 3 499e$((B JJr5 ! 3r6c|jdt|jd|j|j|y)NrA)rF operatorsr<r2r rs r4 visit_OperandzCodeGenerator.visit_Operands3 Qy)*!,- 499e$r6c:|jjr|jd|jd|j|j||jd|j d|jjr|jdyy)N(await auto_await(zenvironment.getattr(r?rBr)rCrBrFr2r)r@rs r4 visit_GetattrzCodeGenerator.visit_Getattrsv    $ $ JJ+ , )* 499e$ R }A&'    $ $ JJt  %r6cvt|jtjr[|j |j ||j d|j |j||j dy|jjr|j d|j d|j |j ||j d|j |j||j d|jjr|j dyy)Nr'r(rbzenvironment.getitem(r?rBr) rYr"r Slicer2r)rFrCrBrs r4 visit_GetitemzCodeGenerator.visit_Getitems dhh , JJtyy% ( JJsO JJtxx ' JJsO(( /0 JJ- . JJtyy% ( JJt  JJtxx ' JJsO(( 4 )r6c:|j|j|j||jd|j|j|j||j.|jd|j|j|yy)Nr)startr2rFstoprrs r4 visit_SlicezCodeGenerator.visit_Slicesq :: ! JJtzz5 ) 3 99 JJtyy% ( 99 JJsO JJtyy% ( !r6 is_filterc#K|jjr|jd|r[|j|j|jd|jjj |j}nZ|j|j |jd|jj j |j}|?|js3|rdnd}|jd|d|jd|jtjdtjd tjd ij tj|}||j|d d|j|||jd |jjr|jd yyw)Nrbr@rrzNo r+rrrrCr?rBr)rCrBrFrrSr!rrrrrrr r"r$)r'r)r*rkrE type_namer#s r4_filter_test_commonz!CodeGenerator._filter_test_commons    $ $ JJ+ ,  JJ$,,tyy12!4 5##++// :D JJ$**TYY/02 3##))--dii8D < 0 0$-6I III;gdii]!<= WU\\N!45 6 6 6s CCC(c|j||d5|j|j|dddy#1swYyxYwr)rnr2r)rs r4rzCodeGenerator.visit_Tests;  % %dE5 9 ) JJtyy% ( ) ) )s :Ac@jdfd }jdjjjdjjjd|jdy)Ncjjjyjdjdy)Nz1cond_expr_undefined("the inline if-expression on z6 evaluated to false and no else section was defined."))expr2r2rFrh)r*r)r'sr4 write_expr2z1CodeGenerator.visit_CondExpr..write_expr2 sLzz% 4::u- JJMM$'()*+ r6r@z if z else rBr)rrFr2expr1r)r'r)r*rts``` r4visit_CondExprzCodeGenerator.visit_CondExprsl   3 4::u% 6 499e$ 8  3r6rc8|jjr|jd|jjr|jdn|jd|j |j ||rddind}|j rddini}|jrddini}|r|j|fi|n|s|r t|fi|}|j||||jd|jjr|jdyy) Nrbzenvironment.call(context, z context.call(rG _loop_vars _block_varsrBr) rCrBrFrDr2r)rrrryr$)r'r)r*rr loop_kwargs block_kwargss r4rzCodeGenerator.visit_Call3s    $ $ JJ+ ,    % % JJ3 4 JJ ' 499e$/=(+4 6;6F6F|\2B 9>9J9J }5PR  L   <| < L <|" 4::u%r6c|jd|j|j||jdy)NzMarkup(rBrFr2r rs r4visit_MarkSafezCodeGenerator.visit_MarkSafePs+ 9 499e$ 3r6c|jd|j|j||jdyrErrs r4visit_MarkSafeIfAutoescapez(CodeGenerator.visit_MarkSafeIfAutoescapeUs. KL 499e$ 3r6c@|jd|jzy)Nz environment.rFrSrs r4visit_EnvironmentAttributez(CodeGenerator.visit_EnvironmentAttribute\s >DII-.r6cZ|jd|jd|jy)Nzenvironment.extensions[z].)rF identifierrSrs r4visit_ExtensionAttributez&CodeGenerator.visit_ExtensionAttributeas' ,T__,?r$))MNr6cT|j|j|jyr.)rFrrrs r4visit_ImportedNamez CodeGenerator.visit_ImportedNamefs 4&&t78r6c:|j|jyr.rrs r4visit_InternalNamez CodeGenerator.visit_InternalNameis 499r6c&|jdy)Nr)rFrs r4visit_ContextReferencez$CodeGenerator.visit_ContextReferencels 9r6cD|j|j|yr.)rFrrs r4visit_DerivedContextReferencez+CodeGenerator.visit_DerivedContextReferenceqs 4&&u-.r6c(|jd|y)Ncontinuerrrs r4visit_ContinuezCodeGenerator.visit_Continuevs z4(r6c(|jd|y)Nbreakrrrs r4 visit_BreakzCodeGenerator.visit_Breakys w%r6c|j}|jj||j||j |j ||j |yr.)rrrNr;rrQr>)r'r)r* scope_frames r4 visit_ScopezCodeGenerator.visit_Scope|sOkkm ((. %  ;/ %r6c|j}|j|d|j||j|d|j|j||j ||j d}|jj||j||j|j||j||jy)Nr1z.vars = T)r)rrrr2rr{rrrNr;rrQr>r})r'r)r*rrs r4visit_OverlayScopez CodeGenerator.visit_OverlayScopes'') #c$"5"5e"? #h'( 4<<' ##C(kk4k0 ((. %  ;/ % ""$r6c~|jD]}|jd|jd|j|j| |jj |j }t|j |j|y#tj$rd|j _ YwxYw)Nzcontext.eval_ctx.r1T) optionsrrr2r`r)r0setattrr r2r1)r'r)r*keywordr6s r4visit_EvalContextModifierz'CodeGenerator.visit_EvalContextModifiers||G NN.w{{m3? @ JJw}}e , :mm,,U^^< S9$ ## /*.' /s %B$B<;B<cJ|j}|jj}|j|d|j |||j D]}|j |||jj||jd|dy)Nz = context.eval_ctx.save()zcontext.eval_ctx.revert(rB)rr0saverrrQr2revert)r'r)r* old_ctx_name saved_ctxr4s r4visit_ScopedEvalContextModifierz-CodeGenerator.visit_ScopedEvalContextModifiers002 NN'')  ,'ABC &&tU3YYE JJue $ i( 1,qABr6NFTrr)r r.)Nr)zasync r)rrrr8rrsTextIOrnrpropertyrWrorrr+rrrrr NoderrrrrrFrrrCallrrMappingr9r$r/r;r>rCrErrrrr^rerhrprsrVrXrWr{r}rr4rrrrrZrrrrrIncluderImport FromImportrrrForrIfrrr FilterBlockrWithr ExprStmtr NamedTupler staticmethodrrrr$r'r7r+r.r0Outputr7Assignr9 AssignBlockr<rrNSRefrArrCr*rGrKrrMDictrOrM visit_Add visit_Sub visit_Mul visit_Divvisit_FloorDiv visit_Pow visit_Mod visit_Andvisit_OrrR visit_Pos visit_Neg visit_Notr;ConcatrZComparer]Operandr`GetattrrcGetitemrfrerjrIteratorrnrrCondExprrvrKeywordr}MarkSaferMarkSafeIfAutoescaperEnvironmentAttributerExtensionAttributerrr InternalNamerContextReferencerDerivedContextReferencerContinuerBreakrScoper OverlayScoperEvalContextModifierrScopedEvalContextModifierrrr6r4r(r(,s (, G4"G4jjoG4**S/ G4  188$ G4  G4G4 G4R*4** LLSL]L,c, /E/d/ 5:99-19 9("C""<>4> BB4BDBHHCHQTH222Q GGEKK89Q BGQ  !Q f  8  E  d  UZZC!!#! +II$I$6C6D65S5T5,11### UEUcU3c3d3 ))O)O4)O\@Du9NNu9+,::e+<u9 u9n) )E)d)V(!%--(!(!$(!T1%--11$1f UGGELL%*:*::; UDI U  U N Ne N N0U%5%50e00dIPeiiIPIP$IPVUXXe*/ /E/d/EOOEd 'e&7&7 ' '$ ' %uzz %% %D %%5>>%%%D% 155,0Iqzz-(/. .`# 155(9#c#%JJ%',%8E% %*%JJ%',%8E% % JJ ', 8E   MMeMM^((e((&e&7&7&&$&0uzz%D2 0 0E 0d 0" "E"d"u'9'9%D. .E.d.uzz%Duzz%DC IC IC IC I &ND!IC IE"I4 H3I3I6"I  e   %--$%%--%%$% %--  $  !%--!!$!!() )E)d)'GGELL%**45'>C'PT' D ''R66e666 )uzz)%)D))5>>%D,EJJJ',>B ,&%--&&$& 5>>%D ..7< /../7</ / O,,O5:O O 9u'9'99%9D9u'9'9%D**38  /11/:?/ / )5>>)%)D)& &E&d&& &E&d& %u'9'9 %% %D % :-- :6; :  : C33 Crs26%$2.&*(*  ??"( AIIcCJ/0         2Q 21 2 CAJJ'PRV'VW* ZZ%//7;TAB0$( .. **S/jjo  JJqxx   ZZ_04"  ::ejj ! *+**S/ UU3Z &&PPfJ,J'k'&&K&,9|CK|Cr6