o
    Vf                     @   s,   d dl mZ edg dZG dd dZdS )    )
namedtupleCubicParamsw_maxk	last_failc                   @   sB   e Zd ZdZdZeefddZdd Zdd Zd	d
 Zdd Z	dS )CubicCalculatorg?gffffff?c                 C   s&   || _ || _|| _|  | _|| _d S N)_w_max_scale_constant_beta_calculate_zero_point_k
_last_fail)selfstarting_max_rate
start_timescale_constantbeta r   \/home/ubuntu/oakencloud.com/venv/lib/python3.10/site-packages/botocore/retries/throttling.py__init__
   s
   

zCubicCalculator.__init__c                 C   s"   | j d| j  | j }|d }|S )N   gUUUUUU?)r
   r   r   )r   scaled_valuer   r   r   r   r      s   z%CubicCalculator._calculate_zero_pointc                 C   s(   || j  }| j|| j d  | j }|S )N   )r   r   r   r
   )r   	timestampdtnew_rater   r   r   success_received   s   
z CubicCalculator.success_receivedc                 C   s    || _ |  | _|| _|| j S r	   )r
   r   r   r   r   )r   current_rater   r   r   r   error_received!   s   

zCubicCalculator.error_receivedc                 C   s   t | j| j| jdS )aX  Return a read-only object of the current cubic parameters.

        These parameters are intended to be used for debug/troubleshooting
        purposes.  These object is a read-only snapshot and cannot be used
        to modify the behavior of the CUBIC calculations.

        New parameters may be added to this object in the future.

        r   )r   r
   r   r   )r   r   r   r   get_params_snapshot+   s   
z#CubicCalculator.get_params_snapshotN)
__name__
__module____qualname___SCALE_CONSTANT_BETAr   r   r   r    r!   r   r   r   r   r      s    

r   N)collectionsr   r   r   r   r   r   r   <module>   s    