+
    ÁFñj–  ã                   ó~   € R t ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RIH	t	H
t
HtHt ]! ]4      tRRRRRRRR	/R
 R lltR# )a  This module contains a network retry loop implementation.
Its specifically tailored to handling the Telegram API and its errors.

.. versionadded:: 21.11

Hint:
    It was originally part of the `Updater` class, but as part of #4657 it was extracted into its
    own module to be used by other parts of the library.

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
N)ÚCallableÚ	Coroutine)Ú
get_logger)ÚInvalidTokenÚ
RetryAfterÚTelegramErrorÚTimedOutÚ	on_err_cbÚ
stop_eventÚ
is_runningÚrepeat_on_successFc                ó
  € V ^8„  d   QhR\         R\        3,          R\         \        .R3,          R,          R\        R\        R\
        P                  R,          R\         . \        3,          R,          R	\        R
\        RR/	# )é   Ú	action_cb.r	   NÚdescriptionÚintervalr
   r   Úmax_retriesr   Úreturn)	r   r   r   ÚstrÚfloatÚasyncioÚEventÚboolÚint)Úformats   "ÚU/opt/hermes-site/venv/lib/python3.14/site-packages/telegram/ext/_utils/networkloop.pyÚ__annotate__r   ,   s    € ÷ \.ñ \.ä˜œY˜Õ'ð\.ô œ˜¨Ð-Õ.°Õ5ð\.ô ð	\.ô
 ð\.ô —‘ Õ$ð\.ô ˜œT˜Õ" TÕ)ð\.ô ð\.ô ð\.ð 
ñ\.ó    c              ƒ  óÈ  a aaa"  € V'       d   S^ 8¼  d   \        R4      hRV R2oT;'       g    R pRR VV3R lllp	R V VV3R llp
\        P                  R	S4       Tp^ pV! 4       '       dq    V
! 4       G R
j  x€L
  V'       g#   \        P                  RS4        V^,          pR
#  TpT^,          pT'       g   K]  \        P                  ! T4      G R
j  x€L
  K}  R
#  Lf  \         dD   pRpYíP                  P                  4       ,           pT RT R2pT	! YÏ4      '       d   h  R
p?L€R
p?i\         d"   p^ pRT R2pT	! YÏ4      '       d   h  R
p?LªR
p?i\         d    \        P                  RS4       h \         dG   pT'       d	   T! T4       T	! T4      '       d   h T^ 8X  d   ^M\        ^RT,          4      p R
p?ELR
p?ii ; i  T^,          pi ; i EL5i)ap  Perform a loop calling `action_cb`, retrying after network errors.

Stop condition for loop in case of ``max_retries < 0``:
    * `is_running()` evaluates :obj:`False`
    * `stop_event` is set.
    * calling `action_cb` succeeds and `repeat_on_success` is :obj:`False`.

Additional stop condition for loop in case of `max_retries >= 0``:
    * a call to `action_cb` succeeds
    * or `max_retries` is reached.

Args:
    action_cb (:term:`coroutine function`): Network oriented callback function to call.
    on_err_cb (:obj:`callable`): Optional. Callback to call when TelegramError is caught.
        Receives the exception object as a parameter.

        Hint:
            Only required if you want to handle the error in a special way. Logging about
            the error is already handled by the loop.

        Important:
            Must not raise exceptions! If it does, the loop will be aborted.
    description (:obj:`str`): Description text to use for logs and exception raised.
    interval (:obj:`float` | :obj:`int`): Interval to sleep between each call to
        `action_cb`.
    stop_event (:class:`asyncio.Event` | :obj:`None`): Event to wait on for stopping the
        loop. Setting the event will make the loop exit even if `action_cb` is currently
        running. Defaults to :obj:`None`.
    is_running (:obj:`callable`): Function to check if the loop should continue running.
        Must return a boolean value. Defaults to `lambda: True`.
    max_retries (:obj:`int`): Maximum number of retries before stopping the loop.

        * < 0: Retry indefinitely.
        * 0: No retries.
        * > 0: Number of retries.

    repeat_on_success (:obj:`bool`): Whether to repeat the action after a successful call.
        Defaults to :obj:`False`.

Raises:
    ValueError: When passing `repeat_on_success=True` and `max_retries >= 0`. This case is
        currently not supported.

z7Cannot use repeat_on_success=True with max_retries >= 0zNetwork Retry Loop (z):c                  ó   € R # )T© r    r   r   Ú<lambda>Ú$network_retry_loop.<locals>.<lambda>h   s   € ±$r   c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   Úcurrent_retriesÚexception_infor   )r   r   r   )r   s   "r   r   Ú(network_retry_loop.<locals>.__annotate__j   s"   € ÷ ñ ´3ð Ìð ÔUYñ r   c                óª   <€ V'       d   S RV 2MSpS^ 8  g   V S8  d   \         P                  RVV S4       R# \         P                  RVV S4       R# )a  Check if max retries reached and log accordingly.

Args:
    current_retries: The current retry count.
    exception_info: Additional context about the exception (e.g., "Timed out: ...").

Returns:
    bool: True if max retries reached (should abort), False otherwise (should retry).
Ú z(%s Failed run number %s of %s. Retrying.Fz(%s Failed run number %s of %s. Aborting.T)Ú_LOGGERÚdebugÚ	exception)r$   r%   Úprefix_with_infoÚ
log_prefixr   s   && €€r   Úcheck_max_retries_and_logÚ5network_retry_loop.<locals>.check_max_retries_and_logj   sh   ø€ ÷ @N˜j˜\¨¨>Ð*:Ñ;ÐS]Ðà˜Œ?˜o°Ô;Ü�M‰MØ:Ø ØØô	ñ Ü×ÑØ6ØØØô		
ñ r   c                ó   € V ^8„  d   QhRR/# )r   r   Nr    )r   s   "r   r   r&   †   s   € ÷  ñ  ˜Tñ  r   c               “   óH  <"  € S'       g   S! 4       G R j  x€L
  R # \         P                  ! S! 4       4      p \         P                  ! SP                  4       4      p\         P                  ! W3\         P                  R7      G R j  x€L
 w  r#\        P
                  ! \         P                  4      ;_uu_ 4        V F  pVP                  4        K  	  R R R 4       W9   d   \        P                  RS4       R # V P                  4        R #  Lô L†  + '       g   i     LD; i5i)N)Úreturn_whenz%s Cancelled)r   Úcreate_taskÚwaitÚFIRST_COMPLETEDÚ
contextlibÚsuppressÚCancelledErrorÚcancelr)   r*   Úresult)Úaction_cb_taskÚ	stop_taskÚdoneÚpendingÚtaskr   r-   r
   s        €€€r   Ú	do_actionÚ%network_retry_loop.<locals>.do_action†   sÍ   øé € ßÙ“+×ÐÙä ×,Ò,©Y«[Ó9ˆÜ×'Ò'¨
¯©Ó(9Ó:ˆ	Ü%ŸlšlØÐ'´W×5LÑ5Lô
÷ 
‰ˆô × Ò ¤×!7Ñ!7×8Õ8Û�Ø—‘–ñ  ÷ 9ð ÔÜ�M‰M˜.¨*Ô5Ùð 	×ÑÖñ% ñ

÷ 9×8üs:   ƒD"–D—A/D"ÂDÂ2D"Â9DÃ9D"ÄD"ÄD	ÄD"z%s StartingNz#%s Action succeeded. Stopping loop.g      à?z	. Adding z seconds to the specified time.zTimed out: Ú.z&%s Invalid token. Aborting retry loop.g      ø?)Ú )Ú
ValueErrorr)   r*   r   Ú_retry_afterÚtotal_secondsr   r   r+   r   Úminr   Úsleep)r   r	   r   r   r
   r   r   r   Úeffective_is_runningr.   r@   Úcur_intervalÚretriesÚexcÚ
slack_timer%   ÚtoeÚtelegram_excr-   s   d$$$d$d$          @r   Únetwork_retry_looprP   ,   sÐ  ûé € ÷n ˜[¨AÔ-äÐRÓSÐSà'¨ }°BÐ7€JØ%×7Ð7©,Ð÷ó ÷8 ò  ô, ‡M�M�- Ô,Ø€LØ€GÙ
×
 Ò
 ð%	Ù“+×Ðß$Ü—‘ÐCÀZÔPØðB �q�LŠGðG %ðB $ˆLà�q�LˆGç‰<Ü—-’- Ó-×-Ò-ñS !áøô ô 	ØˆJà%×(8Ñ(8×(FÑ(FÓ(HÕHˆLØ #˜u I¨j¨\Ð9XÐYˆNñ )¨×AÒAØô Bûäô 	àˆLØ*¨3¨%¨qÐ1ˆNñ )¨×AÒAØô Bûäô 	Ü×ÑÐFÈ
ÔSØÜô 	SßÙ˜,Ô'á(¨×1Ò1Øð !-°Ô 1™1´s¸2¸sÀ\Õ?QÓ7RŽLûð	Sûð �q�L‰Gúò .ùs³   †)G"°AG"Á3
C& Á=C$Á>C& Â
C& Â!G"Â-G Â/G"ÃG"ÃGÃG"Ã$C& Ã&GÃ19D/Ä*G Ä/GÄ<GÄ=EÅG ÅGÅ& GÆGÆG	Æ&G	ÇG Ç	GÇG ÇGÇG")Ú__doc__r   r6   Úcollections.abcr   r   Útelegram._utils.loggingr   Útelegram.errorr   r   r   r   Ú__name__r)   rP   r    r   r   Ú<module>rV      s`   ðñ&ó Û ß /å .ß LÓ Lá
�XÓ
€ð\.ð 9=ð\.ð (,ð\.ð -1ð\.ð $÷\.ñ \.r   