Ë
    ^Qêj‹  ã                   óT  — d dl Z d dlZd dlmZ d dlmZ ej                  r
d dlZd dlmZ  G d„ de j                  «      Z
e
ej                  dgef   z  Z G d„ d	e
«      Z G d
„ de
«      Z G d„ de
«      Z e«       Z G d„ de
«      Z G d„ de
«      Z G d„ de
«      Z G d„ de
«      Zy)é    N)Ú_utils)Úoverride)ÚRetryCallStatec                   óN   — e Zd ZdZej
                  dddefd„«       Zd	d„Zd
d„Z	y)Ú	stop_basez(Abstract base class for stop strategies.Úretry_stater   Úreturnc                  ó   — y ©N© ©Úselfr   s     úR/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/tenacity/stop.pyÚ__call__zstop_base.__call__   s   € àó    c                 ó   — t        | |«      S r   )Ústop_all©r   Úothers     r   Ú__and__zstop_base.__and__#   ó   € Ü˜˜eÓ$Ð$r   c                 ó   — t        | |«      S r   )Ústop_anyr   s     r   Ú__or__zstop_base.__or__&   r   r   N)r   r   r	   r   )r   r   r	   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚabcÚabstractmethodÚboolr   r   r   r   r   r   r   r      s6   „ Ù2à×ÑðÐ$4ð ¸ò ó ðó%ô%r   r   r   c                   ó:   — e Zd ZdZdeddfd„Zedddefd„«       Zy)	r   z+Stop if any of the stop condition is valid.Ústopsr	   Nc                 ó   — || _         y r   ©r#   ©r   r#   s     r   Ú__init__zstop_any.__init__0   ó	   € Øˆ�
r   r   r   c                 ó@   ‡— t        ˆfd„| j                  D «       «      S )Nc              3   ó.   •K  — | ]  } |‰«      –— Œ y ­wr   r   ©Ú.0Úxr   s     €r   ú	<genexpr>z$stop_any.__call__.<locals>.<genexpr>5   ó   øè ø€ Ò6 a‘1�[—>Ñ6ùó   ƒ)Úanyr#   r   s    `r   r   zstop_any.__call__3   ó   ø€ äÓ6¨4¯:©:Ô6Ó6Ð6r   ©	r   r   r   r   r   r'   r   r!   r   r   r   r   r   r   -   s;   „ Ù5ð˜yð ¨Tó ð ð7Ð$4ð 7¸ò 7ó ñ7r   r   c                   ó:   — e Zd ZdZdeddfd„Zedddefd„«       Zy)	r   z*Stop if all the stop conditions are valid.r#   r	   Nc                 ó   — || _         y r   r%   r&   s     r   r'   zstop_all.__init__;   r(   r   r   r   c                 ó@   ‡— t        ˆfd„| j                  D «       «      S )Nc              3   ó.   •K  — | ]  } |‰«      –— Œ y ­wr   r   r+   s     €r   r.   z$stop_all.__call__.<locals>.<genexpr>@   r/   r0   )Úallr#   r   s    `r   r   zstop_all.__call__>   r2   r   r3   r   r   r   r   r   8   s;   „ Ù4ð˜yð ¨Tó ð ð7Ð$4ð 7¸ò 7ó ñ7r   r   c                   ó*   — e Zd ZdZedddefd„«       Zy)Ú_stop_neverzNever stop.r   r   r	   c                  ó   — y)NFr   r   s     r   r   z_stop_never.__call__F   s   € àr   N)r   r   r   r   r   r!   r   r   r   r   r:   r:   C   s&   „ ÙàðÐ$4ð ¸ò ó ñr   r:   c                   ó2   — e Zd ZdZdd„Zedddefd„«       Zy)	Ústop_when_event_setz!Stop when the given event is set.r	   Nc                 ó   — || _         y r   )Úevent)r   r?   s     r   r'   zstop_when_event_set.__init__Q   r(   r   r   r   c                 ó6   — | j                   j                  «       S r   )r?   Úis_setr   s     r   r   zstop_when_event_set.__call__T   s   € à�z‰z× Ñ Ó"Ð"r   )r?   zthreading.Eventr	   N)r   r   r   r   r'   r   r!   r   r   r   r   r=   r=   N   s-   „ Ù+óð ð#Ð$4ð #¸ò #ó ñ#r   r=   c                   ó:   — e Zd ZdZdeddfd„Zedddefd„«       Zy)	Ústop_after_attemptz.Stop when the previous attempt >= max_attempt.Úmax_attempt_numberr	   Nc                 ó   — || _         y r   )rD   )r   rD   s     r   r'   zstop_after_attempt.__init__\   s
   € Ø"4ˆÕr   r   r   c                 ó4   — |j                   | j                  k\  S r   )Úattempt_numberrD   r   s     r   r   zstop_after_attempt.__call___   s   € à×)Ñ)¨T×-DÑ-DÑDÐDr   )	r   r   r   r   Úintr'   r   r!   r   r   r   r   rC   rC   Y   s?   „ Ù8ð5¨3ð 5°4ó 5ð ðEÐ$4ð E¸ò Eó ñEr   rC   c                   óN   — e Zd ZdZdej
                  ddfd„Zedddefd„«       Z	y)	Ú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_delayr	   Nc                 ó8   — t        j                  |«      | _        y r   ©r   Ú
to_secondsrK   ©r   rK   s     r   r'   zstop_after_delay.__init__n   ó   € Ü×*Ñ*¨9Ó5ˆ�r   r   r   c                 ób   — |j                   €t        d«      ‚|j                   | j                  k\  S ©Nz4__call__() called but seconds_since_start is not set)Úseconds_since_startÚRuntimeErrorrK   r   s     r   r   zstop_after_delay.__call__q   s/   € à×*Ñ*Ð2ÜÐUÓVÐVØ×.Ñ.°$·.±.Ñ@Ð@r   ©
r   r   r   r   r   Útime_unit_typer'   r   r!   r   r   r   r   rJ   rJ   d   sG   „ ñð6 &×"7Ñ"7ð 6¸Dó 6ð ðAÐ$4ð A¸ò Aó ñAr   rJ   c                   óN   — e Zd ZdZdej
                  ddfd„Zedddefd„«       Z	y)	Ú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.
    rK   r	   Nc                 ó8   — t        j                  |«      | _        y r   rM   rO   s     r   r'   zstop_before_delay.__init__€   rP   r   r   r   c                 ó|   — |j                   €t        d«      ‚|j                   |j                  z   | j                  k\  S rR   )rS   rT   Úupcoming_sleeprK   r   s     r   r   zstop_before_delay.__call__ƒ   s?   € à×*Ñ*Ð2ÜÐUÓVÐVà×+Ñ+¨k×.HÑ.HÑHØ�~‰~ñð	
r   rU   r   r   r   rX   rX   x   sC   „ ñð6 &×"7Ñ"7ð 6¸Dó 6ð ð
Ð$4ð 
¸ò 
ó ñ
r   rX   )r   ÚtypingÚtenacityr   Útenacity._utilsr   ÚTYPE_CHECKINGÚ	threadingr   ÚABCr   ÚCallabler!   Ú	StopBaseTr   r   r:   Ú
stop_neverr=   rC   rJ   rX   r   r   r   ú<module>re      s±   ðó  Û å Ý $à	×ÒÛå'ô%�—‘ô %ð ˜Ÿ™Ð)9Ð(:¸DÐ(@ÑAÑA€	ô7ˆyô 7ô7ˆyô 7ô�)ô ñ ‹]€
ô#˜)ô #ôE˜ô EôA�yô Aô(
˜	õ 
r   