� ��gJ#��,�ddlZddlZddlZejrddlmZGd�dej��Zejeej dge ffZ Gd�de��Z e ��Z Gd�d e��Ze��ZGd �d e��ZGd �d e��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZGd�de��ZdS) �N)�RetryCallStatec�\�eZdZdZejdddefd���Zdd�Zdd �Z dd �Z dd �Z d S)� retry_basez)Abstract base class for retry strategies.� retry_stater�returnc��dS�N���selfrs �^/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/tenacity/retry.py�__call__zretry_base.__call__s�� ���other� retry_allc�,�|�|��Sr )�__rand__�r rs r �__and__zretry_base.__and__ s���~�~�d�#�#�#rc�"�t||��Sr )rrs r rzretry_base.__rand__#������%�%�%r� retry_anyc�,�|�|��Sr )�__ror__rs r �__or__zretry_base.__or__&s���}�}�T�"�"�"rc�"�t||��Sr )rrs r rzretry_base.__ror__)rrN)rrrr)rrrr) �__name__� __module__� __qualname__�__doc__�abc�abstractmethod�boolrrrrrr rr rrs�������3�3��� �$4� �� � � ��� �$�$�$�$�&�&�&�&�#�#�#�#�&�&�&�&�&�&rrrc�"�eZdZdZdddefd�ZdS)� _retry_neverz-Retry strategy that never rejects any result.rrrc��dS)NFr r s r rz_retry_never.__call__3s���urN�rrrr r#rr rr r%r%0s=������7�7��$4��������rr%c�"�eZdZdZdddefd�ZdS)� _retry_alwaysz.Retry strategy that always rejects any result.rrrc��dS)NTr r s r rz_retry_always.__call__=s���trNr'r rr r)r):s=������8�8��$4��������rr)c�N�eZdZdZdejegefddfd�Zdddefd�Z dS) �retry_if_exceptionzARetry strategy that retries if an exception verifies a predicate.� predicaterNc��||_dSr �r-�r r-s r �__init__zretry_if_exception.__init__G� ��"����rrrc���|j�td���|jjr?|j���}|�td���|�|��SdS)N�(__call__() called before outcome was set�(outcome failed but the exception is NoneF��outcome� RuntimeError�failed� exceptionr-�r rr:s r rzretry_if_exception.__call__Jsh�� � � &��I�J�J� J� � � %� �#�+�5�5�7�7�I�� �"�#M�N�N�N��>�>�)�,�,� ,��5r) rrrr �typing�Callable� BaseExceptionr#r1rr rr r,r,Dsm������K�K�#�&�/�=�/�4�2G�"H�#�T�#�#�#�#� �$4� �� � � � � � rr,c���eZdZdZefdejejeej ejedffddf�fd� Z �xZ S)�retry_if_exception_typez=Retries if an exception has been raised of one or more types.�exception_types.rNc�`����|_t����fd���dS)Nc�$��t|���Sr �� isinstance��erAs �r �<lambda>z2retry_if_exception_type.__init__.<locals>.<lambda>bs���:�a��#A�#A�r�rA�superr1�r rA� __class__s `�r r1z retry_if_exception_type.__init__Zs6���� /��� �����A�A�A�A�B�B�B�B�Br� rrrr � Exceptionr<�Union�Typer>�Tupler1� __classcell__�rLs@r r@r@Ws��������G�G� � C�C��� �K� � &� �L���]�3�S�8� 9� ;� �C� � C�C�C�C�C�C�C�C�C�Crr@c���eZdZdZefdejejeej ejedffddf�fd� Z �xZ S)�retry_if_not_exception_typezARetries except an exception has been raised of one or more types.rA.rNc�`����|_t����fd���dS)Nc�&��t|��� Sr rDrFs �r rHz6retry_if_not_exception_type.__init__.<locals>.<lambda>p����z�!�_�'E�'E�#E�rrIrKs `�r r1z$retry_if_not_exception_type.__init__h�6���� /��� �����E�E�E�E�F�F�F�F�FrrMrSs@r rUrUes��������K�K� � G�G��� �K� � &� �L���]�3�S�8� 9� ;� �G� � G�G�G�G�G�G�G�G�G�GrrUc���eZdZdZefdejejeej ejedffddf�fd� Z ddde fd �Z �xZ S) �retry_unless_exception_typez:Retries until an exception is raised of one or more types.rA.rNc�`����|_t����fd���dS)Nc�&��t|��� Sr rDrFs �r rHz6retry_unless_exception_type.__init__.<locals>.<lambda>~rXrrIrKs `�r r1z$retry_unless_exception_type.__init__vrYrrrc���|j�td���|jjsdS|j���}|�td���|�|��S�Nr4Tr5r6r;s r rz$retry_unless_exception_type.__call__�sj�� � � &��I�J�J� J��"�)� ��4��'�1�1�3�3� � � ��I�J�J� J��~�~�i�(�(�(r)rrrr rNr<rOrPr>rQr1r#rrRrSs@r r[r[ss��������D�D� � G�G��� �K� � &� �L���]�3�S�8� 9� ;� �G� � G�G�G�G�G�G� )�$4� )�� )� )� )� )� )� )� )� )rr[c��eZdZdZefdejejeej ejedffddfd�Z ddde fd �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__`) rA.rNc��||_dSr )�exception_cause_types)r rAs r r1z&retry_if_exception_cause_type.__init__�s��&5��"�"�"rrrc���|j�td���|jjr@|j���}|�%t |j|j��rdS|j}|�%dS)Nz&__call__ called before outcome was setTF)r7r8r9r:rE� __cause__rc)r r�excs r rz&retry_if_exception_cause_type.__call__�sr�� � � &��G�H�H� H� � � %� $��%�/�/�1�1�C��/��c�m�T�-G�H�H� ��4��m���/� �ur) rrrr rNr<rOrPr>rQr1r#rr rr rara�s��������� � 5�5��� �K� � &� �L���]�3�S�8� 9� ;� �5� � 5�5�5�5� �$4� �� � � � � � rrac�X�eZdZdZdejejgefddfd�Zdddefd�Z dS) �retry_if_resultz+Retries if the result verifies a predicate.r-rNc��||_dSr r/r0s r r1zretry_if_result.__init__�r2rrrc��|j�td���|jjs,|�|j�����SdS�Nr4F�r7r8r9r-�resultr s r rzretry_if_result.__call__�sN�� � � &��I�J�J� J��"�)� ��>�>�+�"5�"<�"<�">�">�?�?� ?��5r� rrrr r<r=�Anyr#r1rr rr rhrh�so������5�5�#�&�/�6�:�,��2D�"E�#�$�#�#�#�#��$4��������rrhc�X�eZdZdZdejejgefddfd�Zdddefd�Z dS) �retry_if_not_resultz*Retries if the result refutes a predicate.r-rNc��||_dSr r/r0s r r1zretry_if_not_result.__init__�r2rrrc��|j�td���|jjs-|�|j����� SdSrkrlr s r rzretry_if_not_result.__call__�sQ�� � � &��I�J�J� J��"�)� ��~�~�k�&9�&@�&@�&B�&B�C�C�C� C��5rrnr rr rqrq�so������4�4�#�&�/�6�:�,��2D�"E�#�$�#�#�#�#��$4��������rrqc �~��eZdZdZ ddejedejdeejefddf�fd� Z �xZ S)�retry_if_exception_messagez2Retries if an exception message equals or matches.N�message�matchrc�R�����r|rt|jj�d�����rdtdtf�fd� }|}nI|r+t j|���dtdtf�fd� }|}nt|jj�d����t���|��dS)Nz.() takes either 'message' or 'match', not bothr:rc�*���t|��kSr )�str)r:rvs �r � message_fncz8retry_if_exception_message.__init__.<locals>.message_fnc�s����#�i�.�.�0�0rc�b��t��t|������Sr )r#rwrz)r:�progs �r � match_fncz6retry_if_exception_message.__init__.<locals>.match_fnc�s#����D�J�J�s�9�~�~�6�6�7�7�7rz3() missing 1 required argument 'message' or 'match') � TypeErrorrLrr>r#�re�compilerJr1)r rvrwr{r-r~r}rLs ` @�r r1z#retry_if_exception_message.__init__�s����� � �u� ���>�*�Z�Z�Z��� � � � 1�}� 1�� 1� 1� 1� 1� 1� 1�$�I�I� � ��:�e�$�$�D� 8�]� 8�t� 8� 8� 8� 8� 8� 8�"�I�I���>�*�_�_�_��� � ������#�#�#�#�#r�NN) rrrr r<�OptionalrzrO�Patternr1rRrSs@r ruru�s��������<�<�)-�>B�$�$����%�$��|�D�#�v�~�c�':�:�;�$� � $�$�$�$�$�$�$�$�$�$rruc ���eZdZdZ d dejedejdeejefddf�fd� Z ddde fd �Z �xZ S) �retry_if_not_exception_messagez5Retries until an exception message equals or matches.Nrvrwrc�p���t���||��|j��fd�|_dS)Nc����|i|�� Sr r )�args_�kwargs_� if_predicates �r rHz9retry_if_not_exception_message.__init__.<locals>.<lambda>�s���|�|�U�7V�g�7V�7V�3V�r)rJr1r-)r rvrwr�rLs @�r r1z'retry_if_not_exception_message.__init__�s;���� ������%�(�(�(��~� �V�V�V�V����rrrc���|j�td���|jjsdS|j���}|�td���|�|��Sr_r6r;s r rz'retry_if_not_exception_message.__call__�sh�� � � &��I�J�J� J��"�)� ��4��'�1�1�3�3� � � ��I�J�J� J��~�~�i�(�(�(rr�) rrrr r<r�rzrOr�r1r#rrRrSs@r r�r��s��������?�?�)-�>B�W�W����%�W��|�D�#�v�~�c�':�:�;�W� � W�W�W�W�W�W� )�$4� )�� )� )� )� )� )� )� )� )rr�c�2�eZdZdZdeddfd�Zdddefd�ZdS) rz1Retries if any of the retries condition is valid.�retriesrNc��||_dSr �r��r r�s r r1zretry_any.__init__ � ���� � � rrrc�D��t�fd�|jD����S)Nc3�.�K�|]}|���V��dSr r ��.0�rrs �r � <genexpr>z%retry_any.__call__.<locals>.<genexpr>�+�����8�8�a�1�1�[�>�>�8�8�8�8�8�8r)�anyr�r s `r rzretry_any.__call__�(����8�8�8�8�4�<�8�8�8�8�8�8r�rrrr rr1r#rr rr rr s_������;�;���������9�$4�9��9�9�9�9�9�9rrc�2�eZdZdZdeddfd�Zdddefd�ZdS) rz/Retries if all the retries condition are valid.r�rNc��||_dSr r�r�s r r1zretry_all.__init__r�rrrc�D��t�fd�|jD����S)Nc3�.�K�|]}|���V��dSr r r�s �r r�z%retry_all.__call__.<locals>.<genexpr>r�r)�allr�r s `r rzretry_all.__call__r�rr�r rr rrs_������9�9���������9�$4�9��9�9�9�9�9�9rr)r!r�r<� TYPE_CHECKING�tenacityr�ABCrrOr=r#� RetryBaseTr%� retry_neverr)� retry_alwaysr,r@rUr[rarhrqrur�rrr rr �<module>r�s���" � � � � � � � � � � � � ��(�'�'�'�'�'�'�&�&�&�&�&���&�&�&�(�\�*�f�o�7G�6H�$�6N�&O�O� P� ������:�����l�n�n� ������J�����}��� ����������& C� C� C� C� C�0� C� C� C� G� G� G� G� G�"4� G� G� G�)�)�)�)�)�"4�)�)�)�6�����J����< � � � � �j� � � � � � � � �*� � � � $� $� $� $� $�!3� $� $� $�F)�)�)�)�)�%?�)�)�)�49�9�9�9�9� �9�9�9�9�9�9�9�9� �9�9�9�9�9r
Memory