ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ Yc@sdZddlZddlmZddlmZddlmZmZddl m Z m Z m Z m Z mZmZmZmZmZddlmZmZmZddlmZmZmZmZmZmZmZmZd d d d d dddddddddgZ eZ!dZ"e#Z$e#Z%dZ&dZ'dddddZ)d e#fdYZ*dZ+de,fdYZ-e dZ.d ee-fd!YZ/y!dd"l0m1Z1e1j2e/Wne3k rnXd#e#fd$YZ4d%e#fd&YZ5d e5fd'YZ6ed(e#fd)YZ7d e#fd*YZ8ed+e#fd,YZ9ddd-Z:ed.e9fd/YZ;ed0e9fd1YZ<e9`=e;`=e<`=dS(2s} jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: (c) 2017 by the Jinja Team. :license: BSD. iN(tchain(t MethodType(t EvalContextt_context_function_types( tMarkupt soft_unicodetescapetmissingtconcatt internalcodetobject_type_reprtevalcontextfunctiont Namespace(tUndefinedErrortTemplateRuntimeErrortTemplateNotFound(timapt text_typet iteritemstimplements_iteratortimplements_to_stringt string_typestPY2twith_metaclasst LoopContexttTemplateReferencetMacroRRRRRt markup_joint unicode_joint to_stringtidentityRR cCs|S(N((tx((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt%tcCshg}tt|}xF|D]>}|j|t|drtdjt||SqWt|S(s@Concatenation that escapes if necessary and converts to unicode.t__html__u(RRtappendthasattrRtjoinRR(tseqtbuftiteratortarg((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR+s   cCsttt|S(s4Simple args to unicode conversion and concatenation.(RRR(R&((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR6sc Cs|dkri}n|r$|}nt|p0d|}|r|rTt|}nx6t|D]%\}} | tk ra| ||(t __class__t__name__R8R=(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__repr__Zs (R@t __module__t__doc__R;R>RA(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRPs  cCst|d|S(Nt__func__(tgetattr(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt _get_funcast ContextMetacBseZdZRS(c Cstj||||}|dkr(|St|j}ttj}t|j}ttj}||k r||krt|_n$||kr||krt|_n|S(N(( ttypet__new__RFtresolvetContexttresolve_or_missingtTruet_legacy_resolve_modet_fast_resolve_mode( tclsR=tbasestdtrvRJtdefault_resolveRLtdefault_resolve_or_missing((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRIgs       (R@RBRI(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRGescCs8||jkr|j|S||jkr4|j|S|S(N(R0R4(R:R5R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRL}s   RKcBseZdZeZeZdZdZddZ dZ dZ dZ dZ edZdd Zd Zed Zed Zed ZeredZedZedZn[dZdZdZRS(sThe template context holds the variables of a template. It stores the values passed to the template and also the names the template exports. Creating instances is neither supported nor useful as it's created automatically at various stages of the template evaluation and should not be created by hand. The context is immutable. Modifications on :attr:`parent` **must not** happen and modifications on :attr:`vars` are allowed from generated template code only. Template filters and global functions marked as :func:`contextfunction`\s get the active context passed as first argument and are allowed to access the context read-only. The template context supports read only dict operations (`get`, `keys`, `values`, `items`, `iterkeys`, `itervalues`, `iteritems`, `__getitem__`, `__contains__`). Additionally there is a :meth:`resolve` method that doesn't fail with a `KeyError` but returns an :class:`Undefined` object for missing variables. cCs||_i|_||_t|j||_t|_||_tdt |D|_ |j rt t ||_ ndS(Ncss$|]\}}||gfVqdS(N((t.0tktv((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pys s(R4R0R-Rteval_ctxtsett exported_varsR=R+RR/RORRL(R9R-R4R=R/((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;s      cCsjy,|j|}|j|d}||Wn(tk rV|jjd|ddSXt||||S(sRender a parent block.is#there is no parent block called %r.R=tsuper(R/tindext LookupErrorR-t undefinedR<(R9R=tcurrentR/R]((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR\s    cCs%y ||SWntk r |SXdS(sfReturns an item from the template context, if it doesn't exist `default` is returned. N(tKeyError(R9R5tdefault((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytgets  cCsM|jrt||}n|j|}|tkrI|jjd|S|S(sLooks up a variable like `__getitem__` or `get` but returns an :class:`Undefined` object with the name of the name looked up. R=(RNRLRR-R_(R9R5RS((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRJs   cCsA|jr4|j|}t|tr0t}n|St||S(sxResolves a variable like :meth:`resolve` but returns the special `missing` value if it cannot be found. (RNRJt isinstancet UndefinedRRL(R9R5RS((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRLs   cstfdjDS(s+Get a new dict with the exported variables.c3s"|]}|j|fVqdS(N(R0(RVRW(R9(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pys s(R+R[(R9((R9s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt get_exportedscCs3|js|jS|js |jSt|j|jS(sReturn the complete context as dict including the exported variables. For optimizations reasons this might not return an actual copy so be careful with using it. (R0R4R+(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytget_alls   cOst|drE|j}x*dD]}t||r|}PqqWnt|trt|ddrv|f|}qt|ddr|jf|}qt|ddr|jf|}qny|||SWntk r|jjdSXdS( sCall the callable with the arguments and keyword arguments provided but inject the active context or environment as first argument if the callable is a :func:`contextfunction` or :func:`environmentfunction`. t__call__tcontextfunctionR tenvironmentfunctionisGvalue was undefined because a callable raised a StopIteration exceptionN(RiR Rj( R$RhRdRRERYR-t StopIterationR_(t_Context__selft _Context__objtargstkwargstfntfn_type((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytcalls&     cCs]t|j|ji|jtd|}|j|_|jjdt |jD|S(sInternal helper function to create a derived context. This is used in situations where the system needs a new context in the same template that is independent. css'|]\}}|t|fVqdS(N(tlist(RVRWRX((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pys sN( R7R-R=RgRMR*RYR/tupdateR(R9R3R:((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytderived s  #cs1fd}ttj|_|_|S(Ncst|jS(N(RERg(R9(tmeth(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR R!(RER+RCR@(Rvtproxy((Rvs2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt_alls tkeystvaluestitemstiterkeyst itervaluesRcCs||jkp||jkS(N(R0R4(R9R=((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt __contains__(scCs.|j|}|tkr*t|n|S(sTLookup a variable or raise `KeyError` if the variable is undefined. (RLRRa(R9R5titem((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR>+s cCs&d|jjt|j|jfS(Ns <%s %s of %r>(R?R@treprRgR=(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRA4s N(R@RBRCtFalseRNROR;R\R*RcRJRLRfRgR RrRuRxRyRzR{RR|R}RR~R>RA(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRKs0   "        (tMappingR<cBs5eZdZdZedZedZRS(s"One block on a template reference.cCs(||_||_||_||_dS(N(R=t_contextt_stackt_depth(R9R=R:tstacktdepth((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;Gs   cCs_|jdt|jkr<|jjjd|jddSt|j|j|j|jdS(sSuper the block.is#there is no parent block called %r.R=R\(RtlenRRR-R_R=R<(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR\Ms  cCsAt|j|j|j}|jjjr=t|}n|S(N(RRRRRYt autoescapeR(R9RS((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRhWs(R@RBRCR;tpropertyR\R Rh(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR<Ds  tLoopContextBasecBseZdZeZeZeZdZ dddZ dZ dZ e dZe dZe dZe dZe d Ze d Ze d Ze d Zd ZedZeZ[dZRS(s%A loop context for dynamic iteration.icCs1||_||_d|_||_t|_dS(Ni(t _undefinedt_recursetindex0tdepth0Rt_last_checked_value(R9R_trecurseR((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;gs     cGs*|stdn||jt|S(s7Cycles among the arguments with the current loop index.sno items for cycling given(t TypeErrorRR(R9Rn((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytcyclenscGs |j|kr||_tStS(s9Checks whether the value has changed since the last call.(RRMR(R9R6((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytchangedts cCs |jdkS(Ni(R(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR {R!cCs |jtkS(N(t_aftert_last_iteration(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR |R!cCs |jdS(Ni(R(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR }R!cCs|j|jS(N(tlengthR(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR ~R!cCs|j|jS(N(RR](R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR R!cCs |jdS(Ni(R(R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR R!cCs#|jtkr|jdS|jS(Nsthere is no previous item(t_beforet_first_iterationR(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytprevitems cCs#|jtkr|jdS|jS(Nsthere is no next item(RRR(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytnextitems cCs|jS(N(R(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__len__scCs;|jdkrtdn|j||j|jdS(NsMTried to call non recursive loop. Maybe you forgot the 'recursive' modifier.i(RR*RR(R9titerable((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pytloopscCsd|jj|j|jfS(Ns <%s %r/%r>(R?R@R]R(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRAs N(R@RBRCRRt_currentRRR*t_lengthR;RRRtfirsttlastR]trevindext revindex0RRRRR RRhRA(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR_s*    cBs8eZdddZedZdZdZRS(icCsntj||||t||_yt||_Wn ttfk rZd|_nX|j |_ dS(N( RR;titert _iteratorRRRtAttributeErrorR*t _safe_nextR(R9RR_RR((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;s cCsW|jdkrPt|j}t||_|jd}t|||_n|jS(Ni(RR*ttupleRRRR(R9Rtiterations_done((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs  cCs t|S(N(tLoopContextIterator(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__iter__scCs*yt|jSWntk r%tSXdS(N(tnextRRkR(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs N(R@RBR*R;RRRR(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs RcBs/eZdZdZdZdZdZRS(s The iterator for a loop context.R:cCs ||_dS(N(R:(R9R:((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;scCs|S(N((R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRscCsg|j}|jd7_|jtkr3tn|j|_|j|_|j|_|j|fS(Ni(R:RRRRkRRR(R9tctx((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__next__s    (R:(R@RBRCt __slots__R;RR(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs   cBsAeZdZddZeedZdZdZ RS(sWraps a macro function.c Cs||_||_t||_||_||_||_||_||_d|k|_ |dkru|j }n||_ dS(Ntcaller( t _environmentt_funcRt_argument_countR=t argumentst catch_kwargst catch_varargsRtexplicit_callerR*Rt_default_autoescape( R9R-tfuncR=RRRRtdefault_autoescape((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;s         c Os!|r3t|dtr3|dj}|d}n |j}t||j }t|}t}||jkrxt|j t|D][\}}y|j |} Wnt k rt } nX|dkrt }n|j| qWn |j}|jrN| rN|j dd} | dkr>|jjddd} n|j| n|jrg|j|nP|rd|krtd|jntd|jtt|fn|jr|j||jn:t||jkrtd|jt|j fn|j||S( NiiRsNo caller definedR=samacro %r was invoked with two values for the special caller argument. This is most likely a bug.s%macro %r takes no keyword argument %rs+macro %r takes not more than %d argument(s)(RdRRRRsRRRt enumerateRtpopRaRRMR#RRR*RR_RRR=RRRt_invoke( R9RnRoRRtofft found_callertidxR=R6R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRhsJ    &         " cCs(|j|}|r$t|}n|S(s=This method is being swapped out by the async implementation.(RR(R9RRRS((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRAscCs2d|jj|jdkr!dp-t|jfS(Ns<%s %s>t anonymous(R?R@R=R*R(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRAHs N( R@RBRCR*R;R R RhRRA(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs  K RecBseZdZdZdededZedZ edZ e Z Z Z ZZZZZZZZZZZZZZZZZZZ Z!Z"Z#Z$Z%dZ&d Z'd Z(d Z)d Z*d Z+dZ,e,Z-dZ.RS(szThe default undefined type. This undefined type can be printed and iterated over, but every other access will raise an :exc:`jinja2.exceptions.UndefinedError`: >>> foo = Undefined(name='foo') >>> str(foo) '' >>> not foo True >>> foo + 42 Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined t_undefined_hintt_undefined_objt_undefined_namet_undefined_exceptioncCs(||_||_||_||_dS(N(RRRR(R9thinttobjR=texc((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyR;as   cOs|jdkr~|jtkr.d|j}qt|jts_dt|j|jf}qdt|j|jf}n |j}|j|dS(s{Regular callback function for undefined objects that raises an `jinja2.exceptions.UndefinedError` on call. s%r is undefineds%s has no element %rs%r has no attribute %rN( RR*RRRRdRR R(R9RnRoR((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt_fail_with_undefined_errorgs   cCs)|d dkrt|n|jS(Nit__(RR(R9R=((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt __getattr__}scCst|t|kS(N(RH(R9tother((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__eq__scCs|j| S(N(R(R9R((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__ne__scCstt|S(N(tidRH(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__hash__scCsdS(Nu((R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt__str__scCsdS(Ni((R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRsccsdS(N((R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRscCstS(N(R(R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt __nonzero__scCsdS(NRe((R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRAs(RRRRN(/R@RBRCRR*RR R;R RRt__add__t__radd__t__mul__t__rmul__t__div__t__rdiv__t __truediv__t __rtruediv__t __floordiv__t __rfloordiv__t__mod__t__rmod__t__pos__t__neg__RhR>t__lt__t__le__t__gt__t__ge__t__int__t __float__t __complex__t__pow__t__rpow__t__sub__t__rsub__RRRRRRRt__bool__RA(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyReOs  n       csdkrCddl}|jtj|jtjndkrXtnfddffdY}|S(skGiven a logger object this returns a new undefined class that will log certain failures. It will log iterations and printing. If no logger is given a default logger is created. Example:: logger = logging.getLogger(__name__) LoggingUndefined = make_logging_undefined( logger=logger, base=Undefined ) .. versionadded:: 2.8 :param logger: the logger to use. If not provided, a default logger is created. :param base: the base class to add logging functionality to. This defaults to :class:`Undefined`. iNcs|jdkr~|jtkr.d|j}qt|jts_dt|j|jf}qdt|j|jf}n |j}jd|dS(Ns%s is undefineds%s has no element %ss%s has no attribute %ssTemplate variable warning: %s( RR*RRRRdRR twarning(tundefR(tlogger(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt _log_messages   tLoggingUndefinedcs}eZfdZfdZfdZerifdZfdZnfdZRS(csPyj|||SWn2|jk rK}jdt||nXdS(NsTemplate variable error: %s(RRterrortstr(R9RnRote(tbaseR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs csj|}||S(N(R(R9RS(RR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs csj|}||S(N(R(R9RS(RR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs csj|}||S(N(R(R9RS(RR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs csj|}||S(N(t __unicode__(R9RS(RR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs csj|}||S(N(R(R9RS(RR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs ( R@RBRRRRRRR((RRR(s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs( R*tloggingt getLoggerR@t addHandlert StreamHandlertsyststderrRe(RRRR((RRRs2/usr/lib/python2.7/site-packages/jinja2/runtime.pytmake_logging_undefineds    "#tDebugUndefinedcBseZdZdZdZRS(sAn undefined that returns the debug info when printed. >>> foo = DebugUndefined(name='foo') >>> str(foo) '{{ foo }}' >>> not foo True >>> foo + 42 Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined cCsN|jdkrC|jtkr)d|jSdt|j|jfSd|jS(Nu{{ %s }}s{{ no such element: %s[%r] }}u!{{ undefined value printed: %s }}(RR*RRRR (R9((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs   ((R@RBRCRR(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs tStrictUndefinedcBs9eZdZdZejZZZZ Z Z Z Z RS(ssAn undefined that barks on print and iteration as well as boolean tests and all kinds of comparisons. In other words: you can do nothing with it except checking if it's defined using the `defined` test. >>> foo = StrictUndefined(name='foo') >>> str(foo) Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined >>> not foo Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined >>> foo + 42 Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined ((R@RBRCRReRRRRRRRRR(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyRs(>RCRt itertoolsRttypesRt jinja2.nodesRRt jinja2.utilsRRRRRR R R R tjinja2.exceptionsR RRtjinja2._compatRRRRRRRRt__all__RRtobjectRRRRR*R7RRFRHRGRLRKt collectionsRtregistert ImportErrorR<RRRRReRRRR(((s2/usr/lib/python2.7/site-packages/jinja2/runtime.pyt sV @:           F'mUQ