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: //usr/local/lib/python3.10/dist-packages/tenacity/__pycache__/stop.cpython-310.pyc
o

���g�@s�ddlZddlZddlmZejrddlZddlmZGdd�dej�Zej	eej
dgeffZGdd�de�Z
Gd	d
�d
e�ZGdd�de�Ze�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�N)�_utils)�RetryCallStatec@s<eZdZdZejdddefdd��Zdd	d
�Zddd
�Z	dS)�	stop_basez(Abstract base class for stop strategies.�retry_stater�returncCsdS�N���selfrrr�8/usr/local/lib/python3.10/dist-packages/tenacity/stop.py�__call__szstop_base.__call__�other�stop_allcC�
t||�Sr)r�r
r
rrr�__and__"�
zstop_base.__and__�stop_anycCrr)rrrrr�__or__%rzstop_base.__or__N)r
rrr)r
rrr)
�__name__�
__module__�__qualname__�__doc__�abc�abstractmethod�boolrrrrrrrrs
rrc@�4eZdZdZdeddfdd�Zdddefd	d
�ZdS)rz+Stop if any of the stop condition is valid.�stopsrNcG�
||_dSr�r�r
rrrr�__init__/rzstop_any.__init__rrc�t�fdd�|jD��S)Nc3��|]}|��VqdSrr��.0�x�rrr�	<genexpr>3��z$stop_any.__call__.<locals>.<genexpr>)�anyrr	rr'rr2�zstop_any.__call__�rrrrrr!rrrrrrr,�rc@r)rz*Stop if all the stop conditions are valid.rrNcGrrrr rrrr!9rzstop_all.__init__rrcr")Nc3r#rrr$r'rrr(=r)z$stop_all.__call__.<locals>.<genexpr>)�allrr	rr'rr<r+zstop_all.__call__r,rrrrr6r-rc@s"eZdZdZdddefdd�ZdS)�_stop_neverzNever stop.rrrcCsdS)NFrr	rrrrCsz_stop_never.__call__N)rrrrrrrrrrr/@sr/c@s,eZdZdZddd�Zdd	defd
d�ZdS)
�stop_when_event_setz!Stop when the given event is set.�event�threading.EventrNcCrr)r1)r
r1rrrr!Mrzstop_when_event_set.__init__rrcCs
|j��Sr)r1�is_setr	rrrrPrzstop_when_event_set.__call__)r1r2rN)rrrrr!rrrrrrr0Js
r0c@r)�stop_after_attemptz.Stop when the previous attempt >= max_attempt.�max_attempt_numberrNcCrr)r5)r
r5rrrr!Wrzstop_after_attempt.__init__rrcCs|j|jkSr)�attempt_numberr5r	rrrrZszstop_after_attempt.__call__)rrrr�intr!rrrrrrr4Tr-r4c@�6eZdZdZdejddfdd�Zdddefd	d
�ZdS)�stop_after_delayaS
    Stop when the time from the first attempt >= limit.

    Note: `max_delay` will be exceeded, so when used with a `wait`, the actual total delay will be greater
    than `max_delay` by some of the final sleep period before `max_delay` is exceeded.

    If you need stricter timing with waits, consider `stop_before_delay` instead.
    �	max_delayrNcC�t�|�|_dSr�r�
to_secondsr:�r
r:rrrr!h�zstop_after_delay.__init__rrcCs|jdur	td��|j|jkS�Nz4__call__() called but seconds_since_start is not set)�seconds_since_start�RuntimeErrorr:r	rrrrks
zstop_after_delay.__call__�	rrrrr�time_unit_typer!rrrrrrr9^s	r9c@r8)�stop_before_delaya
    Stop right before the next attempt would take place after the time from the first attempt >= limit.

    Most useful when you are using with a `wait` function like wait_random_exponential, but need to make
    sure that the max_delay is not exceeded.
    r:rNcCr;rr<r>rrrr!yr?zstop_before_delay.__init__rrcCs$|jdur	td��|j|j|jkSr@)rArB�upcoming_sleepr:r	rrrr|s

��zstop_before_delay.__call__rCrrrrrEqsrE)r�typing�tenacityr�
TYPE_CHECKING�	threadingr�ABCr�Union�Callabler�	StopBaseTrrr/�
stop_neverr0r4r9rErrrr�<module>s