a
    ù!f\	  ã                   @   s¼   d dl Z d dlmZmZmZmZmZmZ deeee eeedf dœdd„Z	dee
 ee
ddf dœd	d
„Zdee
ee f eeddf dœdd„Zeegef eeddf dœdd„ZdS )é    N)ÚAnyÚCallableÚ	GeneratorÚIterableÚOptionalÚUnioné   é   )ÚbaseÚfactorÚ	max_valueÚreturnc                 c   sB   dV  d}|| |  }|du s&||k r6|V  |d7 }q
|V  q
dS )ak  Generator for exponential decay.

    Args:
        base: The mathematical base of the exponentiation operation
        factor: Factor to multiply the exponentiation by.
        max_value: The maximum value to yield. Once the value in the
             true exponential sequence exceeds this, the value
             of max_value will forever after be yielded.
    Nr   r	   © )r
   r   r   ÚnÚar   r   úR/var/www/html/python-backend/venv/lib/python3.9/site-packages/backoff/_wait_gen.pyÚexpo   s    
r   )r   r   c                 c   s@   dV  d}d}| du s|| k r4|V  |||  }}q| V  qdS )zëGenerator for fibonaccial decay.

    Args:
        max_value: The maximum value to yield. Once the value in the
             true fibonacci sequence exceeds this, the value
             of max_value will forever after be yielded.
    Nr	   r   )r   r   Úbr   r   r   Úfibo"   s    	r   )Úintervalr   c                 c   sD   dV  zt | ƒ}W n ty.   t | ¡}Y n0 |D ]
}|V  q4dS )z|Generator for constant intervals.

    Args:
        interval: A constant value to yield or an iterable of such values.
    N)ÚiterÚ	TypeErrorÚ	itertoolsÚrepeat)r   ÚitrÚvalr   r   r   Úconstant7   s    	r   )Úvaluer   c                 c   s   dV }| |ƒV }qdS )a  Generator that is based on parsing the return value or thrown
        exception of the decorated method

    Args:
        value: a callable which takes as input the decorated
            function's return value or thrown exception and
            determines how long to wait
    Nr   )r   Z
ret_or_excr   r   r   ÚruntimeK   s    r   )r   r	   N)N)r	   )r   Útypingr   r   r   r   r   r   Úfloatr   Úintr   r   r   r   r   r   r   Ú<module>   s&       ýü  ÿþý