
    ɯei                        d dl mZ d dlZd dlmZmZ 	 dZdZdZdZ	eeee	f	 	 	 	 	 	 	 	 	 ddZ
eeee	f	 	 	 	 	 	 	 	 	 dd	Zeeee	f	 	 	 	 	 	 	 	 	 dd
Zy)    )annotationsN)CallableIterator         Tc                      fd}|S )a7  Randomly chooses between exponential and constant backoff. Uses equal jitter.

    Args:
        factor (int): Exponential base for the exponential term.
        base (int): Initial backoff time in seconds. Constant coefficient for the exponential term.
        cap (int): Maximum backoff time in seconds.
        enable_jitter (int): Whether to enable equal jitter on computed durations. For details see
            https://www.awsarchitectureblog.com/2015/03/backoff.html

    Returns:
        Callable: generator function implementing the mixed backoff policy
    c               3     K   d} }| 	 | dz  } t        j                  ddg      }rd|z  |z  nd}t        t        j                  ||z   | z  z  |z   g            }t        |      }| ew)Nr   r   g      ?)randomchoiceintmin)cntsleepmult_factorjitter_amountbasecapenable_jitterfactors       f/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/snowflake/connector/backoff_policies.py	generatorz mixed_backoff.<locals>.generator7   s     1HC !--Q0K9FC%K+5AM]*D63;,>,NOE
 UOEK s   A/A2 r   r   r   r   r   s   ```` r   mixed_backoffr   $   s    &(     c                      fd}|S )a  Standard linear backoff. Uses full jitter.

    Args:
        factor (int): Linear increment every iteration.
        base (int): Initial backoff time in seconds.
        cap (int): Maximum backoff time in seconds.
        enable_jitter (int): Whether to enable full jitter on computed durations. For details see
            https://www.awsarchitectureblog.com/2015/03/backoff.html

    Returns:
        Callable: generator function implementing the linear backoff policy
    c               3  v   K   } |  	 | z  } t        |       } rt        j                  d|       n|  .wNr   r   r   randintr   r   r   r   r   s    r   r   z!linear_backoff.<locals>.generatora   D     VOEUOE /<&..E*F    69r   r   s   ```` r   linear_backoffr&   N       &	G r   c                      fd}|S )a  Standard exponential backoff. Uses full jitter.

    Args:
        factor (int): Exponential base for the exponential term.
        base (int): Initial backoff time in seconds. Constant coefficient for the exponential term.
        cap (int): Maximum backoff time in seconds.
        enable_jitter (int): Whether to enable full jitter on computed durations. For details see
            https://www.awsarchitectureblog.com/2015/03/backoff.html

    Returns:
        Callable: generator function implementing the exponential backoff policy
    c               3  v   K   } |  	 | z  } t        |       } rt        j                  d|       n|  .wr    r!   r#   s    r   r   z&exponential_backoff.<locals>.generator   r$   r%   r   r   s   ```` r   exponential_backoffr*   o   r'   r   )
r   r   r   r   r   r   r   boolreturnzCallable[..., Iterator[int]])
__future__r   r   typingr   r   DEFAULT_BACKOFF_FACTORDEFAULT_BACKOFF_BASEDEFAULT_BACKOFF_CAPDEFAULT_ENABLE_JITTERr   r&   r*   r   r   r   <module>r3      s    "  %0      )$"/	''
' 
' 	'
 "'V )$"/	
 
 	
 "D )$"/	
 
 	
 "r   