Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/local.cpython-312.pyc

�

'ٜg�W����ddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddl	mZddlmZddl
mZejrdd	lmZdd
lmZddlmZej(d�Zej(d
ej,dej.f��Zdd�ZGd�d�ZGd�dej6e�ZGd�d�ZGd�d�ZGd�de�Zd d�Z d!d�Z!Gd�dej6e�Z"y)"�)�annotationsN)�
ContextVar��partial)�update_wrapper)�
attrgetter�)�ClosingIterator)�
StartResponse)�WSGIApplication)�WSGIEnvironment�T�F.)�boundc�$�|j�y)z�Release the data for the current context in a :class:`Local` or
    :class:`LocalStack` without using a :class:`LocalManager`.

    This should not be needed for modern use cases, and may be removed
    in the future.

    .. versionadded:: 0.6.1
    N)�__release_local__)�locals �9/usr/local/lib/python3.12/site-packages/werkzeug/local.py�
release_localrs��
����c�^�eZdZdZdZdd
d�Zdd�Zdd�					dd�Zdd�Zdd	�Z	dd
�Z
dd�Zy)�LocalaqCreate a namespace of context-local data. This wraps a
    :class:`ContextVar` containing a :class:`dict` value.

    This may incur a performance penalty compared to using individual
    context vars, as it has to copy data to avoid mutating the dict
    between nested contexts.

    :param context_var: The :class:`~contextvars.ContextVar` to use as
        storage for this local. If not given, one will be created.
        Context vars not created at the global scope may interfere with
        garbage collection.

    .. versionchanged:: 2.0
        Uses ``ContextVar`` instead of a custom storage implementation.
    )�	__storageNc�f�|�tdt|��d��}tj|d|�y)Nzwerkzeug.Local<�	>.storage�_Local__storage)r�id�object�__setattr__��self�context_vars  r�__init__zLocal.__init__6s4����
%��r�$�x�j�	�%J�K�K����4�!2�K�@rc�f�t|jji�j��S�N)�iterr�get�items�r!s r�__iter__zLocal.__iter__@s%���D�N�N�&�&�r�*�0�0�2�3�3r��unbound_messagec��t|||��S)z�Create a :class:`LocalProxy` that access an attribute on this
        local namespace.

        :param name: Proxy this attribute.
        :param unbound_message: The error message that the proxy will
            show if the attribute isn't set.
        r+��
LocalProxy�r!�namer,s   r�__call__zLocal.__call__Cs���$��o�F�Frc�:�|jji�yr%)r�setr)s rrzLocal.__release_local__Os�������2�rc�`�|jji�}||vr||St|��r%)rr'�AttributeError�r!r1�valuess   r�__getattr__zLocal.__getattr__Rs2�����#�#�B�'���6�>��$�<���T�"�"rc��|jji�j�}|||<|jj|�yr%)rr'�copyr4)r!r1�valuer8s    rrzLocal.__setattr__Zs:�����#�#�B�'�,�,�.����t�������6�"rc��|jji�}||vr/|j�}||=|jj|�yt	|��r%)rr'r;r4r6r7s   r�__delattr__zLocal.__delattr___sL�����#�#�B�'���6�>��[�[�]�F��t���N�N���v�&� ��&�&rr%)r"z#ContextVar[dict[str, t.Any]] | None�return�None)r?zt.Iterator[tuple[str, t.Any]])r1�strr,�
str | Noner?�LocalProxy[t.Any]�r?r@)r1rAr?�t.Any)r1rAr<rEr?r@)r1rAr?r@)�__name__�
__module__�__qualname__�__doc__�	__slots__r#r*r2rr9rr>�rrrr#sS��� �I�A�4�;?�
G��
G�-7�
G�	�
G��#�#�
'rrc�d�eZdZdZdZddd�Zd
d�Zdd�Zdd�Ze	dd��Z
	ddd	�					dd
�Zy)�
LocalStacka�Create a stack of context-local data. This wraps a
    :class:`ContextVar` containing a :class:`list` value.

    This may incur a performance penalty compared to using individual
    context vars, as it has to copy data to avoid mutating the list
    between nested contexts.

    :param context_var: The :class:`~contextvars.ContextVar` to use as
        storage for this local. If not given, one will be created.
        Context vars not created at the global scope may interfere with
        garbage collection.

    .. versionchanged:: 2.0
        Uses ``ContextVar`` instead of a custom storage implementation.

    .. versionadded:: 0.6.1
    )�_storageNc�F�|�tdt|��d��}||_y)Nzwerkzeug.LocalStack<r)rrrNr s  rr#zLocalStack.__init__s)����
%�';�B�t�H�:�Y�%O�P�K�#��
rc�:�|jjg�yr%)rNr4r)s rrzLocalStack.__release_local__�s���
�
���"�rc��|jjg�j�}|j|�|jj	|�|S)z'Add a new item to the top of the stack.)rNr'r;�appendr4)r!�obj�stacks   r�pushzLocalStack.push�sB���
�
�!�!�"�%�*�*�,��
���S���
�
���%� ��rc��|jjg�}t|�dk(ry|d}|jj|dd�|S)zjRemove the top item from the stack and return it. If the
        stack is empty, return ``None``.
        rN���)rNr'�lenr4)r!rT�rvs   r�popzLocalStack.pop�sL���
�
�!�!�"�%���u�:��?��
�2�Y���
�
���%���*�%��	rc�`�|jjg�}t|�dk(ry|dS)z[The topmost item on the stack.  If the stack is empty,
        `None` is returned.
        rNrW)rNr'rX)r!rTs  r�topzLocalStack.top�s0��
�
�
�!�!�"�%���u�:��?���R�y�rr+c��t|||��S)a@Create a :class:`LocalProxy` that accesses the top of this
        local stack.

        :param name: If given, the proxy access this attribute of the
            top item, rather than the item itself.
        :param unbound_message: The error message that the proxy will
            show if the stack is empty.
        r+r.r0s   rr2zLocalStack.__call__�s���$��o�F�Frr%)r"zContextVar[list[T]] | Noner?r@rD)rSrr?zlist[T])r?zT | None)r1rBr,rBr?rC)rFrGrHrIrJr#rrUrZ�propertyr\r2rKrrrMrMjse���$�I�$�����	��	�"&�G�HL�G��G�;E�G�	�GrrMc�F�eZdZdZdZ	d				d
d�Zdd�Zdd�Zd
d�Zdd�Z	y)�LocalManageraManage releasing the data for the current context in one or more
    :class:`Local` and :class:`LocalStack` objects.

    This should not be needed for modern use cases, and may be removed
    in the future.

    :param locals: A local or list of locals to manage.

    .. versionchanged:: 2.1
        The ``ident_func`` was removed.

    .. versionchanged:: 0.7
        The ``ident_func`` parameter was added.

    .. versionchanged:: 0.6.1
        The :func:`release_local` function can be used instead of a
        manager.
    )�localsNc�j�|�g|_yt|t�r	|g|_yt|�|_yr%)ra�
isinstancer�list)r!ras  rr#zLocalManager.__init__�s.��
�>��D�K�
���
&�!�(�D�K��v�,�D�Krc�<�|jD]
}t|��y)z�Release the data in the locals for this context. Call this at
        the end of each request or use :meth:`make_middleware`.
        N)rar)r!rs  r�cleanupzLocalManager.cleanup�s���[�[�E��%� �!rc�$���						d��fd�}|S)z�Wrap a WSGI application so that local data is released
        automatically after the response has been sent for a request.
        c�>��t�||��j�Sr%)r
rf)�environ�start_response�appr!s  ��r�applicationz1LocalManager.make_middleware.<locals>.application�s���#�3�w��#?����N�Nr)rir
rjrr?zt.Iterable[bytes]rK)r!rkrls`` r�make_middlewarezLocalManager.make_middleware�s,���
	O�$�	O�6C�	O�
�	O�
�rc�8�t|j|�|�S)z�Like :meth:`make_middleware` but used as a decorator on the
        WSGI application function.

        .. code-block:: python

            @manager.middleware
            def application(environ, start_response):
                ...
        )rrm)r!�funcs  r�
middlewarezLocalManager.middleware�s���d�2�2�4�8�$�?�?rc�`�dt|�j�dt|j��d�S)N�<z storages: �>)�typerFrXrar)s r�__repr__zLocalManager.__repr__�s,���4��:�&�&�'�{�3�t�{�{�3C�2D�A�F�Frr%)razJNone | (Local | LocalStack[t.Any] | t.Iterable[Local | LocalStack[t.Any]])r?r@rD)rkrr?r)rorr?r�r?rA)
rFrGrHrIrJr#rfrmrprurKrrr`r`�sE���&�I�
QU�
'�N�
'�
�	
'�!�
�
@�Grr`c�j�eZdZdZdZ				d										d
d�Zdd�Zdd
d�Zdd�Z								dd�Z	y)�_ProxyLookupa�Descriptor that handles proxied attribute lookup for
    :class:`LocalProxy`.

    :param f: The built-in function this attribute is accessed through.
        Instead of looking up the special method, the function call
        is redone on the object.
    :param fallback: Return this function if the proxy is unbound
        instead of raising a :exc:`RuntimeError`.
    :param is_attr: This proxied name is an attribute, not a function.
        Call the fallback immediately to get the value.
    :param class_value: Value to return when accessed from the
        ``LocalProxy`` class directly. Used for ``__doc__`` so building
        docs still works.
    )�bind_f�fallback�is_attr�class_valuer1Nc���t�d�r
						d�fd�}n��
						d�fd�}nd}||_||_||_||_y)N�__get__c�:���j|t|��Sr%�r~rt��instancerS�fs  �rryz%_ProxyLookup.__init__.<locals>.bind_fs����y�y��d�3�i�0�0rc���t�|�Sr%rr�s  �rryz%_ProxyLookup.__init__.<locals>.bind_f%s����q�#��&r�r�rCrSrEr?zt.Callable[..., t.Any])�hasattrryrzr|r{)r!r�rzr|r{rys `    rr#z_ProxyLookup.__init__st����1�i� �
1�+�
1�27�
1�'�
1�
�]�
'�+�
'�27�
'�'�
'��F���� ��
�&�����rc��||_yr%�r1)r!�ownerr1s   r�__set_name__z_ProxyLookup.__set_name__3s	����	rc�b�|�|j�|jS|S	|j�}|j�|j
||�St||j�S#t$rC|j��|jj	||�}|j
r	|�cYS|cYSwxYwr%)	r|�_get_current_object�RuntimeErrorrzr~r{ry�getattrr1)r!r�r�rSrzs     rr~z_ProxyLookup.__get__6s��������+��'�'�'��K�
	��.�.�0�C��;�;�"��;�;�x��-�-��s�D�I�I�&�&��!�	��}�}�$���}�}�,�,�X�u�=�H��|�|� �z�!��O�	�s�A"�"AB.�)B.�-B.c� �d|j��S)Nzproxy r�r)s rruz_ProxyLookup.__repr__Qs����	�	�{�#�#rc�D�|j|t|��|i|��S)z�Support calling unbound methods from the class. For example,
        this happens with ``copy.copy``, which does
        ``type(x).__copy__(x)``. ``type(x)`` can't be proxied, so it
        returns the proxy type and descriptor.
        r�)r!r��args�kwargss    rr2z_ProxyLookup.__call__Ts%��6�t�|�|�H�d�8�n�5�t�F�v�F�Fr)NNNF)
r��t.Callable[..., t.Any] | Nonerz�-t.Callable[[LocalProxy[t.Any]], t.Any] | Noner|zt.Any | Noner{�boolr?r@)r�rCr1rAr?r@r%)r�rCr�ztype | Noner?rErv)r�rCr�rEr�rEr?rE)
rFrGrHrIrJr#r�r~rur2rKrrrxrx�s���
�I�I�,0�BF�$(�� �(� �@� �"�	 �
� �
�
 �D�'�6$�G�)�G�27�G�CH�G�	�Grrxc�8��eZdZdZdZ		d					d�fd�
Z�xZS)�	_ProxyIOpz�Look up an augmented assignment method on a proxied object. The
    method is wrapped to return the proxy instead of the object.
    rKc�B���t�|��|�d�fd�}||_y)Nc�J���d��fd�}|j|t|��S)Nc����||��Sr%rK)r!�otherr�r�s  ��r�i_opz0_ProxyIOp.__init__.<locals>.bind_f.<locals>.i_opns����$����r)r!rEr�rEr?rCr�)r�rSr�r�s`  �rryz"_ProxyIOp.__init__.<locals>.bind_fms���
 ��<�<��T�#�Y�/�/rr�)�superr#ry)r!r�rzry�	__class__s `  �rr#z_ProxyIOp.__init__fs"���
	����H�%�	0���r)NN)r�r�rzr�r?r@)rFrGrHrIrJr#�
__classcell__)r�s@rr�r�_s>�����I�,0�BF��(��@��
�	�rr�c�D��d�fd�}tjt|�S)z5Swap the argument order to turn an l-op into an r-op.c����||�Sr%rK)rSr��ops  �r�r_opz_l_to_r_op.<locals>.r_opzs����%��~�r)rSrEr�rEr?rE)�t�castr)r�r�s` r�
_l_to_r_opr�ws����
�6�6�!�T�?�rc��|Sr%rK)�os r�	_identityr��s���Hrc�`�eZdZUdZdZded<		ddd�							dd�Zeed�d	�
�Zed�d	��Zee	d
���Z
ee�Zee
�Ze�Zeej"�Zeej&�Zeej*�Zeej.�Zeej2�Zeej6�Zee�Zeed���Z ee!�Z"ee#�Z$ee%�Z&ee'd���Z(ed�d	��Z)ed��Z*ed��Z+ed��Z,ee-�Z.eej^�Z0eejb�Z2eejf�Z4eejj�Z6ee7�Z8ee9�Z:ee;�Z<eejz�Z>eej~�Z@eej��ZBeej��ZDeej��ZFeej��ZHeej��ZJeej��ZLeeM�ZNeeO�ZPeej��ZReej��ZTeej��ZVeej��ZXeej��ZZee[ej~��Z\ee[ej���Z]ee[ej���Z^ee[ej���Z_ee[ej���Z`ee[ej���Zaee[ej���Zbee[eM��Zcee[eO��Zdee[ej���Zeee[ej���Zfee[ej���Zgee[ej���Zhee[ej���Ziejej��Zlejej��Znejej��Zpejej��Zrejej��Ztejej��Zvejej��Zxejej��Zzejej��Z|ejej��Z~ejej��Z�eje�j�Z�eje�j�Z�ee�j
�Z�ee�j�Z�ee��Z�ee�j�Z�ee��Z�ee��Z�ee��Z�ee�j&�Z�ee��Z�ee��j0�Z�ee��j4�Z�ee��j8�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�ee��jJ�Z�ee��jN�Z�y)r/as	A proxy to the object bound to a context-local object. All
    operations on the proxy are forwarded to the bound object. If no
    object is bound, a ``RuntimeError`` is raised.

    :param local: The context-local object that provides the proxied
        object.
    :param name: Proxy this attribute from the proxied object.
    :param unbound_message: The error message to show if the
        context-local object is unbound.

    Proxy a :class:`~contextvars.ContextVar` to make it easier to
    access. Pass a name to proxy that attribute.

    .. code-block:: python

        _request_var = ContextVar("request")
        request = LocalProxy(_request_var)
        session = LocalProxy(_request_var, "session")

    Proxy an attribute on a :class:`Local` namespace by calling the
    local with the attribute name:

    .. code-block:: python

        data = Local()
        user = data("user")

    Proxy the top item on a :class:`LocalStack` by calling the local.
    Pass a name to proxy that attribute.

    .. code-block::

        app_stack = LocalStack()
        current_app = app_stack()
        g = app_stack("g")

    Pass a function to proxy the return value from that function. This
    was previously used to access attributes of local objects before
    that was supported directly.

    .. code-block:: python

        session = LocalProxy(lambda: request.session)

    ``__repr__`` and ``__class__`` are proxied, so ``repr(x)`` and
    ``isinstance(x, cls)`` will look like the proxied object. Use
    ``issubclass(type(x), LocalProxy)`` to check if an object is a
    proxy.

    .. code-block:: python

        repr(user)  # <User admin>
        isinstance(user, User)  # True
        issubclass(type(user), LocalProxy)  # True

    .. versionchanged:: 2.2.2
        ``__wrapped__`` is set when wrapping an object, not only when
        wrapping a function, to prevent doctest from failing.

    .. versionchanged:: 2.2
        Can proxy a ``ContextVar`` or ``LocalStack`` directly.

    .. versionchanged:: 2.2
        The ``name`` parameter can be used with any proxied object, not
        only ``Local``.

    .. versionchanged:: 2.2
        Added the ``unbound_message`` parameter.

    .. versionchanged:: 2.0
        Updated proxied attributes and methods to reflect the current
        data model.

    .. versionchanged:: 0.6.1
        The class can be instantiated with a callable.
    )�	__wrappedr�zt.Callable[[], T]r�Nr+c�����|�t�nt|����d�t�t�r|�t	d��d���fd�}n]t�t
�r	d���fd�}nDt�t�r	d���fd�}n+t��rd��fd�}nt	dt���d���tj|d	��tj|d
|�y)Nzobject is not boundz2'name' is required when proxying a 'Local' object.c�H��	���S#t$r
t��d�wxYwr%)r6r�)�get_namerr,s���rr�z0LocalProxy.__init__.<locals>._get_current_object�s1���B�#�E�?�*��%�B�&��7�T�A�B�s��!c�F���j}|�t����|�Sr%)r\r��rSr�rr,s ���rr�z0LocalProxy.__init__.<locals>._get_current_object�s&����i�i���;�&��7�7���}�$rc�h��	�j�}�|�S#t$r
t��d�wxYwr%)r'�LookupErrorr�r�s ���rr�z0LocalProxy.__init__.<locals>._get_current_objects@���B��)�)�+�C� ��}�$��#�B�&��7�T�A�B�s��1c�������Sr%rK)r�rs��rr�z0LocalProxy.__init__.<locals>._get_current_object
s������(�(rzDon't know how to proxy 'z'.�_LocalProxy__wrappedr�)r?r)r�rrcr�	TypeErrorrMr�callablertrr)r!rr1r,r�r�s ` ` @rr#zLocalProxy.__init__�s�����<� �H�!�$�'�H��"�3�O��e�U�#��|�� T�U�U�
B�
B���z�
*�
%�
%���z�
*�
%�
%��e�_�
)��7��U��}�B�G�H�H����4�!7��?����4�!6�8K�Lrc�,�t|�jSr%)rtrIr)s r�<lambda>zLocalProxy.<lambda>s��4��:�3E�3ErT)r|rzr{c��|jSr%)r�r)s rr�zLocalProxy.<lambda>s
��d�7�7r)rzr{c�4�dt|�j�d�S)Nrrz	 unbound>)rtrFr)s rr�zLocalProxy.<lambda>s��a��T�
�(;�(;�'<�I�$Fr)rzc��y)NFrKr)s rr�zLocalProxy.<lambda>+s��rc��gSr%rKr)s rr�zLocalProxy.<lambda>0s��brc��t|�Sr%)rtr)s rr�zLocalProxy.<lambda>;s��4��:rc��t||�Sr%)rc�r!r�s  rr�zLocalProxy.<lambda><����E�4�9Prc��t||�Sr%)�
issubclassr�s  rr�zLocalProxy.<lambda>=r�rc��||i|��Sr%rK)r!r�r�s   rr�zLocalProxy.<lambda>?s��$��:O��:Orr%)rz9ContextVar[T] | Local | LocalStack[T] | t.Callable[[], T]r1rBr,rBr?r@)�rFrGrHrIrJ�__annotations__r#rx�__wrapped__�reprrurA�__str__�bytes�	__bytes__�
__format__�operator�lt�__lt__�le�__le__�eq�__eq__�ne�__ne__�gt�__gt__�ge�__ge__�hash�__hash__r��__bool__r�r9�setattrr�delattrr>�dir�__dir__r��__instancecheck__�__subclasscheck__r2rX�__len__�length_hint�__length_hint__�getitem�__getitem__�setitem�__setitem__�delitem�__delitem__r&r*�next�__next__�reversed�__reversed__�contains�__contains__�add�__add__�sub�__sub__�mul�__mul__�matmul�
__matmul__�truediv�__truediv__�floordiv�__floordiv__�mod�__mod__�divmod�
__divmod__�pow�__pow__�lshift�
__lshift__�rshift�
__rshift__�and_�__and__�xor�__xor__�or_�__or__r��__radd__�__rsub__�__rmul__�__rmatmul__�__rtruediv__�
__rfloordiv__�__rmod__�__rdivmod__�__rpow__�__rlshift__�__rrshift__�__rand__�__rxor__�__ror__r��iadd�__iadd__�isub�__isub__�imul�__imul__�imatmul�__imatmul__�itruediv�__itruediv__�	ifloordiv�
__ifloordiv__�imod�__imod__�ipow�__ipow__�ilshift�__ilshift__�irshift�__irshift__�iand�__iand__�ixor�__ixor__�ior�__ior__�neg�__neg__�pos�__pos__�abs�__abs__�invert�
__invert__�complex�__complex__�int�__int__�float�	__float__�index�	__index__�round�	__round__�math�trunc�	__trunc__�floor�	__floor__�ceil�__ceil__�	__enter__�__exit__�	__await__�	__aiter__�	__anext__�
__aenter__�	__aexit__r;�__copy__�deepcopy�__deepcopy__rKrrr/r/�sV��K�Z5�I�*�*�� �6M�
'+�6M�H�6M��6M�
$�6M�
�
6M�p��&E�t��G��7���K�
��F��H��3��G��U�#�I���J�
�(�+�+�
&�F�
�(�+�+�
&�F�
�(�+�+�
&�F�
�(�+�+�
&�F�
�(�+�+�
&�F�
�(�+�+�
&�F��D�!�H��D�+=�>�H��w�'�K��w�'�K��w�'�K��3��9�G��&=�t�L�I�$�%P�Q��$�%P�Q���O�P�H��3��G�"�8�#7�#7�8�O��x�/�/�0�K��x�/�/�0�K��x�/�/�0�K��D�!�H��D�!�H���)�L��� 1� 1�2�L��8�<�<�(�G��8�<�<�(�G��8�<�<�(�G��h�o�o�.�J��x�/�/�0�K��� 1� 1�2�L��8�<�<�(�G��f�%�J��3��G��h�o�o�.�J��h�o�o�.�J��8�=�=�)�G��8�<�<�(�G�
�(�,�,�
'�F��J�x�|�|�4�5�H��J�x�|�|�4�5�H��J�x�|�|�4�5�H��z�(�/�/�:�;�K��
�8�+;�+;� <�=�L� ��H�,=�,=�!>�?�M��J�x�|�|�4�5�H��z�&�1�2�K��J�s�O�,�H��z�(�/�/�:�;�K��z�(�/�/�:�;�K��J�x�}�}�5�6�H��J�x�|�|�4�5�H��:�h�l�l�3�4�G�����'�H�����'�H�����'�H��H�,�,�-�K��X�.�.�/�L��h�0�0�1�M�����'�H�����'�H��H�,�,�-�K��H�,�,�-�K�����'�H�����'�H�����%�G��8�<�<�(�G��8�<�<�(�G��3��G��h�o�o�.�J��w�'�K��3��G��U�#�I��X�^�^�,�I��U�#�I��T�Z�Z�(�I��T�Z�Z�(�I��D�I�I�&�H���I��~�H���I���I���I���J���I��D�I�I�&�H���
�
�.�Lrr/)rzLocal | LocalStack[t.Any]r?r@)r�rr?r)r�rr?r)#�
__future__rr;rFr��typingr��contextvarsr�	functoolsrrr�wsgir
�
TYPE_CHECKING�_typeshed.wsgirrr
�TypeVarr�Callable�Anyrrr�GenericrMr`rxr�r�r�r/rKrr�<module>rbs���"�����"��$��!��?�?�,�.�.�
�A�I�I�c�N��
�A�I�I�c����C����J�/�0��	�D'�D'�NMG����1��MG�`BG�BG�J]G�]G�@���0�
�C/����1��C/r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists