Viewing File: /usr/lib/python2.7/site-packages/jinja2/compiler.pyo


Rc@sdZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZmZmZdd
lmZmZmZmZmZmZmZidd6d
d6dd6dd6dd6dd6dd6dd6ZeedrdZndZdZ e!e"e dd1Z d1e$dZ%dZ&d Z'd!e(fd"YZ)d#e(fd$YZ*d%e+fd&YZ,d'e
fd(YZ-d)e
fd*YZ.d+e
fd,YZ/d-e0fd.YZ1d/e
fd0YZ2d1S(2s
    jinja2.compiler
    ~~~~~~~~~~~~~~~

    Compiles nodes into python code.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i(tchain(tdeepcopy(t	iskeyword(tnodes(tEvalContext(tNodeVisitor(tTemplateAssertionError(tMarkuptconcattescape(t
range_typetnextt	text_typetstring_typest	iteritemstNativeStringIOtimaps==teqs!=tnet>tgts>=tgteqt<tlts<=tlteqtinsnot intnotinRtitemscsdfd}|S(Ni*csdS(N(((tx(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytf-s((R((Rs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytunoptimize_before_dead_code+st__closure__cCsct|tjs!tdnt|||||}|j||dkr_|jjSdS(s+Generate the python source for a node tree.s Can't compile non template nodesN(	t
isinstanceRtTemplatet	TypeErrort
CodeGeneratortvisittNonetstreamtgetvalue(tnodetenvironmenttnametfilenameR&t
defer_initt	generator((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytgenerate7s
c
Cs|dks$|tks$|tkr(tSt|ttttt	t
ftrQtSt|tt
ttfrx|D]}t|sstSqsWtSt|trx:t|D],\}}t|stSt|stSqWtStS(s)Does the node have a safe representation?N(R%tNotImplementedtEllipsistTrueR tbooltinttfloattcomplexR
RR
ttupletlisttsett	frozensett
has_safe_reprtFalsetdictR(tvaluetitemtkey((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR:Bs$$
cCsIt|}y"x|D]}|j|qWWntk
rAnX|jS(sCheck if the names passed are accessed undeclared.  The return value
    is a set of all the undeclared names from the sequence of names found.
    (tUndeclaredNameVisitorR$tVisitorExitt
undeclared(RtnamestvisitorR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfind_undeclaredXs

tIdentifierscBs2eZdZdZdZdZdZRS(s+Tracks the status of identifiers in frames.cCs@t|_t|_t|_t|_t|_dS(N(R8tdeclaredtouter_undeclaredRBtdeclared_locallytdeclared_parameter(tself((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt__init__hs
cCs$|jj||jj|dS(s$Register a special name like `loop`.N(RBtdiscardRGtadd(RKR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytadd_special{scCs/||jks||jkr"tS||jkS(s6Check if a name is declared in this or an outer scope.(RIRJR1RG(RKR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytis_declaredscCs
t|S(N(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytcopys(t__name__t
__module__t__doc__RLRORPRQ(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRFes
			tFramecBsPeZdZddZdZdZddZdZdZ	eZ
RS(	s&Holds compile time information for us.cCs||_t|_t|_t|_|o3|j|_d|_|rQ|j	pTd|_	t
|_||_|dk	r|jj
j|jj
|jjB|jB|jjj|jj|jj
|j|_ndS(N(teval_ctxRFtidentifiersR;ttoplevelt	rootleveltrequire_output_checkR%tbuffertblockR8tassigned_namestparentRGtupdateRJRHRB(RKRVR^((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLs"						cCsZtj|j}|jj|jtj|jj|_|jjj|jj|S(s!Create a copy of the current one.(tobjectt__new__t	__class__t__dict__R_RW(RKtrv((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRQs
cCs1t|j}x|D]}|j|qWdS(sWalk the node and check for identifiers.  If the scope is hard (eg:
        enforce on a python level) overrides from outer scopes are tracked
        differently.
        N(tFrameIdentifierVisitorRWR$(RKRRDR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytinspects
cs?|jjjBjjB@tfd|DBS(sFind all the shadowed names.  extra is an iterable of variables
        that may be defined with `add_special` which may occour scoped.
        c3s$|]}j|r|VqdS(N(RP(t.0R(ti(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>s(RWRGRHRIRJR8(RKtextra((Rhs3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
find_shadoweds	
cCst|j|S(sReturn an inner frame.(RURV(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytinnerscCs|j}t|_|S(sReturn 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.
        (RQR;RY(RKRd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytsofts	N((RRRSRTR%RLRQRfRjRkRlt__copy__(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRUs+							RAcBseZdZRS(s?Exception used by the `UndeclaredNameVisitor` to signal a stop.(RRRSRT(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRAstDependencyFinderVisitorcBs2eZdZdZdZdZdZRS(s.A visitor that collects filter and test calls.cCst|_t|_dS(N(R8tfiltersttests(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCs$|j||jj|jdS(N(t
generic_visitRoRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Filters
cCs$|j||jj|jdS(N(RqRpRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Tests
cCsdS(sStop visiting at blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Blocks(RRRSRTRLRrRsRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRns
			R@cBs)eZdZdZdZdZRS(sA 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.
    cCst||_t|_dS(N(R8RCRB(RKRC((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCsl|jdkrU|j|jkrU|jj|j|j|jkrhtqhn|jj|jdS(Ntload(tctxR*RCRBRNRARM(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Names
!cCsdS(sStop visiting a blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRts(RRRSRTRLRwRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR@s		RecBszeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZRS(
sA visitor for `Frame.inspect`.cCs
||_dS(N(RW(RKRW((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCs|jdkr(|jjj|jnf|jdkrP|jjj|jn>|jdkr|jj|jr|jjj|jndS(s2All assignments to names go through this function.tstoretparamRuN(RvRWRIRNR*RJRPRB(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRwscsj|jjjjBfd}||j}||jp\d}jj|j	|j
jj||BdS(Ncsm|s
tSj_x|D]}j|q#Wjj}jjjj_|S(N(R8RQRWR$RIRBR_(RtsubnodeRd(t	old_namestreal_identifiersRK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytinner_visit&s
	((R$ttestRWRIRJtbodytelse_RBR_tsymmetric_differenceRG(RKR(R}RR((R{R|RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Ifs	

cCs|jjj|jdS(N(RWRIRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Macro>scCs'|j||jjj|jdS(N(RqRWRIRNttarget(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ImportAs
cCsa|j|xM|jD]B}t|trF|jjj|dq|jjj|qWdS(Ni(RqRCR R6RWRIRN(RKR(R*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_FromImportEs

cCs$|j|j|j|jdS(s'Visit assignments in the correct order.N(R$R(R(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_AssignMscCs|j|jdS(sqVisiting stops at for blocks.  However the block sequence
        is visited as part of the outer scope.
        N(R$titer(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt	visit_ForRscCs|j|jdS(N(R$tcall(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CallBlockXscCs|j|jdS(N(R$tfilter(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_FilterBlock[scCsdS(sStop visiting at scopes.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Scope^scCsdS(sStop visiting at blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRtas(RRRSRTRLRwRRRRRRRRRRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRes		
									tCompilerExitcBseZdZRS(sRaised 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.
    (RRRSRT(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyResR#cBsSeZdRedZdZdZdZdZdZ	ddZ
dRdZd	ZdRd
Z
dZdZdRd
dZdRd
dZdRdZdZdZdZdSdZdZdRedZdRdZdZdZdRdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0ed.Z1ed/Z2e1d0Z3e1d1Z4e1d2Z5e1d3Z6e1d4Z7e1d5Z8e1d6Z9e1d7d8eZ:e1d9d8eZ;e2d0Z<e2d1Z=e2d:d8eZ>[1[2d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGedDZHdEZIdFZJdGZKdHZLdIZMdJZNdKZOdLZPdMZQdNZRdOZSdPZTdQZURS(TcCs|dkrt}n||_||_||_||_t|_||_i|_	i|_
d|_t|_d|_
i|_i|_g|_d|_d|_d|_t|_d|_d|_dS(Nii(R%RR)R*R+R&R;tcreated_block_contextR,timport_aliasestblockstextends_so_farthas_known_extendstcode_linenoRpRot
debug_infot_write_debug_infot
_new_linest
_last_lineR1t_first_writet_last_identifiert_indentation(RKR)R*R+R&R,((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLns,																			cCst|||j|jdS(s*Fail with a :exc:`TemplateAssertionError`.N(RR*R+(RKtmsgtlineno((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfailscCs|jd7_d|jS(sGet a new unique identifier.ist_%d(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyttemporary_identifierscCs'|j|_|jd|jdS(s7Enable buffering for the frame from that point onwards.s%s = []N(RR[t	writeline(RKtframe((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR[scCs|jjry|jd|j|jd|j|j|jd|j|jd|j|jn7|jjr|jd|jn|jd|jdS(s(Return the buffer contents of the frame.sif context.eval_ctx.autoescape:sreturn Markup(concat(%s))selse:sreturn concat(%s)N(RVtvolatileRtindentR[toutdentt
autoescape(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytreturn_buffer_contentss





cCs|jd7_dS(sIndent by one.iN(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsicCs|j|8_dS(sOutdent by step.N(R(RKtstep((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRscCs=|jdkr"|jd|n|jd|j|dS(s%Yield or write into the frame buffer.syield s
%s.append(N(R[R%R(RKRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytstart_writescCs#|jdk	r|jdndS(s1End the writing process started by `start_write`.t)N(R[R%twrite(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt	end_writescCs.|j|||j||j|dS(s4Simple shortcut for start_write + write + end_write.N(RRR(RKtsRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytsimple_writes
cCsi|jdkr|jdn
|jdy%x|D]}|j||q6WWntk
rdnXdS(sVisit 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
        unless the force_generator parameter is set to False.
        sif 0: yield NonetpassN(R[R%RR$R(RKRRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
blockvisits


cCs|jr|jsu|jjd|j|j|j7_|jdk	ru|jj|j|jfd|_qunt	|_|jjd|j
d|_n|jj|dS(s&Write a string into the output stream.s
s    iN(RRR&RRRR%RtappendR;R(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs		
	icCs!|j|||j|dS(s!Combination of newline and write.N(tnewlineR(RKRR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRscCsVt|jd||_|dk	rR|j|jkrR|j|_|j|_ndS(s/Add one or more newlines before the next write.iN(tmaxRR%RRR(RKR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsc	Cset}x@td|jD|p%dD]}t|r)t}Pq)q)Wx.|jD]#}|jd|j||qSW|sx.|jD]#}|jd|j||qW|d
k	rx4t	|D]#\}}|jd||fqWqn|j
r#|jd|j|j
|n|r/|jd
k	rH|jdn
|jdxE|jD]:}|jd|j|j|j
||jdq_W|d
k	rx4t	|D]#\}}|jd||fqWn|jd
k	r|jd	|j|j||jd
qa|jdn2|jd
k	ra|jd|j|j|nd
S(s,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 occour.  The extra keyword arguments should be given
        as python dict.
        css|]}|jVqdS(N(R?(RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>ss, s, %s=%ss, *s
, **dict({s, **{s%r: s%r: %s, s}, **Rt}s, **N((R;Rtkwargstis_python_keywordR1targsRR$R%Rtdyn_argst
dyn_kwargsR?R=(	RKR(Rtextra_kwargstkwarg_workaroundtkwargtargR?R=((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt	signaturesJ	)

!	



cCs2x+|jjD]}|jd||fq
WdS(s9Pull all the references identifiers into the local scope.sl_%s = context.resolve(%r)N(RWRBR(RKRR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpull_locals<scCst}x|D]}|j|qWxtdD]l}t||}xTt||D]C}||krx|j||<n|jd||||fqSWq.WdS(sPull all the dependencies.RoRps%s = environment.%s[%r]N(sfiltersstests(RnR$tgetattrRR(RKRRDR(t
dependencytmappingR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpull_dependenciesAs	

	cCsO|jjrK|jdtr!dp$ddjd|jjDfndS(s+Disable Python optimizations for the frame.s%sdummy(%s)sif 0: ts, css|]}d|VqdS(tl_N((RgR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>WsN(RWRGRRtjoin(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytunoptimize_scopeNs	cCsi}xB|j|D]1}|j||<}|jd||fqWt}x4|jjD]&}||kra|jd|qaqaW|r|jdj|dn|S(sThis function returns all the shadowed variables in a dict
        in the form name: alias and will write the required assignments
        into the current scope.  No indentation takes place.

        This also predefines locally declared variables from the loop
        body because under some circumstances it may be the case that

        `extra_vars` is passed to `Frame.find_shadowed`.
        s	%s = l_%sRs = s
 = missing(RjRRR8RWRIRNR(RKRt
extra_varstaliasesR*tidentt
to_declare((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
push_scopeZs
	cCsx1t|D]#\}}|jd||fq
Wt}x4|jjD]&}||krJ|jd|qJqJW|r|jdj|dndS(s0Restore all aliases and delete unused variables.s	l_%s = %sRs = s
 = missingN(RRR8RWRIRNR(RKRRR*taliast	to_delete((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt	pop_scopeps	c
Cs|d
kr|j}nt|}|j}|j||jj|jj@|jj|jj	B@}|r|j
ddjt||j
n|jj|jj|jj@8_|s|St|_t|_t|_g|jD]}d|j^q|_}t|d}	d|	krNt|_|jjd|jdnd|	krt|_|jjd|jdnd|	krt|_|jjd|jd	n|S(sMIn Jinja a few statements require the help of anonymous
        functions.  Those are currently macros and call blocks and in
        the future also recursive loops.  As there is currently
        technical limitation that doesn't allow reading and writing a
        variable in a scope where the initial value is coming from an
        outer scope, this function tries to fall back with a common
        error message.  Additionally the frame passed is modified so
        that the argumetns are collected and callers are looked up.

        This will return the modified frame.
        sXIt's not possible to set and access variables derived from an outer scope! (affects: %s)s, RtcallerRtvarargstl_callertl_kwargst	l_varargsN(RskwargsR(R%titer_child_nodesR7RkRfRWRBRGRIRJRRtsortedRR;taccesses_kwargstaccesses_varargstaccesses_callerRR*t	argumentsRER1ROR(
RKR(Rtchildrentfind_specialt
func_frametoverridden_closure_varsRRRB((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfunction_scoping~sD
		 
				*			cCs|j|||}t|_|j}d|jjkrI|dg}n|jddj|||j|j	||j
||j|j||j
||j|S(s/Dump the function def of a macro or call block.tloops
l_loop=l_loopsdef macro(%s):s, (RR;RZRRWRGRRRR[RRRRR(RKR(RRR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
macro_bodys		




cCsdjd|jD}t|dd}t|jdkrP|d7}n|jd||fx.|jD]#}|j|||jdqqW|jdt|j	t|j
t|jfdS(	s<Dump the macro definition for the def created by macro_body.s, css|]}t|jVqdS(N(treprR*(RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>sR*it,s%Macro(environment, macro, %r, (%s), (s), %r, %r, %r)N(RRRR%tlenRtdefaultsR$R2RRR(RKR(Rt	arg_tupleR*R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt	macro_defs
		cCs:d|j}|jdk	r6|dt|j7}n|S(s.Return a human readable position for the node.sline %ds in N(RR*R%R(RKR(Rd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpositions
cCsst|j|j}ddlm}|jd|jddj|tsb|jdn|jrrdpud}|j	t
jdk	}xY|j
t
jD]E}|j|jkr|jd	|j|jn||j|j<qWx|j
t
jD]}|j|jkr|j}	|j|j|	<}
d
|	krx|	jd
d\}}|jd|||
fq|jd
|	|
fqqW|jd|j|jd|ddt|}|j|jt|_|_|o|j|_|j|r |jdndt |jd krX|j!j"d|jdn|j#||j$|j|j%|j||j&|r|js|j|jdn|j|jd|j|jd|j&d|jnxt'|jD]\}
}t|}|j|j|
|_(|jd|
|f|d|jt |jd!}d|kr|j!j"d|jdnd|kr|j!j"d|jd|
|
fn|j#||j$|j|j%|j||j&qW|jddjd|jDdd|jddjd|j)DdS("Ni(t__all__sfrom __future__ import divisionsfrom jinja2.runtime import s, sdummy = lambda *x: Nones, environment=environmentRsblock %r defined twicet.isfrom %s import %s as %ssimport %s as %ss	name = %rsdef root(context%s):Risparent_template = NoneRKs#l_self = TemplateReference(context)sif parent_template is not None:s7for event in parent_template.root_render_func(context):syield eventisdef block_%s(context%s):tsupers%l_super = context.super(%r, block_%s)s
blocks = {%s}css|]}d||fVqdS(s%r: block_%sN((RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>Pssdebug_info = %rt&css|]}d|VqdS(s%s=%sN((RgR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>Us(sself(sselfssuper(*RR)R*tjinja2.runtimeRRRRR,tfindRtExtendsR%tfind_alltBlockRRRtImportedNamet
importnameRRtrsplitRURfRR1RXRYRRZRRERWRORRRRRR\R(RKR(RRVtexportedtenvenvthave_extendsR\timport_timpRtmoduletobjR*tblock_frameRB((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Templates
		


	




	

	
cCsd}|jrR|jrdS|jdkrR|jd|j|d7}qRn|jradpdd}|jd|j|f||j|jd||j|dS(	s.Call a block and register it for the template.iNisif parent_template is None:scontext.derived(locals())tcontexts'for event in context.blocks[%r][0](%s):tevent(	RXRRRRtscopedR*RR(RKR(RtlevelR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRtXs		

	
cCs|js|jd|jn|jdkr|jsQ|jd|jn|jdd|jrwtq|jn|jd||j	|j
||jd|j|jdt
|j|jd	|j|jrt|_n|jd
7_dS(sCalls the extender.s,cannot use extend from a non top-level scopeisif parent_template is not None:sraise TemplateRuntimeError(%r)sextended multiple timess+parent_template = environment.get_template(s, %r)s6for name, parent_block in parent_template.blocks.%s():s8context.blocks.setdefault(name, []).append(parent_block)iN(RXRRRRRRRRR$ttemplateRR*tdict_item_iterRYR1(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Extendsks.		
	

		
	


	cCs|jr|j|n|jr<|jd|jnd}t|jtjrt|jj	t
rud}qt|jj	ttfrd}qn't|jtj
tjfrd}n|jd|||j|j||jd|j|jrY|j|jd|j|jd|j|jd	|jn|jrr|jd
n
|jd|j|jd||j|jr|jnd
S(sHandles includes.stry:tget_or_select_templatetget_templatetselect_templatestemplate = environment.%s(s, %r)sexcept TemplateNotFound:Rselse:s]for event in template.root_render_func(template.new_context(context.parent, True, locals())):s*for event in template.module._body_stream:RN(twith_contextRtignore_missingRRR RRtConstR=R
R6R7tTupletListR$RR*RR(RKR(Rt	func_name((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Includes@		

			






	


	cCs|jr|j|n|jd|j||jrP|jd|jn|jd|j|j||jd|j|jr|jdn
|jd|jr|jj	dr|jd|jn|j
j|jd	S(
sVisit regular imports.sl_%s = scontext.vars[%r] = senvironment.get_template(s, %r).s+make_module(context.parent, True, locals())Rt_s!context.exported_vars.discard(%r)N(RRRRRXRR$RR*t
startswithR]RN(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs		
	
cCs|j||jd|j|j||jd|j|jrZ|jdn
|jdg}g}x|jD]}t|tr|\}}n|}|j	d||f|j	d||j
|j	d|d|j|t|f|f|j
|jrN|j||jd	sN|j|qNn|jj|q}W|rt|d
kr|d}|j	d||fq|j	d
djd|Dn|rt|d
kr|j	d|dq|j	ddjtt|ndS(sVisit named imports.s-included_template = environment.get_template(s, %r).s!make_module(context.parent, True)Rs.l_%s = getattr(included_template, %r, missing)sif l_%s is missing:sGl_%s = environment.undefined(%r %% included_template.__name__, name=%r)sGthe template %%r (imported on %s) does not export the requested name %sRiiscontext.vars[%r] = l_%sscontext.vars.update({%s})s, css|]}d||fVqdS(s%r: l_%sN((RgR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pys	<genexpr>ss!context.exported_vars.discard(%r)s-context.exported_vars.difference_update((%s))N(RRR$RR*RRCR R6RRRRRRXRRR]RNRRR(RKR(Rt	var_namestdiscarded_namesR*R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsP

	
	
	

	

		c
Cs|jdd"}|jr9|j|||dt}n|j}|j||jpydt|jdd#d$k}|js|j|d%}n-|jd||j	|j
|i}|r|jd|jjdnxN|j
tjD]:}|jd	kr|jdkr|jd
|jqqW|j||jrt|j}|jd|nd|krdt|jdd&d'kr|jdd|j|n|jd||j|j||j|rdpd|r|jdk	r|jd|j|j||jd|j|j||jd|jry|jdn|j|j||jd|j}	|j|j|	|jdn,|jr|jdn|j|j||jr
|jdn|j|rdp"d|r|jdk	r|j	|jd|j|j||jd|j	|jd|jdn|j	|j |j!||jr|jd|n|j|jr"|jd||j	|j |j||jn|js>|j"||n|jr|j#||j|j$|||jd |j|j||jd!|j%|ndS((NtexcludeRRRtonlyRs-def loop(reciter, loop_render_func, depth=0):sl_loop = missingRxs8Can't assign to special loop variable in for-loop targets%s = 1RR~s/l_loop = environment.undefined(%r, name='loop')s'loop' is undefined. the filter section of a loop as well as the else block don't have access to the special 'loop' variable of the current loop.  Because there is no parent loop it's undefined.  Happened in loop on %ssfor s, l_loop in LoopContext(s in t(s for treciters if (s))s, loop_render_func, depth):s):t:sif not tcontinueis%s = 0sif %s:sloop(s, loop)(siter(sbody(sloop(sloop(selse_stest(sloop(&Rt	recursiveRR;RkRfRERRRR[RWRORRtNameRvR*RRRRRRR$RRR~R%RRQRRRRRRR(
RKR(RRt
loop_framet
extended_loopRR*titeration_indicatort
test_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs	
	


	
		


	
		





	
	

		



cCs|j}|jd||j|j||jd|j|j|j||j|j	r|jd|j|j|j	||jndS(Nsif Rselse:(
RlRR$R~RRRRRR(RKR(Rtif_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs


	

cCs|j||}|j|jre|jjdsN|jd|jn|jd|jn|jd|j|j|||jj	|jdS(NRscontext.exported_vars.add(%r)scontext.vars[%r] = sl_%s = (
RRRXR*RRRRR]RN(RKR(Rtmacro_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs
	cCs~|jdd}|j|||}|jd|j|||j|||j|j|dt|j|dS(NRRs	caller = tforward_caller(scall(	RRRRRt
visit_CallRR1R(RKR(RRt
call_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs
cCs|j}|j|j|j|}|j||j||j|j||j|||j	|j
||j||j||dS(N(
RkRfRRRR[RRRRrRRR(RKR(Rtfilter_frameR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRs


cCs$|j||j|j|dS(N(RR$R((RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExprStmts
csjr|jrdSjjr4fd}nt}t}|jrijdjt}ng}x|j	D]}y|j
|j}Wn$t	jk
r|j
|qynXyI|jjrt|dr|j}qt|}n||}Wn!tk
r(|j
|qynX|rVt|dtrV|dj
|qy|j
|gqyWt|dks|jdk	rw|jdk	rt|dkrjd|jnjd|jjnxL|D]D}t|trItt|}	|jdkr5jd	|	q/j|	d
q|jdkrkjd	|n
j|d}
|jjrjdn)|jjrjdn
jd
jjdk	rjd|
d7}
nj||jd|
|jdk	rjd
qqW|jdk	rjjt|dkrjdpmdqnzg}g}xY|D]Q}t|tr|j
t|jddq|j
d|j
|qWjd	jtt|dd}
jx|D]}j|d}
|jjr_jd|
d7}
n&|jjrjd|
d7}
njjdk	rjd|
d7}
nj||jd|
d
q Wjjd|rjndS(Ncstjj|S(N(RR)tfinalize(R(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt<lambda>ssif parent_template is None:t__html__iiis
%s.append(s%s.extend((syield s, s6(context.eval_ctx.autoescape and escape or to_string)(sescape(s
to_string(senvironment.finalize(Rs))t%s%%s%ss % (i( RRZR)R&RR;RRR1Rtas_constRVt
ImpossibleRRthasattrR(R	t	ExceptionR R7RR[R%RRRRRR$Rtreplace(RKR(RR&t
outdent_laterRtchildtconstR>tvaltclosetformatRtidxtargument((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Outputs	

	


!






+
"












cCs|j||jr1|j}t|_n|}|j|j||jd|j|j||jrg|jD]}|j	ds}|^q}}t
|jdkrtt|j}|j
d||fng|j
dxJt|jD]9\}}|r!|jdn|jd||fqW|jd|rt
|dkry|j
d	|d
q|j
ddjtt|qndS(Ns = Riscontext.vars[%r] = l_%sscontext.vars.update({s, s%r: l_%ss})scontext.exported_vars.add(%r)is"context.exported_vars.update((%s))(RRXRQR8ttoplevel_assignmentsR$RRR(RRRRRt	enumerateRRR(RKR(Rtassignment_frameRtpublic_namesR*R5((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR7s4
	
	

		cCsY|jdkr.|jr.|jj|jn|jd|j|jj|jdS(NRxR(RvRXR8RNR*RR](RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRw^scCsE|j}t|tr.|jt|n|jt|dS(N(R=R R4RtstrR(RKR(RR2((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Constds	cCsRy#|jt|j|jWn(tjk
rM|jd|jnXdS(Ns8(context.eval_ctx.autoescape and Markup or identity)(%r)(RRR*RVRR+tdata(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_TemplateDataks
#	cCs||jdd}xCt|jD]2\}}|rE|jdn|j||q#W|j|dkrqdptddS(NRis, is,)R(RR9RR$(RKR(RR5R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Tuplers
cCsd|jdxCt|jD]2\}}|r?|jdn|j||qW|jddS(Nt[s, t](RR9RR$(RKR(RR5R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_List{s
cCs|jdxft|jD]U\}}|r?|jdn|j|j||jd|j|j|qW|jddS(Nt{s, s: R(RR9RR$R?R=(RKR(RR5R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Dicts

csfd}|S(Ncs|jjre|jjkre|jd|j|j||jd|j|j|nD|jd|j|j||jd|j|j||jddS(Ns$environment.call_binop(context, %r, s, Rs %s R(R)t	sandboxedtintercepted_binopsRR$tlefttright(RKR(R(toperator(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRDs

((RJt
interceptableRD((RJs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytbinops
csfd}|S(Ncsz|jjrE|jjkrE|jd|j|j|n$|jd|j|j||jddS(Ns#environment.call_unop(context, %r, RR(R)RFtintercepted_unopsRR$R((RKR(R(RJ(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRDs((RJRKRD((RJs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytuaops	t+t-t*t/s//s**R)tandRKtorsnot cCs|jjrd}n|jjr*d}nd}|jd|x.|jD]#}|j|||jdqKW|jddS(Ns;(context.eval_ctx.volatile and markup_join or unicode_join)tmarkup_jointunicode_joins%s((s, s))(RVRRRRR$(RKR(RR
R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Concats		cCs;|j|j|x!|jD]}|j||qWdS(N(R$texprtops(RKR(Rtop((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_ComparescCs/|jdt|j|j|j|dS(Ns %s (Rt	operatorsRZR$RX(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_OperandscCs8|jd|j|j||jd|jdS(Nsenvironment.getattr(s, %r)(RR$R(tattr(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Getattrs
cCst|jtjrX|j|j||jd|j|j||jdnM|jd|j|j||jd|j|j||jddS(NRARBsenvironment.getitem(s, R(R RRtSliceR$R(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Getitems


cCs|jdk	r%|j|j|n|jd|jdk	rW|j|j|n|jdk	r|jd|j|j|ndS(NR(tstartR%R$RtstopR(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Slices

cCsk|j|j|jd|jjj|j}|dkr\|jd|j|jnt|dt	r~|jdnDt|dt	r|jdn"t|dt	r|jdn|j
dk	r|j|j
|nc|jj
r|jd	|j|jfn7|jjr6|jd
|jn|jd|j|j|||jddS(
NRsno filter named %rt
contextfilters	context, tevalcontextfilterscontext.eval_ctx, tenvironmentfilters
environment, sB(context.eval_ctx.autoescape and Markup(concat(%s)) or concat(%s))sMarkup(concat(%s))s
concat(%s)R(RRoR*R)tgetR%RRRR;R(R$RVRR[RR(RKR(Rtfunc((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRrs(	cCs|j|j|jd|j|jjkrM|jd|j|jn|j|j||j|||jddS(NRsno test named %rR(	RRpR*R)RRR$R(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsscszfd}jdjjjdjjjd|jddS(NcsDjdk	r"jjSjddjdS(Nsenvironment.undefined(%r)sRthe inline if-expression on %s evaluated to false and no else section was defined.(texpr2R%R$RR((RR(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytwrite_expr2sRs if s else R(RR$texpr1R~(RKR(RRk((RR(RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CondExprs


cCsy|jjr|jdn
|jd|j|j||rOidd6pRd}|j||||jddS(Nsenvironment.call(context, s
context.call(RR(R)RFRR$R(R%R(RKR(RR!R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR"s
cCs+|j|jd|j|j|dS(Nt=(RR?R$R=(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Keyword(scCs1|jd|j|j||jddS(NsMarkup(R(RR$RX(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafe.s
cCs1|jd|j|j||jddS(Ns5(context.eval_ctx.autoescape and Markup or identity)(R(RR$RX(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafeIfAutoescape3s
cCs|jd|jdS(Nsenvironment.(RR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_EnvironmentAttribute8scCs!|jd|j|jfdS(Nsenvironment.extensions[%r].%s(Rt
identifierR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExtensionAttribute;scCs|j|j|jdS(N(RRR(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ImportedName>scCs|j|jdS(N(RR*(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_InternalNameAscCs|jddS(NR(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ContextReferenceDscCs|jd|dS(NR(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ContinueGscCs|jd|dS(Ntbreak(R(RKR(R((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_BreakJscCsb|j}|j|j|j|}|j||j|j||j||dS(N(RkRfRRRRRR(RKR(Rtscope_frameR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRMs
cCsx|jD]}|jd|j|j|j|y|jj|j}Wn tjk
rrt	|j_
q
Xt|j|j|q
WdS(Nscontext.eval_ctx.%s = (toptionsRR?R$R=R*RVRR+R1Rtsetattr(RKR(RtkeywordR2((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_EvalContextModifierUscCs|j}|jj}|jd||j||x!|jD]}|j||qFW|jj||jd|dS(Ns%s = context.eval_ctx.save()scontext.eval_ctx.revert(%s)(RRVtsaveRRRR$trevert(RKR(Rtold_ctx_namet	safed_ctxR0((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ScopedEvalContextModifier`sN((VRRRSR%R;RLRRR[RRRRRRRRRRRRRRRRR1RRRRRRtRRRRRRRRRR%R7RRwR=R?R@RCRERLRNt	visit_Addt	visit_Subt	visit_Mult	visit_Divtvisit_FloorDivt	visit_Powt	visit_Modt	visit_Andtvisit_Ort	visit_Post	visit_Negt	visit_NotRWR[R]R_RaRdRrRsRmR"RoRpRqRrRtRuRvRwRxRzRRR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR#ls6								5		
		D			c		/	+		5	~							{	'							
						
			
												N(3RTt	itertoolsRRQRR~RRtjinja2Rtjinja2.nodesRtjinja2.visitorRtjinja2.exceptionsRtjinja2.utilsRRR	tjinja2._compatR
RRR
RRRR\R,R<RRR2RR%R;R.R:RER`RFRUtRuntimeErrorRARnR@ReR-RR#(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt<module>
sH4
		
		
%XV
Back to Directory File Manager