HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/botocore/__pycache__/context.cpython-38.pyc
U

KD�g��@s�dZddlmZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
eGdd	�d	��Zed
�Zdd�Zd
d�Zdd�Zeddd��Zddd�ZdS)z�
NOTE: All classes and functions in this module are considered private and are
subject to abrupt breaking changes. Please do not use them directly.
�)�contextmanager)�
ContextVar)�deepcopy)�	dataclass�field��wraps)�Setc@s(eZdZUdZeed�Zeee	d<dS)�
ClientContexta

    Encapsulation of objects tracked within the ``_context`` context variable.

    ``features`` is a set responsible for storing features used during
    preparation of an AWS request. ``botocore.useragent.register_feature_id``
    is used to add to this set.
    )�default_factory�featuresN)
�__name__�
__module__�__qualname__�__doc__r�setrr	�str�__annotations__�rr�=/opt/cppython/lib/python3.8/site-packages/botocore/context.pyr
s
r
�_contextcCs
t�d�S)z@Get the current ``_context`` context variable if set, else None.N)r�getrrrr�get_context*srcCst�|�}|S)a2Set the current ``_context`` context variable.

    :type ctx: ClientContext
    :param ctx: Client context object to set as the current context variable.

    :rtype: contextvars.Token
    :returns: Token object used to revert the context variable to what it was
        before the corresponding set.
    )rr)�ctx�tokenrrr�set_context/s

rcCst�|�dS)z�Reset the current ``_context`` context variable.

    :type token: contextvars.Token
    :param token: Token object to reset the context variable.
    N)r�reset)rrrr�
reset_context=srNccsD|pt�}|dkrt�}nt|�}t|�}z
dVW5t|�XdS)a�
    Context manager that copies the passed or current context object and sets
    it as the current context variable. If no context is found, a new
    ``ClientContext`` object is created. It mainly ensures the context variable
    is reset to the previous value once the executed code returns.

    Example usage:

        def my_feature():
            with start_as_current_context():
                register_feature_id('MY_FEATURE')
                pass

    :type ctx: ClientContext
    :param ctx: The client context object to set as the new context variable.
        If not provided, the current or a new context variable is used.
    N)rr
rrr)r�current�newrrrr�start_as_current_contextFs

r cs�fdd�}|S)a�
    Decorator that wraps ``start_as_current_context`` and optionally invokes a
    hook within the newly-set context. This is just syntactic sugar to avoid
    indenting existing code under the context manager.

    Example usage:

        @with_current_context(partial(register_feature_id, 'MY_FEATURE'))
        def my_feature():
            pass

    :type hook: callable
    :param hook: A callable that will be invoked within the scope of the
        ``start_as_current_context`` context manager.
    cst����fdd��}|S)Nc
s2t��"�r���||�W5QR�SQRXdS)N)r )�args�kwargs)�func�hookrr�wrapperwsz8with_current_context.<locals>.decorator.<locals>.wrapperr)r#r%�r$)r#r�	decoratorvsz'with_current_context.<locals>.decoratorr)r$r'rr&r�with_current_contextes
r()N)N)r�
contextlibrZcontextvarsr�copyr�dataclassesrr�	functoolsr�typingr	r
rrrrr r(rrrr�<module>
s