HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/lib/python3.6/site-packages/botocore/__pycache__/waiter.cpython-36.pyc
3

�T_�0�@s�ddlZddlZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZej
e�Zdd�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZdS)�N)�get_service_module_name)�WaiterDocstring�)�WaiterError�ClientError�WaiterConfigError)�
xform_namec	Cs||j|�}t|j�}tt||��}dd�}t||jj|jj|dd�|_	t
dt|jj�|f�}t|t
fd|i�}||||�S)a

    :type waiter_name: str
    :param waiter_name: The name of the waiter.  The name should match
        the name (including the casing) of the key name in the waiter
        model file (typically this is CamelCasing).

    :type waiter_model: botocore.waiter.WaiterModel
    :param waiter_model: The model for the waiter configuration.

    :type client: botocore.client.BaseClient
    :param client: The botocore client associated with the service.

    :rtype: botocore.waiter.Waiter
    :return: The waiter object.

    c[stj|f|�dS)N)�Waiter�wait)�self�kwargs�r
�/usr/lib/python3.6/waiter.pyr
4sz'create_waiter_with_client.<locals>.waitF)�waiter_nameZ
event_emitter�
service_modelZservice_waiter_modelZinclude_signaturez%s.Waiter.%sr
)�
get_waiterr�	operation�NormalizedOperationMethod�getattrr�metaZeventsr�__doc__�strr�typer	)	rZwaiter_modelZclient�single_waiter_configZoperation_name�operation_methodr
Zwaiter_class_nameZdocumented_waiter_clsr
r
r�create_waiter_with_clients$




rc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�_client_method)rZ
client_methodr
r
r�__init__Osz"NormalizedOperationMethod.__init__cKs4y|jf|�Stk
r.}z|jSd}~XnXdS)N)rr�response)rr�er
r
r�__call__Rsz"NormalizedOperationMethod.__call__N)�__name__�
__module__�__qualname__rr r
r
r
rrNsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�WaiterModel�cCs@|d|_|jdd�}|j|�||_tt|dj���|_dS)a�

        Note that the WaiterModel takes ownership of the waiter_config.
        It may or may not mutate the waiter_config.  If this is a concern,
        it is best to make a copy of the waiter config before passing it to
        the WaiterModel.

        :type waiter_config: dict
        :param waiter_config: The loaded waiter config
            from the <service>*.waiters.json file.  This can be
            obtained from a botocore Loader object as well.

        �waiters�version�unknownN)�_waiter_config�get�_verify_supported_versionr'�list�sorted�keysZwaiter_names)rZ
waiter_configr'r
r
rr\s


zWaiterModel.__init__cCs"||jkrtd|j|fd��dS)Nz^Unsupported waiter version, supported version must be: %s, but version of waiter config is: %s)�	error_msg)�SUPPORTED_VERSIONr)rr'r
r
rr+ts

z%WaiterModel._verify_supported_versioncCs8y|j|}Wn tk
r.td|��YnXt|�S)NzWaiter does not exist: %s)r)�KeyError�
ValueError�SingleWaiterConfig)rrrr
r
rr|s
zWaiterModel.get_waiterN)r!r"r#r0rr+rr
r
r
rr$Ysr$c@s$eZdZdZdd�Zedd��ZdS)r3z�Represents the waiter configuration for a single waiter.

    A single waiter is considered the configuration for a single
    value associated with a named waiter (i.e TableExists).

    cCs6||_|jdd�|_|d|_|d|_|d|_dS)N�description�r�delayZmaxAttempts)�_configr*r4rr6�max_attempts)rrr
r
rr�s


zSingleWaiterConfig.__init__cCs.g}x$|jdD]}t|�}|j|�qW|S)N�	acceptors)r7�AcceptorConfig�append)rr9Zacceptor_config�acceptorr
r
rr9�s
zSingleWaiterConfig.acceptorsN)r!r"r#rr�propertyr9r
r
r
rr3�s
r3c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)r:cCs8|d|_|d|_|d|_|jd�|_|j�|_dS)N�state�matcher�expected�argument)r>r?r@r*rA�_create_matcher_func�matcher_func)r�configr
r
rr�s



zAcceptorConfig.__init__cCsn|jdkr|j�S|jdkr$|j�S|jdkr6|j�S|jdkrH|j�S|jdkrZ|j�Std|jd��dS)N�pathZpathAllZpathAnyZstatus�errorzUnknown acceptor: %s)r/)r?�_create_path_matcher�_create_path_all_matcher�_create_path_any_matcher�_create_status_matcher�_create_error_matcherr)rr
r
rrB�s	




z#AcceptorConfig._create_matcher_funccs$tj|j��|j���fdd�}|S)Ncsd|krdS�j|��kS)N�Error)�search)r)r@�
expressionr
r�acceptor_matches�sz=AcceptorConfig._create_path_matcher.<locals>.acceptor_matches)�jmespath�compilerAr@)rrOr
)r@rNrrG�sz#AcceptorConfig._create_path_matchercs$tj|j��|j���fdd�}|S)NcsJd|krdS�j|�}t|t�s(|r,dSx|D]}|�kr2dSq2WdS)NrLFT)rM�
isinstancer,)r�result�element)r@rNr
rrO�s

zAAcceptorConfig._create_path_all_matcher.<locals>.acceptor_matches)rPrQrAr@)rrOr
)r@rNrrH�sz'AcceptorConfig._create_path_all_matchercs$tj|j��|j���fdd�}|S)NcsJd|krdS�j|�}t|t�s(|r,dSx|D]}|�kr2dSq2WdS)NrLFT)rMrRr,)rrSrT)r@rNr
rrO�s

zAAcceptorConfig._create_path_any_matcher.<locals>.acceptor_matches)rPrQrAr@)rrOr
)r@rNrrI�sz'AcceptorConfig._create_path_any_matchercs|j��fdd�}|S)Ncs|jdi�jd�}|�kS)NZResponseMetadataZHTTPStatusCode)r*)rZstatus_code)r@r
rrO�sz?AcceptorConfig._create_status_matcher.<locals>.acceptor_matches)r@)rrOr
)r@rrJ�sz%AcceptorConfig._create_status_matchercs|j��fdd�}|S)Ncs|jdi�jdd��kS)NrLZCoder5)r*)r)r@r
rrO�sz>AcceptorConfig._create_error_matcher.<locals>.acceptor_matches)r@)rrOr
)r@rrK�sz$AcceptorConfig._create_error_matcherN)
r!r"r#rrBrGrHrIrJrKr
r
r
rr:�s
r:c@seZdZdd�Zdd�ZdS)r	cCs||_||_||_dS)a�

        :type name: string
        :param name: The name of the waiter

        :type config: botocore.waiter.SingleWaiterConfig
        :param config: The configuration for the waiter.

        :type operation_method: callable
        :param operation_method: A callable that accepts **kwargs
            and returns a response.  For example, this can be
            a method from a botocore client.

        N)�_operation_method�namerD)rrVrDrr
r
rr
szWaiter.__init__c
Ks�t|jj�}d}|jdi�}|jd|jj�}|jd|jj�}d}x�|jf|�}|d7}xB|D]}	|	j|�r\|	j	}Pq\Wd|kr�t
|j|djdd	�|d
��|dkr�tj
d�dS|d
kr�t
|jd|d
��||kr�t
|jd|d
��tj|�qBWdS)NZwaitingZWaiterConfigZDelayZMaxAttemptsrrrLZMessageZUnknown)rV�reasonZ
last_response�successz3Waiting complete, waiter matched the success state.Zfailurez+Waiter encountered a terminal failure statezMax attempts exceeded)r,rDr9�popr*r6r8rUrCr>rrV�logger�debug�timeZsleep)
rrr9Z
current_staterDZsleep_amountr8Znum_attemptsrr<r
r
rr
s@


zWaiter.waitN)r!r"r#rr
r
r
r
rr		sr	)rPZloggingr\Zbotocore.utilsrZbotocore.docs.docstringr�
exceptionsrrrr5rZ	getLoggerr!rZr�objectrr$r3r:r	r
r
r
r�<module>
s
4+k