
    ph                         S SK r S SKrS SKJr  S SKJrJrJrJrJ	r	J
r
JrJrJr  S SKJrJr  \" S5      r\" S\SS9r\(       a  S S	KJr   " S
 S\\   \ R,                  5      r " S S\\   5      rg)    N)sleep)	TYPE_CHECKINGAnyCallableGenericIterableOptionalTupleTypeTypeVar)ConnectionErrorTimeoutErrorTET)bound	covariant)AbstractBackoffc                       \ rS rSr% Sr\\\   S4   \S'   SSS\	S\\\   S4   4S	 jr
\R                  S
\S\4S j5       rS\	4S jrS\\\      SS4S jrS\	4S jrS\	SS4S jrSrg)AbstractRetry   z0Retry a specific number of times after a failure._supported_errorsbackoffr   retriessupported_errorsc                 (    Xl         X l        X0l        g)z
Initialize a `Retry` object with a `Backoff` object
that retries a maximum of `retries` times.
`retries` can be negative to retry forever.
You can specify the types of supported errors which trigger
a retry with the `supported_errors` parameter.
N_backoff_retriesr   )selfr   r   r   s       E/home/james-whalen/.local/lib/python3.13/site-packages/redis/retry.py__init__AbstractRetry.__init__   s      !1    otherreturnc                     [         $ N)NotImplementedr   r$   s     r    __eq__AbstractRetry.__eq__/   s    r#   c                 l    [        U R                  U R                  [        U R                  5      45      $ r'   )hashr   r   	frozensetr   r   s    r    __hash__AbstractRetry.__hash__3   s'    T]]DMM9T=S=S3TUVVr#   specified_errorsNc                 b    [        [        U R                  [        U5      -   5      5      U l        g)z=
Updates the supported errors with the specified error types
N)tuplesetr   )r   r2   s     r    update_supported_errors%AbstractRetry.update_supported_errors6   s*     "'&&/?)@@A"
r#   c                     U R                   $ )z
Get the number of retries.
r   r/   s    r    get_retriesAbstractRetry.get_retries>   s     }}r#   valuec                     Xl         g)z
Set the number of retries.
Nr9   )r   r<   s     r    update_retriesAbstractRetry.update_retriesD   s	     r#   r   )__name__
__module____qualname____firstlineno____doc__r
   r   r   __annotations__intr!   abcabstractmethodr   boolr*   r0   r   r6   r:   r>   __static_attributes__ r#   r    r   r      s    :T!Wc\**2"2 2  Q-	2" 	C D  W# W
a8I 
d 
S C D r#   r   c            
          ^  \ rS rSr\R
                  r\\\R                  44SSS\
S\\\   S4   4U 4S jjjrS\S	\4S
 jr SS\/ \4   S\\/\4   S\\\/\4      S	\4S jjrSrU =r$ )RetryK   r   r   r   r   .c                 &   > [         TU ]  XU5        g r'   )superr!   )r   r   r   r   	__class__s       r    r!   Retry.__init__N   s     	+;<r#   r$   r%   c                    [        U[        5      (       d  [        $ U R                  UR                  :H  =(       aK    U R                  UR                  :H  =(       a+    [        U R                  5      [        UR                  5      :H  $ r'   )
isinstancerM   r(   r   r   r5   r   r)   s     r    r*   Retry.__eq__Z   sf    %''!! MMU^^+ L/LD**+s53J3J/KK	
r#   dofailis_retryablec                 h   U R                   R                  5         Sn  U" 5       $ ! U R                   ay  nU(       a  U" U5      (       d  e US-  nU" U5        U R                  S:  a  X@R                  :  a  UeU R                   R	                  U5      nUS:  a  [        U5         SnAOSnAff = fM  )z
Execute an operation that might fail and returns its result, or
raise the exception that was thrown depending on the `Backoff` object.
`do`: the operation to call. Expects no argument.
`fail`: the failure handler, expects the last error that was thrown
r      N)r   resetr   r   computer   )r   rV   rW   rX   failureserrorr   s          r    call_with_retryRetry.call_with_retryd   s     	#t)) 	#U(;(;AU==A%(]]*BK--//9Q;'N	# s   & B/A/B**B/rK   r'   )r@   rA   rB   rC   r   r0   r   r   sockettimeoutrF   r
   r   	Exceptionr!   r   rI   r*   r   r   r	   r_   rJ   __classcell__)rQ   s   @r    rM   rM   K   s    %%H NN9
	
="
= 
=  Y 45	
= 
=
C 
D 
 ?C	#RUO# 	{C'(# xT(9:;	#
 
# #r#   rM   )rG   ra   timer   typingr   r   r   r   r   r	   r
   r   r   redis.exceptionsr   r   r   rc   r   redis.backoffr   ABCr   rM   rK   r#   r    <module>rj      sg    
  
 
 
 ;CLCyD1-/GAJ /d3#M)$ 3#r#   