
    ng\j                         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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Union)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       F/home/edenadmin/noVNC/venv/lib/python3.13/site-packages/redis/retry.py__init__AbstractRetry.__init__   s      !1    otherreturnc                     [         $ N)NotImplementedr    r%   s     r!   __eq__AbstractRetry.__eq__0   s    r$   c                 l    [        U R                  U R                  [        U R                  5      45      $ r(   )hashr   r   	frozensetr   r    s    r!   __hash__AbstractRetry.__hash__4   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    r3   s     r!   update_supported_errors%AbstractRetry.update_supported_errors7   s*     "'&&/?)@@A"
r$   c                     U R                   $ )z
Get the number of retries.
r   r0   s    r!   get_retriesAbstractRetry.get_retries?   s     }}r$   valuec                     Xl         g)z
Set the number of retries.
Nr:   )r    r=   s     r!   update_retriesAbstractRetry.update_retriesE   s	     r$   r   )__name__
__module____qualname____firstlineno____doc__r
   r   r   __annotations__intr"   abcabstractmethodr   boolr+   r1   r   r7   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   \\\
/\4   4   S\\\/\4      S\S	\4
S jjrSrU =r$ )RetryL   r   r   r   r   .c                 &   > [         TU ]  XU5        g r(   )superr"   )r    r   r   r   	__class__s       r!   r"   Retry.__init__O   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(   )
isinstancerN   r)   r   r   r6   r   r*   s     r!   r+   Retry.__eq__[   sf    %''!! MMU^^+ L/LD**+s53J3J/KK	
r$   dofailis_retryablewith_failure_countc                    U R                   R                  5         Sn  U" 5       $ ! U R                   a  nU(       a  U" U5      (       d  e US-  nU(       a	  U" Xe5        OU" U5        U R                  S:  a  XPR                  :  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  )a  
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
``is_retryable``: optional function to determine if an error is retryable
``with_failure_count``: if True, the failure count is passed to the failure handler
r      N)r   resetr   r   computer   )r    rW   rX   rY   rZ   failureserrorr   s           r!   call_with_retryRetry.call_with_retrye   s     	#t)) #U(;(;A%)K==A%(]]*BK--//9Q;'N# s   & B?A?B::B?rL   )NF)rA   rB   rC   rD   r   r1   r   r   sockettimeoutrG   r
   r   	Exceptionr"   r   rJ   r+   r   r   r   r	   ra   rK   __classcell__)rR   s   @r!   rN   rN   L   s    %%H NN9
	
="
= 
=  Y 45	
= 
=
C 
D 
 ?C#("#RUO"# Hi[#-.)S9I39N0OOP"# xT(9:;	"#
 !"# 
"# "#r$   rN   )rH   rc   timer   typingr   r   r   r   r   r	   r
   r   r   r   redis.exceptionsr   r   r   re   r   redis.backoffr   ABCr   rN   rL   r$   r!   <module>rl      sg    
     ;CLCyD1-/GAJ /d;#M)$ ;#r$   