o
    Rh\	                     @   s   d dl Z d dlmZmZmZmZmZmZ 			ddededee deeedf fd	d
Z	ddee
 dee
ddf fddZ	ddee
ee f deeddf fddZdeegef deeddf f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 r|V  |d7 }n|V  q)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   Tr	    )r
   r   r   nar   r   S/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/backoff/_wait_gen.pyexpo   s   
r   c                 c   s@    dV  d}d}	 | du s|| k r|V  ||| }}n| V  q	)zGenerator 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   intervalc                 c   sF    dV  zt | }W n ty   t| }Y nw |D ]}|V  qd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   valuec                 c   s    dV }	 | |V }q)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   
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>   s4    
"
