Current File : //proc/self/root/lib/python3/dist-packages/botocore/__pycache__/retryhandler.cpython-312.pyc |
�
P��el9 � �Z � d dl Z d dlZd dlZd dlmZ d dlmZmZmZm Z m
Z
ej e� Z
deee
e giZd� Zd� Zdd�Zdd�Zdd �Zd
� Zd� Zd� Z G d
� d� Z G d� d� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Zy)� N)�crc32)�
ChecksumError�ConnectionClosedError�ConnectionError�EndpointConnectionError�ReadTimeoutError�GENERAL_CONNECTION_ERRORc �v � | dk( rt j � } n| dk rt d| � �� �| ||dz
z z }|S )a1 Calculate 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.
�randr z.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 �: � t j t | |�� 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.
�r r )� functools�partialr r s r �!create_exponential_delay_functionr B s � � �����M�� r c �P � t | |�� }t | |�� }t ||�� S )N)�operation_name)�checker�action)� create_checker_from_retry_config�create_retry_action_from_config�RetryHandler)�configr r r s r �create_retry_handlerr# N s1 � �.��~��G� -��~��F� ���7�7r c �J � | d d }|d dk( rt |d |d �� S y )N�__default__�delay�type�exponentialr r r )r )r"