§
    7xÅjÆ  ã                   ó¼   — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 ddl
mZ e G d„ d¦  «        ¦   «         Z ed	¦  «        Zd
„ Zd„ Zd„ Zedd„¦   «         Zdd„ZdS )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©Úwrapsc                   óB   — e Zd ZU dZ ee¬¦  «        Zee         ed<   dS )Ú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   ÚstrÚ__annotations__© ó    úAC:\Projects\Historical\venv\Lib\site-packages\botocore/context.pyr   r      s?   € € € € € € ðð ð ˜¨sÐ3Ñ3Ô3€Hˆc�#ŒhÐ3Ð3Ñ3Ð3Ð3r   r   Ú_contextc                  ó6   — t                                d¦  «        S )z@Get the current ``_context`` context variable if set, else None.N)r   Úgetr   r   r   Úget_contextr   )   s   € å�<Š<˜ÑÔÐr   c                 ó:   — t                                | ¦  «        }|S )a2  Set 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.
    )r   r   )ÚctxÚtokens     r   Úset_contextr   .   s   € õ �LŠL˜ÑÔ€EØ€Lr   c                 ó:   — t                                | ¦  «         dS )z—Reset the current ``_context`` context variable.

    :type token: contextvars.Token
    :param token: Token object to reset the context variable.
    N)r   Úreset)r   s    r   Úreset_contextr"   <   s   € õ ‡N‚N�5ÑÔÐÐÐr   Nc              #   óØ   K  — | pt          ¦   «         }|€t          ¦   «         }nt          |¦  «        }t          |¦  «        }	 dV — t	          |¦  «         dS # t	          |¦  «         w xY w)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)r   r   r   r   r"   )r   ÚcurrentÚnewr   s       r   Ústart_as_current_contextr&   E   sv   è è € ð& Ð"•[‘]”]€GØ€Ý‰oŒoˆˆå�wÑÔˆÝ˜ÑÔ€EðØˆˆˆå�eÑÔÐÐÐø��eÑÔÐÐøøøs   ÁA ÁA)c                 ó   ‡ — ˆ fd„}|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.
    c                 ó@   •‡ — t          ‰ ¦  «        ˆ ˆfd„¦   «         }|S )Nc                  ó|   •— t          ¦   «         5  ‰r
 ‰¦   «           ‰| i |¤Žcd d d ¦  «         S # 1 swxY w Y   d S ©N)r&   )ÚargsÚkwargsÚfuncÚhooks     €€r   Úwrapperz8with_current_context.<locals>.decorator.<locals>.wrapperv   s˜   ø€ å)Ñ+Ô+ð -ð -Øð Ø�D‘F”F�FØ�t˜TÐ, VÐ,Ð,ð-ð -ð -ð -ñ -ô -ð -ð -ð -ð -ð -ð -øøøð -ð -ð -ð -ð -ð -s   �1±5¸5r   )r-   r/   r.   s   ` €r   Ú	decoratorz'with_current_context.<locals>.decoratoru   s9   øø€ Ý	ˆt‰Œð	-ð 	-ð 	-ð 	-ð 	-ñ 
Œð	-ð ˆr   r   )r.   r0   s   ` r   Úwith_current_contextr1   d   s$   ø€ ð"ð ð ð ð ð Ðr   r*   )r   Ú
contextlibr   Úcontextvarsr   Úcopyr   Údataclassesr   r   Ú	functoolsr	   r   r   r   r   r"   r&   r1   r   r   r   ú<module>r7      s!  ððð ð
 &Ð %Ð %Ð %Ð %Ð %Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð Ð Ð ð ð	4ð 	4ð 	4ð 	4ð 	4ñ 	4ô 	4ñ „ð	4ð ˆ:�jÑ!Ô!€ðð ð ð
ð ð ðð ð ð ðð ð ñ „ðð<ð ð ð ð ð r   