shell bypass 403

Cubjrnet7 Shell


name : runtime.cpython-39.opt-1.pyc
a

�`�w�@sJdZddlZddlmZddlmZddlmZddlmZddlm	Z	dd	l
mZdd
l
mZddl
m
Z
ddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z gd�Z!eZ"dd�Z#dd �Z$d!d"�Z%d?d#d$�Z&Gd%d&�d&e'�Z(d'd(�Z)Gd)d*�d*e*�Z+efd+d,�Z,Gd-d.�d.ee+��Z-ej.�/e-�Gd/d0�d0e'�Z0e
Gd1d2�d2��Z1Gd3d4�d4e'�Z2eGd5d6�d6e'��Z3d@d7d8�Z4Gd9d:�d:e3�Z5eGd;d<�d<e3��Z6eGd=d>�d>e3��Z7e3`8e5`8e6`8e7`8dS)Az;The runtime functions and state used by compiled templates.�N)�chain)�
MethodType)�escape)�Markup)�soft_unicode�)�abc)�imap)�implements_iterator)�implements_to_string)�	iteritems)�PY2)�string_types)�	text_type)�with_metaclass)�TemplateNotFound)�TemplateRuntimeError)�UndefinedError)�EvalContext)�concat)�evalcontextfunction)�internalcode)�missing)�	Namespace)�object_type_repr)�LoopContext�TemplateReference�Macrorrrrr�markup_join�unicode_join�	to_string�identityrr�	UndefinedcCs|S)zLReturns its argument. Useful for certain things in the
    environment.
    ���xr#r#�2/usr/lib/python3.9/site-packages/jinja2/runtime.pyr!7sr!cCsLg}tt|�}|D]0}|�|�t|d�rtd��t||��Sqt|�S)z@Concatenation that escapes if necessary and converts to unicode.�__html__�)r	r�append�hasattrr�joinrr)�seq�buf�iterator�argr#r#r&r>s


rcCsttt|��S)z4Simple args to unicode conversion and concatenation.)rr	r)r,r#r#r&rIsrc
Csl|duri}|r|}nt|pdfi|��}|r\|r:t|�}t|�D]\}}	|	turB|	||<qB|�||||�S)z%Internal helper for context creation.Nr#)�dictrrZ
context_class)
�environmentZ
template_name�blocks�varsZshared�globals�locals�parent�key�valuer#r#r&�new_contextNs

r9c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzThe `self` in templates.cCs
||_dS�N)�_TemplateReference__context)�self�contextr#r#r&�__init__lszTemplateReference.__init__cCs|jj|}t||j|d�S�Nr)r;r2�BlockReference)r<�namer2r#r#r&�__getitem__oszTemplateReference.__getitem__cCsd|jj|jjfS)Nz<%s %r>)�	__class__�__name__r;rA�r<r#r#r&�__repr__sszTemplateReference.__repr__N)rD�
__module__�__qualname__�__doc__r>rBrFr#r#r#r&risrcCst|d|�S)N�__func__)�getattrr$r#r#r&�	_get_funcwsrLc@seZdZdd�ZdS)�ContextMetac	Csvt�||||�}|dkr|St|j�}ttj�}t|j�}ttj�}||ur\||ur\d|_n||urr||urrd|_|S)Nr#T)�type�__new__rL�resolve�Context�resolve_or_missing�_legacy_resolve_mode�_fast_resolve_mode)	ZmcsrA�bases�d�rvrPZdefault_resolverRZdefault_resolve_or_missingr#r#r&rO|s$



����zContextMeta.__new__N)rDrGrHrOr#r#r#r&rM{srMcCs,||jvr|j|S||jvr(|j|S|Sr:�r3r6)r=r7rr#r#r&rR�s




rRc@s�eZdZdZdZdZdd�Zdd�Zd$dd	�Zd
d�Z	dd
�Z
dd�Zdd�Ze
dd��Zd%dd�Zdd�Zed�Zed�Zed�Zer�ed�Zed�Zed�Z[dd�Zd d!�Zd"d#�ZdS)&rQa�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:`contextfunction`\s 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.
    FcCs\||_i|_||_t|j|�|_t�|_||_tdd�t	|�D��|_
|jrXtt
|�|_
dS)Ncss|]\}}||gfVqdSr:r#��.0�k�vr#r#r&�	<genexpr>��z#Context.__init__.<locals>.<genexpr>)r6r3r1r�eval_ctx�set�
exported_varsrAr0rr2rTrrR)r<r1r6rAr2r#r#r&r>�szContext.__init__cCsZz$|j|}|�|�d}||Wn&tyJ|jjd|dd�YS0t||||�S)zRender a parent block.r�#there is no parent block called %r.�super�rA)r2�index�LookupErrorr1�	undefinedr@)r<rA�currentr2rer#r#r&rc�s
�z
Context.superNcCs&z
||WSty |YS0dS)zfReturns an item from the template context, if it doesn't exist
        `default` is returned.
        N)�KeyError)r<r7�defaultr#r#r&�get�s
zContext.getcCs6|jrt||�}n
|�|�}|tur2|jj|d�S|S)z�Looks up a variable like `__getitem__` or `get` but returns an
        :class:`Undefined` object with the name of the name looked up.
        rd)rSrRrr1rg�r<r7rWr#r#r&rP�s
zContext.resolvecCs,|jr"|�|�}t|t�rt}|St||�S)zxResolves a variable like :meth:`resolve` but returns the
        special `missing` value if it cannot be found.
        )rSrP�
isinstancer"rrRrlr#r#r&rR�s

zContext.resolve_or_missingcst�fdd��jD��S)z+Get a new dict with the exported variables.c3s|]}|�j|fVqdSr:)r3)rZr[rEr#r&r]�r^z'Context.get_exported.<locals>.<genexpr>)r0rarEr#rEr&�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.
        )r3r6r0rEr#r#r&�get_all�s
zContext.get_allcOs�t|d�r,|j}dD]}t||�r|}q,qt|�r�t|dd�durP|f|}n:t|dd�durn|jf|}nt|dd�dur�|jf|}z||i|��WSty�|j�d�YS0d	S)
z�Call the callable with the arguments and keyword arguments
        provided but inject the active context or environment as first
        argument if the callable is a :func:`contextfunction` or
        :func:`environmentfunction`.
        �__call__)�contextfunctionr�environmentfunctionrqFTrrrzGvalue was undefined because a callable raised a StopIteration exceptionN)r*rp�callablerKr_r1�
StopIterationrg)Z_Context__selfZ
_Context__obj�args�kwargs�fnZfn_typer#r#r&�calls&

�zContext.callcCsDt|j|ji|��dd|�}|j|_|j�dd�t|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:)�listrYr#r#r&r]3r^z"Context.derived.<locals>.<genexpr>)r9r1rAror_r2�updater)r<r5r=r#r#r&�derived*s�zContext.derivedcs$�fdd�}tt��j|_�|_|S)Ncst|�����Sr:)rKrorE��methr#r&�proxy7szContext._all.<locals>.proxy)rKr0rIrD)r}r~r#r|r&�_all6szContext._all�keys�values�items�iterkeys�
itervaluesrcCs||jvp||jvSr:rX�r<rAr#r#r&�__contains__IszContext.__contains__cCs|�|�}|turt|��|S)zTLookup a variable or raise `KeyError` if the variable is
        undefined.
        )rRrri)r<r7�itemr#r#r&rBLs
zContext.__getitem__cCsd|jjt|���|jfS)Nz
<%s %s of %r>)rCrD�reprrorArEr#r#r&rFUs

�zContext.__repr__)N)N)rDrGrHrIrSrTr>rcrkrPrRrnrorrxr{rr�r�r�r
r�r�rr�rBrFr#r#r#r&rQ�s2
	
%
	rQc@s0eZdZdZdd�Zedd��Zedd��ZdS)	r@z"One block on a template reference.cCs||_||_||_||_dSr:)rA�_context�_stack�_depth)r<rAr=�stack�depthr#r#r&r>cszBlockReference.__init__cCsF|jdt|j�kr,|jjjd|jdd�St|j|j|j|jd�S)zSuper the block.rrbrcrd)r��lenr�r�r1rgrAr@rEr#r#r&rcis

�zBlockReference.supercCs,t|j|j|j��}|jjjr(t|�}|Sr:)rr�r�r�r_�
autoescaper�r<rWr#r#r&rprs
zBlockReference.__call__N)	rDrGrHrIr>�propertyrcrrpr#r#r#r&r@`s
r@c@s�eZdZdZdZdZeZeZeZ	eZ
d+dd�Zedd��Z
ed	d
��Zdd�Zed
d��Zedd��Zedd��Zedd��Zedd��Zdd�Zedd��Zedd��Zedd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zed'd(��Zd)d*�Z dS),rzeA wrapper iterable for dynamic ``for`` loops, with information
    about the loop and iteration.
    ���NrcCs(||_|�|�|_||_||_||_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�_recurse�depth0)r<�iterablergZrecurser�r#r#r&r>�s
	zLoopContext.__init__cCst|�Sr:)�iter)r�r#r#r&r��szLoopContext._to_iteratorcCsj|jdur|jSzt|j�|_WnBtybt|j�}|�|�|_t|�|j|jt	u|_Yn0|jS)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)
�_lengthr�r��	TypeErrorryr�r�re�_afterr�r<r�r#r#r&�length�s

 zLoopContext.lengthcCs|jSr:)r�rEr#r#r&�__len__�szLoopContext.__len__cCs
|jdS)zBHow many levels deep a recursive loop currently is, starting at 1.r)r�rEr#r#r&r��szLoopContext.depthcCs
|jdS)z-Current iteration of the loop, starting at 1.r��index0rEr#r#r&re�szLoopContext.indexcCs|j|jS)zrNumber of iterations from the end of the loop, ending at 0.

        Requires calculating :attr:`length`.
        )r�rerEr#r#r&�	revindex0�szLoopContext.revindex0cCs|j|jS)zrNumber of iterations from the end of the loop, ending at 1.

        Requires calculating :attr:`length`.
        )r�r�rEr#r#r&�revindex�szLoopContext.revindexcCs
|jdkS)z0Whether this is the first iteration of the loop.rr�rEr#r#r&�first�szLoopContext.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�rEr#r#r&�
_peek_next�s
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�rrEr#r#r&�last�szLoopContext.lastcCs|jr|�d�S|jS)zZThe item in the previous iteration. Undefined during the
        first iteration.
        zthere is no previous item)r�r��_beforerEr#r#r&�previtem�s
zLoopContext.previtemcCs|��}|tur|�d�S|S)z�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:`groupby` filter avoids that issue.
        zthere is no next item)r�rr�r�r#r#r&�nextitem�s	
zLoopContext.nextitemcGs|std��||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<rur#r#r&�cycleszLoopContext.cyclecGs|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)�_last_changed_value)r<r8r#r#r&�changed
s
zLoopContext.changedcCs|Sr:r#rEr#r#r&�__iter__szLoopContext.__iter__cCsF|jtur|j}t|_n
t|j�}|jd7_|j|_||_||fS)Nr)r�rr�r�r��_currentr�r�r#r#r&�__next__s

zLoopContext.__next__cCs&|jdurtd��|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�r�r�r#r#r&rp(s

�zLoopContext.__call__cCsd|jj|j|jfS)Nz
<%s %d/%d>)rCrDrer�rEr#r#r&rF6szLoopContext.__repr__)Nr)!rDrGrHrIr�r�rr�r�r�r�r>�staticmethodr�r�r�r�r�rer�r�r�r�r�r�r�r�r�r�r�rrprFr#r#r#r&rzsJ








	
	


rc@s:eZdZdZddd�Zeedd���Zdd�Zd	d
�Z	dS)rzWraps a macro function.Nc		CsV||_||_t|�|_||_||_||_||_||_d|v|_	|durL|j
}||_dS)N�caller)�_environment�_funcr��_argument_countrA�	arguments�catch_kwargs�
catch_varargsr��explicit_callerr��_default_autoescape)	r<r1�funcrAr�r�r�r�Zdefault_autoescaper#r#r&r>=s

zMacro.__init__c
	Os�|r*t|dt�r*|dj}|dd�}n|j}t|d|j��}t|�}d}||jkr�|jt|�d�D]@}z|�|�}Wnt	y�t
}Yn0|dkr�d}|�|�qjn|j}|j
r�|s�|�dd�}	|	dur�|jjddd�}	|�|	�|jr�|�|�n8|�r6d|v�rtd|j��td	|jtt|��f��|j�rT|�||jd��n(t|�|jk�r|td
|jt|j�f��|�||�S)NrrFr�TzNo caller definedrdzamacro %r was invoked with two values for the special caller argument.  This is most likely a bug.z%macro %r takes no keyword argument %rz+macro %r takes not more than %d argument(s))rmrr�r�ryr�r�r��poprirr)r�r�r�rgr�r�rAr�r�r��_invoke)
r<rurvr�r�ZoffZfound_callerrAr8r�r#r#r&rpUsZ





������zMacro.__call__cCs|j|�}|rt|�}|S)z=This method is being swapped out by the async implementation.)r�r)r<r�r�rWr#r#r&r��s
z
Macro._invokecCs$d|jj|jdurdpt|j�fS)Nz<%s %s>Z	anonymous)rCrDrAr�rEr#r#r&rF�s�zMacro.__repr__)N)
rDrGrHrIr>rrrpr�rFr#r#r#r&r:s�
Nrc@s�eZdZdZdZdedefdd�Zedd��Z	e
dd	��Ze
d
d��ZeZ
ZZZZZZZZZZZZZZZZZZZ Z!Z"Z#Z$Z%Z&Z'dd
�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.e.Z/dd�Z0dS)r"ahThe 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_exceptionNcCs||_||_||_||_dSr:r�)r<�hint�objrA�excr#r#r&r>�szUndefined.__init__cCsT|jr|jS|jtur d|jSt|jt�s@dt|j�|jfSdt|j�|jfS)zXBuild a message about the undefined value based on how it was
        accessed.
        z%r is undefinedz%s has no element %rz%r has no attribute %r)r�r�rr�rmrrrEr#r#r&�_undefined_message�s

��zUndefined._undefined_messagecOs|�|j��dS)zeRaise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        N)r�r�)r<rurvr#r#r&�_fail_with_undefined_error�sz$Undefined._fail_with_undefined_errorcCs |dd�dkrt|��|��S)N��__)�AttributeErrorr�r�r#r#r&�__getattr__�szUndefined.__getattr__cCst|�t|�uSr:)rN�r<�otherr#r#r&�__eq__!szUndefined.__eq__cCs|�|�Sr:)r�r�r#r#r&�__ne__$szUndefined.__ne__cCstt|��Sr:)�idrNrEr#r#r&�__hash__'szUndefined.__hash__cCsdS)Nr(r#rEr#r#r&�__str__*szUndefined.__str__cCsdSr?r#rEr#r#r&r�-szUndefined.__len__ccsdSr:r#rEr#r#r&r�0szUndefined.__iter__cCsdS)NFr#rEr#r#r&�__nonzero__4szUndefined.__nonzero__cCsdS)Nr"r#rEr#r#r&rF9szUndefined.__repr__)1rDrGrHrI�	__slots__rrr>r�r�rr�r��__add__�__radd__�__mul__�__rmul__Z__div__Z__rdiv__�__truediv__�__rtruediv__�__floordiv__�
__rfloordiv__�__mod__�__rmod__�__pos__�__neg__rprB�__lt__�__le__�__gt__�__ge__�__int__�	__float__�__complex__�__pow__�__rpow__�__sub__�__rsub__r�r�r�r�r�r�r��__bool__rFr#r#r#r&r"�s�


1�����	��
����������!�#�%�'�)�+�,�,�,r"cs`�dur,ddl}|�t����|�tj���dur8t��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`.
    Nrcsn|jdurX|jtur d|j}q^t|jt�sBdt|j�|jf}q^dt|j�|jf}n|j}��d|�dS)Nz%s is undefinedz%s has no element %sz%s has no attribute %szTemplate variable warning: %s)r�r�rr�rmrrZwarning)Zundefr�)�loggerr#r&�_log_messageYs

��z,make_logging_undefined.<locals>._log_messagecsfeZdZ��fdd�Z��fdd�Z��fdd�ZerT��fdd�Z��fd	d
�Zn��fdd�Z	d
S)z0make_logging_undefined.<locals>.LoggingUndefinedc
sZz�j|g|�Ri|��WS|jyT}z ��dt|��|�WYd}~n
d}~00dS)NzTemplate variable error: %s)r�r��error�str)r<rurv�e)�baser�r#r&r�ls
zKmake_logging_undefined.<locals>.LoggingUndefined._fail_with_undefined_errorcs��|�}�|�|Sr:�r�r��r�r�r#r&r�ss
z8make_logging_undefined.<locals>.LoggingUndefined.__str__cs��|�}�|�|Sr:)r�r�r�r#r&r�xs
z9make_logging_undefined.<locals>.LoggingUndefined.__iter__cs��|�}�|�|Sr:)r�r�r�r#r&r�s
z<make_logging_undefined.<locals>.LoggingUndefined.__nonzero__cs��|�}�|�|Sr:)�__unicode__r�r�r#r&r��s
z<make_logging_undefined.<locals>.LoggingUndefined.__unicode__cs��|�}�|�|Sr:)r�r�r�r#r&r��s
z9make_logging_undefined.<locals>.LoggingUndefined.__bool__N)
rDrGrHr�r�r�r
r�r�r�r#�r�r�r�r#r&�LoggingUndefinedksr�)�loggingZ	getLoggerrDZ
addHandlerZ
StreamHandler�sys�stderrr")r�r�r�r�r#r�r&�make_logging_undefined=s
%r�c@s(eZdZdZdZdd�Zdd�ZeZdS)�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#cCs|��Sr:r�rEr#r#r&r'�szChainableUndefined.__html__cCs|Sr:r#)r<�_r#r#r&r��szChainableUndefined.__getattr__N)rDrGrHrIr�r'r�rBr#r#r#r&r��s
r�c@seZdZdZdZdd�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#cCs<|jdur2|jturd|jSdt|j�|jfSd|jS)Nz{{ %s }}z{{ no such element: %s[%r] }}z!{{ undefined value printed: %s }})r�r�rr�rrEr#r#r&r��s


�zDebugUndefined.__str__N)rDrGrHrIr�r�r#r#r#r&r��s
r�c@s6eZdZdZdZejZZZ	Z
ZZZ
ZdS)�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)rDrGrHrIr�r"r�r�r�r�r�r�r�r�r�r#r#r#r&r�s �������r)NNNN)NN)9rIr��	itertoolsr�typesrZ
markupsaferrrZ_compatrr	r
rrr
rrr�
exceptionsrrrZnodesrZutilsrrrrrrZexportedr r!rrr9�objectrrLrNrMrRrQ�Mapping�registerr@rrr"r�r�r�rr�r#r#r#r&�<module>sz	�
@@y

Y!�

© 2025 Cubjrnet7