HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-310.pyc
o

@%Ne#�@s�ddlZddlZddlZddlmZejrddlmZGdd�dej�ZGdd�de�Z	Gdd	�d	e	�Z
Gd
d�de�ZGdd
�d
e�ZGdd�de�Z
Gdd�de�ZGdd�de�ZGdd�de�ZdS)�N)�_utils)�RetryCallStatec@sJeZdZdZejdddefdd��Zdd	d
�Zddde	j
dfdd
�ZdS)�	wait_basez(Abstract base class for wait strategies.�retry_stater�returncCsdS�N���selfrrr�;/usr/lib/python3/dist-packages/pip/_vendor/tenacity/wait.py�__call__szwait_base.__call__�other�wait_combinecCs
t||�Sr)r�r
r
rrr�__add__"�
zwait_base.__add__)rrcCs|dkr|S|�|�S�Nr)rrrrr�__radd__%s
zwait_base.__radd__N)r
rrr)�__name__�
__module__�__qualname__�__doc__�abc�abstractmethod�floatrr�typing�Unionrrrrrrs
rc@s4eZdZdZdeddfdd�Zdddefd	d
�ZdS)�
wait_fixedzCWait strategy that waits a fixed amount of time between each retry.�waitrNcC�
||_dSr�r)r
rrrr�__init__/rzwait_fixed.__init__rrcCs|jSrr r	rrrr2szwait_fixed.__call__)rrrrrr!rrrrrr,�rcs"eZdZdZd�fdd�Z�ZS)�	wait_nonez7Wait strategy that doesn't wait at all before retrying.rNcst��d�dSr)�superr!)r
��	__class__rrr!9szwait_none.__init__)rN)rrrrr!�
__classcell__rrr%rr#6sr#c@sNeZdZdZddejeefdejeefddfdd	�Zd
ddefdd
�Z	dS)�wait_randomzAWait strategy that waits a random amount of time between min/max.r��min�maxrNcCs||_||_dSr)�wait_random_min�wait_random_max)r
r*r+rrrr!@s
zwait_random.__init__rrcCs|jt��|j|jSr)r,�randomr-r	rrrrDszwait_random.__call__)rr))
rrrrrr�intrr!rrrrrr(=s,r(c@�4eZdZdZdeddfdd�Zdddefd	d
�ZdS)rz#Combine several waiting strategies.�
strategiesrNcGrr)�
wait_funcs�r
r1rrrr!Krzwait_combine.__init__rrcst�fdd�|jD��S)Nc3s�|]}|�d�VqdS)�rNr)�.0�xr4rr�	<genexpr>Os�z(wait_combine.__call__.<locals>.<genexpr>)�sumr2r	rr4rrNszwait_combine.__call__�rrrrrr!rrrrrrrHr"rc@r0)�
wait_chaina�Chain two or more waiting strategies.

    If all strategies are exhausted, the very last strategy is used
    thereafter.

    For example::

        @retry(wait=wait_chain(*[wait_fixed(1) for i in range(3)] +
                               [wait_fixed(2) for j in range(5)] +
                               [wait_fixed(5) for k in range(4)))
        def wait_chained():
            print("Wait 1s for 3 attempts, 2s for 5 attempts and 5s
                   thereafter.")
    r1rNcGrr)r1r3rrrr!brzwait_chain.__init__rrcCs0tt|jd�t|j��}|j|d}||d�S)Nr)r4)r*r+�attempt_number�lenr1)r
r�wait_func_no�	wait_funcrrrres
zwait_chain.__call__r9rrrrr:Rsr:c	@sdeZdZdZddejfdejee	fdejee	fdejee	fddfd	d
�Z
ddde	fd
d�ZdS)�wait_incrementingz�Wait an incremental amount of time after each attempt.

    Starting at a starting value and incrementing by a value for each attempt
    (and restricting the upper limit to some maximum value).
    r�d�start�	incrementr+rNcCs||_||_||_dSr)rArBr+)r
rArBr+rrrr!rs
zwait_incrementing.__init__rrcCs(|j|j|jd}tdt||j��S�Nr)r)rArBr;r+r*)r
r�resultrrrr|szwait_incrementing.__call__�rrrrr�MAX_WAITrrr/rr!rrrrrr?ks����
�
r?c@steZdZdZdejddfdejee	fdejee	fdejee	fdejee	fd	d
f
dd�Z
d
dd	e	fdd�Zd
S)�wait_exponentialaWait strategy that applies exponential backoff.

    It allows for a customized multiplier and an ability to restrict the
    upper and lower limits to some maximum and minimum value.

    The intervals are fixed (i.e. there is no jitter), so this strategy is
    suitable for balancing retries against latency when a required resource is
    unavailable for an unknown duration, but *not* suitable for resolving
    contention between multiple processes for a shared resource. Use
    wait_random_exponential for the latter case.
    r)�r�
multiplierr+�exp_baser*rNcCs||_||_||_||_dSr)rIr*r+rJ)r
rIr+rJr*rrrr!�s
zwait_exponential.__init__rrcCsRz|j|jd}|j|}Wnty|jYSwttd|j�t||j��SrC)rJr;rI�
OverflowErrorr+r*)r
r�exprDrrrr�s
�zwait_exponential.__call__rErrrrrG�s$�����
�rGcs*eZdZdZdddef�fdd�Z�ZS)�wait_random_exponentialaRandom wait with exponentially widening window.

    An exponential backoff strategy used to mediate contention between multiple
    uncoordinated processes for a shared resource in distributed systems. This
    is the sense in which "exponential backoff" is meant in e.g. Ethernet
    networking, and corresponds to the "Full Jitter" algorithm described in
    this blog post:

    https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

    Each retry occurs at a random time in a geometrically expanding interval.
    It allows for a custom multiplier and an ability to restrict the upper
    limit of the random interval to some maximum value.

    Example::

        wait_random_exponential(multiplier=0.5,  # initial window 0.5s
                                max=60)          # max 60s timeout

    When waiting for an unavailable resource to become available again, as
    opposed to trying to resolve contention for a shared resource, the
    wait_exponential strategy (which uses a fixed interval) may be preferable.

    rrrcst�j|d�}t�d|�S)Nr4r)r$rr.�uniform)r
r�highr%rrr�sz wait_random_exponential.__call__)rrrrrrr'rrr%rrM�srM)rr.r�pip._vendor.tenacityr�
TYPE_CHECKINGr�ABCrrr#r(rr:r?rGrMrrrr�<module>s

"