Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/jinja2/__pycache__/environment.cpython-37.pyc

607 lines
42 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F>]<5D><><00>@s<>dZddlZddlZddlZddlmZmZddlmZddl m
Z
m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZddlmZmZddlmZddlm Z dd l!m"Z"m#Z#dd
l$m%Z%m&Z&m'Z'dd l(m)Z)m*Z*m+Z+m,Z,dd l-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5dd l6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAe/d<0E>ZBdaCdd<10>ZDdd<12>ZEdd<14>ZFdd<16>ZGdd<18>ZHdd<1A>ZIGdd<1C>deJ<65>ZKGdd<1E>deJ<65>ZLe>Gdd <20>d eJ<65><03>ZMGd!d"<22>d"eJ<65>ZNe=Gd#d$<24>d$eJ<65><03>ZOeLeK_PdS)%z<>
jinja2.environment
~~~~~~~~~~~~~~~~~~
Provides a class that holds runtime and parsing time options.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
<EFBFBD>N)<02>reduce<63>partial)<01>nodes)<10>BLOCK_START_STRING<4E>BLOCK_END_STRING<4E>VARIABLE_START_STRING<4E>VARIABLE_END_STRING<4E>COMMENT_START_STRING<4E>COMMENT_END_STRING<4E>LINE_STATEMENT_PREFIX<49>LINE_COMMENT_PREFIX<49> TRIM_BLOCKS<4B>NEWLINE_SEQUENCE<43>DEFAULT_FILTERS<52> DEFAULT_TESTS<54>DEFAULT_NAMESPACE<43>DEFAULT_POLICIES<45>KEEP_TRAILING_NEWLINE<4E> LSTRIP_BLOCKS)<02> get_lexer<65> TokenStream)<01>Parser)<01> EvalContext)<02>generate<74> CodeGenerator)<03> Undefined<65> new_context<78>Context)<04>TemplateSyntaxError<6F>TemplateNotFound<6E>TemplatesNotFound<6E>TemplateRuntimeError)<08> import_string<6E>LRUCache<68>Markup<75>missing<6E>concat<61>consume<6D> internalcode<64>have_async_gen) <0B>imap<61>ifilter<65> string_types<65> iteritems<6D> text_type<70>reraise<73>implements_iterator<6F>implements_to_string<6E>encode_filename<6D>PY2<59>PYPY<50>
cGsNyt<00>|<00>}Wntk
r&t|<00>SX|dk r4|St|<00>t|<}d|_|S)z<>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.
NT)<05>_spontaneous_environments<74>get<65> TypeError<6F> Environment<6E>shared)<02>args<67>env<6E>r=<00>6/tmp/pip-install-c3kgu56x/Jinja2/jinja2/environment.py<70>get_spontaneous_environment,s
r?cCs |dkr dS|dkriSt|<00>S)z*Return the cache class for the given size.rN)r#)<01>sizer=r=r><00> create_cache<s
rAcCs&|dkr dSt|<00>tkriSt|j<03>S)z(Create an empty copy of the given cache.N)<04>type<70>dictr#<00>capacity)<01>cacher=r=r><00>
copy_cacheEs
 rFcCs6i}x,|D]$}t|t<01>r t|<03>}||<00>||j<q
W|S)zwLoad the extensions from the list and bind it to the environment.
Returns a dict of instantiated environments.
)<04>
isinstancer,r"<00>
identifier)<04> environment<6E>
extensions<EFBFBD>result<6C> extensionr=r=r><00>load_extensionsNs 

rMc
CsZ||}t|t<01>rNy |<01><02>Wn.tk
rL}zd||f}Wdd}~XYnXt|<02><01>dS)Nz3%s (%s; did you forget to quote the callable name?))rGrZ_fail_with_undefined_error<6F> Exceptionr!)<04>string<6E>name<6D>msg<73>er=r=r><00>fail_for_missing_callableZs
 rScCsNt|jt<02>std<01><01>|j|jkr.|jks8ntd<02><01>|jdksJtd<04><01>|S)z*Perform a sanity check on the environment.zGundefined must be a subclass of undefined because filters depend on it.z;block, variable and comment start strings must be different)<03> z
<EFBFBD>
z3newline_sequence set to unknown line ending string.)<08>
issubclass<EFBFBD> undefinedr<00>AssertionError<6F>block_start_string<6E>variable_start_string<6E>comment_start_string<6E>newline_sequence)rIr=r=r><00>_environment_sanity_checkds  r]c@s<>eZdZdZdZdZdZdZdZdZ e
Z e Z eeeeeeeeeeeeddedddddddfdd<08>Zd d
<EFBFBD>Zd d <0C>Zeeeeeeeeeeeeeeeeeeefd d<0E>Ze e!dd<10>Z"dd<12>Z#dd<14>Z$dd<16>Z%dBdd<18>Z&dCdd<1A>Z'e(dDdd<1C><01>Z)dd<1E>Z*dEdd <20>Z+dFd!d"<22>Z,dGd#d$<24>Z-dHd%d&<26>Z.d'd(<28>Z/e(dId)d*<2A><01>Z0dJd+d,<2C>Z1dKd.d/<2F>Z2dLd0d1<64>Z3dMd2d3<64>Z4d4d5<64>Z5e(d6d7<64><00>Z6e(dNd8d9<64><01>Z7e(dOd:d;<3B><01>Z8e(dPd<d=<3D><01>Z9dQd>d?<3F>Z:d@dA<64>Z;dS)Rr9a<>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 are the possible initialization parameters:
`block_start_string`
The string marking the beginning 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 beginning 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 beginning 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
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 autoescaping 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 ``400`` which means
that if more than 400 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.
.. versionchanged:: 2.8
The cache size was increased to 400 from a low 50.
`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.
`enable_async`
If set to true this enables async template execution which allows
you to take advantage of newer Python features. This requires
Python 3.6 or later.
FNr=Ti<54>cCs<>||_||_||_||_||_||_||_||_| |_|
|_ | |_
| |_ ||_ ||_ ||_||_t<10><11>|_t<13><11>|_t<15><11>|_||_t|<13>|_||_||_t<1C><11>|_t|| <0A>|_||_ |j o<>t!|_"t#|<00>dS)N)$rY<00>block_end_stringrZ<00>variable_end_stringr[<00>comment_end_string<6E>line_statement_prefix<69>line_comment_prefix<69> trim_blocks<6B> lstrip_blocksr\<00>keep_trailing_newlinerW<00> optimized<65>finalize<7A>
autoescaper<00>copy<70>filtersr<00>testsr<00>globals<6C>loaderrArE<00>bytecode_cache<68> auto_reloadrZpoliciesrMrJ<00> enable_asyncr)<00>is_asyncr])<17>selfrYr^rZr_r[r`rarbrcrdr\rerJrfrWrgrhrm<00>
cache_sizerornrpr=r=r><00>__init__s8#




  zEnvironment.__init__cCs|j<00>t||g<01><02>dS)z\Adds an extension after the environment was created.
.. versionadded:: 2.5
N)rJ<00>updaterM)rrrLr=r=r><00> add_extensionTszEnvironment.add_extensioncKs0x*t|<01>D]\}}t||<02>s
t|||<03>q
WdS)z<>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-<00>hasattr<74>setattr)rr<00>
attributes<EFBFBD>key<65>valuer=r=r><00>extend[s
zEnvironment.extendcCs<>tt<01><00>}|d=|d=|d=t<02>|j<04>}|j<05>|j<05>d|_||_x(t |<14>D]\}}|t
k rLt |||<17>qLW|t
k r<>t |<11>|_ n t|j <0A>|_ i|_x&t |j<0F>D]\}}|<17>|<15>|j|<q<>W| t
k r<>|j<0F>t|| <0B><02>t|<15>S)agCreate a new overlay environment that shares all the data with the
current environment except for 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.
rrrsrJT)rC<00>locals<6C>object<63>__new__<5F> __class__<5F>__dict__ru<00> overlayed<65> linked_tor-r%rxrArErFrJ<00>bindrMr])rrrYr^rZr_r[r`rarbrcrdrJrfrWrgrhrmrsrornr;<00>rvrzr{r=r=r><00>overlayds$
   zEnvironment.overlayzThe lexer for this environment.)<01>doccCstt|j<02><03>dd<02>d<03><02>S)z)Iterates over the extensions by priority.cSs|jS)N)<01>priority)<01>xr=r=r><00><lambda><3E><00>z-Environment.iter_extensions.<locals>.<lambda>)rz)<04>iter<65>sortedrJ<00>values)rrr=r=r><00>iter_extensions<6E>s zEnvironment.iter_extensionsc Cs~y||Stttfk
rxt|t<04>rjy t|<02>}Wntk
rHYn"Xy
t||<03>Stk
rhYnX|j||d<01>SXdS)z:Get an item or attribute of an object but prefer the item.)<02>objrPN) <09>AttributeErrorr8<00> LookupErrorrGr,<00>strrN<00>getattrrW)rrr<><00>argument<6E>attrr=r=r><00>getitem<65>s
 
zEnvironment.getitemc
CsRy
t||<02>Stk
rYnXy||Stttfk
rL|j||d<01>SXdS)z<>Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a bytestring.
)r<>rPN)r<>r<>r8r<>rW)rrr<><00> attributer=r=r>r<><00>s
zEnvironment.getattrcCs<>|j<00>|<01>}|dkrtd|<01>|gt|p*d<03>}t|dd<05>rZ|dkrLtd<06><01>|<03>d|<05>nRt|dd<05>r<>|dkr<>|dk r~|j}nt|<00>}|<03>d|<06>nt|d d<05>r<>|<03>d|<00>|||p<>i<00>S)
aWInvokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and the filter
supports async execution. It's your responsibility to await this
if needed.
.. versionadded:: 2.7
Nzno filter named %rr=Z contextfilterFz2Attempted to invoke context filter without contextrZevalcontextfilterZenvironmentfilter) rjr7rS<00>listr<74>r!<00>insert<72>eval_ctxr)rrrPr{r;<00>kwargs<67>contextr<74><00>funcr=r=r><00> call_filter<65>s" 
    zEnvironment.call_filtercCs6|j<00>|<01>}|dkrtd|<01>||f|p*d<03>|p2i<00>S)zdInvokes a test on a value the same way the compiler does it.
.. versionadded:: 2.7
Nzno test named %rr=)rkr7rS)rrrPr{r;r<>r<>r=r=r><00> call_test<73>s 
zEnvironment.call_testcCs>y|<00>|||<03>Stk
r*t<02><03>}YnX|j||d<01>dS)a<>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.
)<01> source_hintN)<05>_parser<00>sys<79>exc_info<66>handle_exception)rr<00>sourcerP<00>filenamer<65>r=r=r><00>parse<73>s
zEnvironment.parsecCst|||t|<03><01><04><02>S)z8Internal parsing function used by `parse` and `compile`.)rr2r<>)rrr<>rPr<>r=r=r>r<><00>szEnvironment._parsecCsHt|<01>}y|j<01>|||<03>Stk
r4t<04><05>}YnX|j||d<01>dS)a<>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.<00>lexerZ tokeniterrr<>r<>r<>)rrr<>rPr<>r<>r=r=r><00>lex<65>s
zEnvironment.lexcst<00><00>fdd<02>|<00><01>t|<01><01>S)z<>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|<01>|<00><01><00>S)N)<01>
preprocess)<02>srR)r<>rPr=r>r<> r<>z(Environment.preprocess.<locals>.<lambda>)rr<>r.)rrr<>rPr<>r=)r<>rPr>r<>szEnvironment.preprocesscCsV|<00>|||<03>}|j<01>||||<04>}x0|<00><03>D]$}|<06>|<05>}t|t<06>s*t|||<03>}q*W|S)z<>Called by the parser to do the preprocessing and filtering
for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
)r<>r<><00>tokenizer<65>Z filter_streamrGr)rrr<>rPr<><00>state<74>stream<61>extr=r=r><00> _tokenize s

zEnvironment._tokenizecCst||||||jd<01>S)z|Internal hook that can be overridden to hook a different generate
method in.
.. versionadded:: 2.5
)<02>
defer_initrf)rrf)rrr<>rPr<>r<>r=r=r><00> _generates zEnvironment._generatecCs t||d<01>S)z{Internal hook that can be overridden to hook a different compile
method in.
.. versionadded:: 2.5
<20>exec)<01>compile)rrr<>r<>r=r=r><00>_compile!szEnvironment._compilecCs<>d}yXt|t<01>r"|}|<00>|||<03>}|j||||d<02>}|r<|S|dkrJd}nt|<03>}|<00>||<03>Stk
rxt<07><08>}YnX|j ||d<04>dS)a<>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.
N)r<>z
<template>)r<>)
rGr,r<>r<>r2r<>rr<>r<>r<>)rrr<>rPr<><00>rawr<77>r<>r<>r=r=r>r<>)s 

 zEnvironment.compilecCs<>t||dd<02>}d}y2|<03><01>}|jjs8td|jjjdd<03><04>|<05>|<00>Wntk
r`t<08> <09>}YnX|dk rx|j
||d<05>t j t <0B> dd<07>|dd <09>g}|<00>t j|dd <09><02>}t||<02>S)
a<EFBFBD>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
<20>variable)r<>Nzchunk after expression)r<>rK<00>store<72>)<01>lineno)rZparse_expressionr<6E>Zeosr<00>currentr<74>Zset_environmentr<74>r<>r<>rZAssign<67>Name<6D> from_string<6E>Template<74>TemplateExpression)rrr<><00>undefined_to_none<6E>parserr<72><00>expr<70>body<64>templater=r=r><00>compile_expressionQs zEnvironment.compile_expression<6F>deflatedc s ddlm}|dkrdd<05>}|r<>tr(trFddlm} | td<07><01>d}n:ddl}
ddl} |
<EFBFBD> <09>d <09>
d
<EFBFBD>} t j d kr<>| d <0C>
d
<EFBFBD>7} <0C><00><01><02>fd d<0E>} <0A>dk r<>ddl m}m<0F>m}m}|<0E>dt||d<11><02><00><03>|d<12><00>n"tj<14><15><01>s<>t<13><16><01>|d<13><00>z<>x<EFBFBD>|<00>||<03>D]<5D>}|j<18>||<11>\}}}y|<00>|||dd<14>}Wn@tk
<EFBFBD>rx}z |<06>sT<73>|d||f<00><00>w
Wdd}~XYnX|<08>|<11>}|<07>r<>|<00>|t|<13><01>}| |d| | <0B>|<17>d<17>|d||df<00>n| ||d<10>|d||f<00><00>q
WWd<03><02>r<><72><03> <20>X|d<1A>dS)a;Finds 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 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
r)<01> ModuleLoaderNcSsdS)Nr=)r<>r=r=r>r<><00>r<>z/Environment.compile_templates.<locals>.<lambda>)<01>warnz,py_compile has no effect on pypy or Python 3Fuÿÿÿÿz iso-8859-15)<02>r<>zcsR<00>r <20>|<00>}d|_<00><03>||<01>n.ttj<04><05>|<00>|<02>}z|<04>|<01>Wd|<04><07>XdS)Ni<00>)<08> external_attr<74>writestr<74>open<65>os<6F>path<74>join<69>write<74>close)r<><00>data<74>mode<64>info<66>f)<04>ZipInfo<66>target<65>zip<69>zip_filer=r><00>
write_file<EFBFBD>sz1Environment.compile_templates.<locals>.write_file)<04>ZipFiler<65><00> ZIP_DEFLATED<45>
ZIP_STORED<EFBFBD>w)r<>ZstoredzCompiling into Zip archive "%s"zCompiling into folder "%s"TzCould not compile "%s": %s<>c<>wbzByte-compiled "%s" as %szCompiled "%s" as %szFinished compiling templates)!Zjinja2.loadersr<73>r3r4<00>warningsr<73><00>Warning<6E>imp<6D>marshal<61> get_magic<69>encoder<65><00> version_info<66>zipfiler<65>r<>r<>r<>rCr<>r<><00>isdir<69>makedirs<72>list_templatesrm<00>
get_sourcer<EFBFBD>rZget_module_filenamer<65>r2<00>dumpsr<73>)rrr<>rJ<00> filter_funcr<63>Z log_function<6F> ignore_errors<72>
py_compiler<EFBFBD>r<>r<>r<>Z py_headerr<72>r<>r<>r<>rPr<>r<><00>_<>coderRr<>r=)r<>r<>r<>r<>r><00>compile_templates~sZ    
 
 
 

 
zEnvironment.compile_templatescsH|j<00><01>}<03>dk r.|dk r"td<02><01><01>fdd<04>}|dk rDtt||<03><02>}|S)a<>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
Nz<either extensions or filter_func can be passed, but not bothcsd|ko|<00>dd<02>d<00>kS)N<>.r<>)<01>rsplit)r<>)rJr=r>r<><00>sz,Environment.list_templates.<locals>.<lambda>)rmr<>r8r<>r+)rrrJr<>r<>r=)rJr>r<><00>s
 zEnvironment.list_templatescCsv|dkrt<00><01>}tdkr$ddlmat||<03>}|rF|jdk rF|<00>|<04>S|jdk rZ|<00>|<04>|j\}}}t|||<07>dS)z<>Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
Nr)<01>make_traceback) r<>r<><00>_make_tracebackZ jinja2.debugr<67><00>exception_formatter<65>exception_handlerZstandard_exc_infor/)rrr<><00>renderedr<64><00> traceback<63>exc_type<70> exc_value<75>tbr=r=r>r<><00>s 



 zEnvironment.handle_exceptioncCs|S)a<>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.
r=)rrr<><00>parentr=r=r><00> join_paths
zEnvironment.join_pathcCsx|jdkrtd<01><01>t<02>|j<00>|f}|jdk rP|j<04>|<03>}|dk rP|jrL|jrP|S|j<00>|||<02>}|jdk rt||j|<|S)Nz(no loader for this environment specified) rmr8<00>weakref<65>refrEr7ro<00> is_up_to_date<74>load)rrrPrl<00> cache_keyr<79>r=r=r><00>_load_templates

 

zEnvironment._load_templatecCs4t|t<01>r|S|dk r"|<00>||<02>}|<00>||<00>|<03><01>S)a<>Load a template from the loader. If a loader is configured this
method asks 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)rGr<>rr<00> make_globals)rrrPrrlr=r=r><00> get_template)s

 zEnvironment.get_templatec Csv|stdd<02><01>|<00>|<03>}xP|D]H}t|t<03>r0|S|dk rD|<00>||<02>}y |<00>||<03>Stk
rdYqXqWt|<01><01>dS)awWorks 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.
z0Tried to select from an empty list of templates.)<01>messageN)r rrGr<>rrr)rr<00>namesrrlrPr=r=r><00>select_template@s 



  
zEnvironment.select_templatecCs4t|t<01>r|<00>|||<03>St|t<03>r&|S|<00>|||<03>S)z<>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
)rGr,r r<>r )rrZtemplate_name_or_listrrlr=r=r><00>get_or_select_template[s

z"Environment.get_or_select_templatecCs*|<00>|<02>}|p|j}|<04>||<00>|<01>|d<01>S)zuLoad a template from a string. This parses the source given and
returns a :class:`Template` object.
N)r<00>template_class<73> from_coder<65>)rrr<>rlr<00>clsr=r=r>r<>js

zEnvironment.from_stringcCs|s
|jSt|jf|<01>S)zReturn a dict for the globals.)rlrC)rr<00>dr=r=r>rrszEnvironment.make_globals)NNNN)NN)NN)NN)NN)NN)F)NNFF)T)NNr<4E>NTF)NN)NFN)NN)NN)NN)NN)<<3C>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__Z sandboxedr<64>r<>r:r<>r<>rZcode_generator_classrZ context_classrrrrr r
r r r rrrrrtrvr|r%r<><00>propertyrr<>r<>r<>r<>r<>r<>r(r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>rrr r r r<>rr=r=r=r>r9qs<>y 6  %  

 


 &
-
]

   
r9c@s<>eZdZdZeeeeee e
e e e eeddedddfdd<07>Zed*dd <09><01>Zed
d <0B><00>Zed d <0A><00>Zdd<0F>Zdd<11>Zdd<13>Zdd<15>Zdd<17>Zd+dd<19>Zd,dd<1B>Zd-dd<1D>Zedd<1F><00>Ze d d!<21><00>Z!d"d#<23>Z"e d$d%<25><00>Z#e d&d'<27><00>Z$d(d)<29>Z%dS).r<>a<>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!'
True
>>> stream = template.stream(name='John Doe')
>>> next(stream) == u'Hello John Doe!'
True
>>> next(stream)
Traceback (most recent call last):
...
StopIteration
r=TNFcCsDt|||||||| |
| | | t|<0E>||||dddd|<13>}|j||d<03>S)NrF)r)r?<00> frozensetr<74>)rr<>rYr^rZr_r[r`rarbrcrdr\rerJrfrWrgrhrpr<r=r=r>r<00>szTemplate.__new__cCs.||jd<01>}t||<05>|<00>|||<03>}||_|S)z<>Creates a template object from compiled code and the globals. This
is used by the loaders and environment to create a template object.
)rI<00>__file__)<04> co_filenamer<65><00>_from_namespace<63> _uptodate)rrIr<>rlZuptodate<74> namespacer<65>r=r=r>r<00>s 

zTemplate.from_codecCs|<00>|||<03>S)z<>Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
)r)rrI<00> module_dictrlr=r=r><00>from_module_dict<63>szTemplate.from_module_dictcCsht<00>|<00>}||_||_|d|_|d|_|d|_|d|_d|_|d|_ d|_
||d<||d<|S)NrPr<00>blocks<6B>root<6F>
debug_inforIZ__jinja_template__) r~rrIrlrPr<>r<00>root_render_func<6E>_module<6C> _debug_infor)rrIrrl<00>tr=r=r>r<00>s





zTemplate._from_namespacecOsJt||<02>}yt|<00>|<00>|<03><01><01>Stk
r:t<05><06>}YnX|j<07>|d<01>S)a<>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.
T) rCr&r"rrNr<>r<>rIr<>)rrr;r<><00>varsr<73>r=r=r><00>render<65>s
zTemplate.rendercOs td<01><01>dS)a.This works similar to :meth:`render` but returns a coroutine
that when awaited returns the entire rendered template string. This
requires the async feature to be enabled.
Example usage::
await template.render_async(knights='that say nih; asynchronously')
z8This feature is not available for this version of PythonN)<01>NotImplementedError)rrr;r<>r=r=r><00> render_async<6E>s
zTemplate.render_asynccOst|j||<02><01>S)z[Works exactly like :meth:`generate` but returns a
:class:`TemplateStream`.
)<02>TemplateStreamr)rrr;r<>r=r=r>r<><00>szTemplate.streamcosdt||<02>}y$x|<00>|<00>|<03><01>D]
}|VqWWntk
rJt<04><05>}YnXdS|j<06>|d<02>VdS)ajFor 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`.
NT)rCr"rrNr<>r<>rIr<>)rrr;r<>r&<00>eventr<74>r=r=r>rs
zTemplate.generatecOs td<01><01>dS)zsAn async version of :meth:`generate`. Works very similarly but
returns an async iterator instead.
z8This feature is not available for this version of PythonN)r()rrr;r<>r=r=r><00>generate_asyncszTemplate.generate_asynccCst|j|j|j|||j|<03>S)a^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.
)rrIrPrrl)rrr&r:r}r=r=r>rszTemplate.new_contextcCst||<00>|||<03><03>S)aJThis 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.
)<02>TemplateModuler)rrr&r:r}r=r=r><00> make_module*szTemplate.make_modulecCs td<01><01>dS)z<>As template module creation can invoke template code for
asynchronous exections this method must be used instead of the
normal :meth:`make_module` one. Likewise the module attribute
becomes unavailable in async mode.
z8This feature is not available for this version of PythonN)r()rrr&r:r}r=r=r><00>make_module_async3szTemplate.make_module_asynccCs"|jdk r|jS|<00><01>|_}|S)N)r#r.)rrr<>r=r=r><00>_get_default_module=s
zTemplate._get_default_modulecCs|<00><00>S)a<>The 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')
>>> str(t.module)
'23'
>>> t.module.foo() == u'42'
True
This attribute is not available if async mode is enabled.
)r0)rrr=r=r><00>moduleDszTemplate.modulecCs(x"t|j<01>D]\}}||kr |Sq WdS)zrReturn the source line number of a line number in the
generated bytecode as they are not in sync.
r<>)<02>reversedr!)rrr<>Z template_lineZ code_liner=r=r><00>get_corresponding_linenoTsz!Template.get_corresponding_linenocCs|jdkrdS|<00><00>S)z?If this variable is `False` there is a newer version available.NT)r)rrr=r=r>r]s
zTemplate.is_up_to_datecCsdd<02>|j<00>d<03>D<00>S)zThe debug info mapping.cSs g|]}ttt|<01>d<00><01><02><01>qS)<01>=)<04>tupler*<00>int<6E>split)<02>.0r<EFBFBD>r=r=r><00>
<listcomp>gsz'Template.debug_info.<locals>.<listcomp><3E>&)r$r7)rrr=r=r>r!dszTemplate.debug_infocCs2|jdkrdt|<00>}n
t|j<00>}d|jj|fS)Nz memory:%xz<%s %s>)rP<00>id<69>reprr<72>r)rrrPr=r=r><00>__repr__js

zTemplate.__repr__)N)NFN)NFN)NFN)&rrrrrrrrr r
r r r rrrrr<00> classmethodrrrr'r)r<>rr,rr.r/r(r0rr1r3rr!r=r=r=r=r>r<>ysJ
  
   r<>c@s2eZdZdZd dd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>ZdS) r-z<>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.
NcCsH|dkr&|jjrtd<01><01>t|<01>|<02><01>}||_|j<06>|<02><08><00>|j |_
dS)NzuAsync mode requires a body stream to be passed to a template module. Use the async methods of the API you are using.) rIrq<00> RuntimeErrorr<72>r"<00> _body_streamr<6D>ruZ get_exportedrPr)rrr<>r<>Z body_streamr=r=r>rtyszTemplateModule.__init__cCstt|j<02><01>S)N)r$r&r@)rrr=r=r><00>__html__<5F>szTemplateModule.__html__cCs
t|j<01>S)N)r&r@)rrr=r=r><00>__str__<5F>szTemplateModule.__str__cCs2|jdkrdt|<00>}n
t|j<00>}d|jj|fS)Nz memory:%xz<%s %s>)rr;r<r<>)rrrPr=r=r>r=<00>s

zTemplateModule.__repr__)N)rrrrrtrArBr=r=r=r=r>r-rs

r-c@s eZdZdZdd<03>Zdd<05>ZdS)r<>z<>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)<02> _template<74>_undefined_to_none)rrr<>r<>r=r=r>rt<00>szTemplateExpression.__init__cOsD|j<00>t||<02><01>}t|j<00>|<03><01>|jd}|jr@t|t<08>r@d}|S)NrK) rCrrCr'r"r&rDrGr)rrr;r<>r<>r<>r=r=r><00>__call__<5F>s 
zTemplateExpression.__call__N)rrrrrtrEr=r=r=r>r<><00>sr<>c@sLeZdZdZdd<03>Zddd<07>Zdd <09>Zd
d <0B>Zdd d<0E>Zdd<10>Z dd<12>Z
dS)r*a A 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||_|<00><01>dS)N)<02>_gen<65>disable_buffering)rr<00>genr=r=r>rt<00>szTemplateStream.__init__N<5F>strictcs<>d}t|t<01>r(<28>dkrd<03>t|d<04>}d}zT<7A>dk rH<72><00>fdd<07>|D<00>}n|}t|d<08>rb|<01>|<05>nx|D]}|<01>|<06>qhWWd|r<>|<01><06>XdS) a!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')
FNzutf-8r<38>Tc3s|]}|<01><00><00><01>VqdS)N)r<>)r8r<>)<02>encoding<6E>errorsr=r><00> <genexpr><3E>sz&TemplateStream.dump.<locals>.<genexpr><3E>
writelines)rGr,r<>rwrMr<>r<>)rr<00>fprJrKr<><00>iterable<6C>itemr=)rJrKr><00>dump<6D>s 


 
zTemplateStream.dumpcCstt|j<02>|_d|_dS)zDisable the output buffering.FN)r<00>nextrF<00>_next<78>buffered)rrr=r=r>rG<00>sz TemplateStream.disable_bufferingccs~g}d}|j}xjy0x*||kr<t|j<02>}||<05>|r|d7}qWWntk
r\|sXdSYnXt|<02>V|dd<00>=d}qWdS)Nrr<>)<05>appendrRrF<00> StopIterationr&)rrr@<00>bufZc_size<7A>pushr<68>r=r=r><00>_buffered_generator<6F>s 




z"TemplateStream._buffered_generator<6F>cCs,|dkrtd<02><01>d|_tt|<00>|<01><01>|_dS)z<Enable buffering. Buffer `size` items before yielding them.r<>zbuffer size too smallTN)<06>
ValueErrorrTrrRrYrS)rrr@r=r=r><00>enable_buffering<6E>szTemplateStream.enable_bufferingcCs|S)Nr=)rrr=r=r><00>__iter__<5F>szTemplateStream.__iter__cCs|<00><00>S)N)rS)rrr=r=r><00>__next__<5F>szTemplateStream.__next__)NrI)rZ) rrrrrtrQrGrYr\r]r^r=r=r=r>r*<00>s


r*)Qrr<>r<>r<00> functoolsrrZjinja2rZjinja2.defaultsrrrrr r
r r r rrrrrrrZ jinja2.lexerrrZ jinja2.parserrZ jinja2.nodesrZjinja2.compilerrrZjinja2.runtimerrrZjinja2.exceptionsrrr r!Z jinja2.utilsr"r#r$r%r&r'r(r)Zjinja2._compatr*r+r,r-r.r/r0r1r2r3r4r6r<>r?rArFrMrSr]r~r9r<>r-r<>r*rr=r=r=r><00><module>
sJ H  (4   
 z   U