$17 GRAYBYTE WORDPRESS FILE MANAGER $32

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/

HOME
Current File : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__//sandbox.cpython-37.pyc
B

�:�`9�@s(UdZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZd	d
lmZd	dlmZd	dlmZd	d
lmZejdejdejfd�ZdZe�Zejeed<e�Z ejeed<ddhZ!ddhZ"ddhZ#ej$e%ddddddd d!g�fej&e%ddd"d#d!g�fej'e%d$d%d&d'd(dg�fe	e%d$d)dd(d*dd+dd,g	�ffZ(ej)ej)ej*ej+efdfed-<ejej,ed.�d/d0�Z-e.e/d1�d2d3�Z0eed4�d5d6�Z1ejee2d7�d8d9�Z3ejee2d7�d:d;�Z4Gd<d=�d=e�Z5Gd>d?�d?e5�Z6Gd@dA�dAe�Z7GdBdC�dCe7e
�Z8dS)Dz�A sandbox layer that ensures unsafe operations cannot be performed.
Useful when the template itself comes from an untrusted source.
�N)�formatter_field_name_split)�abc)�deque)�	Formatter)�EscapeFormatter)�Markup�)�Environment)�
SecurityError)�Context)�	Undefined�F.)�boundi���UNSAFE_FUNCTION_ATTRIBUTES�UNSAFE_METHOD_ATTRIBUTES�gi_frame�gi_code�cr_frame�cr_code�ag_code�ag_frame�add�clear�difference_update�discard�pop�remove�symmetric_difference_update�update�popitem�
setdefault�append�reverse�insert�sort�extend�
appendleft�
extendleft�popleft�rotate�
_mutable_spec)�callable�returncCs8t|tjtjf�r|jdkr dS|j}t|t�r4|SdS)N)�format�
format_map)�
isinstance�types�
MethodType�BuiltinMethodType�__name__�__self__�str)r+�obj�r7�?/opt/alt/python37/lib/python3.7/site-packages/jinja2/sandbox.py�inspect_format_methodSs

r9)�argsr,cGs(t|�}t|�tkr$tdt�d���|S)zWA range that can't generate ranges with a length of more than
    MAX_RANGE items.
    z@Range too big. The sandbox blocks ranges larger than MAX_RANGE (z).)�range�len�	MAX_RANGE�
OverflowError)r:�rngr7r7r8�
safe_rangeas
r@)�fr,cCs
d|_|S)z�Marks a function or method as unsafe.

    .. code-block: python

        @unsafe
        def delete(self):
            pass
    T)�unsafe_callable)rAr7r7r8�unsafeps	rC)r6�attrr,cCs�t|tj�r|tkr�dSn�t|tj�r<|tks6|tkr�dSn�t|t�rT|dkr�dSnzt|tjtjtj	f�rndSt|tj
�r�|tkr�dSnFttd�r�t|tj
�r�|tkr�dSn"ttd�r�t|tj�r�|tkr�dS|�d�S)a�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
    T�mro�
CoroutineType�AsyncGeneratorType�__)r/r0�FunctionTyperr1r�type�CodeType�
TracebackType�	FrameType�
GeneratorType�UNSAFE_GENERATOR_ATTRIBUTES�hasattrrF�UNSAFE_COROUTINE_ATTRIBUTESrG�!UNSAFE_ASYNC_GENERATOR_ATTRIBUTES�
startswith)r6rDr7r7r8�is_internal_attribute}s,

rTcCs(x"tD]\}}t||�r||kSqWdS)a�This function checks if an attribute on a builtin mutable object
    (list, dict, set or deque) or the corresponding ABCs would modify it
    if called.

    >>> 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, ``False`` is returned.

    >>> modifies_known_mutable("foo", "upper")
    False
    F)r*r/)r6rDZtypespecrCr7r7r8�modifies_known_mutable�s
rUcs�eZdZUdZdZejejejej	ej
ejejd�Z
ejeejejejgejffed<ejejd�Zejeejejgejffed<e�Zejeed<e�Zejeed<ejejd	d
��fdd�Zejeejed
�dd�Zejed�dd�Zeeejejejd�dd�Z eeejejd�dd�Z!ejej"eejfej"eje#fd�dd�Z$ejeej"eje#fd�dd�Z%ejee#d�dd �Z&d(eej'ejd!fejeejfej(ejed"�d#d$�Z)eejejejejd%�d&d'�Z*�Z+S))�SandboxedEnvironmenta�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)�+�-�*�/z//z**�%�default_binop_table)rWrX�default_unop_table�intercepted_binops�intercepted_unopsN)r:�kwargsr,cs4t�j||�t|jd<|j��|_|j��|_dS)Nr;)	�super�__init__r@�globalsr\�copy�binop_tabler]�
unop_table)�selfr:r`)�	__class__r7r8rb�s
zSandboxedEnvironment.__init__)r6rD�valuer,cCs|�d�pt||�S)aYThe 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.
        �_)rSrT)rgr6rDrir7r7r8�is_safe_attributesz&SandboxedEnvironment.is_safe_attribute)r6r,cCst|dd�pt|dd�S)z�Check if an object is safely callable. By default callables
        are considered safe unless decorated with :func:`unsafe`.

        This also recognizes the Django convention of setting
        ``func.alters_data = True``.
        rBFZalters_data)�getattr)rgr6r7r7r8�is_safe_callablesz%SandboxedEnvironment.is_safe_callable)�context�operator�left�rightr,cCs|j|||�S)z�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
        )re)rgrnrorprqr7r7r8�
call_binops	zSandboxedEnvironment.call_binop)rnro�argr,cCs|j||�S)z�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
        )rf)rgrnrorsr7r7r8�	call_unop!szSandboxedEnvironment.call_unop)r6�argumentr,cCs�y||Sttfk
r�t|t�r�yt|�}Wntk
rFYnDXyt||�}Wntk
rjYn X|�|||�r~|S|�||�SYnX|j	||d�S)z(Subscribe an object from sandboxed code.)r6�name)
�	TypeError�LookupErrorr/r5�	Exceptionrl�AttributeErrorrk�unsafe_undefined�	undefined)rgr6rurDrir7r7r8�getitem*s 
zSandboxedEnvironment.getitem)r6�	attributer,cCsryt||�}Wn6tk
rDy||Sttfk
r>YnXYn X|�|||�rX|S|�||�S|j||d�S)z�Subscribe an object from sandboxed code and prefer the
        attribute.  The attribute passed *must* be a bytestring.
        )r6rv)rlrzrwrxrkr{r|)rgr6r~rir7r7r8rlAszSandboxedEnvironment.getattrcCs&|jd|�dt|�j�d�||td�S)z1Return an undefined object for unsafe attributes.zaccess to attribute z of z object is unsafe.)rvr6�exc)r|rJr3r
)rgr6r~r7r7r8r{Rs
z%SandboxedEnvironment.unsafe_undefined.)�sr:r`�format_funcr,cCs�t|t�rt||jd�}nt|�}|dk	rl|jdkrlt|�dksD|r`tdt|�|dk	�d���|d}d}|�|||�}t	|�|�S)	z�If a format call is detected, then this is routed through this
        method so that our safety sandbox can be used for it.
        )�escapeNr.rz(format_map() takes exactly one argument z givenrr7)
r/r�SandboxedEscapeFormatterr��SandboxedFormatterr3r<rw�vformatrJ)rgr�r:r`r��	formatter�rvr7r7r8�
format_string\s
z"SandboxedEnvironment.format_string)�_SandboxedEnvironment__context�_SandboxedEnvironment__objr:r`r,cOsJt|�}|dk	r |�||||�S|�|�s8t|�d���|j|f|�|�S)z#Call an object from sandboxed code.Nz is not safely callable)r9r�rmr
�call)Z_SandboxedEnvironment__selfr�r�r:r`�fmtr7r7r8r�ys
zSandboxedEnvironment.call)N),r3�
__module__�__qualname__�__doc__Z	sandboxedror�sub�mul�truediv�floordiv�pow�modr\�t�Dictr5�Callable�Any�__annotations__�pos�negr]�	frozensetr^�	FrozenSetr_rb�boolrkrmrrrrt�Unionrr}rlr{�Tuple�Optionalr�r��
__classcell__r7r7)rhr8rV�s<
	0,		
 *rVcs0eZdZdZejeejed��fdd�Z�Z	S)�ImmutableSandboxedEnvironmentz�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.
    )r6rDrir,cs t��|||�sdSt||�S)NF)rarkrU)rgr6rDri)rhr7r8rk�sz/ImmutableSandboxedEnvironment.is_safe_attribute)
r3r�r�r�r�r�r5r�rkr�r7r7)rhr8r��sr�cs\eZdZeejdd��fdd�Zeejejej	eejfej
ejefd�dd�Z�ZS)r�N)�envr`r,cs||_t�jf|�dS)N)�_envrarb)rgr�r`)rhr7r8rb�szSandboxedFormatter.__init__)�
field_namer:r`r,c	CsVt|�\}}|�|||�}x2|D]*\}}|r<|j�||�}q |j�||�}q W||fS)N)r�	get_valuer�rlr})	rgr�r:r`�first�restr6�is_attr�ir7r7r8�	get_field�szSandboxedFormatter.get_field)
r3r�r�r	r�r�rbr5�Sequence�Mappingr�r�r�r7r7)rhr8r��sr�c@seZdZdS)r�N)r3r�r�r7r7r7r8r��sr�)9r�ror0�typingr��_stringr�collectionsrr�stringrZ
markupsaferr�environmentr	�
exceptionsr
Zruntimerr�TypeVarr�r�r
r=�setr�Setr5r�rrOrQrR�
MutableSetr��MutableMapping�MutableSequencer*r��Typer�r�r9�intr;r@rCr�rTrUrVr�r�r�r7r7r7r8�<module>sn0
%R



Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 11.11 PM
root / linksafe
0755
__init__.cpython-37.opt-1.pyc
1.84 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
__init__.cpython-37.pyc
1.84 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
_identifier.cpython-37.opt-1.pyc
1.825 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
_identifier.cpython-37.pyc
1.825 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
async_utils.cpython-37.opt-1.pyc
2.389 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
async_utils.cpython-37.pyc
2.389 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
bccache.cpython-37.opt-1.pyc
12.802 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
bccache.cpython-37.pyc
12.802 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
compiler.cpython-37.opt-1.pyc
53.089 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
compiler.cpython-37.pyc
53.089 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
constants.cpython-37.opt-1.pyc
1.479 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
constants.cpython-37.pyc
1.479 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
debug.cpython-37.opt-1.pyc
5.204 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
debug.cpython-37.pyc
5.204 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
defaults.cpython-37.opt-1.pyc
1.282 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
defaults.cpython-37.pyc
1.282 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
environment.cpython-37.opt-1.pyc
51.229 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
environment.cpython-37.pyc
51.229 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
exceptions.cpython-37.opt-1.pyc
5.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
exceptions.cpython-37.pyc
5.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
ext.cpython-37.opt-1.pyc
25.626 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
ext.cpython-37.pyc
25.626 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
filters.cpython-37.opt-1.pyc
48.595 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
filters.cpython-37.pyc
48.595 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
idtracking.cpython-37.opt-1.pyc
10.889 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
idtracking.cpython-37.pyc
10.889 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
lexer.cpython-37.opt-1.pyc
19.562 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
lexer.cpython-37.pyc
19.562 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
loaders.cpython-37.opt-1.pyc
19.753 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
loaders.cpython-37.pyc
19.753 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
meta.cpython-37.opt-1.pyc
3.679 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
meta.cpython-37.pyc
3.679 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nativetypes.cpython-37.opt-1.pyc
4.707 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nativetypes.cpython-37.pyc
4.707 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nodes.cpython-37.opt-1.pyc
40.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
nodes.cpython-37.pyc
40.422 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
optimizer.cpython-37.opt-1.pyc
1.836 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
optimizer.cpython-37.pyc
1.836 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
parser.cpython-37.opt-1.pyc
26.864 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
parser.cpython-37.pyc
26.864 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
runtime.cpython-37.opt-1.pyc
32.179 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
runtime.cpython-37.pyc
32.179 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
sandbox.cpython-37.opt-1.pyc
11.517 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
sandbox.cpython-37.pyc
11.517 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
tests.cpython-37.opt-1.pyc
6.349 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
tests.cpython-37.pyc
6.349 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
utils.cpython-37.opt-1.pyc
26.536 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
utils.cpython-37.pyc
26.536 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
visitor.cpython-37.opt-1.pyc
3.768 KB
14 Nov 2023 1.02 PM
root / linksafe
0644
visitor.cpython-37.pyc
3.768 KB
14 Nov 2023 1.02 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF