ó
    &ÝNjI  ã                   ó€   • S r SSKrSSKrSSKJrJrJr  SSKJr  \R                  " \
5      rS\4S jr " S S\5      rg)	z%Progress-to-logs tqdm implementation.é    N)ÚdatetimeÚ	timedeltaÚtimezone)ÚtqdmÚreturnc                  ó¶   • [         R                  S:¼  a0  [        R                  " S[        R
                  S9R                  SS9$ [        R                  " S5      $ )zQReturn the Unix epoch as a naive UTC datetime, compatible across Python versions.)é   é   r   )ÚtzN)Útzinfo)ÚsysÚversion_infor   Úfromtimestampr   ÚutcÚreplaceÚutcfromtimestamp© ó    ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/tqdm_loggable/tqdm_logging.pyÚ
_utc_epochr      sF   € ä
×Ñ˜7Ó"Ü×%Ò% a¬H¯L©LÑ9×AÑAÈÐAÐNÐNä×(Ò(¨Ó+Ð+r   c                   óª   ^ • \ rS rSrSr\R                  r\" SS9r	U 4S jr
\S\4S j5       r\S\4S	 j5       rSU 4S
 jjrS\4S jrS rS rSrU =r$ )Útqdm_loggingé   a-  A tqdm implementation that outputs to Python logger.

- Any postfix progress bar arguments are passed as `extras` to the logging system

- The log has structured data available; all logs are tagged with `{"tqdm": True}`
  so they can be filtered out in the log management service

- Default rate of creating messages is lower than the usually progress bar
  update rate of 1 Htz, because we do not want to spam the logs

See also

- `Implementing structured logging <https://docs.python.org/3/howto/logging-cookbook.html#implementing-structured-logging>`_.
é
   ©Úsecondsc                 óR   >• [        SSS5      U l        [        [        U ]  " U0 UD6  g )Ni²  é   )r   Úlast_log_message_atÚsuperr   Ú__init__)ÚselfÚargsÚkwargsÚ	__class__s      €r   r!   Útqdm_logging.__init__,   s(   ø€ Ü#+¨D°!°QÓ#7ˆÔ ÜŒl˜DÒ*¨DÐ;°FÓ;r   Ú	log_levelc                 ó   • Xl         g)z£Set log level to all tqdm_logging instances.

Currently we do not support per-instance logging level
to maintain argument compatibility with std.tqdm constructor.
N)r'   )Úclsr'   s     r   Ú	set_levelÚtqdm_logging.set_level0   s	   € ð "�r   Úratec                 ó>   • [        U[        5      (       d   eXl        g)z-Set the rate how often we post a log message.N)Ú
isinstancer   Úlog_message_rate)r)   r,   s     r   Úset_log_rateÚtqdm_logging.set_log_rate9   s   € ô ˜$¤	×*Ñ*Ð*Ð*Ø#Õr   c                 ó<   >• Xl         [        [        U ]  " X40 UD6  g)z$Overloaded to store the raw post-fixN)Úraw_postfixr    r   Úset_postfix)r"   Úordered_dictÚrefreshr$   r%   s       €r   r4   Útqdm_logging.set_postfix?   s   ø€ à'ÔÜŒl˜DÒ-¨lÑNÀvÓNr   r   c                 óŠ   • U R                   (       a  g[        R                  " 5       U R                  -
  U R                  :”  a  gg)z5Check if we throttle down displays to reduce log spamFT)Údisabler   Únowr   r/   ©r"   s    r   Úshould_throttle_loggingÚ$tqdm_logging.should_throttle_loggingD   s3   € ð �<�<Øä�<Š<‹>˜D×4Ñ4Ñ4°t×7LÑ7LÓLØàr   c                 óx  • U R                  5       (       a  gU R                  nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  SS5      nUR                  S	S5      nUR                  S
S5      n	UR                  SS5      n
U	(       a,  U
(       a%  U R                  X–U5      nU R                  X¦U5      nOU	nU
nU=(       d    SnU=(       d    SnU(       a  U
(       a  X©-
  U-  OSnU(       a  [        R
                  " U5      OSn U(       a&  U
(       a  [        R                  " 5       [        US9-   O	[        5       n[        R
                  " U5      nU(       a  US:”  a	  US U S3nOSU-  S SU 3nOSn[        U S0 5      nU=(       d    SnSUUUUU	U
UUR                  5       US.
n[        R                  U R                   SUUUUUUUUS9
  [        R                  " 5       U l        g! [         a    [        R                  n NÊf = f)z,Create a log entry for the current progress.NÚprefixÚunknownÚpostfixr,   r   ÚunitÚunit_divisorÚelapsedÚnÚtotaléÿÿÿÿÚ-Ú?r   r   z,.1fz/szs/r3   T)
r   Úprogress_namer,   rB   rD   rE   rF   rA   ÚetaÚ	remainingz?Progress on:%s %s/%s rate:%s remaining:%s elapsed:%s postfix:%s)Úextra)r<   Úformat_dictÚgetÚformat_sizeofÚ	tqdm_autoÚformat_intervalr   r:   r   r   ÚOverflowErrorÚmaxÚgetattrÚ	isoformatÚloggerÚlogr'   r   )r"   r$   rN   ÚnamerA   r,   rB   rC   rD   rE   rF   Ún_formattedÚtotal_formattedrL   Úremaining_strÚeta_dtÚelapsed_strÚrate_formattedr3   Úpostfix_strÚstructured_logss                        r   ÚdisplayÚtqdm_logging.displayP   s1  € ð ×'Ñ'×)Ñ)Øð ×&Ñ&ˆØ�‰˜x¨Ó3ˆØ—/‘/ )¨TÓ2ˆØ�‰˜v qÓ)ˆØ�‰˜v tÓ,ˆØ"—‘ ~°tÓ<ˆØ—/‘/ )¨QÓ/ˆØ�O‰O˜C Ó#ˆØ—‘ ¨Ó,ˆæ–Ø×,Ñ,¨Q°lÓCˆKØ"×0Ñ0°¸lÓK‰Oð ˆKØ#ˆOà!×( SˆØ)×0¨Sˆö +/¶5�U‘Y $Ò&¸aˆ	Þ@Dœ	×1Ò1°)Ô<È#ˆð	"æ¦%ô —l’l“n¤y¸Ñ'CÒCÜ-7«\ð ô
  ×/Ò/°Ó8ˆæØ�a‹xØ$(¨ ;¨t¨f°BÐ!7‘à$% d¡F¨4 =°°4°&Ð!9‘à ˆNô ˜d M°2Ó6ˆà—n ˆð Ø!ØØØØØð #Ø×#Ñ#Ó%Ø"ñ
ˆô  	�
‰
Ø�N‰NØMØØØØØØØØ!ð 	ñ 	
ô $,§<¢<£>ˆÕ øôa ó 	"Ü—\‘\ŠFð	"ús   Ä77H ÈH9È8H9c                 óV   • U R                   (       a  g SU l         U R                  5         g ©NT)r9   rb   r;   s    r   ÚcloseÚtqdm_logging.close©   s   € Ø�<�<Øð ˆŒà�‰�r   )r9   r   r3   re   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚloggingÚINFOr'   r   r/   r!   ÚclassmethodÚintr*   r0   r4   Úboolr<   rb   rf   Ú__static_attributes__Ú__classcell__)r%   s   @r   r   r      s~   ø† ñð  —‘€Iñ !¨Ñ,Ðõ<ð ð" #ó "ó ð"ð ð$ 	ó $ó ð$÷
Oð

¨ô 
òW2÷rð r   r   )rl   rm   r   r   r   r   Ú	tqdm.autor   rQ   Ú	getLoggerrh   rW   r   r   r   r   r   Ú<module>rv      sC   ðÙ +ã Û 
ß 2Ñ 2å 'ð 
×	Ò	˜8Ó	$€ð,�Hô ,ô[�9õ [r   