
    @f?                     B    d dl Z d dlZdZdZdZdZ	  G d d          ZdS )    N   g      ?g?g       @c                   Z    e Zd ZdZeeeefdZd Z	d Z
ed             Zed             ZdS )ExponentialBackoffa>  An exponential backoff iterator. This can be used in a for loop to
    perform requests with exponential backoff.

    Args:
        total_attempts Optional[int]:
            The maximum amount of retries that should happen.
            The default value is 3 attempts.
        initial_wait_seconds Optional[int]:
            The amount of time to sleep in the first backoff. This parameter
            should be in seconds.
            The default value is 1 second.
        randomization_factor Optional[float]:
            The amount of jitter that should be in each backoff. For example,
            a value of 0.1 will introduce a jitter range of 10% to the
            current backoff period.
            The default value is 0.1.
        multiplier Optional[float]:
            The backoff multipler. This adjusts how much each backoff will
            increase. For example a value of 2.0 leads to a 200% backoff
            on each attempt. If the initial_wait is 1.0 it would look like
            this sequence [1.0, 2.0, 4.0, 8.0].
            The default value is 2.0.
    c                 d    || _         || _        | j        | _        || _        || _        d| _        d S Nr   )_total_attempts_initial_wait_seconds_current_wait_in_seconds_randomization_factor_multiplier_backoff_count)selftotal_attemptsinitial_wait_secondsrandomization_factor
multipliers        o/home/panchajanya/Development/work/volatility3/lib/python3.11/site-packages/google/auth/_exponential_backoff.py__init__zExponentialBackoff.__init__@   s=      .%9"(,(B%%9"%    c                 ,    d| _         | j        | _        | S r   )r   r	   r
   r   s    r   __iter__zExponentialBackoff.__iter__P   s    (,(B%r   c                    | j         | j        k    rt          | xj         dz  c_         | j        | j        z  }t          j        | j        |z
  | j        |z             }t          j        |           | xj        | j	        z  c_        | j         S )N   )
r   r   StopIterationr
   r   randomuniformtimesleepr   )r   jitter_variancejitters      r   __next__zExponentialBackoff.__next__U   s    $"666q 7$:TT)O;)O;
 

 	
6%%)99%%""r   c                     | j         S )z7The total amount of backoff attempts that will be made.)r   r   s    r   r   z!ExponentialBackoff.total_attemptse   s     ##r   c                     | j         S )z;The current amount of backoff attempts that have been made.)r   r   s    r   backoff_countz ExponentialBackoff.backoff_countj   s     ""r   N)__name__
__module____qualname____doc___DEFAULT_RETRY_TOTAL_ATTEMPTS!_DEFAULT_INITIAL_INTERVAL_SECONDS_DEFAULT_RANDOMIZATION_FACTOR_DEFAULT_MULTIPLIERr   r   r"   propertyr   r%    r   r   r   r   '   s         4 5>:&          
# # #  $ $ X$ # # X# # #r   r   )r   r   r*   r+   r,   r-   r   r/   r   r   <module>r0      sz      !"  %( ! !$   F# F# F# F# F# F# F# F# F# F#r   