Files
intellecton/venv/lib/python3.12/site-packages/jinja2/__pycache__/environment.cpython-312.pyc
T

784 lines
75 KiB
Plaintext
Raw Normal View History

Ë
LÀjIðãó<—dZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm
Z
ddl m Z ddl
mZd d
lmZd d lmZd d lmZd d
lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlm Z d dlm!Z!d dlm"Z"d dlm#Z#d dlm$Z$d dl%m&Z&d dl%m'Z'd dl%m(Z(d d l%m)Z)d d!l%m*Z*d d"l+m,Z,d d#l+m-Z-d d$l+m.Z.d d%lm/Z/d d&l0m1Z1d d'l2m3Z3d d(l2m4Z4d d)l2m5Z5d d*l6m7Z7d d+l6m8Z8d d,l6m9Z9d d-l6m:Z:d d.l6m;Z;d d/l6m<Z<d d0l6m=Z=ej|rddl?Z@d d1lAmBZBd d2lCmDZDd d3lEmFZFejŽd4d5¬6«ZHed7¬8«d9ej’eHd:ej”d;eHfd<„«ZKd=eLd;ejšejœejžd>ePfd?ffd@„ZQdAejšejœej”ej”fd;ejšejœejžd>ePfd?ffdB„ZRdCd5dDej¦ej¨ePej’dEfd;ejªePdEffdF„ZVdCeHd;eHfdG„ZWGdH„d5«ZXGdI„d?«ZYGdJ„dK«ZZGdL„dM«Z[GdN„dO«Z\eYeX_]y)PzKClasses for managing templates and their runtime and compile time
options.
éN)ÚChainMap)Ú lru_cache)Úpartial)Úreduce)ÚCodeType)ÚMarkupé)Únodes)Ú
CodeGenerator)Úgenerate)ÚBLOCK_END_STRING)ÚBLOCK_START_STRING)ÚCOMMENT_END_STRING)ÚCOMMENT_START_STRING)ÚDEFAULT_FILTERS)ÚDEFAULT_NAMESPACE)ÚDEFAULT_POLICIES)Ú
DEFAULT_TESTS)ÚKEEP_TRAILING_NEWLINE)ÚLINE_COMMENT_PREFIX)ÚLINE_STATEMENT_PREFIX)Ú
LSTRIP_BLOCKS)ÚNEWLINE_SEQUENCE)Ú TRIM_BLOCKS)ÚVARIABLE_END_STRING)ÚVARIABLE_START_STRING)ÚTemplateNotFound)ÚTemplateRuntimeError)ÚTemplatesNotFound)ÚTemplateSyntaxError)ÚUndefinedError©Ú get_lexer)ÚLexer)Ú TokenStream)Ú EvalContext)ÚParser)ÚContext)Ú new_context)Ú Undefined)Ú_PassArg)Úconcat)Úconsume)Ú
import_string)Ú internalcode©ÚLRUCache)Úmissing)Ú
BytecodeCache)Ú Extension)Ú
BaseLoaderÚ
_env_boundÚ Environment)Úboundé
)ÚmaxsizeÚclsÚargsÚreturncó—||Ž}d|_|S)a Return a new spontaneous environment. A spontaneous environment
is used for templates created directly rather than through an
existing environment.
:param cls: Environment class to create.
:param args: Positional arguments passed to environment.
T)Úshared)r;r<Úenvs úU/home/antigravity/intellecton/venv/lib/python3.12/site-packages/jinja2/environment.pyÚget_spontaneous_environmentrBDs€ñ ˆtˆ*€CØ€C„JØ €JóÚsizezweakref.ref[t.Any]ÚTemplatecó2—|dk(ry|dkriSt|«S)z*Return the cache class for the given size.rNr0)rDs rAÚ create_cacherGRs$€ð ˆq‚yØà ˆa‚x؈ ä �D‹>ÐrCÚcachecóX—|€yt|«turiSt|j«S)z(Create an empty copy of the given cache.N)ÚtypeÚdictr1Úcapacity)rHs rAÚ
copy_cacherM_s,€ð
€}Øä ˆEƒ{”dÑØˆ ä �E—N‘NÓ #Ð#rCÚ environmentÚ
extensionsr4có—i}|D]W}t|t«r0tjtjdt |««}||«||j <ŒY|S)zuLoad the extensions from the list and bind it to the environment.
Returns a dict of instantiated extensions.
r4)Ú
isinstanceÚstrÚtÚcastÚTyper.Ú
identifier)rNrOÚresultÚ extensions rAÚload_extensionsrYls\€ð€Fàò>ˆ Ü �i¤Ô %ÜŸ™œqŸv™v kÑ2´MÀ)Ó4LÓMˆIá'0°Ó'=ˆˆy×#Ñ#Ò$ð >ð €MrCcóâ—t|jt«sJd«‚|j|jcxk7r|j
k7sJd«‚Jd«‚|j dvsJd«‚|S)z*Perform a sanity check on the environment.z5'undefined' must be a subclass of 'jinja2.Undefined'.z<block, variable and comment start strings must be different.>ú
ú
ú
z8'newline_sequence' must be one of '\n', '\r\n', or '\r'.)Ú
issubclassÚ undefinedr*Úblock_start_stringÚvariable_start_stringÚcomment_start_stringÚnewline_sequence)rNs rAÚ_environment_config_checkrd~s°€ä Ø×Ñœyô ð?à>ó?ð ð ×&Ñ&Ø × ,Ñ ,ô ,à × +Ñ +ò ,ðFðFó Fñ ,ðFðFó Fð ,ð × 'Ñ 'ð,ñ ðFðFó Fð ð
ÐrCc/óœ—eZdZUdZdZdZdZejde d<dZ
e Z ejde d<djZeZejee d<ejd e d
<eeeeeeeeeeeed d edddd
d ddfdededededededejedejede de ddde dejBejDeejdfde dejedejejFd ejHfd!ejDe ejFejege ffd"ejd#d$e%d%e d&ejd'd(e f,d)„Z&d*ejDeejdfd+dfd,„Z'd-ejHd+dfd.„Z(e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)e)fdededededededejedejede de ddde dejBejDeejdfde dejedejejFd ejHfd!ejDe ejFejege ffd"ejd#d$e%d%e d&ejd'd(e d+d/f.d0„Z*e+d+e,fd1„«Z-d+ej\dfd2„Z/d3ejHd4ejDeejHfd+ejDejHeffd5„Z0d3ejHd6ed+ejHfd7„Z1d8ejDeefd9ejHd:ejejBejHd;ejejdeejHfd<ejed=eje3d>e d+ejHfd?„Z4 dmd8ed9ejHd:ejejBejHd;ejejdeejHfd<ejed=eje3d+ejHfd@„Z5 dmd8ed9ejHd:ejejBejHd;ejejdeejHfd<ejed=eje3d+ejHfdA„Z6e7 dndBed8ejedCejed+e8jrfdD„«Z:dBed8ejedCejed+e8jrfdE„Z; dndBed8ejedCejed+ej\ejxe%eeffdF„Z= dndBed8ejedCejed+efdG„Z> dndBed8ejedCejedHejed+e?f
dI„Z@ dodBe8jrd8ejedCejedJe d+ef
dK„ZAdBedCed+eBfdL„ZCeDjŠ dpdBejDee8jrfd8ejedCejedMdNdJe d+eBf dO„«ZFeDjŠ dqdBejDee8jrfd8ejedCejedMdPdJe d+ef dQ„«ZFe7 dpdBejDee8jrfd8ejedCejedMe dJe d+ejDeeBff dR„«ZF drdBedSe d+dTfdU„ZG dsdVejDedWfdejej�edXejejFege fdYejedZejejFegdfd[e d+dfd\„ZI dndejej�edXejejFege fd+ej”efd]„ZKdtdBejed+d^fd_„ZLd`edaed+efdb„ZMe7d8edcejejœeejHfd+d fdd„«ZOe7 dnd8ejDed fdaejedcejejœeejHfd+d fde„«ZPe7 dndfej¢ejDed fdaejedcejejœeejHfd+d fdg„«ZRe7 dndhejDed ej”ejDed ffdaejedcejejœeejHfd+d fdi„«ZS dndBejDee8jrfdcejejœeejHfd
ejejd d+d fdj„ZTdkejejœeejHfd+ejœeejHffdl„ZUy)ur7a¤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:`~markupsafe.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 using async functions and generators.
FNÚ linked_tor Úcode_generator_classÚÚ
context_classrEÚtemplate_class©Ti�r`Úblock_end_stringraÚvariable_end_stringrbÚcomment_end_stringÚline_statement_prefixÚline_comment_prefixÚ trim_blocksÚ
lstrip_blocksrcúte.Literal['\n', '\r\n', '\r']Úkeep_trailing_newlinerOr4Ú optimizedr_Úfinalize.Ú
autoescapeÚloaderr5Ú
cache_sizeÚ auto_reloadÚbytecode_cacher3Ú enable_asynccó<—||_||_||_||_||_||_||_||_| |_|
|_ | |_
| |_ ||_ ||_
||_||_t!j"«|_t'j"«|_t+j"«|_||_t1|«|_||_||_t9j"«|_t=||
«|_||_ tC|«y©N)"r`rlrarmrbrnrorprqrrrcrtr_rurvrwrÚcopyÚfiltersrÚtestsrÚglobalsrxrGrHr{rzrÚpoliciesrYrOÚis_asyncrd)Úselfr`rlrarmrbrnrorprqrrrcrtrOrur_rvrwrxryrzr{r|s rAÚ__init__zEnvironment.__init__&s €ðJ#5ˆÔØ 0ˆÔØ%:ˆÔ"Ø#6ˆÔ Ø$8ˆÔ!Ø"4ˆÔØ%:ˆÔ"Ø#6ˆÔ Ø&ˆÔØ*ˆÔØ 0ˆÔØ%:ˆÔ"ð-6ˆŒØ"ˆŒØ ˆŒ
Ø$ˆŒô'×+Ñ+Ó-ˆŒ Ü"×'Ñ'Ó)ˆŒ
Ü(×-Ñ-Ó/ˆŒ ðˆŒ Ü! *Ó-ˆŒ
Ø,ˆÔØ&ˆÔô)×-Ñ-Ó/ˆŒ
ô*¨$°
Ó;ˆŒà$ˆŒ
Ü! $Õ'rCrXr=cóP—|jjt||g««y)z\Adds an extension after the environment was created.
.. versionadded:: 2.5
N)rOÚupdaterY)r…rXs rAÚ
add_extensionzEnvironment.add_extensionrs€ð
�‰×Ñœ¨t°i°[ÓAÕBrCÚ
attributesc óh—|j«D]\}}t||«rŒt|||«Œ!y)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)ÚitemsÚhasattrÚsetattr)r…rŠÚkeyÚvalues rAÚextendzEnvironment.extendys6€ð
%×*Ñ*Ó,ò *‰JˆC�ܘ4 Õ%ܘ˜c 5Õ)ñ *rCzte.Selfcó—tt««}|d=|d=|d=|d=tj|j«}|j
j
|j
«d|_||_|j«D]\}}|tusŒt|||«Œ|turt|«|_
nt|j«|_
i|_|jj«D]#\}}|j!|«|j|<Œ%|
tur%|jj
t#||
««|tur||_t'|«S)ajCreate 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.
.. versionchanged:: 3.1.5
``enable_async`` is applied correctly.
.. versionchanged:: 3.1.2
Added the ``newline_sequence``, ``keep_trailing_newline``,
and ``enable_async`` parameters to match ``__init__``.
r…ryrOr|T)rKÚlocalsÚobjectÚ__new__Ú __class__Ú__dict__rˆÚ overlayedrfrŒr2rŽrGrHrMrOÚbindrYr„rd)r…r`rlrarmrbrnrorprqrrrcrtrOrur_rvrwrxryrzr{r|r<Úrvr�r�s rAÚoverlayzEnvironment.overlay‚s-€ôV”F“H‹~ˆØ �ˆL˜$˜|Ð,¨d°<Ð.@À$À~ÐBVä
�^‰^˜DŸN™NÓ
+ˆØ
� ‰ ×ј4Ÿ=™=Ô)؈Œ ؈Œ àŸ*™*›,ò (‰JˆC�ØœGÒ#ܘ˜C Õ'ð (ð œWÑ $Ü# JÓ/ˆB�Hä! $§*¡*Ó-ˆBŒHàˆŒ
ØŸ/™/×/Ñ/Ó1ò 0‰JˆC�Ø!&§¡¨B£ˆB�M‰M˜#Ò ð 0à œWÑ $Ø �M‰M× Ñ ¤°°ZÓ!@Ô Aà œwÑ &Ø&ˆBŒKä(¨Ó,Ð,rCcó—t|«S)zThe lexer for this environment.r"©r…s rAÚlexerzEnvironment.lexerÉs€ô˜‹ÐrCcó`—tt|jj«d„¬««S)z)Iterates over the extensions by priority.có—|jSr~)Úpriority©Úxs rAú<lambda>z-Environment.iter_extensions.<locals>.<lambda>Ðs
€À1Ç:Á:€rC)r�)ÚiterÚsortedrOÚvaluesr�s rAÚiter_extensionszEnvironment.iter_extensionsÎs"€ä”F˜4Ÿ?™?×1Ñ1Ó3Ñ9MÔNÓOÐOrCÚobjÚargumentcóú— ||S#tttf$r_t|t«r9 t |«} t ||«cYS#t$rYnwxYw#t $rYnwxYw|j||¬«cYSwxYw)z:Get an item or attribute of an object but prefer the item.©r©Úname)ÚAttributeErrorÚ TypeErrorÚ LookupErrorrQrRÚgetattrÚ Exceptionr_)r…r©rªÚattrs rAÚgetitemzEnvironment.getitemÒs‹€ð
:Ø�x‘=Ð øÜ¤ ¬;Ð7ò :ܘ(¤CÔ(ðܘx›=�DðÜ& s¨DÓ1Ò1øÜ)òÙðûô !òÙðúð—>‘> c°�>Ó9Ò 9ð :úsO‚‡$A:¬ A¸ AÁA:Á AÁA:ÁAÁA:Á A!ÁA:Á A!Á!A:Á9A:Ú attributecó — t||«S#t$rYnwxYw ||S#tttf$r|j ||¬«cYSwxYw)z‰Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a string.
r¬)r±r®r¯r°r_)r…r©rµs rAr±zEnvironment.getattrås^€ð ܘ3  Ó*Ð *øÜò Ù ð úð ;Ø�y‘>Ð !øÜœ;¬Ð7ò ;Ø—>‘> c° �>Ó:Ò :ð ;ús‚ Ž ™ž#£'A
Á A
r­r�r<ÚkwargsÚcontextÚeval_ctxÚ is_filtercóÄ—|r|j}d} n|j}d} |j|«}
|
€@d| ›d|›d�} t|t«r |j «t| «‚t| «‚|g|�|nd¢}|�|ni}tj|
«}
|
tjur$|€td | ›d
�«‚|jd |«ne|
tjur/|€|�
|j}n t|«}|jd |«n$|
tjur|jd |«|
|i|¤ŽS#t $r} | ›d| ›d�} Yd} ~ t| «‚d} ~ wwxYw) NÚfilterÚtestzNo z named ú.z (z-; did you forget to quote the callable name?)rkzAttempted to invoke a context z without context.r)r€r�ÚgetrQr*Ú_fail_with_undefined_errorr²rr+Úfrom_objr¸ÚinsertÚ eval_contextr¹r&rN)r…r­r�r<r·r¸r¹rºÚenv_mapÚ type_nameÚfuncÚmsgÚeÚpass_args rAÚ_filter_test_commonzEnvironment._filter_test_commonòs†€ñ Ø—l‘lˆGØ ‰Ià—j‘jˆG؈Ià�{‰{˜4Ó ˆà ˆ<ؘ �{ '¨$¨°Ð3ˆCä˜$¤ Ô*ðUØ×3Ñ3Ô5ô' sÓ+Ð +Ô& sÓ+Ð +àÐ; Ð!1™°rÐ;ˆØ!Ð-‘°2ˆÜ×$Ñ$ TÓ*ˆà ”x×'Ñ'Ñ '؈Ü*Ø4°Y°KÐ?PÐQóðð
�K‰K˜˜7Õ #Ø
œ×.Ñ.Ñ
.ØÐØÐ&Ø&×/Ñ/‘Hä*¨4Ó0�Hà �K‰K˜˜8Õ $Ø
œ×-Ñ-Ñ
-Ø �K‰K˜˜4Ô á�TÐ$˜VÑ$Ð$øô7!òUØ ˜E  A 3Ð&SÐT”Cä& sÓ+Ð +ûðUúsÁ
D:Ä: EÅEÅEc ó0—|j||||||d«S)a/Invoke a filter on a value the same way the compiler does.
This might return a coroutine if 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
T©rÊ©r…r­r�r<r·r¸r¹s rAÚ call_filterzEnvironment.call_filter(s&€ð"×'Ñ'Ø �%˜˜v w°¸$ó
ð
rCc ó0—|j||||||d«S)aÇInvoke a test on a value the same way the compiler does.
This might return a coroutine if the test is running from an
environment in async mode and the test supports async execution.
It's your responsibility to await this if needed.
.. versionchanged:: 3.0
Tests support ``@pass_context``, etc. decorators. Added
the ``context`` and ``eval_ctx`` parameters.
.. versionadded:: 2.7
FrÌrÍs rAÚ call_testzEnvironment.call_test=s&€ð*×'Ñ'Ø �%˜˜v w°¸%ó
ð
rCÚsourceÚfilenamecól— |j|||«S#t$r|j|¬«YywxYw)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 Jinja extensions <writing-extensions>`
this gives you a good overview of the node tree generated.
©rÑN)Ú_parser Úhandle_exception©r…rÑr­rÒs rAÚparsezEnvironment.parseVs:€ð 1Ø—;‘;˜v t¨XÓ6Ð 6øÜ"ò 1Ø × !Ñ !¨Ð !Ö 0ð 1ús ‚•3²3có:—t||||«j«S)z8Internal parsing function used by `parse` and `compile`.)r'rØr×s rArÕzEnvironment._parsejs€ô�d˜F D¨(Ó3×9Ñ9Ó;Ð;rCcó–—t|«} |jj|||«S#t$r|j |¬«YywxYw)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)rRržÚ tokeniterr rÖr×s rAÚlexzEnvironment.lexpsK€ô�V“ˆð 1Ø—:‘:×'Ñ'¨°°hÓ?Ð ?øÜ"ò 1Ø × !Ñ !¨Ð !Ö 0ð 1ús�*ªAÁAcóV‡‡—tˆˆfd„|j«t|««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.
có*•—|j|‰‰«Sr~)Ú
preprocess)ÚsrÈrÒr­s €€rAr¤z(Environment.preprocess.<locals>.<lambda>�sø€˜Ÿ™ a¨¨xÓ8€rC)rr¨rRr×s ``rArßzEnvironment.preprocess…s(ù€ôÜ 8Ø × Ñ Ó "Ü �‹Kó
ð
rCÚstatecóð—|j|||«}|jj||||«}|j«D]1}|j |«}t |t «rŒ%t
|||«}Œ3|S)z’Called by the parser to do the preprocessing and filtering
for all the extensions. Returns a :class:`~jinja2.lexer.TokenStream`.
)rßržÚtokenizer¨Ú
filter_streamrQr%)r…rÑr­rÒráÚstreamÚexts rAÚ _tokenizezEnvironment._tokenize•sw€ð—‘ ¨¨xÓ8ˆØ—‘×$Ñ$ V¨T°8¸UÓCˆà×'Ñ'Ó)ò =ˆCØ×&Ñ& vÓ.ˆFä˜f¤kÕ2Ü$ V¨T°8Ó<‘ð  =ð ˆ
rCÚ
defer_initcó8—t||||||j¬«S)z|Internal hook that can be overridden to hook a different generate
method in.
.. versionadded:: 2.5
)rèru)r ru)r…rÑr­rÒrès rAÚ _generatezEnvironment._generateªs'€ôØ Ø Ø Ø Ø!Ø—n‘nô

ð
rCcó—t||d«S)z{Internal hook that can be overridden to hook a different compile
method in.
.. versionadded:: 2.5
Úexec)Úcompile)r…rÑrÒs rAÚ_compilezEnvironment._compile¿s€ô �v˜x¨Ó0Ð0rCÚrawzte.Literal[False]có—yr~rk©r…rÑr­rÒrïrès rArízEnvironment.compileÇs€ðrCzte.Literal[True]có—yr~rkrñs rArízEnvironment.compileÑs€ðrCcóò—d} t|t«r|}|j|||«}|j||||¬«}|r|S|€d}|j ||«S#t
$r|j
|¬«YywxYw)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Ô)rQrRrÕrêrîr rÖ)r…rÑr­rÒrïrèÚ source_hints rArízEnvironment.compileÛs‰€ð8ˆ ð 6ܘ&¤#Ô&Ø$� ØŸ™ V¨T°8Ó<�Ø—^‘^ F¨D°(Àz�^ÓRˆFÙØ�
ØÐØ'�Ø—=‘= ¨Ó2Ð 2øÜ"ò 6Ø × !Ñ !¨Ð !Ö 5ð 6ús„=AÁAÁA6Á5A6Úundefined_to_noneÚTemplateExpressioncóæ—t||d¬«} |j«}|jjs,t d|jj
j dd«‚|j|«tjtjdd«d¬ «g}|jtj|d¬ ««}t||«S#t$r|j|¬«YŒ|wxYw)
a‚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
Úvariable)rázchunk after expressionNrÔrWÚstorer )Úlineno)r'Úparse_expressionråÚeosr ÚcurrentrúÚset_environmentrÖr
ÚAssignÚNameÚ from_stringrErö)r…rÑrõÚparserÚexprÚbodyÚtemplates rAÚcompile_expressionzEnvironment.compile_expressionsÖ€ô<˜˜f¨JÔ7ˆð 1Ø×*Ñ*Ó,ˆDØ—=‘=×$Ò$Ü)Ø,¨f¯m©m×.CÑ.C×.JÑ.JÈDÐRVóðð
× Ñ  Ô &ô— ‘ œUŸZ™Z¨°'Ó:¸DÈÔKÐLˆØ×#Ñ#¤E§N¡N°4ÀÔ$BÓCˆÜ! (Ð,=Ó>Ð>øô #ò 1Ø × !Ñ !¨Ð !Ö 0ð 1ús�A#CÃC0Ã/C0Útargetzos.PathLike[str]Ú filter_funcÚzipÚ log_functionÚ
ignore_errorscó,‡‡‡‡—ddlm}|€ dtddfd„}|€J‚|j€Jd«‚dtd tddfˆˆˆˆfd
„ }‰�<d d lm} d d
lm}
d dlm} d dlmŠ| ‰dt| |
¬«‰«Š|d‰›�«n?tjj‰«stj‰«|d‰›�« |j||«D]`} |jj|| «\}
}} |j!|
| |dd«}|j%| «}|||«|d| ›d|›�«Œb ‰r‰j'« |d«y#t"$r}|s‚|d| ›d|›�«Yd}~ŒŸd}~wwxYw#‰r‰j'«wwxYw)a3Finds 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.
.. versionadded:: 2.4
r )Ú ModuleLoaderNr£r=có—yr~rkr¢s rAr
z3Environment.compile_templates.<locals>.log_functionPs€ØrCúNo loader configured.rÒÚdatacó •—‰r"‰|«}d|_‰j||«yttjj ‰|«d«5}|j
|jd««ddd«y#1swYyxYw)NiíÚwbÚutf8)Ú
external_attrÚwritestrÚopenÚosÚpathÚjoinÚwriteÚencode)rÒrÚinfoÚfÚZipInforr Úzip_files €€€€rAÚ
write_filez1Environment.compile_templates.<locals>.write_fileVsmø€ÙÙ˜xÓ(�Ø%0�Ô"Ø×!Ñ! $¨Õ-äœ"Ÿ'™'Ÿ,™, v¨xÓ8¸$Ó?ð1À1Ø—G‘G˜DŸK™K¨Ó/Ô0÷1÷1ñ1ús Á!A:Á:Br)Ú ZIP_DEFLATED)Ú
ZIP_STORED)ÚZipFile)rÚw)ÚdeflatedÚstoredzCompiling into Zip archive zCompiling into folder TzCould not compile "z": z
Compiled "z" as zFinished compiling templates)Úloadersr
rRrxÚzipfiler!r"r#rrKrrÚisdirÚmakedirsÚlist_templatesÚ
get_sourcerír Úget_module_filenameÚclose)r…rrOrr r
r r
r r!r"r#r­rÑrÒÚ_ÚcoderÈrrs ` ` @@rAÚcompile_templateszEnvironment.compile_templates2s¼û€õ4 *à Ð ð
¤ð
¨ó
ðÐ'Ð'Ð'Ø�{‰{Ð&Ð?Ð(?Ó?Ð&ð 1¤ð 1¬Cð 1°D÷ 1ð 1ð ˆ?Ý ,Ý *Ý 'Ý 'áØ˜œT¨<À
ÔKÈCÑPóˆHñ
Ð6°v°jÐAÕ Bä—7‘7—=‘= Ô(Ü— ‘ ˜FÔ#Ù Ð1°&°Ð<Ô =ð !Ø×+Ñ+¨J¸ ÓDò
A�Ø&*§k¡k×&<Ñ&<¸TÀ4Ó&HÑ#�˜ !ðØŸ<™<¨°°hÀÀdÓK�Dð(×;Ñ;¸DÓA�á˜8 TÔ*Ù˜z¨$¨¨u°X°JÐ?Õ@ñ
AñØ—‘Õ áÐ3Õ4øô+òÙ(ØÙ Ð#6°t°f¸CÀ¸sÐ!CÔDÜûð ûñØ—‘Õ ðús6Ã5E>Ã;EÄ*E>Å E;Å E6Å1E>Å6E;Å;E>Å>Fcó⇗|j€Jd«‚|jj«}‰�|� td«‚dtdtfˆfd„ }|�|D�cgc]
}||«sŒ |‘Œ}}|Scc}w)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
rz<either extensions or filter_func can be passed, but not bothr£r=có>•—d|vxr|jdd«d‰vS)Nr¾r )Úrsplit)r£rOs €rArz/Environment.list_templates.<locals>.filter_func s'ø€Ø˜a�xÒE A§H¡H¨S°!Ó$4°QÑ$7¸:Ð$EÐErC)rxr+r¯rRÚbool)r…rOrÚnamesr­s ` rAr+zEnvironment.list_templatesƒsŒø€ð(�{‰{Ð&Ð?Ð(?Ó?Ð&Ø— ‘ ×*Ñ*Ó,ˆà Ð !ØÐ&ÜØRóðð
Fœsð
F¤tõ
Fð Ð "Ø&+ÖA˜d©{¸4Õ/@’TÐAˆEÐAàˆ ùòBs Á
A,Á$A,z te.NoReturncó —ddlm}||¬«‚)zšException handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
r )Úrewrite_traceback_stackrÔ)Údebugr8)r…rÑr8s rArÖzEnvironment.handle_exception¨s€õ 3á%¨VÔ4Ð4rCrÚparentcó—|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.
rk)r…rr:s rAÚ join_pathzEnvironment.join_path°s €ðˆrCr‚cóÄ—|j€ td«‚tj|j«|f}|j�T|jj |«}|�7|j r |jr|r|jj|«|S|jj|||j|««}|j�||j|<|S)Nz(no loader for this environment specified) rxr¯ÚweakrefÚrefrHr¿rzÚ
is_up_to_dater‚rˆÚloadÚ make_globals)r…r­r‚Ú cache_keyrs rAÚ_load_templatezEnvironment._load_template¼s€ð �;‰;Ð ÜÐFÓGÐ GÜ—[‘[ §¡Ó-¨tÐ4ˆ Ø �:‰:Ð !Ø—z‘z—~‘~ iÓ0ˆHØÐ#Ø×$Ò$¨×(>Ò(>ñØ×$Ñ$×+Ñ+¨GÔ4à�à—;‘;×#Ñ# D¨$°×0AÑ0AÀ'Ó0JÓKˆà �:‰:Ð !Ø$,ˆD�J‰J�yÑ !؈rCcór—t|t«r|S|�|j||«}|j||«S)aHLoad a template by name with :attr:`loader` and return a
:class:`Template`. If the template does not exist a
:exc:`TemplateNotFound` exception is raised.
:param name: Name of the template to load. When loading
templates from the filesystem, "/" is used as the path
separator, even on Windows.
:param parent: The name of the parent template importing this
template. :meth:`join_path` can be used to implement name
transformations with this.
:param globals: Extend the environment :attr:`globals` with
these extra variables available for all renders of this
template. If the template has already been loaded and
cached, its globals are updated with any new items.
.. versionchanged:: 3.0
If a template is loaded from cache, ``globals`` will update
the template's globals instead of ignoring the new values.
.. versionchanged:: 2.4
If ``name`` is a :class:`Template` object it is returned
unchanged.
)rQrEr<rD)r…r­r:r‚s rAÚ get_templatezEnvironment.get_templateÕs<€ô< �dœHÔ %؈KØ Ð Ø—>‘> $¨Ó/ˆDà×"Ñ" 4¨Ó1Ð1rCr6có$—t|t«r|j«|s td¬«‚|D]>}t|t«r|cS|�|j ||«} |j
||«cSt|«‚#ttf$rYŒ]wxYw)aøLike :meth:`get_template`, but tries loading multiple names.
If none of the names can be loaded a :exc:`TemplatesNotFound`
exception is raised.
:param names: List of template names to try loading in order.
:param parent: The name of the parent template importing this
template. :meth:`join_path` can be used to implement name
transformations with this.
:param globals: Extend the environment :attr:`globals` with
these extra variables available for all renders of this
template. If the template has already been loaded and
cached, its globals are updated with any new items.
.. versionchanged:: 3.0
If a template is loaded from cache, ``globals`` will update
the template's globals instead of ignoring the new values.
.. versionchanged:: 2.11
If ``names`` is :class:`Undefined`, an :exc:`UndefinedError`
is raised instead. If no templates were found and ``names``
contains :class:`Undefined`, the message is more helpful.
.. versionchanged:: 2.4
If ``names`` contains a :class:`Template` object it is
returned unchanged.
.. versionadded:: 2.3
z0Tried to select from an empty list of templates.)Úmessage) rQr*rÀrrEr<rDrr!)r…r6r:r‚r­s rAÚselect_templatezEnvironment.select_templateús¢€ôF �eœYÔ 'Ø × ,Ñ ,Ô .áÜ#ØJôð
ðò ˆDܘ$¤Ô)Ø’ ØÐ!Ø—~‘~ d¨FÓ3�ð
Ø×*Ñ*¨4°Ó9Ò9ð
 ô  Ó&Ð&øô%¤nÐ5ò
Ùð
úsÁA=Á=BÂBÚtemplate_name_or_listcóž—t|ttf«r|j|||«St|t«r|S|j |||«S)z¤Use :meth:`select_template` if an iterable of template names
is given, or :meth:`get_template` if one name is given.
.. versionadded:: 2.3
)rQrRr*rFrErI)r…rJr:r‚s rAÚget_or_select_templatez"Environment.get_or_select_template0sQ€ô Ð+¬c´9Ð-=Ô >Ø×$Ñ$Ð%:¸FÀGÓLÐ LÜ
Ð-¬xÔ
8Ø(Ð (Ø×#Ñ#Ð$9¸6À7ÓKÐKrCcóŠ—|j|«}|xs |j}|j||j|«|d«S)aýLoad a template from a source string without using
:attr:`loader`.
:param source: Jinja source to compile into a template.
:param globals: Extend the environment :attr:`globals` with
these extra variables available for all renders of this
template. If the template has already been loaded and
cached, its globals are updated with any new items.
:param template_class: Return an instance of this
:class:`Template` class.
N)rBrjÚ from_coderí)r…rÑr‚rjÚgsr;s rArzEnvironment.from_stringDsB€ð"×
Ñ
˜wÓ
'ˆØÒ3 × 3Ñ 3ˆØ�}‰}˜T 4§<¡<°Ó#7¸¸TÓBÐBrCÚdcó6—|€i}t||j«S)aSMake the globals map for a template. Any given template
globals overlay the environment :attr:`globals`.
Returns a :class:`collections.ChainMap`. This allows any changes
to a template's globals to only affect that template, while
changes to the environment's globals are still reflected.
However, avoid modifying any globals after a template is loaded.
:param d: Dict of template-specific globals.
.. versionchanged:: 3.0
Use :class:`collections.ChainMap` to always prevent mutating
environment globals.
)rr‚)r…rPs rArBzEnvironment.make_globalsYs€ð"
ˆ9؈A䘘4Ÿ<™<Ó(Ð(rC)NNNN)NN)F)NNFF)NN.F)T)NNr%NTr~)VÚ__name__Ú
__module__Ú __qualname__Ú__doc__Ú sandboxedr˜rfrSÚOptionalÚ__annotations__r?r rgrUrr,r(rirr
rrrrrrrrrrr*rRr5ÚSequenceÚUnionÚCallableÚAnyÚintr†r‰r‘r2r›Úpropertyr$ržÚIteratorr¨r´r±ÚMappingr&rÊrÎrÐr/r
rErØrÕÚTuplerÜrßr%rçrêrrîÚtypingÚoverloadrírÚ
Collectionr1ÚListr+rÖr<ÚMutableMappingrDrFÚIterablerIrLrrBrkrCrAr7r7�sM…ñwðz€Ið€Ið,0€Iˆq�z‰z˜-Ñ(Ó/ð€Fð5BИ!Ÿ&™& Ñ1ÓAà
�W‰W€Fð&-€M�1—6‘6˜'‘?Ó,à—F‘F˜:Ñ&Ó&ð#5Ø 0Ø%:Ø#6Ø$8Ø"4Ø1FØ/BØ'Ø+ØAQØ&;ØDFØØ'0Ø7;ØINØ+/ØØ Ø6:Ø"ñ/J(àðJ(ððJ(ð #ð J(ð
!ð J(ð "ð
J(ð ðJ(ð !Ÿz™z¨#™ðJ(ðŸZ™Z¨™_ðJ(ððJ(ððJ(ð?ðJ(ð $ðJ(ð—J‘J˜qŸw™w s¨A¯F©F°;Ñ,?Ð'?Ñ@ÑAðJ(ððJ(ð —6‘6˜)Ñ$ð!J(ð"—*‘*˜QŸZ™Z¨¨Q¯U©U¨
Ñ3Ñ4ð#J(ð$—G‘G˜D !§*¡*¨a¯j©j¸©oÐ->ÀÐ-DÑ"EÐEÑFð%J(ð&—
‘
˜<Ñ(ð'J(ð(ð)J(ð*ð+J(ð,Ÿ
™
 ?Ñ3ð-J(ð.ó/J(ðXC q§w¡w¨s°A·F±F¸;Ñ4GÐ/GÑ'HðCÈTóCð* 1§5¡5ð*¨Tó*ð#*Ø 'Ø%,Ø#*Ø$+Ø")Ø18Ø/6Ø#Ø%ØAHØ&-ØDKØ!Ø'.Ø7>ØIPØ+2Ø!Ø#Ø6=Ø$ñ/E-àðE-ððE-ð #ð E-ð
!ð E-ð "ð
E-ð ðE-ð !Ÿz™z¨#™ðE-ðŸZ™Z¨™_ðE-ððE-ððE-ð?ðE-ð $ðE-ð—J‘J˜qŸw™w s¨A¯F©F°;Ñ,?Ð'?Ñ@ÑAðE-ððE-ð —6‘6˜)Ñ$ð!E-ð"—*‘*˜QŸZ™Z¨¨Q¯U©U¨
Ñ3Ñ4ð#E-ð$—G‘G˜D !§*¡*¨a¯j©j¸©oÐ->ÀÐ-DÑ"EÐEÑFð%E-ð&—
‘
˜<Ñ(ð'E-ð(ð)E-ð*ð+E-ð,Ÿ
™
 ?Ñ3ð-E-ð.ð/E-ð0
ó1E-ðNð�uòóððP §¡¨KÑ!8óPð:Ø—5‘5ð:Ø$%§G¡G¨C°·±¨JÑ$7ð:à
�‰�—‘˜ Ð!Ñ "ó:ð& ;˜1Ÿ5™5ð ;¨Sð ;°Q·U±Uó ;ð4%à�g‰g�c˜9�nÑ%ð4%ð�u‰uð4%ð�j‰j˜Ÿ™ A§E¡EÑ*Ñ+ð 4%ð
—
‘
˜1Ÿ9™9 S¨!¯%©% ZÑ0Ñ1ð 4%ð —‘˜GÑ$ð
4%ð—*‘*˜[Ñ)ð4%ðð4%ð
�‰ó4%ðt/3Ø48Ø'+Ø,0ñ
àð
ð�u‰uð
ð�j‰j˜Ÿ™ A§E¡EÑ*Ñ+ð 
ð
—
‘
˜1Ÿ9™9 S¨!¯%©% ZÑ0Ñ1ð 
ð —‘˜GÑ$ð

ð—*‘*˜[Ñ)ð
ð
�‰ó
ð2/3Ø48Ø'+Ø,0ñ
àð
ð�u‰uð
ð�j‰j˜Ÿ™ A§E¡EÑ*Ñ+ð 
ð
—
‘
˜1Ÿ9™9 S¨!¯%©% ZÑ0Ñ1ð 
ð —‘˜GÑ$ð

ð—*‘*˜[Ñ)ð
ð
�‰ó
ð2ð!%Ø$(ñ 1àð1ð�j‰j˜‰oð1ð—*‘*˜S‘/ð 1ð
�‰ò 1óð1ð&<Øð<Ø!"§¡¨C¡ð<Ø<=¿J¹JÀs¹Oð<à �‰ó<ð!%Ø$(ñ 1àð1ð�j‰j˜‰oð1ð—*‘*˜S‘/ð 1ð
�‰�A—G‘G˜C  c˜MÑ*Ñ +ó 1ð0!%Ø$(ñ 
àð
ð�j‰j˜‰oð
ð—*‘*˜S‘/ð 
ð
ó 
ð(%)Ø!%ñ àðð�j‰j˜‰oðð—*‘*˜S‘/ð ð
�z‰z˜#‰ð ð
ó
ð4!ñ 
à—‘ð
ð�j‰j˜‰oð
ð—*‘*˜S‘/ð 
ð
ð 
ð
ó

ð*1˜sð1¨cð1°hó1ð ‡_�_ð!%Ø$(Ø#(Ø ñ
à—‘˜˜UŸ^™^Ð+Ñ,ðð�j‰j˜‰oðð—*‘*˜S‘/ð ð
!ð ð ð
ð
òóðð ‡_�_ð!%Ø$(Ø"%Ø ñ
à—‘˜˜UŸ^™^Ð+Ñ,ðð�j‰j˜‰oðð—*‘*˜S‘/ð ð
 ð ð ð
ð
òóððð!%Ø$(ØØ ñ
'6à—‘˜˜UŸ^™^Ð+Ñ,ð'6ð�j‰j˜‰oð'6ð—*‘*˜S‘/ð '6ð
ð '6ð ð
'6ð
�‰��h�Ñ ò'6óð'6ðT6:ñ+?Øð+?Ø.2ð+?à ó+?ð`59Ø;?Ø)Ø<@Ø"ñO5à—‘˜Ð/Ð/Ñ0ðO5ð—J‘J˜qŸ|™|¨CÑ0Ñ1ðO5ð—Z‘Z §
¡
¨C¨5°$¨;Ñ 7Ñ8ð O5ð
�Z‰Z˜‰_ð O5ð —j‘j §¡¨S¨E°4¨KÑ!8Ñ9ð
O5ððO5ð
óO5ðf59Ø;?ñ#à—J‘J˜qŸ|™|¨CÑ0Ñ1ð#ð—Z‘Z §
¡
¨C¨5°$¨;Ñ 7Ñ8ð#ð
�‰�‰ó #ñJ5 q§z¡z°#¡ð5À-ó5ð
 #ð
¨sð
°só
ððØðØ"#§*¡*¨Q×-=Ñ-=¸cÀ1Ç5Á5¸jÑ-IÑ"Jðà òóðð0ð#'Ø<@ñ "2à�g‰g�c˜:�oÑ&ð"2ð—
‘
˜3‘ð"2𗑘A×,Ñ,¨S°!·%±%¨ZÑ8Ñ9ð "2ð
ò "2óð"2ðHð#'Ø<@ñ 3'à�z‰z˜!Ÿ'™' # z /Ñ2Ñ3ð3'ð—
‘
˜3‘ð3'𗑘A×,Ñ,¨S°!·%±%¨ZÑ8Ñ9ð 3'ð
ò 3'óð3'ðjð #'Ø<@ñ
Là Ÿw™wØ �˜QŸV™V A§G¡G¨C°¨OÑ$<Ñ=Ð =ñ
ðLð
—
‘
˜3‘ð Lð —‘˜A×,Ñ,¨S°!·%±%¨ZÑ8Ñ9ð
Lð
òLóðLð,=AØ9=ñ Cà—‘˜˜UŸ^™^Ð+Ñ,ðC𗑘A×,Ñ,¨S°!·%±%¨ZÑ8Ñ9ðCðŸ
™
 1§6¡6¨*Ñ#5Ñ6ð Cð
ó Cð*)Ø—‘˜A×,Ñ,¨S°!·%±%¨ZÑ8Ñ9ð)à
× Ñ ˜#˜qŸu™u˜*Ñ %ô)rCc)ó
—eZdZUdZeZejeed<eed<eje
ejfed<eje
ed<eje
ed<eje
ejegej e
ffed<ejegej e
fed<ejd ed
<e
ed <ejejgefed <eeeeeeeeeeeed
dedddfdej>e
e jBfde
de
de
de
de
de
deje
deje
dededddedejDej>e
ejd fd!ed"ejed#ejejd$ejfd%ej>eejeje
geffd&ed'ejf(d(„Z#e$ dGded)e%deje
ejfd*ejejgefd'df
d+„«Z&e$ded,eje
ejfdeje
ejfd'dfd-„«Z'e$ded.eje
ejfdeje
ejfd'dfd/„«Z(d0ejd1ejd'e
fd2„Z)d0ejd1ejd'e
fd3„Z*d0ejd1ejd'd4fd5„Z+d0ejd1ejd'ej e
fd6„Z,d0ejd1ejd'ejZe
e.ffd7„Z/ dHd8ejeje
ejfd9ed:ejej`e
ejfd'efd;„Z1 dHd8ejeje
ejfd9ed:ejej`e
ejfd'd fd<„Z2 dHd8ejeje
ejfd9ed:ejej`e
ejfd'd fd=„Z3e4dGd>ejed'd fd?„«Z5 dGd>ejed'd fd@„Z6e7dIdA„«Z8dBe9d'e9fdC„Z:e7d'efdD„«Z;e7d'ejxejze9e9ffdE„«Z>d'e
fdF„Z?y)JrEaoA compiled template that can be rendered.
Use the methods on :class:`Environment` to create or load templates.
The environment is used to configure how templates are compiled and
behave.
It is also possible to create a template object directly. This is
not usually recommended. The constructor takes most of the same
arguments as :class:`Environment`. All templates created with the
same environment arguments share the same ephemeral ``Environment``
instance behind the scenes.
A template object should be considered immutable. Modifications on
the object are not supported.
Úenvironment_classrNr‚r­rÒÚblocksÚroot_render_funcÚTemplateModuleÚ_moduleÚ _debug_infoÚ _uptodaterkTNFrÑr`rlrarmrbrnrorprqrrrcrsrtrOr4rur_rv.rwr|r=có�—t|j|||||||| |
| | |
t|«||||dddd|«}|j||¬«S)NrF)rj)rBriÚ frozensetr)r;rÑr`rlrarmrbrnrorprqrrrcrtrOrur_rvrwr|r@s rAr•zTemplate.__new__�ss€ô,*Ø × !Ñ !Ø Ø Ø !Ø Ø Ø Ø !Ø Ø Ø Ø Ø !Ü �jÓ !Ø Ø Ø Ø Ø Ø
Ø Ø Ø ó/
ˆð2�‰˜v°cˆÓ:Ð:rCr0Úuptodatecóp—||jdœ}t||«|j|||«}||_|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.
)rNÚ__file__)Ú co_filenamerìÚ_from_namespacero)r;rNr0r‚rrÚ namespaceršs rArNzTemplate.from_codeÀs>€ð%0¸T×=MÑ=MÑNˆ Ü ˆT�9ÔØ
×
Ñ
 ¨i¸Ó
AˆØˆŒ ؈ rCÚ module_dictcó(—|j|||«S)z˜Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
)rv)r;rNrxr‚s rAÚfrom_module_dictzTemplate.from_module_dictÑs€ð×"Ñ" ;° ¸WÓEÐErCrwcóà—tj|«}||_||_|d|_|d|_|d|_|d|_d|_|d|_ d|_
||d<||d<|S)Nr­rtrjÚrootÚ
debug_inforNÚ__jinja_template__) r”r•rNr‚r­rÒrjrkrmrnro)r;rNrwr‚rSs rArvzTemplate._from_namespaceßs‹€ô—n‘n SÓ)ˆØ#ˆŒ
؈Œ ؘ6Ñ"ˆŒØ˜zÑ*ˆŒ
ؘXÑ&ˆŒð' vÑ.ˆÔ؈Œ ð" ,Ñ/ˆŒ
؈Œ ð$/ˆ �-Ñ Ø*+ˆ Ð&Ñ'àˆrCr<r·cóT—|jjr%ddl}|j|j|i|¤Ž«S|j t
|i|¤Ž«} |jj|j|««S#t$r|jj«YywxYw)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 a string.
rN) rNr„ÚasyncioÚrunÚ render_asyncr)rKr,rkr²rÖ)r…r<r·r€Úctxs rAÚrenderzTemplate.renderûsš€ð × Ñ × $Ò $Û à—;‘;Ð0˜t×0Ñ0°$ÐA¸&ÑAÓBÐ Bà×Ñœt TÐ4¨VÑ4Ó5ˆð 0Ø×#Ñ#×*Ñ*¨4×+@Ñ+@ÀÓ+EÓFÐ FøÜò 0Ø × Ñ × -Ñ -Ö /ð 0úsÁ)BÂ#B'Â&B'c�ó`K—|jjs td«‚|jt |i|¤Ž«} |jj |j
|«2�cgc3d{–—†}|‘Œ 7Œ6ncc}wc}«S#t$r|jj«cYSwxYw­w)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')
ú8The environment was not created with async mode enabled.N) rNr„Ú RuntimeErrorr)rKr,rkr²rÖ)r…r<r·rƒÚns rAr‚zTemplate.render_asyncs©èø€ð×Ñ×(Ò(ÜØJóð
ð×Ñœt TÐ4¨VÑ4Ó5ˆð 7Ø×#Ñ#×*Ñ*Ø"&×"7Ñ"7¸Ó"<×=Ô=˜Q’Ð=øÑ=ùÔ=óð
øôò 7Ø×#Ñ#×4Ñ4Ó6Ò 6ð 7üsX‚<B.¿(BÁ'A9Á)A7
Á-A5Á.A7
Á1A9Á5A7
Á7A9Á8 BÂB.Â#B+Â(B.Â*B+Â+B.ÚTemplateStreamcó8—t|j|i|¤Ž«S)z[Works exactly like :meth:`generate` but returns a
:class:`TemplateStream`.
)r‰r )r…r<r·s rAråzTemplate.stream(s€ô˜m˜dŸm™m¨TÐ<°VÑ<Ó=Ð=rCc/󈇇‡K—‰jjrBddl}dtjt
fˆˆˆfd„ }|j
|««Ed{–—†y‰jt‰i‰¤Ž«} ‰j|«Ed{–—†y7Œ:7Œ#t$r‰jj«–—YywxYw­w)abFor 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 strings.
It accepts the same arguments as :meth:`render`.
rNr=c“óf•K—‰j‰i‰¤Ž2�cgc3d{–—†}|‘Œ 7Œ6c}Scc}w­wr~)Úgenerate_async)r£r<r·r…s €€€rAÚto_listz"Template.generate.<locals>.to_list9s4øèø€Ø)<¨×)<Ñ)<¸dÐ)MÀfÑ)M×NÔN AšÐNøÒNÐNùÒNùs$ƒ1˜,š(ž&
Ÿ(¢,¦(¨,©1) rNr„r€rSrerRr�r)rKrkr²rÖ)r…r<r·r€rŽrƒs``` rAr zTemplate.generate.s«úèø€ð × Ñ × $Ò $Û ð
O¤1§6¡6¬#¡;÷
Oð—{‘{¡7£9Ó-× -Ð -Ø à×Ñœt TÐ4¨VÑ4Ó5ˆð 6Ø×,Ñ,¨SÓ1× 1Ñ 1ð
.øð
2ùÜò 6Ø×"Ñ"×3Ñ3Ó5Ô 5ð 6üsH…ACÁBÁCÁ9BÂ
BÂBÂCÂBÂ%B?Â<CÂ>B?Â?Ccó˜K—|jjs td«‚|jt |i|¤Ž«} |j |«} |23d{–—†}|­–—Œ7Œ
6 |j
«ƒd{–—†7y#|j
«ƒd{–—†7wxYw#t$r |jj«­–—YywxYw­w)zsAn async version of :meth:`generate`. Works very similarly but
returns an async iterator instead.
r†N) rNr„r‡r)rKrkÚacloser²rÖ)r…r<r·rƒÚagenÚevents rAr�zTemplate.generate_asyncFs¼èø€ð ×Ñ×(Ò(ÜØJóð
ð×Ñœt TÐ4¨VÑ4Ó5ˆð
6Ø×(Ñ(¨Ó-ˆDð
$Ø#'÷ ð ˜%Ø”Kð ø¡4ð
—k‘k“m×#Ò#ø�d—k‘k“m×#Ò#ûÜò 6Ø×"Ñ"×3Ñ3Ó5Õ 5ð 6üs|‚<C
¿BÁBÁA$ÁA"ÁA$ÁBÁ"A$Á$BÁ&BÁ9A<Á:BÁ?C
ÂBÂBÂBÂBÂ&CÃC
ÃCÃC
Úvarsr?r“c ót—t|j|j|j|||j|«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 is to the context without adding the globals.
`locals` can be a dict of local variables for internal usage.
)r)rNr­rjr‚)r…r“r?r“s rAr)zTemplate.new_context_s3€ôØ × Ñ ˜dŸi™i¨¯©°d¸FÀDÇLÁLÐRXó
ð
rCcó@—|j|||«}t||«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.
)r)rl)r…r“r?r“rƒs rAÚ make_modulezTemplate.make_moduleps%€ð×јt V¨VÓ4ˆÜ˜d CÓ(Ð(rCc
ƒóžK—|j|||«}t|||j|«2�cgc3d{–—†}|‘Œ 7Œ6c}«Scc}w­w)zûAs template module creation can invoke template code for
asynchronous executions this method must be used instead of the
normal :meth:`make_module` one. Likewise the module attribute
becomes unavailable in async mode.
N)r)rlrk)r…r“r?r“rƒr£s rAÚmake_module_asynczTemplate.make_module_asyncsTèø€ð×јt V¨VÓ4ˆÜØ Ø Ø"×3Ñ3°CÓ8× 9Ô 9˜ŠQÐ 9øÒ 9ó
ð
ùò
:ùs.‚.A
°A ²A>·AºA ¾AÁA Á A
rƒcóX—|jjr td«‚|�V|j|jj «z
}|r-|j
|D�cic]}||j|“Œc}«S|j€|j
«|_|jScc}w)aOIf a context is passed in, this means that the template was
imported. Imported templates have access to the current
template's globals by default, but they can only be accessed via
the context during runtime.