o
    .&ßaü  ã                   @   s.   d dl mZ edg d¢ƒZG dd„ deƒ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   ú=/usr/lib/python3/dist-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   r   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   Úobjectr   r   r   r   r   Ú<module>   s    