f)ddlZddlmZddlmZdZdZdZdZ dd ejejd ejd d d fd Z ddejd ejd d d fdZGdd ZGddeZGddeZy)N)nodes) NodeVisitorparamresolvealias undefinedrparent_symbolsSymbolsreturncdt|}t|}|D]}|j||SN)parent)r FrameSymbolVisitorvisit)rr symvisitornodes Z/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/jinja2/idtracking.py find_symbolsr s3  (C %G d Jrc@t|}|j||Sr)r analyze_node)rr rs rsymbols_for_noders!  (CT Jrc (eZdZ ddejddejeddfdZdejdejddfdZ dd e d ejeje eje fde fd Z d e dejejfd Zd e deje fdZd e de fdZddZd e ddfdZd e de fdZd e ddfdZdej*dddfdZdej.e e ffdZdej2e fdZy)r Nrlevelr c||d}n|jdz}||_||_i|_i|_t |_y)Nrr)rrrefsloadssetstores)selfrrs r__init__zSymbols.__init__sF =~ q(  &( )+ "%% rrkwargsc @t|}|j|fi|yN) RootVisitorr)r"rr$rs rrzSymbols.analyze_node.sd# d%f%rnameloadcjd|jd|}||j|<|||j|<|S)Nl__)rrr)r"r(r)idents r _define_refzSymbols._define_ref2s@TZZL$( $   $DJJu  rtargetc||jvr|j|S|j|jj|Syr&)rr find_load)r"r/s rr1zSymbols.find_load;s? TZZ ::f% % ;; ";;((0 0rc||jvr|j|S|j|jj|Syr&)rrfind_refr"r(s rr3zSymbols.find_refDs> 499 99T? " ;; ";;''- -rcJ|j|}|td|d|S)NzFTried to resolve a name to a reference that was unknown to the frame ())r3AssertionError)r"r(rvs rrefz Symbols.refMs: ]]4  : **.4  rcHtj|j}|jj |j|j j |_|jj |_|jj |_|Sr&) object__new__ __class____dict__updatercopyrr!)r"r8s rr@z Symbols.copyVsg ^^DNN + 4==))).."::??$KK$$&  rc|jj|||jvr]|j7|jj |}||j |t |fy|j |tdfyyN)r))r!addrrr3r.VAR_LOAD_ALIASVAR_LOAD_UNDEFINED)r"r( outer_refs rstorez Symbols.store^s  tyy {{& KK006 ($$T0K$L   T);T(B  C !rcj|jj||j|tdfSrB)r!rCr.VAR_LOAD_PARAMETERr4s rdeclare_parameterzSymbols.declare_parameterps. ,>+EFFrcZ|j||j|t|fyyrB)r3r.VAR_LOAD_RESOLVEr4s rr)z Symbols.loadts/ ==  &   T)94(@  A 'rbranch_symbolsci}|D]:}|jD])}||jvr|j|ddz||<+<|D]q}|jj|j|jj|j|jj|js|j D]\}}|t |k(r|j|}|Jd|j3|jj|}|t|f|j|<nt|f|j|<y)Nrrzshould not happen) r!getrr?ritemslenr3rrDrL) r"rMr!branchr/rr( branch_count outer_targets r branch_updatezSymbols.branch_updatexs)#%$F --T[[(!'FA!6!:v(% "C II  SXX & JJ  cii ( KK  szz *" #),,. D,s>22]]4(F% :': :%{{&#{{33D9 +*8,)GDJJv&"2D!9DJJv #1rci}|}|Bt|jD]}||vs|j|||<|j}|B|Sr&)sortedr!r3r)r"r8rr(s r dump_storeszSymbols.dump_storessX!&*t{{+r>#}}T2BtH,;;D  rct}|}|O|jjD]#\}\}}|tk(s|j |%|j }|O|Sr&)r rrPrIrCr)r"r8rr/instrr,s rdump_param_targetszSymbols.dump_param_targetssb U&*&*jj&6&6&8" ..FF6N'9;;D  r)NNr&)r r )__name__ __module__ __qualname__tOptionalintr#rNodeAnyrstrTupler.r1r3r9r@rGrJr)SequencerUDictrXSetr[rrr r svMQ (jj+ (;<::c? (  (&&quu&& LP zz!''#qzz#2F*GH  155(9SQZZ_D#D$D$GcGcGBBB:AJJy,A:d:6 QVVCH-  AEE#J rc eZdZddZdej dejddfdZeZ eZ eZ eZ eZ eZeZdej dejddfdZdej$dejddfdZdej(dejddfd Z ddej,d edejddfd Zdej2dejddfd Zdej d ejdejddfdZy)r'r Nc$t||_yr&)r sym_visitorr"symbolss rr#zRootVisitor.__init__s-g6rrr$c d|jD]}|jj|yr&iter_child_nodesrlrr"rr$childs r _simple_visitzRootVisitor._simple_visits)**,E    " "5 )-rc \|jD]}|jj|yr&bodyrlrrrs rvisit_AssignBlockzRootVisitor.visit_AssignBlock$YYE    " "5 )rc h|jdD]}|jj|y)N)call)excluderprrs rvisit_CallBlockzRootVisitor.visit_CallBlocks.**9*=E    " "5 )>rc \|jD]}|jj|yr&rvrrs rvisit_OverlayScopezRootVisitor.visit_OverlayScoperyr for_branchc |dk(r4|jj|jd|j}n{|dk(r |j}ni|dk(rY|jj|jd|j %|jj|j yt d|r#|D]}|jj|yy)NrwT)store_as_paramelsetestzUnknown for branch)rlrr/rwelse_r RuntimeError)r"rrr$rRitems r visit_ForzRootVisitor.visit_Fors      " "4;;t " DYYF 6 !ZZF 6 !    " "4;;t " Dyy$  &&tyy1 34 4   &&t, rc |jD]}|jj||jD]}|jj|yr&)targetsrlrrw)r"rr$r/rss r visit_WithzRootVisitor.visit_WithsFllF    " "6 *#YYE    " "5 )rargscDtdt|j)NzCannot find symbols for )NotImplementedErrortyper\)r"rrr$s r generic_visitzRootVisitor.generic_visits !$dejddfdZ dejBdejddfdZ"dejFdejddfdZ$dejJdejddfdZ&y)rzA visitor for `Frame.inspect`.r Nc||_yr&)rnrms rr#zFrameSymbolVisitor.__init__s  rrrr$c F|s|jdk(r&|jj|jy|jdk(r&|jj |jy|jdk(r&|jj |jyy)z2All assignments to names go through this function.rrGr)N)ctxrnrJr(rGr))r"rrr$s r visit_NamezFrameSymbolVisitor.visit_Namesq TXX0 LL * *499 5 XX LL  tyy ) XX  LL  dii ( rc N|jj|jyr&)rnr)r(r"rr$s r visit_NSRefzFrameSymbolVisitor.visit_NSRefs $))$rc bj|jfijdtjt j ddffd }||j}||j}||jxsd}jj|||gy)Nrr r cxjx_}|D]}j|fi_|Sr&)r@rnr)rr8subnoder$original_symbolsr"s r inner_visitz0FrameSymbolVisitor.visit_If..inner_visitsC 0 5 5 7 7DL2  7-f-!,DLIrri) rrrnr_Iterablerrbrwelif_rrU)r"rr$r body_symbols elif_symbols else_symbolsrs` ` @rrzFrameSymbolVisitor.visit_Ifs 499''<< qzz%**5 ) #499- "4::. "4::#34  ""L, #MNrc N|jj|jyr&)rnrGr(rs rrzFrameSymbolVisitor.visit_Macros 499%rc t|j|fi||jj|jyr&)rrnrGr/rs r visit_ImportzFrameSymbolVisitor.visit_Imports-4*6* 4;;'rc |j|fi||jD]L}t|tr|jj |d2|jj |Ny)Nr)rnames isinstancetuplernrG)r"rr$r(s rvisit_FromImportz#FrameSymbolVisitor.visit_FromImportsW4*6*JJD$& ""47+ ""4( rc x|j|jfi||j|jfi|y)z'Visit assignments in the correct order.N)rrr/rs r visit_AssignzFrameSymbolVisitor.visit_Assigns0 499'' 4;;)&)rc >|j|jfi|y)zqVisiting stops at for blocks. However the block sequence is visited as part of the outer scope. N)riterrs rrzFrameSymbolVisitor.visit_For#s  499''rc >|j|jfi|yr&)rr{rs rr}z"FrameSymbolVisitor.visit_CallBlock)s 499''rc >|j|jfi|yr&)rfilterrs rrz$FrameSymbolVisitor.visit_FilterBlock,s 4;;)&)rc H|jD]}|j|yr&)valuesr)r"rr$r/s rrzFrameSymbolVisitor.visit_With/skkF JJv "rc >|j|jfi|y)zStop visiting at block assigns.N)rr/rs rrxz$FrameSymbolVisitor.visit_AssignBlock3s 4;;)&)rc y)zStop visiting at scopes.Nrirs rrzFrameSymbolVisitor.visit_Scope7rc y)zStop visiting at blocks.Nrirs rrzFrameSymbolVisitor.visit_Block:rrc y)z!Do not visit into overlay scopes.Nrirs rrz%FrameSymbolVisitor.visit_OverlayScope=rrr)F)'r\r]r^__doc__r#rNameboolr_rcrNSRefrIfrMacrorImportr FromImportrAssignrrrrr} FilterBlockrrrrrxScoperBlockrrrrirrrrs$(8= )JJ )04 )HI )  )% %quu%%OUXXOO4O$& &quu&&(((4()U%5%5))4)***4* (eii(155(T( (EOO(quu((*e&7&7*155*T*uzzQUUt*e&7&7*155*T*' 'quu''' 'quu''0u'9'90QUU0t0rrr&)typingr_rrrrIrLrDrErrbr`rrr r'rrirrrs  LP ::ejj !34::i3H?C **&'jj&;MM`7V+7VtV0V0r