HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/botocore/__pycache__/waiter.cpython-37.pyc
B

�P�e�7�@s�ddlZddlZddlZddlmZddlmZddlmZddl	m
Z
mZmZe�
e�Zdd�Zd	d
�ZGdd�d�ZGd
d�d�ZGdd�d�ZGdd�d�ZGdd�d�ZdS)�N)�WaiterDocstring)�get_service_module_name�)�
xform_name)�ClientError�WaiterConfigError�WaiterErrorc	Cs||�|�}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
�@/opt/alt/python37/lib/python3.7/site-packages/botocore/waiter.pyr
6sz'create_waiter_with_client.<locals>.waitF)�waiter_nameZ
event_emitter�
service_modelZservice_waiter_modelZinclude_signaturez%s.Waiter.%sr
)�
get_waiterr�	operation�NormalizedOperationMethod�getattrr�meta�eventsr�__doc__�strr�typer	)	rZwaiter_model�client�single_waiter_configZoperation_name�operation_methodr
Zwaiter_class_nameZdocumented_waiter_clsr
r
r�create_waiter_with_clients"


rcCs$|�d�}t|t�r d|kr dSdS)N�Error�CodeTF)�get�
isinstance�dict)�response�errorr
r
r�is_valid_waiter_errorPs
r%c@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�_client_method)rZ
client_methodr
r
r�__init__Xsz"NormalizedOperationMethod.__init__c
Ks6y|jf|�Stk
r0}z|jSd}~XYnXdS)N)r&rr#)rr�er
r
r�__call__[sz"NormalizedOperationMethod.__call__N)�__name__�
__module__�__qualname__r'r)r
r
r
rrWsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�WaiterModel�cCs@|d|_|�dd�}|�|�||_tt|d����|_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_configr �_verify_supported_versionr0�list�sorted�keysZwaiter_names)rZ
waiter_configr0r
r
rr'es


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)rr0r
r
rr3}s
z%WaiterModel._verify_supported_versioncCs8y|j|}Wn tk
r.td|��YnXt|�S)NzWaiter does not exist: %s)r2�KeyError�
ValueError�SingleWaiterConfig)rrrr
r
rr�s
zWaiterModel.get_waiterN)r*r+r,r8r'r3rr
r
r
rr-bs
r-c@s$eZdZdZdd�Zedd��ZdS)r;z�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||_|�dd�|_|d|_|d|_|d|_dS)N�description�r�delayZmaxAttempts)�_configr r<rr>�max_attempts)rrr
r
rr'�s


zSingleWaiterConfig.__init__cCs.g}x$|jdD]}t|�}|�|�qW|S)N�	acceptors)r?�AcceptorConfig�append)rrAZacceptor_config�acceptorr
r
rrA�s
zSingleWaiterConfig.acceptorsN)r*r+r,rr'�propertyrAr
r
r
rr;�s
r;c@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rBcCs8|d|_|d|_|d|_|�d�|_|��|_dS)N�state�matcher�expected�argument)rFrGrHr rI�_create_matcher_func�matcher_func)r�configr
r
rr'�s



zAcceptorConfig.__init__cCs�|jdkrd�|j|j�S|jdkr4d|j|jfS|jdkrNd|j|jfS|jdkrbd|jS|jd	krvd
|jSd|jSdS)N�pathz2For expression "{}" we matched expected path: "{}"�pathAllz;For expression "%s" all members matched excepted path: "%s"�pathAnyz@For expression "%s" we matched expected path: "%s" at least once�statusz%Matched expected HTTP status code: %sr$z'Matched expected service error code: %sz,No explanation for unknown waiter type: "%s")rG�formatrIrH)rr
r
r�explanation�s






zAcceptorConfig.explanationcCsn|jdkr|��S|jdkr$|��S|jdkr6|��S|jdkrH|��S|jdkrZ|��Std|jd��dS)NrMrNrOrPr$zUnknown acceptor: %s)r7)rG�_create_path_matcher�_create_path_all_matcher�_create_path_any_matcher�_create_status_matcher�_create_error_matcherr)rr
r
rrJ�s	




z#AcceptorConfig._create_matcher_funccs$t�|j��|j���fdd�}|S)Ncst|�rdS��|��kS)N)r%�search)r#)rH�
expressionr
r�acceptor_matches�sz=AcceptorConfig._create_path_matcher.<locals>.acceptor_matches)�jmespath�compilerIrH)rrZr
)rHrYrrS�sz#AcceptorConfig._create_path_matchercs$t�|j��|j���fdd�}|S)NcsFt|�rdS��|�}t|t�r$|s(dSx|D]}|�kr.dSq.WdS)NFT)r%rXr!r4)r#�result�element)rHrYr
rrZ�s

zAAcceptorConfig._create_path_all_matcher.<locals>.acceptor_matches)r[r\rIrH)rrZr
)rHrYrrT�sz'AcceptorConfig._create_path_all_matchercs$t�|j��|j���fdd�}|S)NcsFt|�rdS��|�}t|t�r$|s(dSx|D]}|�kr.dSq.WdS)NFT)r%rXr!r4)r#r]r^)rHrYr
rrZs

zAAcceptorConfig._create_path_any_matcher.<locals>.acceptor_matches)r[r\rIrH)rrZr
)rHrYrrUsz'AcceptorConfig._create_path_any_matchercs|j��fdd�}|S)Ncs|�di��d�}|�kS)NZResponseMetadataZHTTPStatusCode)r )r#�status_code)rHr
rrZsz?AcceptorConfig._create_status_matcher.<locals>.acceptor_matches)rH)rrZr
)rHrrVs	z%AcceptorConfig._create_status_matchercs|j��fdd�}|S)Ncs|�di��dd��kS)Nrrr=)r )r#)rHr
rrZ*sz>AcceptorConfig._create_error_matcher.<locals>.acceptor_matches)rH)rrZr
)rHrrW's	z$AcceptorConfig._create_error_matcherN)r*r+r,r'rErRrJrSrTrUrVrWr
r
r
rrB�srBc@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�namerL)rrarLrr
r
rr'7szWaiter.__init__cKs4t|jj�}d}|�di�}|�d|jj�}|�d|jj�}d}d}x�|jf|�}	|d7}xZ|D]}
|
�|	�r`|
}|
j	}Pq`Wt
|	�r�t|jd|	d�d	d
�|	d�dd
�f|	d��|d
kr�t
�d�dS|dkr�d|
j}t|j||	d��||k�r"|dk�rd}n
d|
j}t|j||	d��t�|�qFWdS)NZwaitingZWaiterConfigZDelayZMaxAttemptsrrzAn error occurred (%s): %srr�Unknown�Message)ra�reasonZ
last_response�successz3Waiting complete, waiter matched the success state.Zfailurez/Waiter encountered a terminal failure state: %szMax attempts exceededz4Max attempts exceeded. Previously accepted state: %s)r4rLrA�popr r>r@r`rKrFr%rra�logger�debugrR�time�sleep)rrrAZ
current_staterLZsleep_amountr@Zlast_matched_acceptorZnum_attemptsr#rDrdr
r
rr
LsV



zWaiter.waitN)r*r+r,r'r
r
r
r
rr	6sr	)�loggingrir[Zbotocore.docs.docstringrZbotocore.utilsrr=r�
exceptionsrrr�	getLoggerr*rgrr%rr-r;rBr	r
r
r
r�<module>
s
5-