B õCÿ_] ã@s¢ddlZddlZddlmZe ej¡Gdd„deƒƒZGdd„deƒZ Gdd„deƒZ Gd d „d eƒZ e ƒZ Gd d „d eƒZ Gd d„deƒZGdd„deƒZdS)éN)Úcompatc@s.eZdZdZejdd„ƒZdd„Zdd„ZdS) Ú stop_basez(Abstract base class for stop strategies.cCsdS)N©)ÚselfÚ retry_staterrúg/private/var/folders/fw/jsxvvqfs4sz4tdnfdvg5typ5vk77qg/T/pip-install-pio4sg6z/tenacity/tenacity/stop.pyÚ__call__szstop_base.__call__cCs t||ƒS)N)Ústop_all)rÚotherrrrÚ__and__szstop_base.__and__cCs t||ƒS)N)Ústop_any)rr rrrÚ__or__"szstop_base.__or__N) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚabcÚabstractmethodrr r rrrrrsrc@s&eZdZdZdd„Zejdd„ƒZdS)r z+Stop if any of the stop condition is valid.cGstdd„|Dƒƒ|_dS)Ncss|]}t |¡VqdS)N)Ú_compatÚstop_func_accept_retry_state)Ú.0Ú stop_funcrrrú *sz$stop_any.__init__..)ÚtupleÚstops)rrrrrÚ__init__)szstop_any.__init__cst‡fdd„|jDƒƒS)Nc3s|]}|ˆƒVqdS)Nr)rÚx)rrrr/sz$stop_any.__call__..)Úanyr)rrr)rrr-szstop_any.__call__N)rrrrrrÚ"stop_dunder_call_accept_old_paramsrrrrrr &sr c@s&eZdZdZdd„Zejdd„ƒZdS)r z*Stop if all the stop conditions are valid.cGstdd„|Dƒƒ|_dS)Ncss|]}t |¡VqdS)N)rr)rrrrrr6sz$stop_all.__init__..)rr)rrrrrr5szstop_all.__init__cst‡fdd„|jDƒƒS)Nc3s|]}|ˆƒVqdS)Nr)rr)rrrr;sz$stop_all.__call__..)Úallr)rrr)rrr9szstop_all.__call__N)rrrrrrrrrrrrr 2sr c@seZdZdZejdd„ƒZdS)Ú _stop_neverz Never stop.cCsdS)NFr)rrrrrrAsz_stop_never.__call__N)rrrrrrrrrrrr >sr c@s&eZdZdZdd„Zejdd„ƒZdS)Ústop_when_event_setz!Stop when the given event is set.cCs ||_dS)N)Úevent)rr"rrrrLszstop_when_event_set.__init__cCs |j ¡S)N)r"Úis_set)rrrrrrOszstop_when_event_set.__call__N)rrrrrrrrrrrrr!Isr!c@s&eZdZdZdd„Zejdd„ƒZdS)Ústop_after_attemptz.Stop when the previous attempt >= max_attempt.cCs ||_dS)N)Úmax_attempt_number)rr%rrrrWszstop_after_attempt.__init__cCs |j|jkS)N)Úattempt_numberr%)rrrrrrZszstop_after_attempt.__call__N)rrrrrrrrrrrrr$Tsr$c@s&eZdZdZdd„Zejdd„ƒZdS)Ústop_after_delayz3Stop when the time from the first attempt >= limit.cCs ||_dS)N)Ú max_delay)rr(rrrrbszstop_after_delay.__init__cCs |j|jkS)N)Zseconds_since_startr()rrrrrreszstop_after_delay.__call__N)rrrrrrrrrrrrr'_sr')rÚsixZtenacityrrÚ add_metaclassÚABCMetaÚobjectrr r r Z stop_neverr!r$r'rrrrÚs