ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/jinja2/__pycache__/environment.cpython-311.pyc

�

�܋f7����dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlm
Z
ddlmZd	d
lmZd	dlmZd	dlmZd	d
lmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlmZd	dlm Z d	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%lm0Z0d	d&l1m2Z2d	d'l3m4Z4d	d(l3m5Z5d	d)l3m6Z6d	d*l7m8Z8d	d+l7m9Z9d	d,l7m:Z:d	d-l7m;Z;d	d.l7m<Z<d	d/l7m=Z=d	d0l7m>Z>ej?rddl@ZAd	d1lBmCZCd	d2lDmEZEd	d3lFmGZGejHd4d5�6��ZIe	d7�8��d9ejJeId:ejKd;eIfd<���ZLd=eMd;ejNejOejPejQeRfd>ffd?�ZSd@ejNejOd;ejNejOejPejQeRfd>ffdA�ZTdBd5dCejUejVeRejJdDfd;ejWeRdDffdE�ZXdOdF�ZYGdG�d5��ZZGdH�d>��Z[GdI�dJ��Z\GdK�dL��Z]GdM�dN��Z^e[eZ__dS)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)aReturn 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   �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/environment.py�get_spontaneous_environmentrBCs���#�t�*�C��C�J��J��size�Templatec�@�|dkrdS|dkriSt|��S)z*Return the cache class for the given size.rNr0)rDs rA�create_cacherGQs,���q�y�y��t��a�x�x��	��D�>�>�rC�cachec�b�|�dSt|��turiSt|j��S)z(Create an empty copy of the given cache.N)�type�dictr1�capacity)rHs rA�
copy_cacherM^s4��
�}��t��E�{�{�d����	��E�N�#�#�#rC�environment�
extensionsr4c���i}|D]\}t|t��r2tjtjdt|����}||��||j<�]|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_extensionsrYksj���F��>�>�	��i��%�%�	N���q�v�k�2�M�)�4L�4L�M�M�I�'0�y��'=�'=��y�#�$�$��MrCc���t|jt��s
Jd���|j|jcxkr|jksnJd���|jdvs
Jd���|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�	���
�rCc-�t�eZdZUdZdZdZdZejde	d<dZ
eZej
de	d<eZej
ee	d<ej
de	d	<eeeeeeeeeeeed
dedddddddfd
ededededededejedejedededddedejej eej
dfdedej
edejej!dej"fd ej eej!ejegeffd!ejd"d#e#d$ed%ejd&d'ef,d(�Z$d)ej eej
dfd*dfd+�Z%d,ej"d*dfd-�Z&e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'e'fd
ededededededejedejedededejej eej
dfdedej
edejej!dej"fd ej eej!ejegeffd!ejd"d#e#d$ed%ejd&d*df(d.�Z(e)d*e*fd/���Z+d*ej,dfd0�Z-d1ej"d2ej eej"fd*ej ej"effd3�Z.d1ej"d4ed*ej"fd5�Z/d6ej eefd7ej"d8ejejej"d9ejej0eej"fd:ejed;eje1d<ed*ej"fd=�Z2				dkd6ed7ej"d8ejejej"d9ejej0eej"fd:ejed;eje1d*ej"fd>�Z3				dkd6ed7ej"d8ejejej"d9ejej0eej"fd:ejed;eje1d*ej"fd?�Z4e5		dld@ed6ejedAejed*e6j7fdB���Z8d@ed6ejedAejed*e6j7fdC�Z9		dld@ed6ejedAejed*ej,ej:e#eeffdD�Z;		dld@ed6ejedAejed*efdE�Z<		dld@ed6ejedAejedFejed*e=f
dG�Z>	dmd@e6j7d6ejedAejedHed*ef
dI�Z?d@edAed*e@fdJ�ZAeBjC				dnd@ej ee6j7fd6ejedAejedKdLdHed*e@fdM���ZDeBjC				dod@ej ee6j7fd6ejedAejedKdNdHed*efdO���ZDe5				dnd@ej ee6j7fd6ejedAejedKedHed*ej ee@ffdP���ZD	dpd@edQed*dRfdS�ZE					dqdUej eeFjGfdejejHedVejej!egefdWejedXejej!egdfdYed*dfdZ�ZI		dldejejHedVejej!egefd*ejJefd[�ZKdrd@ejed*d\fd]�ZLd^ed_ed*efd`�ZMe5d6edaejej0eej"fd*dfdb���ZNe5		dld6ej edfd_ejedaejej0eej"fd*dfdc���ZOe5		dlddejPej edfd_ejedaejej0eej"fd*dfde���ZQe5		dldfej edejJej edffd_ejedaejej0eej"fd*dfdg���ZR		dld@ej ee6j7fdaejej0eej"fd	ejej
dd*dfdh�ZSdiejej0eej"fd*ejTeej"ffdj�ZUdS)sr7a�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�N�||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_||_||_
||_||_t!j��|_t'j��|_t+j��|_||_t1|��|_||_||_t9j��|_t=||
��|_||_ tC|��dS�N)"r`rkrarlrbrmrnrorprqrcrsr_rtrurvr�copy�filtersr�testsr�globalsrwrGrHrzryr�policiesrYrO�is_asyncrd)�selfr`rkrarlrbrmrnrorprqrcrsrOrtr_rurvrwrxryrzr{s                       rA�__init__zEnvironment.__init__#s��J#5��� 0���%:��"�#6�� �$8��!�"4���%:��"�#6�� �&���*��� 0���%:��"�-6���"��� ��
�$���'�+�-�-���"�'�)�)��
�(�-�/�/������!�*�-�-��
�,���&���)�-�/�/��
�*�$�
�;�;���$��
�!�$�'�'�'�'�'rCrXr=c�X�|j�t||g����dS)z\Adds an extension after the environment was created.

        .. versionadded:: 2.5
        N)rO�updaterY)r�rXs  rA�
add_extensionzEnvironment.add_extensionos,��
	
�����t�i�[�A�A�B�B�B�B�BrC�
attributesc�|�|���D]&\}}t||��st|||���'dS)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.extendvsR��
%�*�*�,�,�	*�	*�J�C���4��%�%�
*���c�5�)�)�)��	*�	*rCc��tt����}|d=|d=|d=t�|j��}|j�|j��d|_||_|�	��D]\}}|turt|||��� |turt|��|_
nt|j
��|_
i|_|j�	��D]"\}}|�|��|j|<�#|tur(|j�t#||����t%|��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.
        r�rxrOT)rK�locals�object�__new__�	__class__�__dict__r��	overlayedrfr�r2r�rGrHrMrO�bindrYrd)r�r`rkrarlrbrmrnrorprqrOrtr_rurvrwrxryrzr<�rvr�r�s                        rA�overlayzEnvironment.overlaysB��B�F�H�H�~�~����L�$�|�,�d�<�.@�
�^�^�D�N�
+�
+��
����4�=�)�)�)��������*�*�,�,�	(�	(�J�C���G�#�#���C��'�'�'���W�$�$�#�J�/�/�B�H�H�!�$�*�-�-�B�H���
��/�/�/�1�1�	0�	0�J�C��!&���B���B�M�#����W�$�$��M� � ���Z�!@�!@�A�A�A�(��,�,�,rCc� �t|��S)zThe lexer for this environment.r"�r�s rA�lexerzEnvironment.lexer�s������rCc�n�tt|j���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�3�9M�9M�N�N�N�O�O�OrC�obj�argumentc�,�	||S#tttf$rrt|t��rC	t	|��}	t||��cYS#t$rYnwxYw#t$rYnwxYw|�||���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�1�1�1��)�����������!�����D������>�>�c��>�9�9�9�9�9�	:���sP�
�,B�A)�A�B�
A&�#B�%A&�&B�)
A6�3B�5A6�6B�B�	attributec��	t||��S#t$rYnwxYw	||S#tttf$r|�||���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�	�*�*�*���	�	�	��D�	����	;��y�>�!���;��7�	;�	;�	;��>�>�c�	�>�:�:�:�:�:�	;���s��
��+�.A�Ar�r�r<�kwargs�context�eval_ctx�	is_filterc��|r
|j}d}	n	|j}d}	|�|��}
|
�bd|	�d|�d�}t|t��r5	|���n#t$r}|�d|�d�}Yd}~nd}~wwxYwt|���|g|�|nd�}|�|ni}tj	|
��}
|
tj
ur,|�td	|	�d
����|�d|��nd|
tjur2|�|�|j
}nt|��}|�d|��n$|
tjur|�d|��|
|i|��S)N�filter�testzNo z named �.z (z-; did you forget to quote the callable name?)rjzAttempted to invoke a context z without context.r)rr��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�G� �I�I��j�G��I��{�{�4� � ���<�3�	�3�3�$�3�3�3�C��$�	�*�*�
U�U��3�3�5�5�5�5�� �U�U�U� �T�T�A�T�T�T�C�C�C�C�C�C�����U����'�s�+�+�+��;��!1���r�;��!�-���2���$�T�*�*���x�'�'�'���*�Q�Y�Q�Q�Q����
�K�K��7�#�#�#�#�
��.�
.�
.����&�&�/�H�H�*�4�0�0�H��K�K��8�$�$�$�$�
��-�
-�
-��K�K��4� � � ��t�T�$�V�$�$�$s�A!�!
A=�+A8�8A=c	�8�|�||||||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_filters+��"�'�'��%��v�w��$�
�
�	
rCc	�8�|�||||||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��	|�|||��S#t$r|�|���YdSwxYw)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.parseFsX��	1��;�;�v�t�X�6�6�6��"�	1�	1�	1��!�!��!�0�0�0�0�0�0�	1���s�� =�=c�J�t||||�����S)z8Internal parsing function used by `parse` and `compile`.)r'r�r�s    rAr�zEnvironment._parseZs$���d�F�D�(�3�3�9�9�;�;�;rCc��t|��}	|j�|||��S#t$r|�|���YdSwxYw)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.lex`si���V����	1��:�'�'���h�?�?�?��"�	1�	1�	1��!�!��!�0�0�0�0�0�0�	1���s�-� A�Ac�n���t��fd�|���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�2��|�|����Sr})�
preprocess)�sr�r�r�s  ��rAr�z(Environment.preprocess.<locals>.<lambda>�s������a��x�8�8�rC)rr�rRr�s  ``rAr�zEnvironment.preprocessus?�����8�8�8�8�8�� � �"�"���K�K�
�
�	
rC�statec��|�|||��}|j�||||��}|���D]=}|�|��}t|t��st
|||��}�>|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�s��������x�8�8����$�$�V�T�8�U�C�C���'�'�)�)�	=�	=�C��&�&�v�.�.�F��f�k�2�2�
=�$�V�T�8�<�<����
rC�
defer_initc�6�t||||||j���S)z|Internal hook that can be overridden to hook a different generate
        method in.

        .. versionadded:: 2.5
        )r�rt)rrt)r�r�r�r�r�s     rA�	_generatezEnvironment._generate�s/�������!��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�0�0rC�rawzte.Literal[False]c��dSr}rj�r�r�r�r�r�r�s      rAr�zEnvironment.compile��	��	�rCzte.Literal[True]c��dSr}rjr�s      rAr�zEnvironment.compile�r�rCc� �d}	t|t��r|}|�|||��}|�||||���}|r|S|�d}|�||��S#t
$r|�|���YdSwxYw)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�R�F��
��
���'���=�=���2�2�2��"�	6�	6�	6��!�!��!�5�5�5�5�5�5�	6���s�A
A)�A)�) B
�B
�undefined_to_none�TemplateExpressionc���t||d���}	|���}|jjs!t	d|jjjdd���|�|��n&#t$r|�|���YnwxYwtj
tjdd��|d�	��g}|�tj
|d�	����}t||��S)
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_expression�s
��<��f�J�7�7�7��	1��*�*�,�,�D��=�$�
�)�,�f�m�.C�.J�D�RV����
� � ��&�&�&�&��"�	1�	1�	1��!�!��!�0�0�0�0�0�	1������U�Z��'�:�:�D��K�K�K�L���#�#�E�N�4��$B�$B�$B�C�C��!�(�,=�>�>�>s�AA+�+ B�
B�deflated�target�filter_func�zip�log_function�
ignore_errorsc�t�����ddlm}|�
dtddfd�}|�J�|j�
Jd���dtd	tddf����fd
�}��=ddlm}	m�m}
m}|	�d
t|
|�������|d�����nAtj����stj
���|d�����	|�||��D]�}|j�||��\}
}}	|�|
||dd��}n+#t"$r}|s�|d|�d|����Yd}~�_d}~wwxYw|�|��}|||��|d|�d|������	�r����n#�r����wwxYw|d��dS)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��dSr}rjr�s rArz3Environment.compile_templates.<locals>.log_functionBs���rC�No loader configured.r��datac�>���r*�|��}d|_��||��dSttj��|��d��5}|�|�d����ddd��dS#1swxYwYdS)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_fileHs�����
1��w�x�(�(��%0��"��!�!�$��-�-�-�-�-��"�'�,�,�v�x�8�8�$�?�?�1�1��G�G�D�K�K��/�/�0�0�0�1�1�1�1�1�1�1�1�1�1�1�1����1�1�1�1�1�1s�)B�B�Br)�ZipFiler�ZIP_DEFLATED�
ZIP_STORED�w)r�storedzCompiling into Zip archive zCompiling into folder TzCould not compile "z": z
Compiled "z" as zFinished compiling templates)�loadersrrRrw�zipfiler"rr#r$rKrr�isdir�makedirs�list_templates�
get_sourcer�r �get_module_filename�close)r�rrOr	r
rrrr!r"r#r$r�r�r��_�coder�rr s `  `             @@rA�compile_templateszEnvironment.compile_templates$s�������4	*�)�)�)�)�)���
��
��
�
�
�
��'�'�'��{�&�&�(?�&�&�&�	1��	1�C�	1�D�	1�	1�	1�	1�	1�	1�	1�	1�	1��?�J�J�J�J�J�J�J�J�J�J�J�J��w���T�<�
�K�K�K�C�P���H�
�L�A�v�A�A�B�B�B�B��7�=�=��(�(�
$���F�#�#�#��L�<�&�<�<�=�=�=�	!��+�+�J��D�D�

A�

A��&*�k�&<�&<�T�4�&H�&H�#���!���<�<���h��d�K�K�D�D��*����(��� �L�!C�t�!C�!C��!C�!C�D�D�D��H�H�H�H�����	����(�;�;�D�A�A���
�8�T�*�*�*���?�$�?�?�X�?�?�@�@�@�@�

A��
!���� � � ����
!���� � � � �
!����	��3�4�4�4�4�4s6�	7F�D�F�
E�%D>�9F�>E�6F�F*c�����|j�
Jd���|j���}��%��td���dtdtf�fd�����fd�|D��}|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
        Nrz<either extensions or filter_func can be passed, but not bothr�r=c�H��d|vo|�dd��d�vS)Nr�r	)�rsplit)r�rOs �rAr	z/Environment.list_templates.<locals>.filter_func�s*����a�x�E�A�H�H�S�!�$4�$4�Q�$7�:�$E�ErCc�*��g|]}�|���
|��Srjrj)�.0r�r	s  �rA�
<listcomp>z.Environment.list_templates.<locals>.<listcomp>�s(���A�A�A�d�{�{�4�/@�/@�A�T�A�A�ArC)rwr+r�rR�bool)r�rOr	�namess `` rAr+zEnvironment.list_templatesrs�����(�{�&�&�(?�&�&�&���*�*�,�,���!��&��R����
F�s�
F�t�
F�
F�
F�
F�
F�
F��"�A�A�A�A�e�A�A�A�E��rCzte.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�)�debugr;)r�r�r;s   rAr�zEnvironment.handle_exception�s*��	3�2�2�2�2�2�%�%�V�4�4�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.
        rj)r�rr=s   rA�	join_pathzEnvironment.join_path�s	���rCr�c��|j�td���tj|j��|f}|j�H|j�|��}|�,|jr|jr|r|j�	|��|S|j�
|||�|����}|j�
||j|<|S)Nz(no loader for this environment specified)rwr��weakref�refrHr�ry�
is_up_to_dater�r��load�make_globals)r�r�r��	cache_keyrs     rA�_load_templatezEnvironment._load_template�s����;���F�G�G�G��[���-�-�t�4�	��:�!��z�~�~�i�0�0�H��#��$�$�(0�(>�$�
�5��$�+�+�G�4�4�4����;�#�#�D�$��0A�0A�'�0J�0J�K�K���:�!�$,�D�J�y�!��rCc��t|t��r|S|�|�||��}|�||��S)a�Load 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.
        :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?rG)r�r�r=r�s    rA�get_templatezEnvironment.get_template�sJ��8�d�H�%�%�	��K����>�>�$��/�/�D��"�"�4��1�1�1rCr9c�`�t|t��r|���|std����|D]b}t|t��r|cS|�|�||��}	|�||��cS#ttf$rY�_wxYwt|���)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?rGrr!)r�r9r=r�r�s     rA�select_templatezEnvironment.select_template�s���F�e�Y�'�'�	/��,�,�.�.�.��	�#�J����
��	�	�D��$��)�)�
������!��~�~�d�F�3�3��
��*�*�4��9�9�9�9�9��$�n�5�
�
�
���
������&�&�&s�2B
�
B�B�template_name_or_listc���t|ttf��r|�|||��St|t��r|S|�|||��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*rIrErL)r�rMr=r�s    rA�get_or_select_templatez"Environment.get_or_select_templatesg���+�c�9�-=�>�>�	)��$�$�%:�F�G�L�L�L�
�-�x�
8�
8�	)�(�(��#�#�$9�6�7�K�K�KrCc��|�|��}|p|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)rEri�	from_coder�)r�r�r�ri�gsr;s      rArzEnvironment.from_string1sH��"�
�
�w�
'�
'���3�� 3���}�}�T�4�<�<��#7�#7��T�B�B�BrC�dc�4�|�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�rSs  rArEzEnvironment.make_globalsFs ��"
�9��A���4�<�(�(�(rC)NNNN)NN)F)NNFF)NN.F)T)NNrNTr})V�__name__�
__module__�__qualname__�__doc__�	sandboxedr�rfrS�Optional�__annotations__r?rrgrUr(rhrr
rrrrrrrrrrr*rRr8�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�rr�PathLike�
Collectionr1�Listr+r�r?rGrI�IterablerLrOr�MutableMappingrErjrCrAr7r7�s4�������w�w�z�I��I�,0�I�q�z�-�(�/�/�/��F�5B��!�&��1�A�A�A�&-�M�1�6�'�?�,�,�,��F�:�&�&�&�&�#5� 0�%:�#6�$8�"4�1F�/B�'�+�AQ�&;�DF��'0�7;�IN�+/�� �6:�"�/J(�J(��J(��J(� #�	J(�
!�J(�"�
J(� �J(� !�z�#��J(��Z��_�J(��J(��J(�?�J(� $�J(��J�q�w�s�A�F�;�,?�'?�@�A�J(��J(� �6�)�$�!J(�"�*�Q�Z��Q�U�
�3�4�#J(�$�G�D�!�*�a�j��o�->��-D�"E�E�F�%J(�&�
�<�(�'J(�(�)J(�*�+J(�,�
�?�3�-J(�.�/J(�J(�J(�J(�XC�q�w�s�A�F�;�4G�/G�'H�C�T�C�C�C�C�*�1�5�*�T�*�*�*�*�#*� '�%,�#*�$+�")�18�/6�#�%�DK�!�'.�7>�IP�+2�!�#�6=�)8-�8-��8-��8-� #�	8-�
!�8-�"�
8-� �8-� !�z�#��8-��Z��_�8-��8-��8-��J�q�w�s�A�F�;�,?�'?�@�A�8-��8-��6�)�$�8-��*�Q�Z��Q�U�
�3�4�8-� �G�D�!�*�a�j��o�->��-D�"E�E�F�!8-�"�
�<�(�#8-�$�%8-�&�'8-�(�
�?�3�)8-�*
�+8-�8-�8-�8-�t��u�����X��P���K�!8�P�P�P�P�:��5�:�$%�G�C���J�$7�:�	
����	�!�	"�:�:�:�:�&;�1�5�;�S�;�Q�U�;�;�;�;�4%��g�c�9�n�%�4%��u�4%��j���A�E�*�+�	4%�
�
�1�9�S�!�%�Z�0�1�4%���G�$�
4%��*�[�)�4%��4%�
��4%�4%�4%�4%�t/3�48�'+�,0�
�
��
��u�
��j���A�E�*�+�	
�
�
�1�9�S�!�%�Z�0�1�
���G�$�

��*�[�)�
�
��
�
�
�
�2/3�48�'+�,0�
�
��
��u�
��j���A�E�*�+�	
�
�
�1�9�S�!�%�Z�0�1�
���G�$�

��*�[�)�
�
��
�
�
�
�2�!%�$(�	1�1��1��j��o�1��*�S�/�	1�

��1�1�1��\�1�&<��<�!"��C��<�<=�J�s�O�<�	��<�<�<�<�!%�$(�	1�1��1��j��o�1��*�S�/�	1�

��A�G�C��c�M�*�	+�1�1�1�1�0!%�$(�	
�
��
��j��o�
��*�S�/�	
�


�
�
�
�
�(%)�!%������j��o���*�S�/�	�
�z�#���
�
����4!�
�
���
��j��o�
��*�S�/�	
�
�
�

�

�
�
�
�*1�s�1�c�1�h�1�1�1�1��_�!%�$(�#(� �
�����U�^�+�,���j��o���*�S�/�	�
!���
�
�����_���_�!%�$(�"%� �
�����U�^�+�,���j��o���*�S�/�	�
 ���
�

�����_���!%�$(�� �
'6�'6����U�^�+�,�'6��j��o�'6��*�S�/�	'6�
�'6��
'6�
���h��	�'6�'6�'6��\�'6�T6:�+?�+?��+?�.2�+?�	�+?�+?�+?�+?�`59�;?�)�<@�"�L5�L5����R�[�(�)�L5��J�q�|�C�0�1�L5��Z��
�C�5�$�;� 7�8�	L5�
�Z��_�L5��j���S�E�4�K�!8�9�
L5��L5�
�L5�L5�L5�L5�`59�;?�#�#��J�q�|�C�0�1�#��Z��
�C�5�$�;� 7�8�#�
����	#�#�#�#�J5�5�q�z�#��5�-�5�5�5�5�
�#�
�s�
�s�
�
�
�
�����"#�*�Q�Y�s�A�E�z�-B�"C��	�����\��0�#'�59�	 2� 2��g�c�:�o�&� 2��
�3�� 2���A�I�c�1�5�j�1�2�	 2�

� 2� 2� 2��\� 2�D�#'�59�	3'�3'��z�!�'�#�z�/�2�3�3'��
�3��3'���A�I�c�1�5�j�1�2�	3'�

�3'�3'�3'��\�3'�j�#'�59�
L�L� �w���Q�V�A�G�C��O�$<�=�=� 
�L�
�
�3��L���A�I�c�1�5�j�1�2�
L�
�L�L�L��\�L�,6:�9=�	C�C����U�^�+�,�C���A�I�c�1�5�j�1�2�C��
�1�6�*�#5�6�	C�

�C�C�C�C�*)���A�I�c�1�5�j�1�2�)�	
�	�#�q�u�*�	%�)�)�)�)�)�)rCc)�r�eZdZUdZeZejeed<eed<ej	e
ejfed<eje
ed<eje
ed<ej
e
ejegeje
ffed<ejegeje
fed<ejd	ed
<e
ed<ejejgefed<eeeeeeeeeeeed
dedddfdeje
e j!fde
de
de
de
de
de
deje
deje
dededddedej"eje
ejd fd!ed"ejed#ejejd$ejfd%ejeejeje
geffd&ed'ejf(d(�Z#e$	dGded)e%dej	e
ejfd*ejejgefd'df
d+���Z&e$ded,ej	e
ejfdej	e
ejfd'dfd-���Z'e$ded.ej	e
ejfdej	e
ejfd'dfd/���Z(d0ejd1ejd'e
fd2�Z)d0ejd1ejd'e
fd3�Z*d0ejd1ejd'd4fd5�Z+d0ejd1ejd'eje
fd6�Z,d0ejd1ejd'ej-e
fd7�Z.			dHd8ejej
e
ejfd9ed:ejej/e
ejfd'efd;�Z0			dHd8ejej
e
ejfd9ed:ejej/e
ejfd'd	fd<�Z1			dHd8ejej
e
ejfd9ed:ejej/e
ejfd'd	fd=�Z2e3dGd>ejed'd	fd?���Z4	dGd>ejed'd	fd@�Z5e6dIdA���Z7dBe8d'e8fdC�Z9e6d'efdD���Z:e6d'ej;ej<e8e8ffdE���Z=d'e
fdF�Z>dS)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�	_uptodaterjTNFr�r`rkrarlrbrmrnrorprqrcrrrsrOr4rtr_ru.rvr{r=c��t|j||||||||	|
|||
t|��||||dddd|��}|�||���S)NrF)ri)rBrm�	frozensetr)r;r�r`rkrarlrbrmrnrorprqrcrsrOrtr_rurvr{r@s                     rAr�zTemplate.__new__|s{��,*��!���!�� ��!�����!��j�!�!������
����/
�
��2���v�c��:�:�:rCr0�uptodatec�v�||jd�}t||��|�|||��}||_|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_namespacers)r;rNr0r�rv�	namespacer�s       rArQzTemplate.from_code�sG��%0�T�=M�N�N�	��T�9����
�
 �
 ��i��
A�
A������	rC�module_dictc�0�|�|||��S)z�Creates a template object from a module.  This is used by the
        module loader to create a template object.

        .. versionadded:: 2.4
        )rz)r;rNr|r�s    rA�from_module_dictzTemplate.from_module_dict�s���"�"�;��W�E�E�ErCr{c��t�|��}||_||_|d|_|d|_|d|_|d|_d|_|d|_	d|_
||d<||d<|S)Nr�rxrn�root�
debug_inforN�__jinja_template__)r�r�rNr�r�r�rnrorqrrrs)r;rNr{r�rSs     rArzzTemplate._from_namespace�s������s�+�+��#��
���	��6�"����z�*��
��X�&���'�v�.�����	�"�,�/��
����$/�	�-� �*+�	�&�'��rCr<r�c�h�|jjr�ddl}d}tjdkr|���}n<	|���}n&#t$r|���}d}YnwxYw	|�	|j
|i|����|r|���SS#|r|���wwxYw|�t|i|����}	t|�|����S#t $r|j���YdSwxYw)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.
        rNF���T)rNr��asyncio�sys�version_info�get_event_loop�get_running_loop�RuntimeError�new_event_loop�run_until_complete�render_asyncr.r)rKr,ror�r�)r�r<r�r�r.�loop�ctxs       rA�renderzTemplate.render�sn����$�	!��N�N�N��E���&�(�(��-�-�/�/���!�"�3�3�5�5�D�D��#�!�!�!�"�1�1�3�3�D� �E�E�E�!����
!��.�.�/@�t�/@�$�/Q�&�/Q�/Q�R�R��!��J�J�L�L�L�L�!��5�!��J�J�L�L�L�L�!�������t�T�4�V�4�4�5�5��	0��$�/�/��4�4�5�5�5���	0�	0�	0���-�-�/�/�/�/�/�/�	0���s/�A� A1�0A1�5B,�,C�(!D
�
#D1�0D1c��2K�|jjstd���|�t	|i|����}	td�|�|��2���d{V����S#t$r|j���cYSwxYw)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.c��"K�g|3d{V��}|��
6Sr}rj)r6�ns  rAr7z)Template.render_async.<locals>.<listcomp>s.����G�G�G�G�G�G�G�G�q�1�G�G�G�G��N)	rNr�r�r)rKr,ror�r�)r�r<r�r�s    rAr�zTemplate.render_async
s�������(�	��J���
����t�T�4�V�4�4�5�5��	7��G�G�D�,A�,A�#�,F�,F�G�G�G�G�G�G�G�G�G�H�H�H���	7�	7�	7��#�4�4�6�6�6�6�6�	7���s�1A0�0#B�B�TemplateStreamc�6�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�T�<�V�<�<�=�=�=rCc/����K��jjr�ddl}dtjt
f���fd�}tjdkr2|���}|�	|����}n|�
|����}|Ed{V��dS��t�i�����}	��
|��Ed{V��dS#t$r�j���V�YdSwxYw)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��B�K�d��j�i���2���d{V��S)Nc��"K�g|3d{V��}|��
6Sr}rj�r6r�s  rAr7z6Template.generate.<locals>.to_list.<locals>.<listcomp>4s.����N�N�N�N�N�N�N�N�A��N�N�N�Nr�)�generate_async)r<r�r�s���rA�to_listz"Template.generate.<locals>.to_list3s@�����N�N�)<��)<�d�)M�f�)M�)M�N�N�N�N�N�N�N�N�N�NrCr�)rNr�r�rSrirRr�r�r�r��runr)rKror�r�)r�r<r�r�r�r��outr�s```     rArzTemplate.generate(sY���������$�
	��N�N�N�
O�1�6�#�;�
O�
O�
O�
O�
O�
O�
O�
O���&�(�(��-�-�/�/���-�-�g�g�i�i�8�8����k�k�'�'�)�)�,�,���N�N�N�N�N�N�N��F����t�T�4�V�4�4�5�5��	6��,�,�S�1�1�1�1�1�1�1�1�1�1�1���	6�	6�	6��"�3�3�5�5�5�5�5�5�5�5�	6���s�>C�%D�Dc� K�|jjstd���|�t	|i|����}	|�|��23d{V��}|WV��
6dS#t$r |j���WV�YdSwxYw)zsAn async version of :meth:`generate`.  Works very similarly but
        returns an async iterator instead.
        r�N)rNr�r�r)rKror�r�)r�r<r�r��events     rAr�zTemplate.generate_asyncFs�������(�	��J���
����t�T�4�V�4�4�5�5��	6�#�4�4�S�9�9�
�
�
�
�
�
�
�e������� :�9�9���	6�	6�	6��"�3�3�5�5�5�5�5�5�5�5�5�	6���s�A#�A �A#�#&B
�B
�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�rnr�)r�r�r?r�s    rAr)zTemplate.new_contextYs/�����d�i���d�F�D�L�RX�
�
�	
rCc�P�|�|||��}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)rp�r�r�r?r�r�s     rA�make_modulezTemplate.make_modulejs+�����t�V�V�4�4���d�C�(�(�(rCc��K�|�|||��}t||d�|�|��2���d{V����S)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.
        c��"K�g|3d{V��}|��
6Sr}rjr�s  rAr7z.Template.make_module_async.<locals>.<listcomp>�s.����D�D�D�D�D�D�D�D�A��D�D�D�Dr�N)r)rpror�s     rA�make_module_asynczTemplate.make_module_asyncysg�������t�V�V�4�4����#�D�D��)>�)>�s�)C�)C�D�D�D�D�D�D�D�D�D�
�
�	
rCr�c���|jjrtd�����D�j|j���z
}|r!|��fd�|D����S|j�|���|_|jS)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.

        If there are new globals, we need to create a new module because
        the cached module is already rendered and will not have access
        to globals from the current context. This new module is not
        cached because the template can be imported elsewhere, and it
        should have access to only the current template's globals.
        z&Module is not available in async mode.Nc�,��i|]}|�j|��Srj�r=�r6�kr�s  �rA�
<dictcomp>z0Template._get_default_module.<locals>.<dictcomp>�s!���(H�(H�(H�a��C�J�q�M�(H�(H�(HrC)rNr�r��globals_keysr��keysr�rq�r�r�r�s ` rA�_get_default_modulezTemplate._get_default_module�s������$�	I��G�H�H�H��?��#�d�l�&7�&7�&9�&9�9�D��
J��'�'�(H�(H�(H�(H�4�(H�(H�(H�I�I�I��<���+�+�-�-�D�L��|�rCc���K���J�j|j���z
}|r'|��fd�|D�����d{V��S|j�|����d{V��|_|jS)Nc�,��i|]}|�j|��Srjr�r�s  �rAr�z6Template._get_default_module_async.<locals>.<dictcomp>�s!���4T�4T�4T�!�Q��
�1�
�4T�4T�4TrC)r�r�r�r�rqr�s ` rA�_get_default_module_asyncz"Template._get_default_module_async�s�������?��#�d�l�&7�&7�&9�&9�9�D��
V�!�3�3�4T�4T�4T�4T�t�4T�4T�4T�U�U�U�U�U�U�U�U�U��<��!%�!7�!7�!9�!9�9�9�9�9�9�9�D�L��|�rCc�*�|���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.
        )r�r�s rA�modulezTemplate.module�s���'�'�)�)�)rCr�c�N�t|j��D]\}}||kr|cS�dS)zrReturn the source line number of a line number in the
        generated bytecode as they are not in sync.
        r	)�reversedr�)r�r��
template_line�	code_lines    rA�get_corresponding_linenoz!Template.get_corresponding_lineno�sC��)1���(A�(A�	%�	%�$�M�9��F�"�"�$�$�$�$�#��qrCc�<�|j�dS|���S)z?If this variable is `False` there is a newer version available.NT)rsr�s rArCzTemplate.is_up_to_date�s!���>�!��4��~�~���rCc�\�|jr$d�|j�d��D��SgS)zThe debug info mapping.c
�x�g|]7}ttt|�d��������8S)�=)�tuple�mapr`�splitr�s  rAr7z'Template.debug_info.<locals>.<listcomp>�sD�������c�#�q�w�w�s�|�|�,�,�-�-���rC�&)rrr�r�s rAr�zTemplate.debug_info�sH����	����)�/�/��4�4����
�
�	rCc��|j�dt|��d��}nt|j��}dt|��j�d|�d�S�Nzmemory:r��<� �>)r��id�reprrJrU�r�r�s  rA�__repr__zTemplate.__repr__�sQ���9��)�R��X�X�)�)�)�D�D���	�?�?�D�0�4��:�:�&�0�0��0�0�0�0rCr})NFN)r=rp)?rUrVrWrXr7rmrSrUr[rkrRr_rZ�Dictr^r(rbr8rr
rrrrrrrrrrr*r]r
rEr\r��classmethodrrQr~rzr�r�r�r�
AsyncIteratorr�rcr)r�r�r/r�r�rar�r`r�rCrirdr�r�rjrCrArErE]sT���������$.9��q�v�k�*�8�8�8�����
�
�c�1�5�j�
)�)�)�)�
�*�S�/�����j��o����
�F�3��
�G�9�a�j��o�#=�>�>�?�?�?�?��j�'��A�J�s�O�!;�<�<�<�<�
�Z�(�
)�)�)�)������z�!�*�R��X�.�/�/�/�/�
#5� 0�%:�#6�$8�"4�1F�/B�'�+�AQ�&;�DF��'0�7;�IN�"�)/;�/;����U�^�+�,�/;� �/;��	/;�
 #�/;�!�
/;�"�/;� �/;� !�z�#��/;��Z��_�/;��/;��/;�?�/;� $�/;��J�q�w�s�A�F�;�,?�'?�@�A�/;� �!/;�"�6�)�$�#/;�$�*�Q�Z��Q�U�
�3�4�%/;�&�G�D�!�*�a�j��o�->��-D�"E�E�F�'/;�(�)/;�*
��+/;�/;�/;�/;�b�6:��� �����!�#�q�u�*�-�	�
�*�Q�Z��D��1�2��
�
����[�� �F� �F��%�c�1�5�j�1�F��!�#�q�u�*�-�	F�

�F�F�F��[�F��� ���#�C���J�/���!�#�q�u�*�-�	�

�����[��6#0�A�E�#0�Q�U�#0�s�#0�#0�#0�#0�J7���7���7�3�7�7�7�7�*>�A�E�>�Q�U�>�7G�>�>�>�>�6�a�e�6�q�u�6���C��6�6�6�6�<6��U�6�&'�e�6�	
���	�6�6�6�6�*04��48�	
�
��j����Q�U�
�+�,�
��
��
�1�9�S�!�%�Z�0�1�	
�

�
�
�
�
�&04��48�	
)�
)��j����Q�U�
�+�,�
)��
)��
�1�9�S�!�%�Z�0�1�	
)�

�
)�
)�
)�
)�"04��48�	
�
��j����Q�U�
�+�,�
��
��
�1�9�S�!�%�Z�0�1�	
�

�
�
�
�
� ���q�z�'�':��FV�����\��6*.����:�g�&��	������
*�
*�
*��X�
*��s��s������ �t� � � ��X� ���A�F�1�7�3��8�#4�5�����X��1�#�1�1�1�1�1�1rCc	�~�eZdZdZ	ddededejeje	ddfd�Z
defd�Zde	fd	�Z
de	fd
�ZdS)rpz�Represents an imported template.  All the exported names of the
    template are available as attributes on this object.  Additionally
    converting it into a string renders the contents.
    Nrr��body_streamr=c��|�=|jjrtd���t|�|����}||_|j�|�����|j	|_
dS)NztAsync mode requires a body stream to be passed to a template module. Use the async methods of the API you are using.)rNr�r��listro�_body_streamr�r��get_exportedr�rU)r�rr�r�s    rAr�zTemplateModule.__init__�s������"�+�
�"�*�����x�8�8��A�A�B�B�K�'����
���W�1�1�3�3�4�4�4� �
��
�
�
rCc�D�tt|j����Sr})rr,r�r�s rA�__html__zTemplateModule.__html__�s���f�T�.�/�/�0�0�0rCc�*�t|j��Sr})r,r�r�s rA�__str__zTemplateModule.__str__s���d�'�(�(�(rCc��|j�dt|��d��}nt|j��}dt|��j�d|�d�Sr�)rUr�r�rJr�s  rAr�zTemplateModule.__repr__sS���=� �)�R��X�X�)�)�)�D�D���
�&�&�D�0�4��:�:�&�0�0��0�0�0�0rCr})rUrVrWrXrEr(rSrZrjrRr�rr�r�r�rjrCrArprp�s���������48�	&�&��&��&��Z��
�3��0�	&�

�&�&�&�&�(1�&�1�1�1�1�)��)�)�)�)�1�#�1�1�1�1�1�1rCrpc�n�eZdZdZdededdfd�Zdejdejdej	ejfd	�Z
dS)
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.
    rr�r=Nc�"�||_||_dSr})�	_template�_undefined_to_none)r�rr�s   rAr�zTemplateExpression.__init__s��!���"3����rCr<r�c���|j�t|i|����}t|j�|����|jd}|jrt|t��rd}|S)NrW)	r�r)rKr-ror�r�rQr*)r�r<r�r�r�s     rA�__call__zTemplateExpression.__call__st���.�,�,�T�4�-B�6�-B�-B�C�C�����/�/��8�8�9�9�9�
�\�(�
#���"�	�z�"�i�'@�'@�	��B��	rC)rUrVrWrXrEr8r�rSr_rZr�rjrCrAr�r�
s}��������
4��4�d�4�t�4�4�4�4��a�e��q�u����A�E�9J������rCr�c	��eZdZdZdejeddfd�Z		ddejeej	fdej
ed	ej
eddfd
�Zdd�Zde
dejefd
�Zdde
ddfd�Zdd�Zdefd�ZdS)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 string is yielded.

    If buffering is enabled with a buffer size of 5, five items are combined
    into a new string.  This is mainly useful if you are streaming
    big templates to a client via WSGI which flushes after each iteration.
    �genr=Nc�<�||_|���dSr})�_gen�disable_buffering)r�r�s  rAr�zTemplateStream.__init__+s!����	���� � � � � rC�strict�fp�encoding�errorsc�v���d}t|t��r��d�t|d��}d}	����fd�|D��}n|}t|d��r|�|��n|D]}|�|���|r|���dSdS#|r|���wwxYw)aDump the complete stream into a file or file-like object.
        Per default 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-8rTc3�D�K�|]}|�����V��dSr})r)r6r�r�r�s  ��rA�	<genexpr>z&TemplateStream.dump.<locals>.<genexpr>Gs1�����E�E�1�A�H�H�X�v�6�6�E�E�E�E�E�ErC�
writelines)rQrRrr�r�rr.)r�r�r�r�r.�iterable�items  ``   rA�dumpzTemplateStream.dump/s��������b�#���	���"���b�$���B��E�
	��#�E�E�E�E�E��E�E�E������r�<�(�(�
#��
�
�h�'�'�'�'�$�#�#�D��H�H�T�N�N�N�N��
����
�
�
�
�
�
�
��u�
����
�
�
�
�
���s�AB�B8c�R�tt|j��|_d|_dS)zDisable the output buffering.FN)r�nextr��_next�bufferedr�s rAr�z TemplateStream.disable_bufferingTs ���T�4�9�-�-��
���
�
�
rCrDc#��K�g}d}|j}		||kr,t|j��}||��|r|dz
}||k�,n#t$r|sYdSYnwxYwt	|��V�|dd�=d}�b)NrTr	)�appendr�r��
StopIterationr,)r�rD�buf�c_size�push�cs      rA�_buffered_generatorz"TemplateStream._buffered_generatorYs����������z��	�
��t�m�m��T�Y���A��D��G�G�G��$��!���	�t�m�m���
!�
�
�
����F�F���
������+�+�����A�A�A���F�	s�2A�A�A�c��|dkrtd���d|_tt|�|����|_dS)z<Enable buffering.  Buffer `size` items before yielding them.r	zbuffer size too smallTN)�
ValueErrorr�rr�rr�)r�rDs  rA�enable_bufferingzTemplateStream.enable_bufferinglsD���1�9�9��4�5�5�5���
��T�4�#;�#;�D�#A�#A�B�B��
�
�
rCc��|Sr}rjr�s rA�__iter__zTemplateStream.__iter__ts���rCc�*�|���Sr})r�r�s rA�__next__zTemplateStream.__next__ws���z�z�|�|�rC)Nr�)r=N)r)r=r�)rUrVrWrXrSrbrRr�r]�IOrZr�r�r`rrrrrjrCrAr�r� s@��������!�A�J�s�O�!��!�!�!�!�%)�"*�	#�#�
�G�C���I��#��*�S�/�#��
�3��	#�

�#�#�#�#�J����
����
�3������&C�C�S�C��C�C�C�C������#������rCr�)rNr7r=r7)`rXrr�rerSrA�collectionsr�	functoolsrrr�typesr�
markupsafer�r
�compilerrr�defaultsr
rrrrrrrrrrrrrrr�
exceptionsrrrr r!r�r#r$r%r&rr'�runtimer(r)r*�utilsr+r,r-r.r/r1r2�
TYPE_CHECKING�typing_extensions�te�bccacher3r�r4r'r5�TypeVarr6rUr_rBr`rZrkrdrBrRrGrMr\r]r�rYrdr7rErpr�r�rirjrCrA�<module>rs����
�	�	�	�
�
�
�
�
�
�
�
��������� � � � � � �������������������������������������#�#�#�#�#�#�������&�&�&�&�&�&�(�(�(�(�(�(�(�(�(�(�(�(�*�*�*�*�*�*�%�%�%�%�%�%�'�'�'�'�'�'�&�&�&�&�&�&�#�#�#�#�#�#�+�+�+�+�+�+�)�)�)�)�)�)�+�+�+�+�+�+�#�#�#�#�#�#�&�&�&�&�&�&�!�!�!�!�!�!�)�)�)�)�)�)�+�+�+�+�+�+�(�(�(�(�(�(�,�,�,�,�,�,�)�)�)�)�)�)�+�+�+�+�+�+�&�&�&�&�&�&������������������������������������� � � � � � ������������������������� � � � � � ��������������������?�$�"�"�"�"�&�&�&�&�&�&�������#�#�#�#�#�#�
�Q�Y�|�=�
9�
9�
9�
���2����
�Q�V�J�%7�
���
�*�
�
�
���
�
�

�
��Z�� �����c�)9�!:�J�!F�G�H�
�
�
�
�
$��:�a�&�'�
$��Z�� �����c�)9�!:�J�!F�G�H�
$�
$�
$�
$�����
�1�7�3���{�(;�#;�<�=���V�C��������$����$K)�K)�K)�K)�K)�K)�K)�K)�\E1�E1�E1�E1�E1�E1�E1�E1�P%1�%1�%1�%1�%1�%1�%1�%1�P��������&X�X�X�X�X�X�X�X�z&����rC

Zerion Mini Shell 1.0