HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/botocore/__pycache__/retryhandler.cpython-312.pyc
�

P��el9��Z�ddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
eje�Z
deee
e	giZd�Zd�Zdd�Zdd�Zdd	�Zd
�Zd�Zd�ZGd
�d�ZGd�d�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zy)�N)�crc32)�
ChecksumError�ConnectionClosedError�ConnectionError�EndpointConnectionError�ReadTimeoutError�GENERAL_CONNECTION_ERRORc�v�|dk(rtj�}n|dkrtd|����|||dz
zz}|S)a1Calculate time to sleep based on exponential function.

    The format is::

        base * growth_factor ^ (attempts - 1)

    If ``base`` is set to 'rand' then a random number between
    0 and 1 will be used as the base.
    Base must be greater than 0, otherwise a ValueError will be
    raised.

    �randrz.The 'base' param must be greater than 0, got: �)�random�
ValueError)�base�
growth_factor�attempts�
time_to_sleeps    �7/usr/lib/python3/dist-packages/botocore/retryhandler.py�delay_exponentialr+sO���v�~��}�}���	
����<�T�F�C�
�	
��M�h��l�;�<�M���c�:�tjt||��S)z�Create an exponential delay function based on the attempts.

    This is used so that you only have to pass it the attempts
    parameter to calculate the delay.

    �rr)�	functools�partialrrs  r�!create_exponential_delay_functionrBs�������M��rc�P�t||��}t||��}t||��S)N)�operation_name)�checker�action)� create_checker_from_retry_config�create_retry_action_from_config�RetryHandler)�configrrrs    r�create_retry_handlerr#Ns1��.��~��G�-��~��F����7�7rc�J�|dd}|ddk(rt|d|d��Sy)N�__default__�delay�type�exponentialrrr)r)r"r�delay_configs   rr r XsB��
�-�(��1�L��F��}�,�0��f�%�&��7�
�	
�-rc��g}d}g}d|vrb|djdg�}|dd}|D]@}||}|jt|��t|�}|��0|j	|��B|�_|j|��N||d}	|	D]A}|jt|	|��t|	|�}|��1|j	|��Ct|�dk(rt
|d|��St|�}
t
|
|t|���S)Nr%�policies�max_attemptsrr)r,)r,�retryable_exceptions)	�get�append�_create_single_checker�_extract_retryable_exception�extend�len�MaxAttemptsDecorator�MultiChecker�tuple)r"r�checkersr,r-r+�key�current_config�retry_exception�operation_policies�
multi_checkers           rrresB���H��L�������-�(�,�,�Z��<���m�,�^�<���	=�C�%�c�]�N��O�O�2�>�B�C�:�>�J�O��*�$�+�+�O�<�	=��!�f�j�j��&@�&L�#�N�3�J�?��%�	=�C��O�O�2�3E�c�3J�K�L�:�"�3�'��O��*�$�+�+�O�<�
	=��8�}���#�H�Q�K�l�K�K�$�X�.�
�#��%�!&�';�!<�
�	
rc�V�d|dvrt|dd�Sd|dvr
t�Sy)N�response�applies_when�
socket_errors)�_create_single_response_checker�ExceptionRaiser)r"s rr0r0�sF���V�N�+�+�.��>�"�:�.�
�	
�
�F�>�2�	2�� � �
3rc��d|vrt|d|d��}|Sd|vrt|d��}|Sd|vrt|d��}|Std��)N�service_error_code�http_status_code)�status_code�
error_code)rF�	crc32body)�headerzUnknown retry policy)�ServiceErrorCodeChecker�HTTPStatusCodeChecker�CRC32Checkerr)r>rs  rrArA�s���x�'�)� �!3�4�� 4�5�
���N�
�x�	'�'� �!3�4�
���N�
��	 ��h�{�&;�<���N��/�0�0rc��|d}d|jdi�vrtgSd|vr&g}|dD]}|jt|��|Sy)Nr?rHr>r@)r.rr2�
EXCEPTION_MAP)r"r?�
exceptions�names    rr1r1�sh���.�)�L��l�&�&�z�2�6�6����	�L�	(��
� ��1�	3�D����m�D�1�2�	3���	
)rc��eZdZdZd�Zd�Zy)r!a�Retry handler.

    The retry handler takes two params, ``checker`` object
    and an ``action`` object.

    The ``checker`` object must be a callable object and based on a response
    and an attempt number, determines whether or not sufficient criteria for
    a retry has been met.  If this is the case then the ``action`` object
    (which also is a callable) determines what needs to happen in the event
    of a retry.

    c� �||_||_y�N)�_checker�_action)�selfrrs   r�__init__zRetryHandler.__init__�s����
���rc�:�|||d�}t|jt�r*|ddjd�}|j	d|i�|jd
i|��r*|j|��}tjd|�|Stjd�y	)z�Handler for a retry.

        Intended to be hooked up to an event handler (hence the **kwargs),
        this will process retries appropriately.

        )�attempt_numberr>�caught_exception�request_dict�context�retries�retries_context)rzRetry needed, action of: %szNo retry needed.N�)�
isinstancerTr4r.�updaterU�logger�debug)rVrr>rZ�kwargs�checker_kwargsr^�results        r�__call__zRetryHandler.__call__�s���'� � 0�
��
�d�m�m�%9�:�$�^�4�Y�?�C�C�I�N�O��!�!�#4�o�"F�G��4�=�=�*�>�*��\�\�8�\�4�F��L�L�6��?��M����'�(rN)�__name__�
__module__�__qualname__�__doc__rWrgr_rrr!r!�s����)rr!c�"�eZdZdZd�Zd�Zd�Zy)�BaseCheckerz�Base class for retry checkers.

    Each class is responsible for checking a single criteria that determines
    whether or not a retry should not happen.

    c�h�|�|j||�S|�|j||�Std��)a�Determine if retry criteria matches.

        Note that either ``response`` is not None and ``caught_exception`` is
        None or ``response`` is None and ``caught_exception`` is not None.

        :type attempt_number: int
        :param attempt_number: The total number of times we've attempted
            to send the request.

        :param response: The HTTP response (if one was received).

        :type caught_exception: Exception
        :param caught_exception: Any exception that was caught while trying to
            send the HTTP response.

        :return: True, if the retry criteria matches (and therefore a retry
            should occur.  False if the criteria does not match.

        z,Both response and caught_exception are None.)�_check_response�_check_caught_exceptionr)rVrYr>rZs    rrgzBaseChecker.__call__�sJ��,���'�'���A�A�
�
)��/�/�� 0��
��K�L�Lrc��yrSr_�rVrYr>s   rrozBaseChecker._check_response����rc��yrSr_�rVrYrZs   rrpz#BaseChecker._check_caught_exceptionrsrN)rhrirjrkrgrorpr_rrrmrm�s���M�>
�
rrmc�$�eZdZdZdd�Zd�Zd�Zy)r4a�Allow retries up to a maximum number of attempts.

    This will pass through calls to the decorated retry checker, provided
    that the number of attempts does not exceed max_attempts.  It will
    also catch any retryable_exceptions passed in.  Once max_attempts has
    been exceeded, then False will be returned or the retryable_exceptions
    that was previously being caught will be raised.

    Nc�.�||_||_||_yrS)rT�
_max_attempts�_retryable_exceptions)rVrr,r-s    rrWzMaxAttemptsDecorator.__init__s����
�)���%9��"rc��|r)t|jdd�|j�|d<|j|||�}|r<||jk\r+|�d|dvrd|ddd<tjd|�y|Sy)	N�maxr�ResponseMetadatarT�MaxAttemptsReachedz0Reached the maximum number of retry attempts: %sF)r{r.rx�
_should_retryrbrc)rVrYr>rZr^�should_retrys      rrgzMaxAttemptsDecorator.__call__s����%(��#�#�E�1�-�t�/A�/A�&�O�E�"��)�)��H�&6�
�����!3�!3�3��'�,>�(�1�+�,M���Q�K� 2�3�,�����F�"���#�#�rc���|jr#||jkr	|j|||�S|j|||�S#|j$r"}tj	d|d��Yd}~yd}~wwxYw)Nz,retry needed, retryable exception caught: %sT)�exc_info)ryrxrTrbrc)rVrYr>rZ�es     rr~z"MaxAttemptsDecorator._should_retry0s����%�%�.�4�;M�;M�*M�

��}�}�"�H�.>����=�=���;K�L�L���-�-�
����B��!���
��

�s�A�A4�A/�/A4rS)rhrirjrkrWrgr~r_rrr4r4s���:�
�8Mrr4c��eZdZd�Zd�Zy)rKc��||_yrS)�_status_code)rVrFs  rrWzHTTPStatusCodeChecker.__init__Ds
��'��rc�~�|dj|jk(r!tjd|j�yy)Nrz5retry needed: retryable HTTP status code received: %sTF)rFr�rbrcrrs   rroz%HTTPStatusCodeChecker._check_responseGs:���A�;�"�"�d�&7�&7�7��L�L�G��!�!�
��rN�rhrirjrWror_rrrKrKCs��(�rrKc��eZdZd�Zd�Zy)rJc� �||_||_yrS)r��_error_code)rVrFrGs   rrWz ServiceErrorCodeChecker.__init__Ss��'���%��rc��|dj|jk(r_|djdi�jd�}||jk(r,tjd|j|j�yy)Nrr�Error�Codez>retry needed: matching HTTP status and error code seen: %s, %sTF)rFr�r.r�rbrc)rVrYr>�actual_error_codes    rroz'ServiceErrorCodeChecker._check_responseWss���A�;�"�"�d�&7�&7�7� (������� <� @� @�� H�� �D�$4�$4�4������%�%��$�$�	��rNr�r_rrrJrJRs��&�rrJc��eZdZd�Zd�Zy)r5c��||_yrS��	_checkers)rVr7s  rrWzMultiChecker.__init__fs	��!��rc�F�|jD]}||||�}|s�|cSy)NFr�)rVrYr>rZr�checker_responses      rrgzMultiChecker.__call__is8���~�~�	(�G�&���*:� �� �'�'�	(�rN)rhrirjrWrgr_rrr5r5es��"�rr5c��eZdZd�Zd�Zy)rLc��||_yrS)�_header_name)rVrIs  rrWzCRC32Checker.__init__ts
��"��rc�^�|d}|jj|j�}|�!tj	d|j�yt|dj�dz}|t|�k(s7tj	dt|�|�tdt|�|���y)Nrz?crc32 check skipped, the %s header is not in the http response.l��z>retry needed: crc32 check failed, expected != actual: %s != %sr)�
checksum_type�expected_checksum�actual_checksum)	�headersr.r�rbrcr�content�intr)rVrYr>�
http_response�expected_crc�actual_crc32s      rrozCRC32Checker._check_responsexs��� ���
�$�,�,�0�0��1B�1B�C�����L�L�(��!�!�
�!��!��!4�!4�5�
�B�L��3�|�#4�4�������%� �	�$�")�&)�,�&7�$0���5rNr�r_rrrLrLss��#�rrLc��eZdZdZd�Zy)rBz`Raise any caught exceptions.

    This class will raise any non None ``caught_exception``.

    c��|�rSr_rus   rrpz'ExceptionRaiser._check_caught_exception�s
���rN)rhrirjrkrpr_rrrBrB�s���rrBrS)r�loggingr
�binasciir�botocore.exceptionsrrrrr�	getLoggerrhrbrNrrr#r rr0rAr1r!rmr4rKrJr5rLrBr_rr�<module>r�s�����
����
��	�	�8�	$�������	!��
��.	�8�

�
�D!��$�&)�&)�R+
�+
�\<M�;�<M�~�K���k��&�;���;��<�k�r