Ë
    ~¾�j—  ã                   ó²   — d dl Z d dlZd dlZd dlZd dlmZ ddlmZ  e j                  e	«      Z
edd ddd e
ddf	d„Zedd ddd e
ddf	d„Zddedd ddd e
ddfd	„Zy)
é    N)Úpartialé   ©Ú	decoratoréÿÿÿÿFc
           
      ó†  — ||}}
|
r		  | «       S yy# |$ �r#}|	� |	|«      rY d}~y|
dz  }
|
s‚ |�­	 | j                   j                  }n$# t        $ r t        | j                   «      }Y nw xY w|j	                  dj                  |j                  j                  || j                   j                  ||«      «       |r#|j	                  t        j                  «       «       t        j                  |«       ||z  }t        |t        «      r|t        j                  |Ž z  }n||z  }|�t!        ||«      }Y d}~nd}~ww xY w|
r�Œ:�Œ4)aC  
    Executes a function and retries it if it failed.

    :param f: the function to execute.
    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
    :param tries: the maximum number of attempts. default: -1 (infinite).
    :param delay: initial delay between attempts. default: 0.
    :param max_delay: the maximum value of delay. default: None (no limit).
    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
    :param jitter: extra seconds added to delay between attempts. default: 0.
                   fixed if a number, random if a range tuple (min, max)
    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
                   default: retry.logging_logger. if None, logging is disabled.
    :param on_exception: handler called when exception occurs. will be passed the captured
                         exception as an argument. further retries are stopped when handler
                         returns True. default: None
    :returns: the result of the f function.
    Nr   z*{}: {} in {}.{}, retrying in {} seconds...)ÚfuncÚ__qualname__ÚAttributeErrorÚstrÚwarningÚformatÚ	__class__Ú
__module__Ú	tracebackÚ
format_excÚtimeÚsleepÚ
isinstanceÚtupleÚrandomÚuniformÚmin)ÚfÚ
exceptionsÚtriesÚdelayÚ	max_delayÚbackoffÚjitterÚloggerÚlog_tracebackÚon_exceptionÚ_triesÚ_delayÚeÚfunc_qualnames                 úJ/var/www/api.ozpay.ru/ozpay/venv/lib/python3.12/site-packages/retry/api.pyÚ__retry_internalr)      s6  € ð( ˜EˆF€FÙ
ð	0Ù“3ˆJøð øð ó 	0ØÐ'Ù ”?Üà�a‰KˆFÙØàÐ!ð0Ø%&§V¡V×%8Ñ%8‘MøÜ%ò 0Ü$'¨¯©£K’Mð0úà—‘ÐK×RÑRÐST×S^ÑS^×SkÑSkÐmnØ Ÿv™v×0Ñ0°-Àó Iô Já Ø—N‘N¤9×#7Ñ#7Ó#9Ô:ä�J‰J�vÔØ�gÑˆFä˜&¤%Ô(Øœ&Ÿ.™.¨&Ð1Ñ1‘à˜&Ñ �àÐ$Ü˜V YÓ/�ÿøð9	0úó ùs=   ˆ ‘D:—
D5¦
D5±AÁD5ÁA)Á&D5Á(A)Á)CD5Ä5D:c	           
      óD   ‡ ‡‡‡‡‡‡‡‡— t         ˆˆˆ ˆˆˆˆˆˆf	d„«       }	|	S )aö  Returns a retry decorator.

    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
    :param tries: the maximum number of attempts. default: -1 (infinite).
    :param delay: initial delay between attempts. default: 0.
    :param max_delay: the maximum value of delay. default: None (no limit).
    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
    :param jitter: extra seconds added to delay between attempts. default: 0.
                   fixed if a number, random if a range tuple (min, max)
    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
                   default: retry.logging_logger. if None, logging is disabled.
    :param on_exception: handler called when exception occurs. will be passed the captured
                         exception as an argument. further retries are stopped when handler
                         returns True. default: None
    :returns: a retry decorator.
    c                 ó~   •	— |r|n	t        «       }|r|n	t        «       }t        t        | g|¢­i |¤Ž‰‰‰‰‰‰‰
‰	‰«
      S )N©ÚlistÚdictr)   r   )r   ÚfargsÚfkwargsÚargsÚkwargsr   r   r   r    r"   r!   r   r#   r   s        €€€€€€€€€r(   Úretry_decoratorzretry.<locals>.retry_decoratorV   sP   ø€ á‰u¤4£6ˆÙ#‘¬«ˆÜ¤¨Ð ;¨DÒ ;°FÑ ;¸ZÈÐPUÐW`ÐbiÐkqØ &¨°|óEð 	Eó    r   )
r   r   r   r   r   r    r!   r"   r#   r3   s
   ````````` r(   Úretryr5   C   s(   ÿø€ ô& ÷Eó Eó ðEð Ðr4   c                 ó|   — |r|n	t        «       }|r|n	t        «       }t        t        | g|¢­i |¤Ž|||||||	|
|«
      S )aÏ  
    Calls a function and re-executes it if it failed.

    :param f: the function to execute.
    :param fargs: the positional arguments of the function to execute.
    :param fkwargs: the named arguments of the function to execute.
    :param exceptions: an exception or a tuple of exceptions to catch. default: Exception.
    :param tries: the maximum number of attempts. default: -1 (infinite).
    :param delay: initial delay between attempts. default: 0.
    :param max_delay: the maximum value of delay. default: None (no limit).
    :param backoff: multiplier applied to delay between attempts. default: 1 (no backoff).
    :param jitter: extra seconds added to delay between attempts. default: 0.
                   fixed if a number, random if a range tuple (min, max)
    :param logger: logger.warning(fmt, error, delay) will be called on failed attempts.
                   default: retry.logging_logger. if None, logging is disabled.
    :param on_exception: handler called when exception occurs. will be passed the captured
                         exception as an argument. further retries are stopped when handler
                         returns True. default: None
    :returns: the result of the f function.
    r,   )r   r/   r0   r   r   r   r   r   r    r!   r"   r#   r1   r2   s                 r(   Ú
retry_callr7   `   sO   € ñ, ‰5œt›v€DÙ‰W¤T£V€FÜœG AÐ7¨Ò7°Ñ7¸ÀUÈEÐS\Ð^eÐgmÐouØ)¨<ó9ð 9r4   )Úloggingr   r   r   Ú	functoolsr   Úcompatr   Ú	getLoggerÚ__name__Úlogging_loggerÚ	Exceptionr)   r5   r7   © r4   r(   ú<module>r@      s‡   ðÛ Û Û Û Ý å à"�×"Ñ" 8Ó,€ð $-°B¸aÈ4ÐYZÐcdØ*¸%Èdó40ðn  b°¸TÈ1ÐUVÐ_mØ¨Dóð:  d°yÈÐRSÐ_cÐmnØ ¸eÐRVô9r4   