HEX
Server: LiteSpeed
System: Linux altar40.supremepanel40.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: sescorpcl (4477)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //opt/alt/python313/lib/python3.13/site-packages/jinja2/__pycache__/sandbox.cpython-313.pyc
�

��
i�:��r�%SrSSKrSSKrSSKrSSKJr SSKJr SSKJ	r	 SSK
Jr SSKJ
r
 SSKJr SS	KJr S
SKJr S
SKJr S
S
KJr S
SKJr \R0"S\R2S\R44S9rSr\"5r\R>\ \!S'\"5r"\R>\ \!S'SS1r#SS1r$SS1r%\RL\'"/SQ54\RP\'"/SQ54\RR\'"/SQ54\	\'"/SQ544r*\RV\RV\RX\R4\RZ\ 4S4\!S'S \.S!\/4S"jr0S#\S!\4S$jr1S%\R4S&\ S!\24S'jr3S%\R4S&\ S!\24S(jr4"S)S*\5r5"S+S,\55r6"S-S.\
5r7"S/S0\7\5r8g)1z�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)�update_wrapper)�	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)rr�popitem�
setdefaultr )�appendrr�reverse�insert�sort�extendr)	r#�
appendleftrr'�
extendleftr�popleftr�rotate�
_mutable_spec�args�returnc�b�[U6n[U5[:�a[S[S35eU$)zOA 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-�rngs  �A/opt/alt/python313/lib/python3.13/site-packages/jinja2/sandbox.py�
safe_ranger6Ws>����,�C�
�3�x�)���
�$�+�R�
)�
�	
�
�J��fc��SUlU$)zmMarks a function or method as unsafe.

.. code-block: python

    @unsafe
    def delete(self):
        pass
T)�unsafe_callable)r8s r5�unsafer;fs���A���Hr7�obj�attrc���[U[R5(a
U[;agGO<[U[R5(aU[;d
U[
;agGO[U[5(aUS:XagO�[U[R[R[R45(ag[U[R5(aU[;agO[[S5(a+[U[R5(aU[;agO?[[S5(a*[U[R5(aU[ ;agUR#S5$)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�__)�
isinstance�types�FunctionTyper�
MethodTyper�type�CodeType�
TracebackType�	FrameType�
GeneratorType�UNSAFE_GENERATOR_ATTRIBUTES�hasattrr@�UNSAFE_COROUTINE_ATTRIBUTESrA�!UNSAFE_ASYNC_GENERATOR_ATTRIBUTES�
startswith)r<r=s  r5�is_internal_attributerQss,���#�u�)�)�*�*��-�-��.�	�C��)�)�	*�	*��-�-��9Q�1Q��2R�	�C��	�	��5�=���	�C�%�.�.�%�*=�*=�u���O�	P�	P��	�C��,�,�	-�	-��.�.��/�	���	(�	(�Z��U�=P�=P�-Q�-Q��.�.��/�	��,�	-�	-�*��U�
%�
%�3�3��4�4���?�?�4� � r7c�N�[Hup#[X5(dMX;s $ g)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,rC)r<r=�typespecr;s    r5�modifies_known_mutablerT�s)��&*����c�$�$��>�!�*�r7c
�z^�\rSrSr%SrSr\R\R\R\R\R\R\RS.r\R \\R$\R&\R&/\R&44\S'\R*\R,S.r\R \\R$\R&/\R&44\S'\"5r\R4\\S'\"5r\R4\\S	'S
\R&S\R&SS
4U4SjjrS\R&S\S\R&S\4SjrS\R&S\4SjrS\ S\S\R&S\R&S\R&4
Sjr!S\ S\S\R&S\R&4Sjr"S\R&S\RF\\R&4S\RF\R&\$44Sjr%S\R&S\S\RF\R&\$44Sjr&S\R&S\S\$4Sjr'S\R&S\RP\R$S \44S!jr)S"\ S#\R&S
\R&S\R&S\R&4
S$jr*S%r+U=r,$)&�SandboxedEnvironment�a�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)rXrY�default_unop_table�intercepted_binops�intercepted_unopsr-�kwargsr.Nc��>�[TU]"U0UD6 [URS'URR5UlURR5Ulg)Nr0)	�super�__init__r6�globalsr]�copy�binop_tabler^�
unop_table)�selfr-ra�	__class__s   �r5rd�SandboxedEnvironment.__init__�sP���
���$�)�&�)� *����W���3�3�8�8�:����1�1�6�6�8��r7r<r=�valuec�R�URS5=(d [X5(+$)a1The 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.
�_)rPrQ)rir<r=rls    r5�is_safe_attribute�&SandboxedEnvironment.is_safe_attribute�s!���O�O�C�(�L�,A�#�,L�M�Mr7c�N�[USS5=(d
 [USS5(+$)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``.
r:F�alters_data)�getattr)rir<s  r5�is_safe_callable�%SandboxedEnvironment.is_safe_callables*��
�C�*�E�2�X�g�c�=�RW�6X�
�	
r7�context�operator�left�rightc�,�URU"X45$)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
)rg)rirvrwrxrys     r5�
call_binop�SandboxedEnvironment.call_binops������)�$�6�6r7�argc�,�URU"U5$)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
)rh)rirvrwr}s    r5�	call_unop�SandboxedEnvironment.call_unops�����x�(��-�-r7�argumentc��X$![[4a� [U[5(a�[U5n[	X5nURU5nUbUs$UR
XU5(aUs$URX5s$![a Of=f![a O
f=fOf=fURXS9$)z(Subscribe an object from sandboxed code.�r<�name)�	TypeError�LookupErrorrC�strrs�wrap_str_formatro�unsafe_undefined�AttributeError�	Exception�	undefined)rir<r�r=rl�fmts      r5�getitem�SandboxedEnvironment.getitem s���	D��=� ���;�'�	D��(�C�(�(�D��x�=�D�
D� '�� 2��#�2�2�5�9���?�#&�J��1�1�#��G�G�#(�L�#�4�4�S�C�C��*�����!�����)�	D��$�~�~�#�~�5�5s[��%B.�B�B	�B.�B.�6B.�	
B�B.�B�B.�
B(�$B.�'B(�(B.�-B.�	attributec��[X5nURU5nUbU$URXU5(aU$URX5$![a Xs$![
[4a Of=ff=fURXS9$)zpSubscribe an object from sandboxed code and prefer the
attribute.  The attribute passed *must* be a bytestring.
r�)rsr�ror�r�r�r�r�)rir<r�rlr�s     r5rs�SandboxedEnvironment.getattr:s���
	9��C�+�E��&�&�u�-�C����
��%�%�c�e�<�<����(�(��8�8���	�
��~�%���{�+�
��
��	���~�~�#�~�6�6s/�A
�
A6�A�A6�A2�.A6�1A2�2A6c�f�URSU<S[U5R<S3UU[S9$)z1Return an undefined object for unsafe attributes.zaccess to attribute z of z object is unsafe.)r�r<�exc)r�rG�__name__r)rir<r�s   r5r��%SandboxedEnvironment.unsafe_undefinedNsE���~�~�"�9�-�0��S�	�"�"�%�%7�
9�����
�	
r7.c�^^^^�[U[R[R45(aURS;agUR
m[T[5(dg[T5mURS:Hm[T[5(a[UTRS9nO[U5nURmS[RS[RS[4UUUU4Sjjn[X15$)	z�If the given value is a ``str.format`` or ``str.format_map`` method,
return a new function than handles sandboxing. This is done at access
rather than in :meth:`call`, so that calls made without ``call`` are
also sandboxed.
)�format�
format_mapNr�)�escaper-rar.c�>�T(a@U(a[S5e[U5S:wa[S[U5S35eUSnSnT"T"TX55$)Nz'format_map() takes no keyword argumentsr
z)format_map() takes exactly one argument (z given)r�)r�r1)r-ra�f_self�
is_format_map�str_type�vformats  ����r5�wrapper�5SandboxedEnvironment.wrap_str_format.<locals>.wrapperss_�����#�$M�N�N��t�9��>�#�C�C��I�;�g�V����a������G�F�D�9�:�:r7)rCrDrF�BuiltinMethodTyper��__self__r�rGr	�SandboxedEscapeFormatterr��SandboxedFormatterr��t�Anyr)rirl�	formatterr�r�r�r�r�s    @@@@r5r��$SandboxedEnvironment.wrap_str_formatXs������E�$�$�e�&=�&=�>�
�
�
�^�^�#;�
;�������&�#�&�&�� $�V������,�6�
��f�f�%�%�0��f�m�m�L�I�*�4�0�I��#�#��
	;�1�5�5�
	;�A�E�E�
	;�c�
	;�
	;��g�-�-r7�_SandboxedEnvironment__context�_SandboxedEnvironment__objc�x�URU5(d[U<S35eUR"U/UQ70UD6$)z#Call an object from sandboxed code.z is not safely callable)rtr�call)�_SandboxedEnvironment__selfr�r�r-ras     r5r��SandboxedEnvironment.call�sA���&�&�u�-�-��5�)�+B� C�D�D��~�~�e�5�d�5�f�5�5r7)rgrh)-r��
__module__�__qualname__�__firstlineno__�__doc__�	sandboxedrwr�sub�mul�truediv�floordiv�pow�modr]r��Dictr��Callabler��__annotations__�pos�negr^�	frozensetr_�	FrozenSetr`rd�boolrortr
r{r�Unionrr�rsr��Optionalr�r��__static_attributes__�
__classcell__�rjs@r5rVrV�s������I��\�\�
�\�\�
�\�\�
�
�
�����l�l�
�\�\�K������Q�Z�Z�����������0E�%F� F�G���\�\�
�\�\�C�����s�A�J�J����w����~�$>�>�?��&,5�;�����C�(�6�+4�+��q�{�{�3�'�5�9�a�e�e�9�q�u�u�9��9�N�Q�U�U�N�#�N�a�e�e�N��N�	
�A�E�E�	
�d�	
�	7��	7�*-�	7�56�U�U�	7�CD�5�5�	7�	
���	7�.��.�C�.�a�e�e�.����.�6��5�5�6�$%�G�G�C����J�$7�6�	
������	�!�	"�6�47�1�5�5�7�S�7�Q�W�W�Q�U�U�I�=M�5N�7�(
�A�E�E�
�c�
�i�
�*.�Q�U�U�*.�q�z�z�!�*�*�S�#�X�:N�/O�*.�X
6��
6��u�u�
6��u�u�	
6�
�%�%�
6�
���

6�
6r7rVc�h^�\rSrSrSrS\RS\S\RS\4U4Sjjr	Sr
U=r$)	�ImmutableSandboxedEnvironmenti�z�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.
r<r=rlr.c�P>�[TU]XU5(dg[X5(+$)NF)rcrorT)rir<r=rlrjs    �r5ro�/ImmutableSandboxedEnvironment.is_safe_attribute�s&����w�(��E�:�:��)�#�4�4�4r7r�)r�r�r�r�r�r�r�r�r�ror�r�r�s@r5r�r��s6����
5�Q�U�U�5�#�5�a�e�e�5��5�5r7r�c
�^�\rSrSrS\S\RSS4U4SjjrS\S\R\RS\R\\R4S\R\R\44S	jrS
r
U=r$)r�i��envrar.Nc�2>�Xl[TU]"S0UD6 g)Nr�)�_envrcrd)rir�rarjs   �r5rd�SandboxedFormatter.__init__�s����	�
���"�6�"r7�
field_namer-c���[U5upEURXBU5nUHDupxU(aURRXh5nM)URR	Xh5nMF Xd4$)N)r�	get_valuer�rsr�)	rir�r-ra�first�restr<�is_attr�is	         r5�	get_field�SandboxedFormatter.get_field�sa��1��<����n�n�U�&�1���J�G���i�i�'�'��/���i�i�'�'��/��	�
�z�r7)r�)r�r�r�r�rr�r�rdr��Sequence�Mapping�Tupler�r�r�r�s@r5r�r��sz���#�K�#�1�5�5�#�T�#�
��
�%&�Z�Z����%6�
�@A�	�	�#�q�u�u�*�@U�
�	
��������	�
�
r7r�c��\rSrSrSrg)r�i�r�N)r�r�r�r�r�r�r7r5r�r��s��r7r�)9r�rwrD�typingr��_stringr�collectionsrr�	functoolsr�stringr�
markupsaferr	�environmentr�
exceptionsr�runtimer
r�TypeVarr�r�rr2�setr�Setr�r�rrLrNrO�
MutableSetr��MutableMapping�MutableSequencer,r��Typer��intr0r6r;r�rQrTrVr�r�r�r�r7r5�<module>r�s�������.���$��&��$�%����I�I�c����C����J�/�0��
�	�*-���A�E�E�#�J�.�(+�u��!�%�%��*�,� *�9�5�� *�9�5��&/�
�$;�!�	����	
�	
�� 	����E�F��
	����W�	
��	��

�	
��5*I�
�q�w�w�q�w�w�q�v�v�a�e�e�}�a�k�k�#�.>�>�?��D�E�*�Z�c��e��

�a�

�A�

�"!�q�u�u�"!�C�"!�D�"!�J�����S��T��2`6�;�`6�F
5�$8�
5����$	�1�?�	r7