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__/retry.cpython-310.pyc
o

���g#�@s6ddlZddlZddlZejrddlmZGdd�dej�Zejeej	dge
ffZGdd�de�Ze�Z
Gdd	�d	e�Ze�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS) �N)�RetryCallStatec@sPeZdZdZejdddefdd��Zdd	d
�Zddd�Z	ddd�Z
ddd�ZdS)�
retry_basez)Abstract base class for retry strategies.�retry_stater�returncCsdS�N���selfrrr�9/usr/local/lib/python3.10/dist-packages/tenacity/retry.py�__call__szretry_base.__call__�other�	retry_allcC�
|�|�Sr)�__rand__�r	rrrr
�__and__ �
zretry_base.__and__cC�
t||�Sr)r
rrrr
r#rzretry_base.__rand__�	retry_anycCrr)�__ror__rrrr
�__or__&rzretry_base.__or__cCrr)rrrrr
r)rzretry_base.__ror__N)rrrr
)rrrr)�__name__�
__module__�__qualname__�__doc__�abc�abstractmethod�boolrrrrrrrrr
rs


rrc@�"eZdZdZdddefdd�ZdS)�_retry_neverz-Retry strategy that never rejects any result.rrrcC�dS)NFrrrrr
r3�z_retry_never.__call__N�rrrrrrrrrr
r0�rc@r)�
_retry_alwaysz.Retry strategy that always rejects any result.rrrcCr )NTrrrrr
r=r!z_retry_always.__call__Nr"rrrr
r$:r#r$c@s@eZdZdZdejegefddfdd�Zdddefd	d
�Z	dS)�retry_if_exceptionzARetry strategy that retries if an exception verifies a predicate.�	predicaterNcC�
||_dSr�r&�r	r&rrr
�__init__Grzretry_if_exception.__init__rrcCsB|jdur	td��|jjr|j��}|durtd��|�|�SdS)N�(__call__() called before outcome was set�(outcome failed but the exception is NoneF��outcome�RuntimeError�failed�	exceptionr&�r	rr1rrr
rJs


zretry_if_exception.__call__)
rrrr�typing�Callable�
BaseExceptionrr*rrrrr
r%Dsr%c�NeZdZdZefdejejeej	ejedffddf�fdd�
Z
�ZS)�retry_if_exception_typez=Retries if an exception has been raised of one or more types.�exception_types.rNc��|_t���fdd��dS)Ncs
t|��Sr��
isinstance��e�r8rr
�<lambda>bs
z2retry_if_exception_type.__init__.<locals>.<lambda>�r8�superr*�r	r8��	__class__r>r
r*Z�z retry_if_exception_type.__init__�rrrr�	Exceptionr3�Union�Typer5�Tupler*�
__classcell__rrrCr
r7W������r7cr6)�retry_if_not_exception_typezARetries except an exception has been raised of one or more types.r8.rNcr9)Nc�t|��Srr:r<r>rr
r?p�z6retry_if_not_exception_type.__init__.<locals>.<lambda>r@rBrCr>r
r*hrEz$retry_if_not_exception_type.__init__rFrrrCr
rMerLrMcs`eZdZdZefdejejeej	ejedffddf�fdd�
Z
dd	defd
d�Z�Z
S)�retry_unless_exception_typez:Retries until an exception is raised of one or more types.r8.rNcr9)NcrNrr:r<r>rr
r?~rOz6retry_unless_exception_type.__init__.<locals>.<lambda>r@rBrCr>r
r*vrEz$retry_unless_exception_type.__init__rrcC�B|jdur	td��|jjsdS|j��}|durtd��|�|�S�Nr+Tr,r-r2rrr
r�s


z$retry_unless_exception_type.__call__)rrrrrGr3rHrIr5rJr*rrrKrrrCr
rPss�����
rPc@sXeZdZdZefdejejeej	ejedffddfdd�Z
dd	defd
d�ZdS)�retry_if_exception_cause_typez�Retries if any of the causes of the raised exception is of one or more types.

    The check on the type of the cause of the exception is done recursively (until finding
    an exception in the chain that has no `__cause__`)
    r8.rNcCr'r)�exception_cause_typesrBrrr
r*�s
z&retry_if_exception_cause_type.__init__rrcCsP|jdur	td��|jjr&|j��}|dur&t|j|j�rdS|j}|dusdS)Nz&__call__ called before outcome was setTF)r.r/r0r1r;�	__cause__rT)r	r�excrrr
r�s

�z&retry_if_exception_cause_type.__call__)
rrrrrGr3rHrIr5rJr*rrrrrr
rS�s����
�	rSc@�BeZdZdZdejejgefddfdd�Zdddefd	d
�Z	dS)�retry_if_resultz+Retries if the result verifies a predicate.r&rNcCr'rr(r)rrr
r*�rzretry_if_result.__init__rrcCs.|jdur	td��|jjs|�|j���SdS�Nr+F�r.r/r0r&�resultrrrr
r�s

zretry_if_result.__call__�
rrrrr3r4�Anyrr*rrrrr
rX�� rXc@rW)�retry_if_not_resultz*Retries if the result refutes a predicate.r&rNcCr'rr(r)rrr
r*�rzretry_if_not_result.__init__rrcCs0|jdur	td��|jjs|�|j���SdSrYrZrrrr
r�s

zretry_if_not_result.__call__r\rrrr
r_�r^r_cs@eZdZdZ		ddejedejeddf�fdd�
Z�ZS)	�retry_if_exception_messagez2Retries if an exception message equals or matches.N�message�matchrcs��r
|r
t|jj�d����rdtdtf�fdd�}|}n|r2t�|��dtdtf�fdd�}|}n	t|jj�d���t��|�dS)	Nz.() takes either 'message' or 'match', not bothr1rcs�t|�kSr)�str�r1)rarr
�message_fnc�sz8retry_if_exception_message.__init__.<locals>.message_fnccst��t|���Sr)rrbrcrd)�progrr
�	match_fnc�sz6retry_if_exception_message.__init__.<locals>.match_fncz3() missing 1 required argument 'message' or 'match')	�	TypeErrorrDrr5r�re�compilerAr*)r	rarbrer&rgrC)rarfr
r*�s�
�z#retry_if_exception_message.__init__�NN)	rrrrr3�Optionalrcr*rKrrrCr
r`�s����r`csReZdZdZ		ddejedejeddf�fdd�
Zdd	defd
d�Z	�Z
S)
�retry_if_not_exception_messagez5Retries until an exception message equals or matches.Nrarbrcs&t��||�|j��fdd�|_dS)Ncs�|i|��Srr)�args_�kwargs_��if_predicaterr
r?�sz9retry_if_not_exception_message.__init__.<locals>.<lambda>)rAr*r&)r	rarbrCrpr
r*�sz'retry_if_not_exception_message.__init__rrcCrQrRr-r2rrr
r�s


z'retry_if_not_exception_message.__call__rk)rrrrr3rlrcr*rrrKrrrCr
rm�s����
rmc@�4eZdZdZdeddfdd�Zdddefd	d
�ZdS)rz1Retries if any of the retries condition is valid.�retriesrNcGr'r�rs�r	rsrrr
r*rzretry_any.__init__rrc�t�fdd�|jD��S)Nc3��|]}|��VqdSrr��.0�r�rrr
�	<genexpr>��z%retry_any.__call__.<locals>.<genexpr>)�anyrsrrr{r
r�zretry_any.__call__�rrrrrr*rrrrrr
r	�rc@rr)r
z/Retries if all the retries condition are valid.rsrNcGr'rrtrurrr
r*rzretry_all.__init__rrcrv)Nc3rwrrrxr{rr
r|r}z%retry_all.__call__.<locals>.<genexpr>)�allrsrrr{r
rrzretry_all.__call__r�rrrr
r
r�r
)rrir3�
TYPE_CHECKING�tenacityr�ABCrrHr4r�
RetryBaseTr�retry_neverr$�retry_alwaysr%r7rMrPrSrXr_r`rmrr
rrrr
�<module>s,#