� ��g��|�ddlZddlZddlmZejr ddlZddlmZGd�dej��Zej eej dge ffZ Gd�de��Z Gd �d e��ZGd �d e��Ze��ZGd �de��ZGd�de��ZGd�de��ZGd�de��ZdS)�N)�_utils)�RetryCallStatec�L�eZdZdZejdddefd���Zd d�Zd d �Z d S)� stop_basez(Abstract base class for stop strategies.� retry_stater�returnc��dS�N���selfrs �]/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/tenacity/stop.py�__call__zstop_base.__call__s�� ���other�stop_allc�"�t||��Sr )r�r rs r�__and__zstop_base.__and__"�����e�$�$�$r�stop_anyc�"�t||��Sr )rrs r�__or__zstop_base.__or__%rrN)rrrr)rrrr) �__name__� __module__� __qualname__�__doc__�abc�abstractmethod�boolrrrr rrrrss������2�2��� �$4� �� � � ��� �%�%�%�%�%�%�%�%�%�%rrrc�2�eZdZdZdeddfd�Zdddefd�ZdS) rz+Stop if any of the stop condition is valid.�stopsrNc��||_dSr �r"�r r"s r�__init__zstop_any.__init__/� ���� � � rrrc�D��t�fd�|jD����S)Nc3�.�K�|]}|���V��dSr r ��.0�xrs �r� <genexpr>z$stop_any.__call__.<locals>.<genexpr>3�+�����6�6�a�1�1�[�>�>�6�6�6�6�6�6r)�anyr"r s `rrzstop_any.__call__2�(����6�6�6�6�4�:�6�6�6�6�6�6r�rrrrrr&r rr rrrr,s_������5�5��y��T�����7�$4�7��7�7�7�7�7�7rrc�2�eZdZdZdeddfd�Zdddefd�ZdS) rz*Stop if all the stop conditions are valid.r"rNc��||_dSr r$r%s rr&zstop_all.__init__9r'rrrc�D��t�fd�|jD����S)Nc3�.�K�|]}|���V��dSr r r*s �rr-z$stop_all.__call__.<locals>.<genexpr>=r.r)�allr"r s `rrzstop_all.__call__<r0rr1r rrrr6s_������4�4��y��T�����7�$4�7��7�7�7�7�7�7rrc�"�eZdZdZdddefd�ZdS)� _stop_neverz Never stop.rrrc��dS)NFr r s rrz_stop_never.__call__Cs���urN)rrrrr rr rrr8r8@s=���������$4��������rr8c�*�eZdZdZd d�Zdddefd �ZdS) �stop_when_event_setz!Stop when the given event is set.�event�threading.EventrNc��||_dSr )r<)r r<s rr&zstop_when_event_set.__init__Mr'rrrc�4�|j���Sr )r<�is_setr s rrzstop_when_event_set.__call__Ps���z� � �"�"�"r)r<r=rN)rrrrr&r rr rrr;r;JsQ������+�+�����#�$4�#��#�#�#�#�#�#rr;c�2�eZdZdZdeddfd�Zdddefd�ZdS) �stop_after_attemptz.Stop when the previous attempt >= max_attempt.�max_attempt_numberrNc��||_dSr )rC)r rCs rr&zstop_after_attempt.__init__Ws��"4����rrrc�"�|j|jkSr )�attempt_numberrCr s rrzstop_after_attempt.__call__Zs���)�T�-D�D�Dr)rrrr�intr&r rr rrrBrBTsg������8�8�5�3�5�4�5�5�5�5�E�$4�E��E�E�E�E�E�ErrBc�<�eZdZdZdejddfd�Zdddefd�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_delayrNc�8�tj|��|_dSr �r� to_secondsrJ�r rJs rr&zstop_after_delay.__init__h����*�9�5�5����rrrc�N�|j�td���|j|jkS�Nz4__call__() called but seconds_since_start is not set)�seconds_since_start� RuntimeErrorrJr s rrzstop_after_delay.__call__ks*�� � *� 2��U�V�V� V��.�$�.�@�@r� rrrrr�time_unit_typer&r rr rrrIrI^sn��������6�&�"7�6�D�6�6�6�6�A�$4�A��A�A�A�A�A�ArrIc�<�eZdZdZdejddfd�Zdddefd�ZdS) �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. rJrNc�8�tj|��|_dSr rLrNs rr&zstop_before_delay.__init__yrOrrrc�^�|j�td���|j|jz|jkSrQ)rRrS�upcoming_sleeprJr s rrzstop_before_delay.__call__|s7�� � *� 2��U�V�V� V� � +�k�.H� H��~� � rrTr rrrWrWqsf��������6�&�"7�6�D�6�6�6�6� �$4� �� � � � � � rrW)r�typing�tenacityr� TYPE_CHECKING� threadingr�ABCr�Union�Callabler � StopBaseTrrr8� stop_neverr;rBrIrWr rr�<module>rds���  � � � � � � � ������� ��(�����'�'�'�'�'�'� %� %� %� %� %��� %� %� %� �L��F�O�5E�4F��4L�$M�M� N� �7�7�7�7�7�y�7�7�7�7�7�7�7�7�y�7�7�7������)�����[�]�]� �#�#�#�#�#�)�#�#�#�E�E�E�E�E��E�E�E�A�A�A�A�A�y�A�A�A�& � � � � � � � � � � r
Memory