� ��^i#��J�ddlZddlZddlZddlmZejrddlmZGd�dej��ZGd�de��Z Gd�d e ��Z Gd �d e��Z Gd �d e��Z Gd�de��Z Gd�de��ZGd�de��ZGd�de��ZdS)�N)�_utils)�RetryCallStatec�j�eZdZdZejdddefd���Zd d�Zddde j d fd �Z d S) � wait_basez(Abstract base class for wait strategies.� retry_stater�returnc��dS�N���selfrs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/tenacity/wait.py�__call__zwait_base.__call__s�� ���other� wait_combinec�"�t||��Sr )r�r rs r�__add__zwait_base.__add__"s���D�%�(�(�(r)rrc�<�|dkr|S|�|��S�Nr)rrs r�__radd__zwait_base.__radd__%s"�� �A�:�:��K��|�|�E�"�"�"rN)rrrr) �__name__� __module__� __qualname__�__doc__�abc�abstractmethod�floatrr�typing�Unionrr rrrrs�������2�2��� �$4� �� � � ��� �)�)�)�)�#�k�#�f�l�;V�.W�#�#�#�#�#�#rrc�2�eZdZdZdeddfd�Zdddefd�ZdS) � wait_fixedzCWait strategy that waits a fixed amount of time between each retry.�waitrNc��||_dSr �r#)r r$s r�__init__zwait_fixed.__init__/s ������rrrc��|jSr r&r s rrzwait_fixed.__call__2s ����r)rrrrrr'rr rrr#r#,s_������M�M��U��t������$4��������rr#c�$��eZdZdZd�fd� Z�xZS)� wait_nonez7Wait strategy that doesn't wait at all before retrying.rNc�J��t���d��dSr)�superr')r � __class__s �rr'zwait_none.__init__9s!��� ����������r)rN)rrrrr'� __classcell__�r-s@rr*r*6sC�������A�A����������rr*c�l�eZdZdZd dejeefdejeefddfd�Zd d defd �Z dS) � wait_randomzAWait strategy that waits a random amount of time between min/max.r��min�maxrNc�"�||_||_dSr )�wait_random_min�wait_random_max)r r3r4s rr'zwait_random.__init__@s��"���"����rrrc�X�|jtj��|j|jz zzSr )r6�randomr7r s rrzwait_random.__call__Ds'���#�v�}���$�:N�QU�Qe�:e�'f�g�gr)rr2) rrrrr r!�intrr'rr rrr1r1=s�������K�K�#�#�F�L��e��4�#�v�|�C�QV�J�?W�#�`d�#�#�#�#�h�$4�h��h�h�h�h�h�hrr1c�2�eZdZdZdeddfd�Zdddefd�ZdS) rz#Combine several waiting strategies.� strategiesrNc��||_dSr )� wait_funcs�r r<s rr'zwait_combine.__init__K� ��$����rrrc�D��t�fd�|jD����S)Nc3�0�K�|]}|����V��dS)�rNr )�.0�xrs �r� z(wait_combine.__call__..Os0�����G�G�!�1�1��-�-�-�G�G�G�G�G�Gr)�sumr>r s `rrzwait_combine.__call__Ns(����G�G�G�G�t��G�G�G�G�G�Gr�rrrrrr'rrr rrrrHsg������-�-�%�I�%�$�%�%�%�%�H�$4�H��H�H�H�H�H�Hrrc�2�eZdZdZdeddfd�Zdddefd�ZdS) � wait_chaina�Chain two or more waiting strategies. If all strategies are exhausted, the very last strategy is used thereafter. For example:: @retry(wait=wait_chain(*[wait_fixed(1) for i in range(3)] + [wait_fixed(2) for j in range(5)] + [wait_fixed(5) for k in range(4))) def wait_chained(): print("Wait 1s for 3 attempts, 2s for 5 attempts and 5s thereafter.") r<rNc��||_dSr )r<r?s rr'zwait_chain.__init__br@rrrc��tt|jd��t|j����}|j|dz }||���S)Nr2rC)r3r4�attempt_number�lenr<)r r� wait_func_no� wait_funcs rrzwait_chain.__call__esL���3�{�9�1�=�=�s�4�?�?S�?S�T�T� ��O�L�1�$4�5� ��y�[�1�1�1�1rrHr rrrJrJRsc������ � �%�I�%�$�%�%�%�%�2�$4�2��2�2�2�2�2�2rrJc ��eZdZdZddejfdejee fdejee fdejee fddfd �Z d d de fd �Z dS) �wait_incrementingz�Wait an incremental amount of time after each attempt. Starting at a starting value and incrementing by a value for each attempt (and restricting the upper limit to some maximum value). r�d�start� incrementr4rNc�0�||_||_||_dSr )rTrUr4)r rTrUr4s rr'zwait_incrementing.__init__rs�� �� �"�������rrrc�|�|j|j|jdz zz}tdt ||j����S�Nr2r)rTrUrMr4r3)r r�results rrzwait_incrementing.__call__|s9����t�~��1K�a�1O�P�Q���1�c�&�$�(�+�+�,�,�,r� rrrrr�MAX_WAITr r!r:rr'rr rrrRrRks���������+,�.1�(.�� ���|�C��J�'���<��U� �+���\�#�u�*� %� � � ����-�$4�-��-�-�-�-�-�-rrRc ��eZdZdZdejddfdejee fdejee fdejee fdejee fd d f d �Z d d d e fd�Z d S)�wait_exponentialaWait strategy that applies exponential backoff. It allows for a customized multiplier and an ability to restrict the upper and lower limits to some maximum and minimum value. The intervals are fixed (i.e. there is no jitter), so this strategy is suitable for balancing retries against latency when a required resource is unavailable for an unknown duration, but *not* suitable for resolving contention between multiple processes for a shared resource. Use wait_random_exponential for the latter case. r2�r� multiplierr4�exp_baser3rNc�>�||_||_||_||_dSr )r_r3r4r`)r r_r4r`r3s rr'zwait_exponential.__init__�s$��%��������� �� � � rrrc��� |j|jdz z}|j|z}n#t$r |jcYSwxYwt t d|j��t ||j����SrX)r`rMr_� OverflowErrorr4r3)r r�exprYs rrzwait_exponential.__call__�sw�� ��-�K�$>��$B�C�C��_�s�*�F�F��� � � ��8�O�O�O� �����3�q�$�(�#�#�S����%:�%:�;�;�;s ��3�3rZr rrr]r]�s������� � �01�(.��-.�()� !� !��L��e��,� !��\�#�u�*� %� !��,�s�E�z�*� !� �\�#�u�*� %� !� � !� !� !� !�<�$4�<��<�<�<�<�<�rms���" � � � � � � � � � � � �'�'�'�'�'�'� ��4�3�3�3�3�3�3�#�#�#�#�#���#�#�#�"�������������� ����h�h�h�h�h�)�h�h�h�H�H�H�H�H�9�H�H�H�2�2�2�2�2��2�2�2�2-�-�-�-�-� �-�-�-�,<�<�<�<�<�y�<�<�<�D'�'�'�'�'�.�'�'�'�'�'r