HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/botocore/__pycache__/waiter.cpython-310.pyc
o

�h�8�@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
t|jj��d|���}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|fi|��dS�N)�Waiter�wait)�self�kwargs�r�E/usr/local/CyberPanel/lib/python3.10/site-packages/botocore/waiter.pyr6sz'create_waiter_with_client.<locals>.waitF)�waiter_name�
event_emitter�
service_model�service_waiter_model�include_signaturez.Waiter.r)�
get_waiterr�	operation�NormalizedOperationMethod�getattrr�meta�eventsr�__doc__�strr�typer
)	r�waiter_model�client�single_waiter_config�operation_name�operation_methodr�waiter_class_name�documented_waiter_clsrrr�create_waiter_with_clients(

��	��r%cCs$|�d�}t|t�rd|vrdSdS)N�Error�CodeTF)�get�
isinstance�dict)�response�errorrrr�is_valid_waiter_errorOs
r-c@�eZdZdd�Zdd�ZdS)rcCs
||_dSr	)�_client_method)r�
client_methodrrr�__init__Ws
z"NormalizedOperationMethod.__init__c
Ks>z	|jdi|��WSty}z	|jWYd}~Sd}~ww)Nr)r/rr+)rr
�errr�__call__Zs��z"NormalizedOperationMethod.__call__N)�__name__�
__module__�__qualname__r1r3rrrrrVsrc@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_versionr:�list�sorted�keys�waiter_names)r�
waiter_configr:rrrr1ds


zWaiterModel.__init__cCs&||jkrtd|j�d|��d��dS)Nz7Unsupported waiter version, supported version must be: z#, but version of waiter config is: ��	error_msg)�SUPPORTED_VERSIONr)rr:rrrr=|s
����z%WaiterModel._verify_supported_versioncCs2z
|j|}Wt|�Stytd|����w)NzWaiter does not exist: )r<�KeyError�
ValueError�SingleWaiterConfig)rrr rrrr�s��zWaiterModel.get_waiterN)r4r5r6rEr1r=rrrrrr7as

r7c@s$eZdZdZdd�Zedd��ZdS)rHz�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�delay�maxAttempts)�_configr(rIrrK�max_attempts)rr rrrr1�s


zSingleWaiterConfig.__init__cCs*g}|jdD]}t|�}|�|�q|S)N�	acceptors)rM�AcceptorConfig�append)rrO�acceptor_config�acceptorrrrrO�s
zSingleWaiterConfig.acceptorsN)r4r5r6rr1�propertyrOrrrrrH�s

rHc@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rPcCs8|d|_|d|_|d|_|�d�|_|��|_dS)N�state�matcher�expected�argument)rUrVrWr(rX�_create_matcher_func�matcher_func)r�configrrrr1�s



zAcceptorConfig.__init__cCs�|jdkrd|j�d|j�d�S|jdkr d|j�d|j�d�S|jdkr0d|j�d|j�d�S|jd	kr;d
|j��S|jdkrFd|j��Sd
|j�d�S)N�pathzFor expression "z" we matched expected path: "�"�pathAllz&" all members matched expected path: "�pathAnyz" at least once�statusz#Matched expected HTTP status code: r,z%Matched expected service error code: z)No explanation for unknown waiter type: ")rVrXrW�rrrr�explanation�s"


��

��

zAcceptorConfig.explanationcCsl|jdkr	|��S|jdkr|��S|jdkr|��S|jdkr$|��S|jdkr-|��Std|j��d��)Nr\r^r_r`r,zUnknown acceptor: rC)rV�_create_path_matcher�_create_path_all_matcher�_create_path_any_matcher�_create_status_matcher�_create_error_matcherrrarrrrY�s
	




�z#AcceptorConfig._create_matcher_funcc�$t�|j��|j���fdd�}|S)Ncst|�rdS��|��kSr	)r-�search�r+�rW�
expressionrr�acceptor_matches�sz=AcceptorConfig._create_path_matcher.<locals>.acceptor_matches��jmespath�compilerXrW�rrmrrkrrc�sz#AcceptorConfig._create_path_matchercrh)NcsDt|�rdS��|�}t|t�r|sdS|D]	}|�krdSqdS�NFT�r-rir)r>�r+�result�elementrkrrrm��
�zAAcceptorConfig._create_path_all_matcher.<locals>.acceptor_matchesrnrqrrkrrd��z'AcceptorConfig._create_path_all_matchercrh)NcsDt|�rdS��|�}t|t�r|sdS|D]	}|�krdSqdSrrrsrtrkrrrmrwzAAcceptorConfig._create_path_any_matcher.<locals>.acceptor_matchesrnrqrrkrre�rxz'AcceptorConfig._create_path_any_matcherc�|j��fdd�}|S)Ncs|�di��d�}|�kS)N�ResponseMetadata�HTTPStatusCode�r()r+�status_code�rWrrrms�z?AcceptorConfig._create_status_matcher.<locals>.acceptor_matchesr~rqrr~rrfs	z%AcceptorConfig._create_status_matchercry)NcsD�durd|vo
d|dvS�durd|vS|�di��dd��kS)NTr&r'FrJr|rjr~rrrm$s

z>AcceptorConfig._create_error_matcher.<locals>.acceptor_matchesr~rqrr~rrg!sz$AcceptorConfig._create_error_matcherN)r4r5r6r1rTrbrYrcrdrerfrgrrrrrP�s
rPc@r.)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�namer[)rr�r[r"rrrr19s
zWaiter.__init__c	Ks0t|jj�}d}|�di�}|�d|jj�}|�d|jj�}d}d}	|jdi|��}	|d7}|D]}
|
�|	�r?|
}|
j	}nq1t
|	�r\t|jd�
|	d	�d
d�|	d	�dd��|	d
��|dkrgt�d�dS|dkryd|
j��}t|j||	d
��||kr�|dur�d}nd|
j��}t|j||	d
��t�|�q#)N�waiting�WaiterConfig�Delay�MaxAttemptsrTrzAn error occurred ({}): {}r&r'�Unknown�Message)r��reason�
last_response�successz3Waiting complete, waiter matched the success state.�failurez-Waiter encountered a terminal failure state: zMax attempts exceededz2Max attempts exceeded. Previously accepted state: r)r>r[rO�popr(rKrNrrZrUr-rr��format�logger�debugrb�time�sleep)rr
rO�
current_stater[�sleep_amountrN�last_matched_acceptor�num_attemptsr+rSr�rrrrNsf
��������
�zWaiter.waitN)r4r5r6r1rrrrrr
8sr
)�loggingr�ro�botocore.docs.docstringr�botocore.utilsrrJr�
exceptionsrrr�	getLoggerr4r�r%r-rr7rHrPr
rrrr�<module>s 
4-