Spade
Mini Shell
�
��Rc@sdZddlmZddlmZddlmZddlm Z ddl
mZddlm
Z
ddlmZdd lmZmZmZdd
lmZmZmZmZmZmZmZidd6d
d6dd6dd6dd6dd6dd6dd6Zeed�rdZndZd�Z
e!e"e �dd1��Z d1e$d�Z%d�Z&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
fd0��YZ2d1S(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_typetstring_typest iteritemstNativeStringIOtimaps==teqs!=tnet>tgts>=tgteqt<tlts<=tlteqtinsnot
intnotinRtitemscsd��fd�}|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|tj�s!td��nt|||||�}|j|�|dkr_|jj�SdS(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
ft�rQtSt|tt
ttf�r�x|D]}t|�sstSqsWtSt|t�r�x:t|�D],\}}t|�s�tSt|�s�tSq�WtStS(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(s�Check 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
tIdentifierscBs2eZdZd�Zd�Zd�Zd�ZRS(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_declared�scCs
t|�S(N(R(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytcopy�s(t__name__t
__module__t__doc__RLRORPRQ(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRFes
tFramecBsPeZdZdd�Zd�Zd�Zdd�Zd�Zd�Z 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.pyRL�s" cCsZtj|j�}|jj|j�tj|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.pyRQ�s
cCs1t|j�}x|D]}|j|�qWdS(s�Walk 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.pytinspect�s
cs?|j��j�jB�j�jB@t�fd�|D��BS(s�Find
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_shadowed�s
cCst|j|�S(sReturn
an inner
frame.(RURV(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytinner�scCs|j�}t|_|S(s�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.
(RQR;RY(RKRd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytsoft�s N((RRRSRTR%RLRQRfRjRkRlt__copy__(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRU�s+ RAcBseZdZRS(s?Exception
used by the `UndeclaredNameVisitor` to signal a
stop.(RRRSRT(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRA�stDependencyFinderVisitorcBs2eZdZd�Zd�Zd�Zd�ZRS(s.A
visitor that collects filter and test
calls.cCst�|_t�|_dS(N(R8tfiltersttests(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRL�scCs$|j|�|jj|j�dS(N(t
generic_visitRoRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Filter�s
cCs$|j|�|jj|j�dS(N(RqRpRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Test�s
cCsdS(sStop visiting at
blocks.N((RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Block�s(RRRSRTRLRrRsRt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRn�s
R@cBs)eZdZd�Zd�Zd�ZRS(s�A 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.pyRL�scCsl|jdkrU|j|jkrU|jj|j�|j|jkrht��qhn|jj|j�dS(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 RecBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�ZRS(
sA visitor for
`Frame.inspect`.cCs
||_dS(N(RW(RKRW((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRLscCs�|jdkr(|jjj|j�nf|jdkrP|jjj|j�n>|jdkr�|jj|j�r�|jjj|j�ndS(s2All
assignments to names go through this
function.tstoretparamRuN(RvRWRIRNR*RJRPRB(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRwscs��j|j��j��j�jB����fd�}||j�}||jp\d�}�jj|j |��j
��jj||B�dS(Ncsm|s
t�S�j��_x|D]}�j|�q#W�jj�}�jj�jj���_|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|j�dS(N(RWRIRNR*(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Macro>scCs'|j|�|jjj|j�dS(N(RqRWRIRNttarget(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ImportAs
cCsa|j|�xM|jD]B}t|t�rF|jjj|d�q|jjj|�qWdS(Ni(RqRCR
R6RWRIRN(RKR(R*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_FromImportEs
cCs$|j|j�|j|j�dS(s'Visit assignments in the
correct
order.N(R$R(R�(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_AssignMscCs|j|j�dS(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|j�dS(N(R$tcall(RKR(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CallBlockXscCs|j|j�dS(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(RRRSRTRLRwR�R�R�R�R�R�R�R�R�Rt(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRes
tCompilerExitcBseZdZRS(s�Raised 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.pyR�esR#cBsSeZdRed�Zd�Zd�Zd�Zd�Zd�Z dd�Z
dRd�Zd �ZdRd
�Z
d�Zd�ZdRd
d�ZdRd
d�ZdRd�Zd�Zd�Zd�ZdSd�Zd�ZdRed�ZdRd�Zd�Zd�ZdRd�Zd�Zd�Zd�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*�Z-d+�Z.d,�Z/d-�Z0ed.�Z1ed/�Z2e1d0�Z3e1d1�Z4e1d2�Z5e1d3�Z6e1d4�Z7e1d5�Z8e1d6�Z9e1d7d8e�Z:e1d9d8e�Z;e2d0�Z<e2d1�Z=e2d:d8e�Z>[1[2d;�Z?d<�Z@d=�ZAd>�ZBd?�ZCd@�ZDdA�ZEdB�ZFdC�ZGedD�ZHdE�ZIdF�ZJdG�ZKdH�ZLdI�ZMdJ�ZNdK�ZOdL�ZPdM�ZQdN�ZRdO�ZSdP�ZTdQ�ZURS(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|j��dS(s*Fail
with a
:exc:`TemplateAssertionError`.N(RR*R+(RKtmsgtlineno((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytfail�scCs|jd7_d|jS(sGet
a new unique
identifier.ist_%d(R�(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyttemporary_identifier�scCs'|j�|_|jd|j�dS(s7Enable
buffering for the frame from that point onwards.s%s =
[]N(R�R[t writeline(RKtframe((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR[�scCs�|jjry|jd�|j�|jd|j�|j�|jd�|j�|jd|j�|j�n7|jjr�|jd|j�n|jd|j�dS(s(Return
the buffer contents of the frame.sif context.eval_ctx.autoescape:sreturn
Markup(concat(%s))selse:sreturn
concat(%s)N(RVtvolatileR�tindentR[toutdentt
autoescape(RKR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytreturn_buffer_contents�s
cCs|jd7_dS(sIndent by
one.iN(R�(RK((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��sicCs|j|8_dS(sOutdent
by
step.N(R�(RKtstep((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��scCs=|jdkr"|jd|�n|jd|j|�dS(s%Yield
or write into the frame buffer.syield s
%s.append(N(R[R%R�(RKR�R(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytstart_write�scCs#|jdk r|jd�ndS(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_write�scCs.|j||�|j|�|j|�dS(s4Simple
shortcut for start_write + write +
end_write.N(R�R�R�(RKtsR�R(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytsimple_write�s
cCsi|jdkr|jd�n
|jd�y%x|D]}|j||�q6WWntk
rdnXdS(s�Visit 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%R�R$R�(RKRR�R(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
blockvisit�s
cCs�|jr�|jsu|jjd|j�|j|j7_|jdk ru|jj|j|jf�d|_qunt |_|jjd|j
�d|_n|jj|�dS(s&Write a string into the output stream.s
s
iN(R�R�R&R�R�R�R%R�tappendR;R�(RKR((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
icCs!|j||�|j|�dS(s!Combination
of newline and
write.N(tnewlineR�(RKRR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��scCsVt|jd|�|_|dk rR|j|jkrR|j|_|j|_ndS(s/Add
one or more newlines before the next
write.iN(tmaxR�R%R�R�R�(RKR(Ri((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR�sc Cset}x@td�|jD�|p%d�D]}t|�r)t}Pq)q)Wx.|jD]#}|jd�|j||�qSW|s�x.|jD]#}|jd�|j||�q�W|d
k r�x4t |�D]#\}}|jd||f�q�Wq�n|j
r#|jd�|j|j
|�n|r/|jd
k rH|jd�n
|jd�xE|jD]:}|jd|j�|j|j
|�|jd�q_W|d
k r�x4t |�D]#\}}|jd||f�q�Wn|jd
k r|jd �|j|j|�|jd
�qa|jd�n2|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}, **R�t}s,
**N((R;Rtkwargstis_python_keywordR1targsR�R$R%Rtdyn_argst
dyn_kwargsR?R=( RKR(R�textra_kwargstkwarg_workaroundtkwargtargR?R=((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt signaturesJ )
!
cCs2x+|jjD]}|jd||f�q
WdS(s9Pull
all the references identifiers into the local scope.sl_%s =
context.resolve(%r)N(RWRBR�(RKR�R*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpull_locals<scCs�t�}x|D]}|j|�qWxtdD]l}t||�}xTt||�D]C}||krx|j�||<n|jd||||f�qSWq.WdS(sPull
all the dependencies.RoRps%s =
environment.%s[%r]N(sfiltersstests(RnR$tgetattrR�R�(RKRRDR(t
dependencytmappingR*((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytpull_dependenciesAs
cCsO|jjrK|jdtr!dp$ddjd�|jjD��f�ndS(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(RWRGR�Rtjoin(RKR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytunoptimize_scopeNs cCs�i}xB|j|�D]1}|j�||<}|jd||f�qWt�}x4|jjD]&}||kra|jd|�qaqaW|r�|jdj|�d�n|S(s�This
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_%sR�s = s
= missing(RjR�R�R8RWRIRNR�(RKR�t
extra_varstaliasesR*tidentt
to_declare((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
push_scopeZs
cCs�x1t|�D]#\}}|jd||f�q
Wt�}x4|jjD]&}||krJ|jd|�qJqJW|r�|jdj|�d�ndS(s0Restore
all aliases and delete unused variables.s l_%s = %sR�s = s
=
missingN(RR�R8RWRIRNR�(RKR�R�R*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�|jd�nd| kr�t|_|jjd�|jd�nd| kr�t|_|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,
R�tcallerR�tvarargstl_callertl_kwargst l_varargsN(R�skwargsR�(R%titer_child_nodesR7RkRfRWRBRGRIRJR�R�tsortedR�R;taccesses_kwargstaccesses_varargstaccesses_callerR�R*t argumentsRER1ROR�(
RKR(R�tchildrentfind_specialt
func_frametoverridden_closure_varsRR�RB((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,
(R�R;RZR�RWRGR�R�R�R[R�R�RR�R�(RKR(R�R�R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
macro_body�s
cCs�djd�|jD��}t|dd�}t|j�dkrP|d7}n|jd||f�x.|jD]#}|j||�|jd�qqW|jdt|j �t|j
�t|j�f�dS( s<Dump the macro definition for the def
created by macro_body.s,
css|]}t|j�VqdS(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(R�R�R�R%tlenR�tdefaultsR$R2R�R�R�(RKR(R�t arg_tupleR*R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt macro_def�s
cCs:d|j}|jdk r6|dt|j�7}n|S(s.Return
a human readable position for the node.sline %ds in
N(R�R*R%R�(RKR(Rd((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytposition�s
cCs�|dkstd��t|j|j�}ddlm}|jd�|jddj|��t sz|jd�n|j
r�dp�d }|jtj
�dk }xY|jtj�D]E}|j|jkr�|jd
|j|j�n||j|j<q�Wx�|jtj�D]�}|j|jkr|j} |j�|j| <}
d| kr�| jdd�\}}|jd
|||
f�q�|jd| |
f�qqW|jd|j�|jd|dd�t|�}|j|j�t|_|_|o|j|_|j
�|r8|jd�ndt!|jd!�krp|j"j#d�|jd�n|j$|�|j%|j�|j&|j|�|j'�|r|js�|j
�|jd�n|j �|jd�|j
�|jd�|j'd|j�nxt(|j�D]\}
}t|�}|j|j�|
|_)|jd|
|f|d�|j
�t!|jd"�}d|kr�|j"j#d�|jd�nd|kr�|j"j#d�|jd|
|
f�n|j$|�|j%|j�|j&|j|�|j'�q)W|jddjd�|jD��dd�|jddjd
�|j*D���dS(#Nsno root frame
allowedi����(t__all__sfrom __future__ import divisionsfrom
jinja2.runtime import s, sdummy = lambda *x: Nones,
environment=environmentR�sblock %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(+R%tAssertionErrorRR)R*tjinja2.runtimeR�R�R�RR,tfindRtExtendstfind_alltBlockR�R�R�tImportedNamet
importnameR�R�trsplitRURfRR1RXRYR�RZR�RERWROR�R�R�R�RR\R�(RKR(R�RVtexportedtenvenvthave_extendsR\timport_timpR�tmoduletobjR*tblock_frameRB((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Template�s�
cCs�d}|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( RXR�R�R�R�tscopedR*R�R�(RKR(R�tlevelR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRtXs
cCs|js|jd|j�n|jdkr�|jsQ|jd�|j�n|jdd�|jrwt��q�|j�n|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(RXR�R�R�R�R�R�R�R�R$ttemplateR�R*tdict_item_iterRYR1(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Extendsks.
cCs�|jr|j|�n|jr<|jd�|j�nd}t|jtj�r�t|jj t
�rud}q�t|jj ttf�r�d}q�n't|jtj
tjf�r�d}n|jd||�|j|j|�|jd|j�|jrY|j�|jd�|j�|jd�|j�|jd �|j�n|jrr|jd
�n
|jd�|j�|jd|�|j�|jr�|j�nd
S(sHandles
includes.stry:tget_or_select_templatetget_templatetselect_templatestemplate
= environment.%s(s, %r)sexcept TemplateNotFound:R�selse:s]for event in
template.root_render_func(template.new_context(context.parent, True,
locals())):s*for event in
template.module._body_stream:RN(twith_contextR�tignore_missingR�R�R
RRtConstR=R
R6R7tTupletListR$R�R*R�R�(RKR(R�t func_name((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Include�s@
cCs�|jr|j|�n|jd|j|�|jrP|jd|j�n|jd�|j|j|�|jd|j�|jr�|jd�n
|jd�|jr�|jj d�r�|jd|j�n|j
j|j�d S(
sVisit regular imports.sl_%s = scontext.vars[%r] =
senvironment.get_template(s, %r).s+make_module(context.parent, True,
locals())R�t_s!context.exported_vars.discard(%r)N(R R�R�R�RXR�R$RR*t
startswithR]RN(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
cCs|j|�|jd�|j|j|�|jd|j�|jrZ|jd�n
|jd�g}g}x�|jD]�}t|t�r�|\}}n|}|j d||f�|j d|�|j
�|j d|d|j|�t|�f|f�|j
�|jrN|j|�|jd �sN|j|�qNn|jj|�q}W|r�t|�d
kr�|d}|j d||f�q�|j d
djd�|D���n|rt|�d
kr�|j d|d�q|j ddjtt|���ndS(sVisit named
imports.s-included_template = environment.get_template(s,
%r).s!make_module(context.parent, True)R�s.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(R�R�R$RR*R RCR
R6R�R�R�R�R�RXR�RR]RNR�R�R(RKR(R�t var_namestdiscarded_namesR*R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��sP
c
Cs�|jdd"�}|jr9|j|||dt�}n|j�}|j|�|jpydt|jdd#�d$�k}|js�|j|d%�}n-|jd|�|j �|j
|�i}|r�|jd�|jjd�nxN|j
tj�D]:}|jd kr|jdkr|jd
|j�qqW|j|�|jrt|j�}|jd|�nd|kr�dt|jdd&�d'�kr�|jdd|j|��n|jd|�|j|j|�|j|r�dp�d�|r�|jdk r�|jd�|j|j|�|jd�|j|j|�|jd�|jry|jd�n|j|j|�|jd�|j�} |j|j| �|jd�n,|jr�|jd�n|j|j|�|jr
|jd�n|j|rdp"d�|r�|jdk r�|j �|jd�|j|j|�|jd�|j �|jd�|jd�n|j �|j
|j!|�|jr�|jd|�n|j�|jr"|jd|�|j �|j
|j|�|j�n|js>|j"||�n|jr�|j#|�|j�|j$||�|jd
�|j|j|�|jd!�|j%|�ndS((NtexcludeR�R�R�tonlyRs-def
loop(reciter, loop_render_func, depth=0):sl_loop = missingRxs8Can't
assign to special loop variable in for-loop targets%s = 1R�R~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(&R�t recursiveR�R;RkRfRER�R�R�R[RWROR�RtNameRvR*R�R�R�R�R�R�R$R�R�R~R%R�RQR�R�RR�R�R�R�(
RKR(R�R�t
loop_framet
extended_loopR�R*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 |�|j�ndS(Nsif
Rselse:(
RlR�R$R~R�R�R�RR�R�(RKR(R�tif_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
cCs�|j||�}|j�|jre|jjd�sN|jd|j�n|jd|j�n|jd|j�|j||�|jj |j�dS(NRscontext.exported_vars.add(%r)scontext.vars[%r]
= sl_%s = (
R�R�RXR*RR�R�R�R]RN(RKR(R�tmacro_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
cCs~|jdd�}|j|||�}|jd�|j||�|j||�|j|j|dt�|j|�dS(NRR�s caller
= tforward_caller(scall( R�R�R�R�R�t
visit_CallR�R1R�(RKR(R�R�t
call_frame((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
cCs�|j�}|j|j��|j|�}|j|�|j|�|j|j|�|j||�|j |j
|�|j|�|j||�dS(N(
RkRfR�R�R�R[R�RR�RrR�R�R�(RKR(R�tfilter_frameR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR��s
cCs$|j|�|j|j|�dS(N(R�R$R((RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExprStmt�s
cs�jr|jrdS�jjr4�fd�}nt}t}|jri�jd��j�t}ng}x�|j D]�}y|j
|j�}Wn$t jk
r�|j
|�qynXyI|jjr�t|d�r�|j�}q�t|�}n||�}Wn!tk
r(|j
|�qynX|rVt|dt�rV|dj
|�qy|j
|g�qyWt|�dks�|jdk rw|jdk r�t|�dkr��jd|j�n�jd|j��j�nxL|D]D}t|t�rItt|��} |jdkr5�jd | �q/�j| d
�q�|jdkrk�jd |�n
�j|�d}
|jjr��jd�n)|jjr��jd�n
�jd
��jjdk r��jd�|
d7}
n�j||��jd|
�|jdk r��jd
�q�q�W|jdk r��j��jt|�dkrjdpmd�q�nzg}g}xY|D]Q}t|t�r�|j
t|�jdd��q�|j
d�|j
|�q�W�jd ��jtt|��d�d}
�j�x�|D]�}�j|�d}
|jjr_�jd�|
d7}
n&|jjr��jd�|
d7}
n�jjdk r��jd�|
d7}
n�j||��jd|
d
�q
W�j��jd�|r�j�ndS(Ncst�jj|��S(N(RR)tfinalize(R(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt<lambda>�ssif
parent_template is None:t__html__i����iis
%s.append(s%s.extend((syield s, s6(context.eval_ctx.autoescape and
escape or to_string)(sescape(s
to_string(senvironment.finalize(R�s))t%s%%s%ss % (i(
R�RZR)R'RR;R�R�R1Rtas_constRVt
ImpossibleR�R�thasattrR)R t ExceptionR
R7R�R[R%R�RR�R�R�R$R�treplace(RKR(R�R't
outdent_laterRtchildtconstR>tvaltclosetformatR�tidxtargument((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Output�s�
!
+
"
cCs�|j|�|jr1|j�}t�|_n|}|j|j|�|jd�|j|j|�|jr�g|jD]}|j d�s}|^q}}t
|j�dkr�tt|j��}|j
d||f�ng|j
d�xJt|j�D]9\}}|r!|jd�n|jd||f�q�W|jd�|r�t
|�dkry|j
d |d
�q�|j
ddjtt|���q�ndS(Ns =
Riscontext.vars[%r] = l_%sscontext.vars.update({s, s%r:
l_%ss})scontext.exported_vars.add(%r)is"context.exported_vars.update((%s))(R�RXRQR8ttoplevel_assignmentsR$R�R�R(RR�RR�R�t enumerateR�RR�(RKR(R�tassignment_frameRtpublic_namesR*R6((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR�7s4
cCsY|jdkr.|jr.|jj|j�n|jd|j�|jj|j�dS(NRxR�(RvRXR9RNR*R�R](RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRw^scCsE|j}t|t�r.|jt|��n|jt|��dS(N(R=R
R4R�tstrR�(RKR(R�R3((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Constds cCsRy#|jt|j|j���Wn(tjk
rM|jd|j�nXdS(Ns8(context.eval_ctx.autoescape and Markup or
identity)(%r)(R�R�R+RVRR,tdata(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_TemplateDataks
# cCs||jd�d}xCt|j�D]2\}}|rE|jd�n|j||�q#W|j|dkrqdptd�dS(NRi����s,
is,)R�(R�R:RR$(RKR(R�R6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Tuplers
cCsd|jd�xCt|j�D]2\}}|r?|jd�n|j||�qW|jd�dS(Nt[s,
t](R�R:RR$(RKR(R�R6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_List{s
cCs�|jd�xft|j�D]U\}}|r?|jd�n|j|j|�|jd�|j|j|�qW|jd�dS(Nt{s,
s:
R�(R�R:RR$R?R=(RKR(R�R6R>((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Dict�s
cs�fd�}|S(Ncs�|jjre�|jjkre|jd��|j|j|�|jd�|j|j|�nD|jd�|j|j|�|jd��|j|j|�|jd�dS(Ns$environment.call_binop(context,
%r, s, Rs %s
R�(R)t sandboxedtintercepted_binopsR�R$tlefttright(RKR(R�(toperator(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRD�s
((RKt
interceptableRD((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytbinop�s
cs�fd�}|S(Ncsz|jjrE�|jjkrE|jd��|j|j|�n$|jd��|j|j|�|jd�dS(Ns#environment.call_unop(context,
%r,
RR�(R)RGtintercepted_unopsR�R$R((RKR(R�(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRD�s((RKRLRD((RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytuaop�s t+t-t*t/s//s**R*tandRLtorsnot
cCs�|jjrd}n|jjr*d}nd}|jd|�x.|jD]#}|j||�|jd�qKW|jd�dS(Ns;(context.eval_ctx.volatile
and markup_join or unicode_join)tmarkup_jointunicode_joins%s((s,
s))(RVR�R�R�RR$(RKR(R�RR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Concat�s cCs;|j|j|�x!|jD]}|j||�qWdS(N(R$texprtops(RKR(R�top((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Compare�scCs/|jdt|j�|j|j|�dS(Ns
%s
(R�t operatorsR[R$RY(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Operand�scCs8|jd�|j|j|�|jd|j�dS(Nsenvironment.getattr(s,
%r)(R�R$R(tattr(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Getattr�s
cCs�t|jtj�rX|j|j|�|jd�|j|j|�|jd�nM|jd�|j|j|�|jd�|j|j|�|jd�dS(NRBRCsenvironment.getitem(s,
R�(R
R�RtSliceR$R(R�(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Getitem�s
cCs�|jdk r%|j|j|�n|jd�|jdk rW|j|j|�n|jdk r�|jd�|j|j|�ndS(NR(tstartR%R$R�tstopR�(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_Slice�s
cCsk|j|j|jd�|jjj|j�}|dkr\|jd|j|j�nt|dt �r~|jd�nDt|dt �r�|jd�n"t|dt �r�|jd�n|j
dk r�|j|j
|�nc|jj
r|jd |j|jf�n7|jjr6|jd
|j�n|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�(R�RoR*R)tgetR%R�R�R�R;R(R$RVR�R[R�R�(RKR(R�tfunc((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRr�s( cCs�|j|j|jd�|j|jjkrM|jd|j|j�n|j|j|�|j||�|jd�dS(NRsno
test named
%rR�( R�RpR*R)R�R�R$R(R�(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyRsscsz���fd�}�jd��j�j���jd��j�j���jd�|��jd�dS(NcsD�jdk r"�j�j��S�jdd�j���dS(Nsenvironment.undefined(%r)sRthe
inline if-expression on %s evaluated to false and no else section was
defined.(texpr2R%R$R�R�((R�R(RK(s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytwrite_expr2sRs
if s else
R�(R�R$texpr1R~(RKR(R�Rl((R�R(RKs3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_CondExprs
cCsy|jjr|jd�n
|jd�|j|j|�|rOidd6pRd}|j|||�|jd�dS(Nsenvironment.call(context,
s
context.call(R�R�(R)RGR�R$R(R%R�(RKR(R�R"R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR#s
cCs+|j|jd�|j|j|�dS(Nt=(R�R?R$R=(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt
visit_Keyword(scCs1|jd�|j|j|�|jd�dS(NsMarkup(R�(R�R$RY(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafe.s
cCs1|jd�|j|j|�|jd�dS(Ns5(context.eval_ctx.autoescape
and Markup or
identity)(R�(R�R$RY(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_MarkSafeIfAutoescape3s
cCs|jd|j�dS(Nsenvironment.(R�R*(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_EnvironmentAttribute8scCs!|jd|j|jf�dS(Nsenvironment.extensions[%r].%s(R�t
identifierR*(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ExtensionAttribute;scCs|j|j|j�dS(N(R�R�R�(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ImportedName>scCs|j|j�dS(N(R�R*(RKR(R�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_InternalNameAscCs|jd�dS(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(RkRfR�R�R�R�RR�(RKR(R�tscope_frameR�((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR�Ms
cCs�x�|jD]}|jd|j�|j|j|�y|jj|j�}Wn
tjk
rrt |j_
q
Xt|j|j|�q
WdS(Nscontext.eval_ctx.%s =
(toptionsR�R?R$R=R+RVRR,R1R�tsetattr(RKR(R�tkeywordR3((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)(R�RVtsaveR�R�RR$trevert(RKR(R�told_ctx_namet safed_ctxR1((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pytvisit_ScopedEvalContextModifier`sN((VRRRSR%R;RLR�R�R[R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R1R�R�R�R�R�RtRRR�R�R�R�R�R�R�R&R8R�RwR>R@RARDRFRMROt visit_Addt visit_Subt visit_Mult visit_Divtvisit_FloorDivt visit_Powt visit_Modt visit_Andtvisit_Ort visit_Post visit_Negt visit_NotRXR\R^R`RbReRrRsRnR#RpRqRrRsRuRvRwRxRyR{R�R�R�(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyR#ls�6 5
D c / + 5 ~ { '
N(3RTt itertoolsRRQRRRR�tjinja2Rtjinja2.nodesRtjinja2.visitorRtjinja2.exceptionsRtjinja2.utilsRRR tjinja2._compatR
RRR
RRRR]R-R<RRR2R�R%R;R.R:RER`RFRUtRuntimeErrorRARnR@ReR.R�R#(((s3/usr/lib/python2.7/site-packages/jinja2/compiler.pyt<module>
sH4
%XV