HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/site-packages/pip/_vendor/tenacity/__pycache__/wait.cpython-310.pyc
o

��iK�@s
ddlZddlZddlZddlmZddlmZejr!ddlmZej	e
eefZdedefdd�Z
Gd	d
�d
ej�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�N)�	timedelta)�_utils)�RetryCallState�	wait_unit�returncCstt|t�r|���S|�S�N)�float�
isinstancer�
total_seconds)r�r�D/usr/local/lib/python3.10/site-packages/pip/_vendor/tenacity/wait.py�
to_secondssr
c@sJeZdZdZejdddefdd��Zdd	d
�Zddde	j
dfdd
�ZdS)�	wait_basez(Abstract base class for wait strategies.�retry_staterrcCsdSrr��selfrrrr�__call__%szwait_base.__call__�other�wait_combinecCs
t||�Sr)r�rrrrr�__add__)�
zwait_base.__add__)rrcCs|dkr|S|�|�S�Nr)rrrrr�__radd__,s
zwait_base.__radd__N)rrrr)�__name__�
__module__�__qualname__�__doc__�abc�abstractmethodrrr�typing�Unionrrrrrr"s
rc@�4eZdZdZdeddfdd�Zdddefd	d
�ZdS)�
wait_fixedzCWait strategy that waits a fixed amount of time between each retry.�waitrNcCst|�|_dSr)r
r#)rr$rrr�__init__6szwait_fixed.__init__rrcCs|jSr)r#rrrrr9szwait_fixed.__call__�rrrr�wait_unit_typer%rrrrrrr#3�r#cs"eZdZdZd�fdd�Z�ZS)�	wait_nonez7Wait strategy that doesn't wait at all before retrying.rNcst��d�dSr)�superr%)r��	__class__rrr%@szwait_none.__init__)rN)rrrrr%�
__classcell__rrr+rr)=sr)c@s:eZdZdZddededdfdd	�Zd
ddefdd
�ZdS)�wait_randomzAWait strategy that waits a random amount of time between min/max.r��min�maxrNcCst|�|_t|�|_dSr)r
�wait_random_min�wait_random_max)rr0r1rrrr%Gs
zwait_random.__init__rrcCs|jt��|j|jSr)r2�randomr3rrrrrKszwait_random.__call__)rr/r&rrrrr.Dsr.c@r")rz#Combine several waiting strategies.�
strategiesrNcG�
||_dSr)�
wait_funcs�rr5rrrr%Rrzwait_combine.__init__rrcst�fdd�|jD��S)Nc3s�|]}|�d�VqdS)�rNr)�.0�xr9rr�	<genexpr>Vs�z(wait_combine.__call__.<locals>.<genexpr>)�sumr7rrr9rrUszwait_combine.__call__�rrrrrr%rrrrrrrOr(rc@r")�
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.")
    r5rNcGr6r)r5r8rrrr%irzwait_chain.__init__rrcCs0tt|jd�t|j��}|j|d}||d�S)Nr/r9)r0r1�attempt_number�lenr5)rr�wait_func_no�	wait_funcrrrrls
zwait_chain.__call__r>rrrrr?Ysr?c	@sFeZdZdZddejfdedededdfd	d
�Zdddefd
d�Z	dS)�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�	incrementr1rNcCs"t|�|_t|�|_t|�|_dSr)r
rFrGr1)rrFrGr1rrrr%ys

zwait_incrementing.__init__rrcCs(|j|j|jd}tdt||j��S�Nr/r)rFrGr@r1r0)rr�resultrrrr�szwait_incrementing.__call__)
rrrrr�MAX_WAITr'r%rrrrrrrDrs����
�
rDc@s`eZdZdZdejddfdejee	fde
dejee	fde
d	d
f
dd�Zd
dd	e	fdd�Zd
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�
multiplierr1�exp_baser0rNcCs$||_t|�|_t|�|_||_dSr)rMr
r0r1rN)rrMr1rNr0rrrr%�s


zwait_exponential.__init__rrcCsRz|j|jd}|j|}Wnty|jYSwttd|j�t||j��SrH)rNr@rM�
OverflowErrorr1r0)rr�exprIrrrr�s
�zwait_exponential.__call__)
rrrrrrJr r!�intrr'r%rrrrrrK�s$�����
�rKcs*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)Nr9r)r*rr4�uniform)rr�highr+rrr�sz wait_random_exponential.__call__)rrrrrrr-rrr+rrR�srRc@sLeZdZdZdejddfdededededd	f
d
d�Zdd
defdd�Zd	S)�wait_exponential_jitterabWait strategy that applies exponential backoff and jitter.

    It allows for a customized initial wait, maximum wait and jitter.

    This implements the strategy described here:
    https://cloud.google.com/storage/docs/retry-strategy

    The wait time is min(initial * (2**n + random.uniform(0, jitter)), maximum)
    where n is the retry count.
    r/rL�initialr1rN�jitterrNcCs||_||_||_||_dSr)rVr1rNrW)rrVr1rNrWrrrr%�s
z wait_exponential_jitter.__init__rrcCs\t�d|j�}z|j|jd}|j||}Wnty$|j}Ynwtdt||j��S)Nrr/)	r4rSrWrNr@rVrOr1r0)rrrWrPrIrrrr�s
�z wait_exponential_jitter.__call__)	rrrrrrJrr%rrrrrrU�s$
�����
�rU)rr4r �datetimer�pip._vendor.tenacityr�
TYPE_CHECKINGrr!rQrr'r
�ABCrr#r)r.rr?rDrKrRrUrrrr�<module>s&

"