ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/jinja2/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/jinja2/environment.pyc

�
,��Qc@s|dZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZddlmZmZddlmZddlmZddlmZdd	lmZdd
l m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/dd
l0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<ddl=m>Z>e*d�Z?e@aAd�ZBd�ZCd�ZDd�ZEd�ZFdeGfd��YZHdeGfd��YZIe8deGfd��Y�ZJdeGfd��YZKe7deGfd��Y�ZLeIeH_MdS(s�
    jinja2.environment
    ~~~~~~~~~~~~~~~~~~

    Provides a class that holds runtime and parsing time options.

    :copyright: (c) 2010 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
i����N(tnodes(tBLOCK_START_STRINGtBLOCK_END_STRINGtVARIABLE_START_STRINGtVARIABLE_END_STRINGtCOMMENT_START_STRINGtCOMMENT_END_STRINGtLINE_STATEMENT_PREFIXtLINE_COMMENT_PREFIXtTRIM_BLOCKStNEWLINE_SEQUENCEtDEFAULT_FILTERSt
DEFAULT_TESTStDEFAULT_NAMESPACEtKEEP_TRAILING_NEWLINEt
LSTRIP_BLOCKS(t	get_lexertTokenStream(tParser(tEvalContext(toptimize(tgenerate(t	Undefinedtnew_context(tTemplateSyntaxErrortTemplateNotFoundtTemplatesNotFoundtTemplateRuntimeError(t
import_stringtLRUCachetMarkuptmissingtconcattconsumetinternalcode(timaptifiltertstring_typest	iteritemst	text_typetreraisetimplements_iteratortimplements_to_stringtget_nexttencode_filenametPY2tPYPY(treducei
cGs_ytj|�}Wntk
r-t|�SX|dk	r>|St|�t|<}t|_|S(s�Return a new spontaneous environment.  A spontaneous environment is an
    unnamed and unaccessible (in theory) environment that is used for
    templates generated from a string and not from the file system.
    N(t_spontaneous_environmentstgett	TypeErrortEnvironmenttNonetTruetshared(targstenv((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytget_spontaneous_environment,s
	cCs*|dkrdS|dkr iSt|�S(s*Return the cache class for the given size.iN(R4R(tsize((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytcreate_cache<s
cCs3|dkrdSt|�tkr&iSt|j�S(s(Create an empty copy of the given cache.N(R4ttypetdictRtcapacity(tcache((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt
copy_cacheEs
cCsLi}x?|D]7}t|t�r1t|�}n||�||j<q
W|S(swLoad the extensions from the list and bind it to the environment.
    Returns a dict of instantiated environments.
    (t
isinstanceR%Rt
identifier(tenvironmentt
extensionstresultt	extension((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytload_extensionsNs
cCsnt|jt�std��|j|jko>|jknsOtd��|jdksjtd��|S(s*Perform a sanity check on the environment.sGundefined must be a subclass of undefined because filters depend on it.s;block, variable and comment start strings must be differents
s
s
s3newline_sequence set to unknown line ending string.(s
s
s
(t
issubclasst	undefinedRtAssertionErrortblock_start_stringtvariable_start_stringtcomment_start_stringtnewline_sequence(RC((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt_environment_sanity_checkZs	R3cBsQeZdZeZeZd!ZeZd!Z	d!Z
eee
eeeeeeeeed"eed!ed!ded!d�Zd�Zd�Zeeeeeeeeeeeeeeeeeeed�Zeedd�Z d�Z!d	�Z"d
�Z#d!d!d!d!d�Z$d!d!d�Z%e&d!d!d
��Z'd�Z(d!d!d�Z)d!d!d�Z*d!d!d�Z+ed�Z,d�Z-e&d!d!eed��Z.ed�Z/d!d!dd!eed�Z0d!d!d�Z1d!ed!d�Z2d�Z3e&d��Z4e&d!d!d��Z5e&d!d!d��Z6e&d!d!d��Z7d!d!d�Z8d �Z9RS(#s�The core component of Jinja is the `Environment`.  It contains
    important shared variables like configuration, filters, tests,
    globals and others.  Instances of this class may be modified if
    they are not shared and if no template was loaded so far.
    Modifications on environments after the first template was loaded
    will lead to surprising effects and undefined behavior.

    Here the possible initialization parameters:

        `block_start_string`
            The string marking the begin of a block.  Defaults to ``'{%'``.

        `block_end_string`
            The string marking the end of a block.  Defaults to ``'%}'``.

        `variable_start_string`
            The string marking the begin of a print statement.
            Defaults to ``'{{'``.

        `variable_end_string`
            The string marking the end of a print statement.  Defaults to
            ``'}}'``.

        `comment_start_string`
            The string marking the begin of a comment.  Defaults to ``'{#'``.

        `comment_end_string`
            The string marking the end of a comment.  Defaults to ``'#}'``.

        `line_statement_prefix`
            If given and a string, this will be used as prefix for line based
            statements.  See also :ref:`line-statements`.

        `line_comment_prefix`
            If given and a string, this will be used as prefix for line based
            based comments.  See also :ref:`line-statements`.

            .. versionadded:: 2.2

        `trim_blocks`
            If this is set to ``True`` the first newline after a block is
            removed (block, not variable tag!).  Defaults to `False`.

        `lstrip_blocks`
            If this is set to ``True`` leading spaces and tabs are stripped
            from the start of a line to a block.  Defaults to `False`.

        `newline_sequence`
            The sequence that starts a newline.  Must be one of ``'\r'``,
            ``'\n'`` or ``'\r\n'``.  The default is ``'\n'`` which is a
            useful default for Linux and OS X systems as well as web
            applications.

        `keep_trailing_newline`
            Preserve the trailing newline when rendering templates.
            The default is ``False``, which causes a single newline,
            if present, to be stripped from the end of the template.

            .. versionadded:: 2.7

        `extensions`
            List of Jinja extensions to use.  This can either be import paths
            as strings or extension classes.  For more information have a
            look at :ref:`the extensions documentation <jinja-extensions>`.

        `optimized`
            should the optimizer be enabled?  Default is `True`.

        `undefined`
            :class:`Undefined` or a subclass of it that is used to represent
            undefined values in the template.

        `finalize`
            A callable that can be used to process the result of a variable
            expression before it is output.  For example one can convert
            `None` implicitly into an empty string here.

        `autoescape`
            If set to true the XML/HTML autoescaping feature is enabled by
            default.  For more details about auto escaping see
            :class:`~jinja2.utils.Markup`.  As of Jinja 2.4 this can also
            be a callable that is passed the template name and has to
            return `True` or `False` depending on autoescape should be
            enabled by default.

            .. versionchanged:: 2.4
               `autoescape` can now be a function

        `loader`
            The template loader for this environment.

        `cache_size`
            The size of the cache.  Per default this is ``50`` which means
            that if more than 50 templates are loaded the loader will clean
            out the least recently used template.  If the cache size is set to
            ``0`` templates are recompiled all the time, if the cache size is
            ``-1`` the cache will not be cleaned.

        `auto_reload`
            Some loaders load templates from locations where the template
            sources may change (ie: file system or database).  If
            `auto_reload` is set to `True` (default) every time a template is
            requested the loader checks if the source changed and if yes, it
            will reload the template.  For higher performance it's possible to
            disable that.

        `bytecode_cache`
            If set to a bytecode cache object, this object will provide a
            cache for the internal Jinja bytecode so that templates don't
            have to be parsed if they were not changed.

            See :ref:`bytecode-cache` for more information.
    i2cCs||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_||_||_
||_||_tj�|_tj�|_tj�|_||_t|�|_||_||_t||
�|_t|�dS(N(RKtblock_end_stringRLtvariable_end_stringRMtcomment_end_stringtline_statement_prefixtline_comment_prefixttrim_blockst
lstrip_blocksRNtkeep_trailing_newlineRIt	optimizedtfinalizet
autoescapeRtcopytfiltersRttestsR
tglobalstloaderR;R?tbytecode_cachetauto_reloadRGRDRO(tselfRKRPRLRQRMRRRSRTRURVRNRWRDRXRIRYRZR_t
cache_sizeRaR`((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__init__�s2"																			cCs |jjt||g��dS(s\Adds an extension after the environment was created.

        .. versionadded:: 2.5
        N(RDtupdateRG(RbRF((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt
add_extension3scKsCx<t|�D].\}}t||�s
t|||�q
q
WdS(s�Add the items to the instance of the environment if they do not exist
        yet.  This is used by :ref:`extensions <writing-extensions>` to register
        callbacks and configuration values without breaking inheritance.
        N(R&thasattrtsetattr(Rbt
attributestkeytvalue((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytextend:scCs8tt��}|d=|d=|d=tj|j�}|jj|j�t|_||_	x9t
|�D]+\}}|tk	rht|||�qhqhW|tk	r�t
|�|_nt|j�|_i|_x3t
|j�D]"\}}|j|�|j|<q�W|tk	r.|jjt||��nt|�S(sfCreate a new overlay environment that shares all the data with the
        current environment except of cache and the overridden attributes.
        Extensions cannot be removed for an overlayed environment.  An overlayed
        environment automatically gets all the extensions of the environment it
        is linked to plus optional extra extensions.

        Creating overlays should happen after the initial environment was set
        up completely.  Not all attributes are truly linked, some are just
        copied over so modifications on the original environment may not shine
        through.
        RbRcRD(R=tlocalstobjectt__new__t	__class__t__dict__ReR5t	overlayedt	linked_toR&RRhR;R?R@RDtbindRGRO(RbRKRPRLRQRMRRRSRTRURVRDRXRIRYRZR_RcRaR`R7trvRjRk((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytoverlayCs$			tdocsThe lexer for this environment.cCs"tt|jj�dd���S(s)Iterates over the extensions by priority.RjcSs|jS(N(tpriority(tx((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt<lambda>us(titertsortedRDtvalues(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytiter_extensionsrscCs�y||SWn�ttfk
r�t|t�r}yt|�}Wntk
rTq}Xyt||�SWq}tk
ryq}Xn|jd|d|�SXdS(s:Get an item or attribute of an object but prefer the item.tobjtnameN(	R2tLookupErrorRAR%tstrt	ExceptiontgetattrtAttributeErrorRI(RbRtargumenttattr((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytgetitemws

cCseyt||�SWntk
r$nXy||SWn-tttfk
r`|jd|d|�SXdS(s�Get an item or attribute of an object but prefer the attribute.
        Unlike :meth:`getitem` the attribute *must* be a bytestring.
        RR�N(R�R�R2R�RI(RbRt	attribute((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��s
cCs|jj|�}|dkr1td|��n|gt|pCd�}t|dt�r�|dkrwtd��n|jd|�n}t|dt�r�|dkr�|dk	r�|j}q�t	|�}n|jd|�n%t|dt�r|jd|�n|||pi�S(	sfInvokes a filter on a value the same way the compiler does it.

        .. versionadded:: 2.7
        sno filter named %rt
contextfilters2Attempted to invoke context filter without contextitevalcontextfiltertenvironmentfilterN((
R\R1R4RtlistR�tFalsetinsertteval_ctxR(RbR�RkR7tkwargstcontextR�tfunc((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytcall_filter�s"cCsM|jj|�}|dkr1td|��n|||p@d|pIi�S(sdInvokes a test on a value the same way the compiler does it.

        .. versionadded:: 2.7
        sno test named %rN((R]R1R4R(RbR�RkR7R�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt	call_test�scCsNy|j|||�SWntk
r6tj�}nX|j|d|�dS(s�Parse the sourcecode and return the abstract syntax tree.  This
        tree of nodes is used by the compiler to convert the template into
        executable source- or bytecode.  This is useful for debugging or to
        extract information from templates.

        If you are :ref:`developing Jinja2 extensions <writing-extensions>`
        this gives you a good overview of the node tree generated.
        tsource_hintN(t_parseRtsystexc_infothandle_exception(RbtsourceR�tfilenameR�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytparse�s


cCst|||t|��j�S(s8Internal parsing function used by `parse` and `compile`.(RR,R�(RbR�R�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��scCs]t|�}y|jj|||�SWntk
rEtj�}nX|j|d|�dS(s�Lex the given sourcecode and return a generator that yields
        tokens as tuples in the form ``(lineno, token_type, value)``.
        This can be useful for :ref:`extension development <writing-extensions>`
        and debugging templates.

        This does not perform preprocessing.  If you want the preprocessing
        of the extensions to be applied you have to filter source through
        the :meth:`preprocess` method.
        R�N(R'tlexert	tokeniterRR�R�R�(RbR�R�R�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytlex�s

cs(t��fd�|j�t|��S(s�Preprocesses the source with all extensions.  This is automatically
        called for all parsing and compiling methods but *not* for :meth:`lex`
        because there you usually only want the actual source tokenized.
        cs|j|���S(N(t
preprocess(tste(R�R�(s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRz�s(R/R~R'(RbR�R�R�((R�R�s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��scCs~|j|||�}|jj||||�}xG|j�D]9}|j|�}t|t�s=t|||�}q=q=W|S(s�Called by the parser to do the preprocessing and filtering
        for all the extensions.  Returns a :class:`~jinja2.lexer.TokenStream`.
        (R�R�ttokenizeR~t
filter_streamRAR(RbR�R�R�tstatetstreamtext((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt	_tokenize�scCst||||d|�S(s|Internal hook that can be overridden to hook a different generate
        method in.

        .. versionadded:: 2.5
        t
defer_init(R(RbR�R�R�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt	_generate�scCst||d�S(s{Internal hook that can be overridden to hook a different compile
        method in.

        .. versionadded:: 2.5
        texec(tcompile(RbR�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt_compile�scCs�d}y�t|t�r6|}|j|||�}n|jrQt||�}n|j|||d|�}|rv|S|dkr�d}nt|�}|j||�SWnt	k
r�t
j�}nX|j|d|�dS(s�Compile a node or template source code.  The `name` parameter is
        the load name of the template after it was joined using
        :meth:`join_path` if necessary, not the filename on the file system.
        the `filename` parameter is the estimated filename of the template on
        the file system.  If the template came from a database or memory this
        can be omitted.

        The return value of this method is a python code object.  If the `raw`
        parameter is `True` the return value will be a string with python
        code equivalent to the bytecode returned otherwise.  This method is
        mainly used internally.

        `defer_init` is use internally to aid the module code generator.  This
        causes the generated code to be able to import without the global
        environment variable to be set.

        .. versionadded:: 2.4
           `defer_init` parameter added.
        R�s
<template>R�N(
R4RAR%R�RXRR�R,R�RR�R�R�(RbR�R�R�trawR�R�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�s$			
cCs�t||dd�}d	}yJ|j�}|jjsWtd|jjjd	d	��n|j|�Wntk
r�t	j
�}nX|d	k	r�|j|d|�ntj
tjdd�|dd�g}|jtj|dd��}t||�S(
s�A handy helper method that returns a callable that accepts keyword
        arguments that appear as variables in the expression.  If called it
        returns the result of the expression.

        This is useful if applications want to use the same rules as Jinja
        in template "configuration files" or similar situations.

        Example usage:

        >>> env = Environment()
        >>> expr = env.compile_expression('foo == 42')
        >>> expr(foo=23)
        False
        >>> expr(foo=42)
        True

        Per default the return value is converted to `None` if the
        expression returns an undefined value.  This can be changed
        by setting `undefined_to_none` to `False`.

        >>> env.compile_expression('var')() is None
        True
        >>> env.compile_expression('var', undefined_to_none=False)()
        Undefined

        .. versionadded:: 2.1
        R�tvariableschunk after expressionR�REtstoretlinenoiN(RR4tparse_expressionR�teosRtcurrentR�tset_environmentR�R�R�RtAssigntNametfrom_stringtTemplatetTemplateExpression(RbR�tundefined_to_nonetparserR�texprtbodyttemplate((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytcompile_expression,s 
'tdeflatedc	s�ddlm}|dkr(d�}n|r�ts;trdddlm}	|	td��t}q�ddl	}
ddl
}|
j�djd�}t
jdkr�|d
jd�7}q�n����fd�}
�dk	r9ddlm}m�m}m}|�d
td|d|����|d��n0tjj��s[tj��n|d��z$x|j||�D]	}|jj||�\}}}y|j|||tt�}Wn6tk
r�}|s��n|d||f�qnX|j|�}|rd|j |t!|��}|
|d||j"|�d�|d||df�q|
||d
�|d||f�qWWd�r��j#�nX|d�dS(sCFinds all the templates the loader can find, compiles them
        and stores them in `target`.  If `zip` is `None`, instead of in a
        zipfile, the templates will be will be stored in a directory.
        By default a deflate zip algorithm is used, to switch to
        the stored algorithm, `zip` can be set to ``'stored'``.

        `extensions` and `filter_func` are passed to :meth:`list_templates`.
        Each template returned will be compiled to the target folder or
        zipfile.

        By default template compilation errors are ignored.  In case a
        log function is provided, errors are logged.  If you want template
        syntax errors to abort the compilation you can set `ignore_errors`
        to `False` and you will get an exception on syntax errors.

        If `py_compile` is set to `True` .pyc files will be written to the
        target instead of standard .py files.  This flag does not do anything
        on pypy and Python 3 where pyc files are not picked up by itself and
        don't give much benefit.

        .. versionadded:: 2.4
        i����(tModuleLoadercSsdS(N(R4(Ry((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRzus(twarns,py_compile has no effect on pypy or Python 3Nuÿÿÿÿsiso-8859-15iucso�r.�|�}d|_�j||�n=ttjj�|�|�}z|j|�Wd|j�XdS(Ni�ii�(t
external_attrtwritestrtopentostpathtjointwritetclose(R�tdatatmodetinfotf(tZipInfottargettziptzip_file(s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt
write_file�s	(tZipFileR�tZIP_DEFLATEDt
ZIP_STOREDtwR�tstoredsCompiling into Zip archive "%s"sCompiling into folder "%s"sCould not compile "%s": %stctwbsByte-compiled "%s" as %ssCompiled "%s" as %ssFinished compiling templates(ii($tjinja2.loadersR�R4R-R.twarningsR�tWarningR�timptmarshalt	get_magictencodeR�tversion_infotzipfileR�R�R�R�R=R�R�tisdirtmakedirstlist_templatesR_t
get_sourceR�R5Rtget_module_filenameR�R,tdumpsR�(RbR�RDtfilter_funcR�tlog_functiont
ignore_errorst
py_compileR�R�R�R�t	py_headerR�R�R�R�R�R�R�t_tcodeR�R�((R�R�R�R�s6/usr/lib/python2.7/site-packages/jinja2/environment.pytcompile_templatesYsX
		"
csj|jj�}�dk	rH|dk	r6td��n�fd�}n|dk	rft||�}n|S(s�Returns a list of templates for this environment.  This requires
        that the loader supports the loader's
        :meth:`~BaseLoader.list_templates` method.

        If there are other files in the template folder besides the
        actual templates, the returned list can be filtered.  There are two
        ways: either `extensions` is set to a list of file extensions for
        templates, or a `filter_func` can be provided which is a callable that
        is passed a template name and should return `True` if it should end up
        in the result list.

        If the loader does not support that, a :exc:`TypeError` is raised.

        .. versionadded:: 2.4
        s<either extensions or filter_func can be passed, but not bothcs&d|ko%|jdd�d�kS(Nt.i(trsplit(Ry(RD(s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRz�sN(R_R�R4R2R$(RbRDR�Ry((RDs6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��scCs�|dkrtj�}ntdkr:ddlmant||�}|rk|jdk	rk|j|�S|jdk	r�|j|�n|j\}}}t	|||�dS(s�Exception handling helper.  This is used internally to either raise
        rewritten exceptions or return a rendered traceback for the template.
        i����(tmake_tracebackN(
R4R�R�t_make_tracebacktjinja2.debugR�texception_formattertexception_handlertstandard_exc_infoR((RbR�trenderedR�t	tracebacktexc_typet	exc_valuettb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��s
cCs|S(s�Join a template with the parent.  By default all the lookups are
        relative to the loader root so this method returns the `template`
        parameter unchanged, but if the paths should be relative to the
        parent template, this function can be used to calculate the real
        template name.

        Subclasses may override this method and implement template path
        joining here.
        ((RbR�tparent((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt	join_path�s
cCs�|jdkrtd��n|jdk	re|jj|�}|dk	re|js^|jre|Sn|jj|||�}|jdk	r�||j|<n|S(Ns(no loader for this environment specified(R_R4R2R?R1Rat
is_up_to_datetload(RbR�R^R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt_load_template�s	cCsMt|t�r|S|dk	r4|j||�}n|j||j|��S(s�Load a template from the loader.  If a loader is configured this
        method ask the loader for the template and returns a :class:`Template`.
        If the `parent` parameter is not `None`, :meth:`join_path` is called
        to get the real template name before loading.

        The `globals` parameter can be used to provide template wide globals.
        These variables are available in the context at render time.

        If the template does not exist a :exc:`TemplateNotFound` exception is
        raised.

        .. versionchanged:: 2.4
           If `name` is a :class:`Template` object it is returned from the
           function unchanged.
        N(RAR�R4RRtmake_globals(RbR�RR^((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytget_templates
cCs�|stdd��n|j|�}xj|D]b}t|t�rG|S|dk	rh|j||�}ny|j||�SWq.tk
r�q.Xq.Wt|��dS(swWorks like :meth:`get_template` but tries a number of templates
        before it fails.  If it cannot find any of the templates, it will
        raise a :exc:`TemplatesNotFound` exception.

        .. versionadded:: 2.3

        .. versionchanged:: 2.4
           If `names` contains a :class:`Template` object it is returned
           from the function unchanged.
        tmessageu0Tried to select from an empty list of templates.N(RRRAR�R4RRR(RbtnamesRR^R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytselect_templates

cCsHt|t�r"|j|||�St|t�r5|S|j|||�S(s�Does a typecheck and dispatches to :meth:`select_template`
        if an iterable of template names is given, otherwise to
        :meth:`get_template`.

        .. versionadded:: 2.3
        (RAR%RR�R
(Rbttemplate_name_or_listRR^((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytget_or_select_template4s
	cCs=|j|�}|p|j}|j||j|�|d�S(suLoad a template from a string.  This parses the source given and
        returns a :class:`Template` object.
        N(Rttemplate_classt	from_codeR�R4(RbR�R^R
tcls((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�CscCs|s
|jSt|j|�S(sReturn a dict for the globals.(R^R=(Rbtd((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRKsN((:t__name__t
__module__t__doc__R�t	sandboxedRrR4RsR6R�R�RRRRRRRRR	RR
RR5RRdRfRlRRvtpropertyRR�R~R�R�R�R�R"R�R�R�R�R�R�R�R�R�R�R�R�RRRR
RR�R(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR3gs�q0					%			

			(-\	
R�cBs�eZdZeeeeeee	e
eee
edeeded�Zedd��Zed��Zed��Zd�Zd�Zd�Zdedd�Zdedd	�Zed
��Zd�Zed��Z ed
��Z!d�Z"RS(s�The central template object.  This class represents a compiled template
    and is used to evaluate it.

    Normally the template object is generated from an :class:`Environment` but
    it also has a constructor that makes it possible to create a template
    instance directly using the constructor.  It takes the same arguments as
    the environment constructor but it's not possible to specify a loader.

    Every template object has a few methods and members that are guaranteed
    to exist.  However it's important that a template object should be
    considered immutable.  Modifications on the object are not supported.

    Template objects created from the constructor rather than an environment
    do have an `environment` attribute that points to a temporary environment
    that is probably shared with other templates created with the constructor
    and compatible settings.

    >>> template = Template('Hello {{ name }}!')
    >>> template.render(name='John Doe')
    u'Hello John Doe!'

    >>> stream = template.stream(name='John Doe')
    >>> stream.next()
    u'Hello John Doe!'
    >>> stream.next()
    Traceback (most recent call last):
        ...
    StopIteration
    cCsat||||||||	|
|||
t|�||||ddtd�}|j|d|�S(NiR
(R9t	frozensetR4R�R�(RR�RKRPRLRQRMRRRSRTRURVRNRWRDRXRIRYRZR8((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRoqs				cBsGi|d6|jd6}||fdU|j|||�}||_|S(s�Creates a template object from compiled code and the globals.  This
        is used by the loaders and environment to create a template object.
        RCt__file__N(tco_filenamet_from_namespacet	_uptodate(RRCR�R^tuptodatet	namespaceRu((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�s
	cCs|j|||�S(s�Creates a template object from a module.  This is used by the
        module loader to create a template object.

        .. versionadded:: 2.4
        (R(RRCtmodule_dictR^((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytfrom_module_dict�scCs�tj|�}||_||_|d|_|d|_|d|_|d|_d|_	|d|_
d|_||d<||d<|S(NR�Rtblockstroott
debug_infoRCt__jinja_template__(RnRoRCR^R�R�Rtroot_render_funcR4t_modulet_debug_infoR(RRCRR^tt((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�s		



	
	

cOsbt||�}y t|j|j|���SWntk
rNtj�}nX|jj|t	�S(s�This method accepts the same arguments as the `dict` constructor:
        A dict, a dict subclass or some keyword arguments.  If no arguments
        are given the context will be empty.  These two calls do the same::

            template.render(knights='that say nih')
            template.render({'knights': 'that say nih'})

        This will return the rendered template as unicode string.
        (
R=R R#RR�R�R�RCR�R5(RbR7R�tvarsR�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytrender�s
 
cOst|j||��S(s[Works exactly like :meth:`generate` but returns a
        :class:`TemplateStream`.
        (tTemplateStreamR(RbR7R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR��scoswt||�}y,x%|j|j|��D]}|Vq+WWntk
rZtj�}nXdS|jj|t�VdS(sjFor very large templates it can be useful to not render the whole
        template at once but evaluate each statement after another and yield
        piece for piece.  This method basically does exactly that and returns
        a generator that yields one item after another as unicode strings.

        It accepts the same arguments as :meth:`render`.
        N(	R=R#RR�R�R�RCR�R5(RbR7R�R'teventR�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�s

cCs(t|j|j|j|||j|�S(s^Create a new :class:`Context` for this template.  The vars
        provided will be passed to the template.  Per default the globals
        are added to the context.  If shared is set to `True` the data
        is passed as it to the context without adding the globals.

        `locals` can be a dict of local variables for internal usage.
        (RRCR�RR^(RbR'R6Rm((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�scCst||j|||��S(sJThis method works like the :attr:`module` attribute when called
        without arguments but it will evaluate the template on every call
        rather than caching it.  It's also possible to provide
        a dict which is then used as context.  The arguments are the same
        as for the :meth:`new_context` method.
        (tTemplateModuleR(RbR'R6Rm((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytmake_module�scCs-|jdk	r|jS|j�|_}|S(sUThe template as module.  This is used for imports in the
        template runtime but is also useful if one wants to access
        exported template variables from the Python layer:

        >>> t = Template('{% macro foo() %}42{% endmacro %}23')
        >>> unicode(t.module)
        u'23'
        >>> t.module.foo()
        u'42'
        N(R$R4R,(RbRu((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytmodule�scCs4x-t|j�D]\}}||kr|SqWdS(srReturn the source line number of a line number in the
        generated bytecode as they are not in sync.
        i(treversedR!(RbR�t
template_linet	code_line((s6/usr/lib/python2.7/site-packages/jinja2/environment.pytget_corresponding_linenoscCs|jdkrtS|j�S(s?If this variable is `False` there is a newer version available.N(RR4R5(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRscCs;g|jjd�D]$}ttt|jd���^qS(sThe debug info mapping.t&t=(R%tsplitttupleR#tint(RbRy((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR!scCsE|jdkr"dt|�}nt|j�}d|jj|fS(Ns	memory:%xs<%s %s>(R�R4tidtreprRpR(RbR�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__repr__s(N(#RRRRRRRRRRRR	RR
RR5RR4R�RotclassmethodRRRR(R�RRR,RR-R1RR!R9(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�Rs@

							R+cBs2eZdZd�Zd�Zd�Zd�ZRS(s�Represents an imported template.  All the exported names of the
    template are available as attributes on this object.  Additionally
    converting it into an unicode- or bytestrings renders the contents.
    cCs>t|j|��|_|jj|j��|j|_dS(N(R�R#t_body_streamRqRetget_exportedR�R(RbR�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRd-scCstt|j��S(N(RR R;(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__html__2scCs
t|j�S(N(R R;(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__str__5scCsE|jdkr"dt|�}nt|j�}d|jj|fS(Ns	memory:%xs<%s %s>(RR4R7R8Rp(RbR�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR98s(RRRRdR=R>R9(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR+&s
			R�cBs eZdZd�Zd�ZRS(s�The :meth:`jinja2.Environment.compile_expression` method returns an
    instance of this object.  It encapsulates the expression-like access
    to the template with an expression it wraps.
    cCs||_||_dS(N(t	_templatet_undefined_to_none(RbR�R�((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRdFs	cOsc|jjt||��}t|jj|��|jd}|jr_t|t�r_d}n|S(NRE(
R?RR=R!R#R'R@RARR4(RbR7R�R�Ru((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__call__Js
	(RRRRdRA(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR�@s	R)cBsMeZdZd�Zd	dd�Zd�Zdd�Zd�Zd�Z	RS(
sA template stream works pretty much like an ordinary python generator
    but it can buffer multiple items to reduce the number of total iterations.
    Per default the output is unbuffered which means that for every unbuffered
    instruction in the template one unicode string is yielded.

    If buffering is enabled with a buffer size of 5, five items are combined
    into a new unicode string.  This is mainly useful if you are streaming
    big templates to a client via WSGI which flushes after each iteration.
    cCs||_|j�dS(N(t_gentdisable_buffering(Rbtgen((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRd_s	tstrictcs�t}t|t�r?t|�dkr-dp0d�}t}nzo�dk	rj��fd�|D�}n|}t|d�r�|j|�nx|D]}|j|�q�WWd|r�|j	�nXdS(s!Dump the complete stream into a file or file-like object.
        Per default unicode strings are written, if you want to encode
        before writing specify an `encoding`.

        Example usage::

            Template('Hello {{ name }}!').stream(name='foo').dump('hello.html')
        R�R�c3s!|]}|j���VqdS(N(R�(t.0Ry(tencodingterrors(s6/usr/lib/python2.7/site-packages/jinja2/environment.pys	<genexpr>rst
writelinesN(
R�RAR%R�R4R5RgRIR�R�(RbtfpRGRHR�titerabletitem((RGRHs6/usr/lib/python2.7/site-packages/jinja2/environment.pytdumpcs	!	
cCst|j�|_t|_dS(sDisable the output buffering.N(R+RBt_nextR�tbuffered(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyRC~sicsU�dkrtd��n�fd�}t|_t|t|j���|_dS(s<Enable buffering.  Buffer `size` items before yielding them.isbuffer size too smallc3s�g}d}|j}xsy=x6|�krS|�}||�|r|d7}qqWWntk
rr|ssdSnXt|�V|2d}qdS(Nii(tappendt
StopIterationR (tnexttbuftc_sizetpushR�(R:(s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt	generator�s 		

N(t
ValueErrorR5ROR+RBRN(RbR:RV((R:s6/usr/lib/python2.7/site-packages/jinja2/environment.pytenable_buffering�s
	cCs|S(N((Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__iter__�scCs
|j�S(N(RN(Rb((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt__next__�sN(
RRRRdR4RMRCRXRYRZ(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyR)Ss
			(NRR�R�tjinja2Rtjinja2.defaultsRRRRRRRRR	R
RRR
RRtjinja2.lexerRRt
jinja2.parserRtjinja2.nodesRtjinja2.optimizerRtjinja2.compilerRtjinja2.runtimeRRtjinja2.exceptionsRRRRtjinja2.utilsRRRRR R!R"tjinja2._compatR#R$R%R&R'R(R)R*R+R,R-R.t	functoolsR/R0R4R�R9R;R@RGRORnR3R�R+R�R)R
(((s6/usr/lib/python2.7/site-packages/jinja2/environment.pyt<module>
s>d"4R							
����S

Zerion Mini Shell 1.0