Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/jinja2/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/jinja2/__pycache__/runtime.cpython-310.pyc
o

^�a��@s8dZddlZddlZddlZddlmZddlmZddl	m
Z
ddl	mZddl	mZdd	l
mZdd
l
mZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZe�d�Zejdej dej!fd�Z"ej#r�ddl$Z$ddl%Z&ddl'm(Z(Gdd�de&j)�Z*gd�Z+gd�Z,ded efd!d"�Z-d#ej.ej!d e/fd$d%�Z0d#ej.ej!d e/fd&d'�Z1d#ej.ej!d e/fd(d)�Z2		*		dQd+d,d-ej3e/d.ej4e/ej d/gej5e/ffd0ej3ej4e/ej!fd1e6d2ej3ej7e/ej!fd3ej3ej8e/ej!fd d/fd4d5�Z9Gd6d7�d7�Z:d8e"d e"fd9d:�Z;ej8j<Gd;d/�d/��Z=Gd<d=�d=�Z>Gd>d?�d?�Z?Gd@dA�dAe?�Z@GdBdC�dC�ZAGdDdE�dE�ZBdeBfdFej3dGdHejCeBd ejCeBfdIdJ�ZDGdKdL�dLeB�ZEGdMdN�dNeB�ZFGdOdP�dPeB�ZGeB`HeE`HeF`HeG`HdS)Rz;The runtime functions and state used by compiled templates.�N)�abc)�chain)�escape)�Markup)�soft_str���
auto_aiter)�
auto_await)�TemplateNotFound)�TemplateRuntimeError)�UndefinedError)�EvalContext)�_PassArg)�concat)�internalcode)�missing)�	Namespace)�object_type_repr)�pass_eval_context�V�F.)�bound)�Environmentc	@s0eZdZ	d	dejedddedefdd�ZdS)
�LoopRenderFuncr�reciter�loop_render_func�depth�returncCsdS�N�)�selfrrrr r �0/usr/lib/python3/dist-packages/jinja2/runtime.py�__call__#szLoopRenderFunc.__call__N)r)	�__name__�
__module__�__qualname__�t�Iterabler�int�strr#r r r r"r"s�����r)�LoopContext�TemplateReference�Macrorrrrr�markup_join�str_join�identityrr�	Undefinedr)�AsyncLoopContextr	r
�xrcC�|S)zLReturns its argument. Useful for certain things in the
    environment.
    r )r3r r r"r0Esr0�seqcCsLg}tt|�}|D]}|�|�t|d�r!td��t||��Sq	t|�S)z?Concatenation that escapes if necessary and converts to string.�__html__�)�mapr�append�hasattrr�joinrr)r5�buf�iterator�argr r r"r.Ls


�r.cCsttt|��S)z3Simple args to string conversion and concatenation.)rr8r*)r5r r r"r/Wsr/cCs ddl}|jdtdd�t|�S)NrzWThis template must be recompiled with at least Jinja 3.0, or it will fail in Jinja 3.1.���
stacklevel)�warnings�warn�DeprecationWarningr/)r5rBr r r"�unicode_join\s�rEF�environmentr�
template_name�blocks�Context�vars�shared�globals�localsc
Csp|duri}|r|}n
t|pdfi|��}|r.|rt|�}|��D]\}}	|	tur-|	||<q!|j|||||d�S)z%Internal helper for context creation.Nr )rL)�dict�itemsr�
context_class)
rFrGrHrJrKrLrM�parent�key�valuer r r"�new_contexths
�
�rTc@s<eZdZdZd
dd�Zdedejfd	d
�Zdefdd�Z	dS)r,zThe `self` in templates.�contextrIrNcCs
||_dSr)�_TemplateReference__context)r!rUr r r"�__init__�s
zTemplateReference.__init__�namecCs|jj|}t||j|d�S�Nr)rVrH�BlockReference)r!rXrHr r r"�__getitem__�szTemplateReference.__getitem__cCsdt|�j�d|jj�d�S)N�<� �>)�typer$rVrX�r!r r r"�__repr__�szTemplateReference.__repr__)rUrIrN)
r$r%r&�__doc__rWr*r'�Anyr[rar r r r"r,�s

r,�dict_methodcs.t���dddtjf�fdd��}t�t|�S)Nr!rIrcs�|���Sr)�get_allr`�rdr r"�f_all�sz_dict_method_all.<locals>.f_all)�	functools�wrapsr'rc�castr)rdrgr rfr"�_dict_method_all�srkc@s�eZdZUdZdZejeed<d/dd�Z		d0dd	d
ej
eejfdej
edej
eejdgejeffd
ej
ejeejff
dd�Zdedejdgejefdejdfdd�Zd0dedejdejfdd�Zdedejejdffdd�Zdedejfdd�Zdej
eejffdd�Zdej
eejffdd �Zed!ejd"ejd#ejdejejdffd$d%��Zd0d&ej
ej
eejfddfd'd(�Zeej�Zeej�Zeej �Z dedefd)d*�Z!dedejfd+d,�Z"defd-d.�Z#dS)1rIa�The template context holds the variables of a template.  It stores the
    values passed to the template and also the names the template exports.
    Creating instances is neither supported nor useful as it's created
    automatically at various stages of the template evaluation and should not
    be created by hand.

    The context is immutable.  Modifications on :attr:`parent` **must not**
    happen and modifications on :attr:`vars` are allowed from generated
    template code only.  Template filters and global functions marked as
    :func:`pass_context` get the active context passed as first argument
    and are allowed to access the context read-only.

    The template context supports read only dict operations (`get`,
    `keys`, `values`, `items`, `iterkeys`, `itervalues`, `iteritems`,
    `__getitem__`, `__contains__`).  Additionally there is a :meth:`resolve`
    method that doesn't fail with a `KeyError` but returns an
    :class:`Undefined` object for missing variables.
    F�_legacy_resolve_moderNcCsJd|jvr
d|_dSd|jvs|jr#ddl}|jdtdd�d|_dSdS)	N�resolve_or_missingF�resolverzOverriding 'resolve' is deprecated and will not have the expected behavior in Jinja 3.1. Override 'resolve_or_missing' instead r?r@T)�__dict__rlrBrCrD)�clsrBr r r"�__init_subclass__�s

�
�zContext.__init_subclass__rFrrQrXrHrLcCs^||_i|_||_t|j|�|_t�|_||_|durt�nt|�|_dd�|�	�D�|_
dS)NcSsi|]\}}||g�qSr r ��.0�k�vr r r"�
<dictcomp>��z$Context.__init__.<locals>.<dictcomp>)rQrJrFr�eval_ctx�set�
exported_varsrX�globals_keysrOrH)r!rFrQrXrHrLr r r"rW�szContext.__init__�current�rZr1cCs^z|j|}|�|�d}||Wnty'|jjd|�d�dd�YSwt||||�S)zRender a parent block.r� there is no parent block called �.�super�rX)rH�index�LookupErrorrF�	undefinedrZ)r!rXr|rHr�r r r"r��s

��z
Context.superrR�defaultcCs"z||WSty|YSw)z�Look up a variable by name, or return a default if the key is
        not found.

        :param key: The variable name to look up.
        :param default: The value to return if the key is not found.
        )�KeyError)r!rRr�r r r"�get�s

�zContext.getr1cCs`|jr||jvr
|j|S||jvr|j|S|jj|d�S|�|�}|tur.|jj|d�S|S)aNLook up a variable by name, or return an :class:`Undefined`
        object if the key is not found.

        If you need to add custom behavior, override
        :meth:`resolve_or_missing`, not this method. The various lookup
        functions use that method, not this one.

        :param key: The variable name to look up.
        r�)rlrJrQrFr�rmr�r!rR�rvr r r"rn�s





zContext.resolvecCsN|jr|�|�}t|t�rtS|S||jvr|j|S||jvr%|j|StS)aNLook up a variable by name, or return a ``missing`` sentinel
        if the key is not found.

        Override this method to add custom lookup behavior.
        :meth:`resolve`, :meth:`get`, and :meth:`__getitem__` use this
        method. Don't call this method directly.

        :param key: The variable name to look up.
        )rlrn�
isinstancer1rrJrQr�r r r"rms






zContext.resolve_or_missingcs�fdd��jD�S)z+Get a new dict with the exported variables.csi|]}|�j|�qSr )rJ)rsrtr`r r"rv*rwz(Context.get_exported.<locals>.<dictcomp>)rzr`r r`r"�get_exported(szContext.get_exportedcCs,|js|jS|js|jSt|jfi|j��S)z�Return the complete context as dict including the exported
        variables.  For optimizations reasons this might not return an
        actual copy so be careful with using it.
        )rJrQrNr`r r r"re,s
zContext.get_all�
_Context__obj�args�kwargscOs�	d}t|d�rt�|j�dur|j}t�|�}|tjur;|�d�r)|�|d�}|�d�r5|�|d�}|f|}n|tjurG|jf|}n|tj	urR|j	f|}|�
dd�|�
dd�z||i|��WStyu|j	�d�YSw)z�Call the callable with the arguments and keyword arguments
        provided but inject the active context or environment as first
        argument if the callable has :func:`pass_context` or
        :func:`pass_environment`.
        Tr#N�
_loop_vars�_block_varszGvalue was undefined because a callable raised a StopIteration exception)
r:r�from_objr#rUr��derived�eval_contextrxrF�pop�
StopIterationr�)�_Context__selfr�r�r��__traceback_hide__�pass_argr r r"�call7s4	�





��zContext.callrMcCsDt|j|ji|��dd|�}|j|_|j�dd�|j��D��|S)z�Internal helper function to create a derived context.  This is
        used in situations where the system needs a new context in the same
        template that is independent.
        TNcss �|]\}}|t|�fVqdSr)�listrrr r r"�	<genexpr>ms�z"Context.derived.<locals>.<genexpr>)rTrFrXrerxrH�updaterO)r!rMrUr r r"r�ds�zContext.derivedcCs||jvp	||jvSr)rJrQ�r!rXr r r"�__contains__tszContext.__contains__cCs|�|�}|tur
t|��|S)zpLook up a variable by name with ``[]`` syntax, or raise a
        ``KeyError`` if the key is not found.
        )rmrr�)r!rR�itemr r r"r[ws
zContext.__getitem__cCs$dt|�j�d|���d|j�d�S)Nr\r]z of r^)r_r$rerXr`r r r"ra�s$zContext.__repr__)rNr)$r$r%r&rbrlr'�ClassVar�bool�__annotations__rq�Dictr*rc�Optional�Callable�Iterator�MutableMappingrW�Unionr�r�rnrmr�rerr�r�rkrN�keys�valuesrOr�r[rar r r r"rI�sZ

�����
���
�����&,


c
@s�eZdZdZdedddejejdgejefde	ddf
d	d
�Z
edejdfdd
��Z
edefdd��Zedefdd��ZdS)rZz"One block on a template reference.rXrUrI�stackrrNcC�||_||_||_||_dSr)rX�_context�_stack�_depth)r!rXrUr�rr r r"rW��
zBlockReference.__init__r}cCsJ|jdt|j�kr|jjjd|j�d�dd�St|j|j|j|jd�S)zSuper the block.rr~rr�r�)r��lenr�r�rFr�rXrZr`r r r"r��s
�zBlockReference.superc�s>�tdd�|j|j|j�2�IdH�}|jjjrt|�S|S)Nc���g|z3dHW}|�q6Srr �rsr3r r r"�
<listcomp>���z.BlockReference._async_call.<locals>.<listcomp>)rr�r�r�rx�
autoescaper�r!r�r r r"�_async_call�s� �
zBlockReference._async_callcCs>|jjjr	|��St|j|j|j��}|jjjrt	|�S|Sr)
r�rF�is_asyncr�rr�r�rxr�rr�r r r"r#�s

zBlockReference.__call__)r$r%r&rbr*r'�Listr�r�r)rW�propertyr�r�rr�r#r r r r"rZ�s&����
�
rZc@seZdZUdZdZdZejee	d<e
Zeje	d<e
Z
eje	d<e
Zeje	d<e
Zeje	d<			d9d
ejedejdd
ejddeddf
dd�Zed
ejedejefdd��Zedefdd��Zdefdd�Zedefdd��Zedefdd��Zedefdd��Zedefdd ��Zedefd!d"��Zdejfd#d$�Z edefd%d&��Z!edej"ejdffd'd(��Z#edej"ejdffd)d*��Z$d+edefd,d-�Z%d.ejdefd/d0�Z&d:d1d2�Z'dej(ejdffd3d4�Z)e*d
ejede+fd5d6��Z,de+fd7d8�Z-dS);r+zeA wrapper iterable for dynamic ``for`` loops, with information
    about the loop and iteration.
    ���N�_length�_after�_current�_before�_last_changed_valuer�iterabler�r1�recurser�depth0rcCs(||_|�|�|_||_||_||_dS)a@
        :param iterable: Iterable to wrap.
        :param undefined: :class:`Undefined` class to use for next and
            previous items.
        :param recurse: The function to render the loop body when the
            loop is marked recursive.
        :param depth0: Incremented when looping recursively.
        N)�	_iterable�_to_iterator�	_iterator�
_undefined�_recurser�)r!r�r�r�r�r r r"rW�s

zLoopContext.__init__cC�t|�Sr)�iter�r�r r r"r��szLoopContext._to_iteratorcCsl|jdur|jSz
t|j�|_W|jSty5t|j�}|�|�|_t|�|j|jt	u|_Y|jSw)z�Length of the iterable.

        If the iterable is a generator or otherwise does not have a
        size, it is eagerly evaluated to get a size.
        N)
r�r�r��	TypeErrorr�r�r�r�r�r�r!r�r r r"�length�s
�
�zLoopContext.lengthcCs|jSr)r�r`r r r"�__len__�szLoopContext.__len__cC�
|jdS)zBHow many levels deep a recursive loop currently is, starting at 1.r)r�r`r r r"r��
zLoopContext.depthcCr�)z-Current iteration of the loop, starting at 1.r��index0r`r r r"r��r�zLoopContext.indexcC�|j|jS)zrNumber of iterations from the end of the loop, ending at 0.

        Requires calculating :attr:`length`.
        �r�r�r`r r r"�	revindex0��zLoopContext.revindex0cCr�)zrNumber of iterations from the end of the loop, ending at 1.

        Requires calculating :attr:`length`.
        �r�r�r`r r r"�revindexr�zLoopContext.revindexcCs
|jdkS)z0Whether this is the first iteration of the loop.rr�r`r r r"�firstr�zLoopContext.firstcCs$|jtur|jSt|jt�|_|jS)aReturn the next element in the iterable, or :data:`missing`
        if the iterable is exhausted. Only peeks one item ahead, caching
        the result in :attr:`_last` for use in subsequent checks. The
        cache is reset when :meth:`__next__` is called.
        )r�r�nextr�r`r r r"�
_peek_nexts
zLoopContext._peek_nextcCs|��tuS)z�Whether this is the last iteration of the loop.

        Causes the iterable to advance early. See
        :func:`itertools.groupby` for issues this can cause.
        The :func:`groupby` filter avoids that issue.
        �r�rr`r r r"�lastszLoopContext.lastcCs|jr|�d�S|jS)zZThe item in the previous iteration. Undefined during the
        first iteration.
        zthere is no previous item)r�r�r�r`r r r"�previtem)s
zLoopContext.previtemcCs|��}|tur
|�d�S|S)a	The item in the next iteration. Undefined during the last
        iteration.

        Causes the iterable to advance early. See
        :func:`itertools.groupby` for issues this can cause.
        The :func:`jinja-filters.groupby` filter avoids that issue.
        �there is no next item�r�rr�r�r r r"�nextitem3s	
zLoopContext.nextitemr�cGs|std��||jt|�S)z�Return a value from the given args, cycling through based on
        the current :attr:`index0`.

        :param args: One or more values to cycle through.
        zno items for cycling given)r�r�r�)r!r�r r r"�cycleCszLoopContext.cyclerScGs|j|kr
||_dSdS)z�Return ``True`` if previously called with a different value
        (including when called for the first time).

        :param value: One or more values to compare to the last call.
        TF)r�)r!rSr r r"�changedNs
zLoopContext.changedcCr4rr r`r r r"�__iter__Z�zLoopContext.__iter__cCsF|jtur|j}t|_nt|j�}|jd7_|j|_||_||fS�Nr)r�rr�r�r�r�r�r�r r r"�__next__]s

zLoopContext.__next__cCs&|jdur	td��|j||j|jd�S)z�When iterating over nested data, render the body of the loop
        recursively with the given inner iterable data.

        The loop must have the ``recursive`` marker for this to work.
        NzCThe loop must have the 'recursive' marker to be called recursively.)r)r�r�rr�r r r"r#is

�zLoopContext.__call__cCs"dt|�j�d|j�d|j�d�S)Nr\r]�/r^)r_r$r�r�r`r r r"raws"zLoopContext.__repr__rY)rr+).r$r%r&rbr�r�r'r�r)r�rr�rcr�r�r�r(r�TyperW�staticmethodr�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r��Tupler�rr*r#rar r r r"r+�sd
�����
� 		

r+c@s�eZdZUejejed<edejej	e
eje
fdeje
fdd��Ze
defdd��Ze
defdd	��Ze
defd
d��Zdejfdd
�Ze
defdd��Ze
dejejdffdd��Zddd�Zdejejdffdd�ZdS)r2r�r�rcCr�rrr�r r r"r�~szAsyncLoopContext._to_iteratorc�sz�|jdur	|jSz
t|j�|_W|jSty<dd�|j2�IdH}|�|�|_t|�|j|jtu|_Y|jSw)Nc�r�rr r�r r r"r��r�z+AsyncLoopContext.length.<locals>.<listcomp>)	r�r�r�r�r�r�r�r�rr�r r r"r��s�
��zAsyncLoopContext.lengthc���|jIdH|jSrr�r`r r r"r����zAsyncLoopContext.revindex0c�r�rr�r`r r r"r��r�zAsyncLoopContext.revindexc�sJ�|jtur	|jSz
|j��IdH|_W|jSty$t|_Y|jSwr)r�rr��	__anext__�StopAsyncIterationr`r r r"r��s�
��zAsyncLoopContext._peek_nextc�s�|��IdHtuSrr�r`r r r"r��r�zAsyncLoopContext.lastr1c�s&�|��IdH}|tur|�d�S|S)Nr�r�r�r r r"r��s
�
zAsyncLoopContext.nextitemcCr4rr r`r r r"�	__aiter__�r�zAsyncLoopContext.__aiter__c�sN�|jtur
|j}t|_n|j��IdH}|jd7_|j|_||_||fSr�)r�rr�r�r�r�r�r�r r r"r��s�
zAsyncLoopContext.__anext__N)rr2)r$r%r&r'�
AsyncIteratorrcr�r�r�r(r�
AsyncIterabler�r�r)r�r�r�r�r�r�r�r�r�r�r r r r"r2{s*
��

r2c@s�eZdZdZ	ddddejdefdedejed	ed
ededej	efd
d�Z
eedej
dej
defdd���Zdejej
dedefdd�Zdejej
dedefdd�Zdefdd�ZdS)r-zWraps a macro function.NrFr�func.rX�	arguments�catch_kwargs�
catch_varargs�caller�default_autoescapec		Csl||_||_t|�|_||_||_||_||_||_d|v|_	|dur1t
|j�r.|�d�}n|j}||_dS)Nr�)
�_environment�_funcr��_argument_countrXr�r�r�r��explicit_caller�callabler��_default_autoescape)	r!rFr�rXr�r�r�r�r�r r r"rW�s



zMacro.__init__r�r�rc
	Os�|rt|dt�r|dj}|dd�}n|j}t|d|j��}t|�}d}||jkrW|jt|�d�D] }z|�|�}Wnt	yIt
}Ynw|dkrPd}|�|�q5n|j}|j
rv|sv|�dd�}	|	durq|jjddd�}	|�|	�|jr|�|�n|r�d|vr�td|j�d	���td|j�d
tt|������|jr�|�||jd��nt|�|jkr�td|j�dt|j��d���|�||�S)
NrrFr�TzNo caller definedr�zmacro zX was invoked with two values for the special caller argument. This is most likely a bug.z takes no keyword argument z takes not more than z argument(s))r�rr�rr�r�r�r�r�r�rr9r�r�r�r�r�r�rXr�r�r��_invoke)
r!r�r�r�r��off�found_callerrXrSr�r r r"r#�sV

��	

��
��zMacro.__call__r�c�s"�|j|�IdH}|rt|�S|Sr)r�r�r!r�r�r�r r r"�
_async_invoke0s
�zMacro._async_invokecCs.|jjr
|�||�S|j|�}|rt|�}|Sr)r�r�rr�rrr r r"r8s
z
Macro._invokecCs0|jdurdnt|j�}dt|�j�d|�d�S)N�	anonymousr\r]r^)rX�reprr_r$r�r r r"raCszMacro.__repr__r)r$r%r&rbr'r�r*r�r�r�rWrrrcr#rrrar r r r"r-�s4��������	
�Lr-c@s�eZdZdZdZdedefdeje	dej
deje	dejeddf
d	d
�Z
ede	fdd��Zed
ej
dej
ddfdd��Zede	dej
fdd��ZeZZZZeZZZZeZZeZZeZZ eZ!Z"eZ#Z$eZ%Z&Z'Z(eZ)Z*Z+eZ,Z-dej
de.fdd�Z/dej
de.fdd�Z0de1fdd�Z2de	fdd�Z3de1fdd�Z4dej5ej
fdd �Z6dej7ej
fd!d"�Z8de.fd#d$�Z9de	fd%d&�Z:dS)'r1ahThe default undefined type.  This undefined type can be printed and
    iterated over, but every other access will raise an :exc:`UndefinedError`:

    >>> foo = Undefined(name='foo')
    >>> str(foo)
    ''
    >>> not foo
    True
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    ��_undefined_hint�_undefined_obj�_undefined_name�_undefined_exceptionN�hint�objrX�excrcCr�rr)r!r
rrXrr r r"rW^r�zUndefined.__init__cCsZ|jr|jS|jtur|j�d�St|jt�s"t|j��d|j��St|j��d|j��S)zXBuild a message about the undefined value based on how it was
        accessed.
        z
 is undefinedz has no element z has no attribute )r	r
rrr�r*rr`r r r"�_undefined_messagejs
����zUndefined._undefined_messager�r��te.NoReturncOs|�|j��)zeRaise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        )rr)r!r�r�r r r"�_fail_with_undefined_error�sz$Undefined._fail_with_undefined_errorcCs |dd�dkrt|��|��S)Nr?�__)�AttributeErrorrr�r r r"�__getattr__�szUndefined.__getattr__�othercCst|�t|�uSr)r_�r!rr r r"�__eq__�szUndefined.__eq__cCs|�|�Sr)rrr r r"�__ne__��zUndefined.__ne__cCstt|��Sr)�idr_r`r r r"�__hash__�rzUndefined.__hash__cC�dS)Nr7r r`r r r"�__str__�r�zUndefined.__str__cCrrYr r`r r r"r��r�zUndefined.__len__ccs�dEdHdS�Nr r r`r r r"r��s�zUndefined.__iter__cCs�dD]}dVqdSrr �r!�_r r r"r��s��zUndefined.__aiter__cCr)NFr r`r r r"�__bool__�r�zUndefined.__bool__cCr)Nr1r r`r r r"ra�r�zUndefined.__repr__);r$r%r&rb�	__slots__rr
r'r�r*rcr�rrWr�rrrr�__add__�__radd__�__sub__�__rsub__�__mul__�__rmul__�__div__�__rdiv__�__truediv__�__rtruediv__�__floordiv__�
__rfloordiv__�__mod__�__rmod__�__pos__�__neg__r#r[�__lt__�__le__�__gt__�__ge__�__int__�	__float__�__complex__�__pow__�__rpow__r�rrr)rrr�r�r�r�r�r"rar r r r"r1Hsb	�����
����r1�loggerzlogging.Logger�basecs\�durddl}|�t����|�tj��dtddf�fdd��G��fdd�d|�}|S)	akGiven a logger object this returns a new undefined class that will
    log certain failures.  It will log iterations and printing.  If no
    logger is given a default logger is created.

    Example::

        logger = logging.getLogger(__name__)
        LoggingUndefined = make_logging_undefined(
            logger=logger,
            base=Undefined
        )

    .. versionadded:: 2.8

    :param logger: the logger to use.  If not provided, a default logger
                   is created.
    :param base: the base class to add logging functionality to.  This
                 defaults to :class:`Undefined`.
    Nr�undefrcs��d|j�dS)NzTemplate variable warning: %s)�warningr)r?)r=r r"�_log_message�s�z,make_logging_undefined.<locals>._log_messagecsxeZdZdZdejdejddf��fdd�Zdef��fdd	�Zdej	ejf��fd
d�Z
def��fdd
�Z�Z
S)z0make_logging_undefined.<locals>.LoggingUndefinedr r�r�rrc
sDzt�j|i|��WdS|jy!}z��d|�|�d}~ww)NzTemplate variable error: %s)r�rr�error)r!r�r��e)�	__class__r=r r"r�s��zKmake_logging_undefined.<locals>.LoggingUndefined._fail_with_undefined_errorc��|�t���Sr)r�rr`�rDrAr r"r��
z8make_logging_undefined.<locals>.LoggingUndefined.__str__crEr)r�r�r`rFr r"r��rGz9make_logging_undefined.<locals>.LoggingUndefined.__iter__crEr)r�r"r`rFr r"r"�rGz9make_logging_undefined.<locals>.LoggingUndefined.__bool__)r$r%r&r#r'rcrr*rr�r�r�r"�
__classcell__r �rAr=)rDr"�LoggingUndefined�s���	rJ)�logging�	getLoggerr$�
addHandler�
StreamHandler�sys�stderrr1)r=r>rKrJr rIr"�make_logging_undefined�s
rQc@s8eZdZdZdZdefdd�Zdeddfdd�ZeZd	S)
�ChainableUndefineda�An undefined that is chainable, where both ``__getattr__`` and
    ``__getitem__`` return itself rather than raising an
    :exc:`UndefinedError`.

    >>> foo = ChainableUndefined(name='foo')
    >>> str(foo.bar['baz'])
    ''
    >>> foo.bar['baz'] + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined

    .. versionadded:: 2.11.0
    r rcCr�r)r*r`r r r"r6szChainableUndefined.__html__r!cCr4rr r r r r"r	r�zChainableUndefined.__getattr__N)	r$r%r&rbr#r*r6rr[r r r r"rR�srRc@s"eZdZdZdZdefdd�ZdS)�DebugUndefinedaAn undefined that returns the debug info when printed.

    >>> foo = DebugUndefined(name='foo')
    >>> str(foo)
    '{{ foo }}'
    >>> not foo
    True
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    r rcCsL|jr
d|j��}n|jtur|j}n
dt|j��d|j�d�}d|�d�S)Nzundefined value printed: zno such element: �[�]z{{ z }})r	r
rrr)r!�messager r r"rs
��zDebugUndefined.__str__N)r$r%r&rbr#r*rr r r r"rSs
rSc@s:eZdZdZdZejZZZ	ejZ
ZZZ
ejZdS)�StrictUndefinedasAn undefined that barks on print and iteration as well as boolean
    tests and all kinds of comparisons.  In other words: you can do nothing
    with it except checking if it's defined using the `defined` test.

    >>> foo = StrictUndefined(name='foo')
    >>> str(foo)
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    >>> not foo
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    r N)r$r%r&rbr#r1rr�rr�rrr"rr�r r r r"rW/s
rW)NFNN)IrbrhrO�typingr'�collectionsr�	itertoolsr�
markupsaferrr�async_utilsr	r
�
exceptionsrrr
�nodesr�utilsrrrrrrr�TypeVarrr�rcr�
TYPE_CHECKINGrK�typing_extensions�terFr�Protocolr�exported�async_exportedr0r(r*r.r/rEr�r�r�r�r��MappingrTr,rk�registerrIrZr+r2r-r1r�rQrRrSrWr#r r r r"�<module>s�
��������
�k0FGq���
�< 

Spamworldpro Mini