ó
    R§•jÂ  ã                   ó˜   • S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
  S rS rS rSS	 jr " S
 S\5      r " S S\5      rg)zE
Helpers for logging.

This module needs much love to become useful.
é    )Úprint_functionNé   )Úmkdirpc                 ól   • [         R                  R                  S5      (       a  [        SU S-
  5      $ U $ )z–Remove .1s to the time under Windows: this is the time it take to
stat files. This is needed to make results similar to timings under
Unix, for tests
Úwinr   gš™™™™™¹?)ÚsysÚplatformÚ
startswithÚmax©Úts    Ú›C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\joblib/logger.pyÚ_squeeze_timer      s.   € ô
 ‡|�|×Ñ˜u×%Ñ%Ü�1�a˜#‘g‹Ðàˆó    c                 ó*   • [        U 5      n SX S-  4-  $ )a  Format a duration in seconds as a human-readable string.

Returns both seconds and minutes, e.g. ``'12.3s, 0.2min'``.

Parameters
----------
t : float
    Duration in seconds.

Returns
-------
str
    Formatted string showing the duration in seconds and minutes.
z%.1fs, %.1fminç      N@©r   r   s    r   Úformat_timer   "   s   € ô 	�aÓ€AØ˜q d¡(˜mÑ+Ð+r   c                 ó>   • [        U 5      n U S:”  a  SU S-  -  $ SU -  $ )a1  Format a duration in seconds as a compact human-readable string.

Returns minutes for durations over 60 seconds, otherwise seconds.

Parameters
----------
t : float
    Duration in seconds.

Returns
-------
str
    Formatted string: ``'  42.0s'`` for short durations or
    ``' 1.2min'`` for longer ones.
é<   z%4.1fminr   z %5.1fsr   r   s    r   Úshort_format_timer   5   s.   € ô  	�aÓ€AØˆ2ƒvØ˜Q ™XÑ&Ð&à˜A‰Ðr   c                 óÚ   • S[         R                  ;   a&  SSKnUR                  5       nUR	                  SSSS9  OSn[
        R                  " XUS9nU(       a  WR                  " S	0 UD6  U$ )
aû  Return a pretty-printed string representation of an object.

Uses :func:`pprint.pformat` with numpy print options temporarily
reduced to keep output concise when numpy is available.

Parameters
----------
obj : object
    The object to format.
indent : int, optional
    Indentation level passed to :func:`pprint.pformat`. Default is 0.
depth : int, optional
    Maximum nesting depth passed to :func:`pprint.pformat`. Default is 3.

Returns
-------
str
    Pretty-printed string representation of ``obj``.
Únumpyr   Né   é@   r   )Ú	precisionÚ	thresholdÚ	edgeitems)ÚdepthÚindent© )r   Úmodulesr   Úget_printoptionsÚset_printoptionsÚpprintÚpformat)Úobjr    r   ÚnpÚprint_optionsÚouts         r   r&   r&   L   sd   € ð( ”#—+‘+ÓÛà×+Ñ+Ó-ˆØ
×Ñ a°2ÀÐÒCàˆÜ
�.Š.˜°&Ñ
9€CÞØ
×ÒÑ,˜mÒ,Ø€Jr   c                   ó>   • \ rS rSrSrS
S jrS rS rS rSS jr	S	r
g)ÚLoggerép   z Base class for logging messages.Nc                 ó:   • Xl         U(       a  X l        gSU l        g)zœ
Parameters
----------
depth: int, optional
    The depth of objects printed.
name: str, optional
    The namespace to log to. If None, defaults to joblib.
ÚjoblibN)r   Ú_name)Úselfr   Únames      r   Ú__init__ÚLogger.__init__s   s   € ð Œ
Þ!�T�
 xˆ�
r   c                 ór   • [         R                  " U R                  5      R                  SU < SU< 35        g ©NÚ[z]: )ÚloggingÚ	getLoggerr0   Úwarning©r1   Úmsgs     r   ÚwarnÚLogger.warn   s$   € Ü×Ò˜$Ÿ*™*Ó%×-Ò-»DÂ#Ð.FÕGr   c                 ó@   • [         R                  " SU < SU< 35        g r6   )r8   Úinfor;   s     r   r@   ÚLogger.info‚   s   € Ü�‹£4ªÐ-Õ.r   c                 ór   • [         R                  " U R                  5      R                  SU < SU< 35        g r6   )r8   r9   r0   Údebugr;   s     r   rC   ÚLogger.debug…   s$   € ä×Ò˜$Ÿ*™*Ó%×+Ò+»$ÂÐ,DÕEr   c                 ó*   • [        XU R                  S9$ )z2Return the formatted representation of the object.)r    r   )r&   r   )r1   r'   r    s      r   ÚformatÚLogger.format‰   s   € ä�s°·±Ñ<Ð<r   )r0   r   )é   N)r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r3   r=   r@   rC   rF   Ú__static_attributes__r!   r   r   r,   r,   p   s    † Ù*ô
0òHò/òF÷=r   r,   c                   ó,   • \ rS rSrSrSS jrSS jrSrg)	Ú	PrintTimeé‘   z3Print and log messages while keeping track of time.Nc                 ó  • Ub  Ub  [        S5      e[        R                  " 5       U l        U R                  U l        Ub   [        R
                  R                  US5      nXl        Ubú  [        [        R
                  R                  U5      5        [        R
                  R                  U5      (       aT  [        SS5       H*  n [        R                  " USU-  -   USUS-   -  -   5        M,      [        R                  " XS-   5         [        US5       nUR!                  S5        UR!                  S	[        R"                  " U R                  5      -  5        S S S 5        g g !    M¨  = f!    Ng= f! , (       d  f       g = f!    g = f)
Nz&Cannot specify both logfile and logdirz
joblib.logr   é	   z.%iz.1Úwz
Logging joblib python script
z

---%s---
)Ú
ValueErrorÚtimeÚ	last_timeÚ
start_timeÚosÚpathÚjoinÚlogfiler   ÚdirnameÚexistsÚrangeÚshutilÚmoveÚcopyÚopenÚwriteÚctime)r1   r\   ÚlogdirÚis       r   r3   ÚPrintTime.__init__”   s;  € ØÑ 6Ñ#5ÜÐEÓFÐFäŸš›ˆŒØŸ.™.ˆŒØÑÜ—g‘g—l‘l 6¨<Ó8ˆGØŒØÑÜ”2—7‘7—?‘? 7Ó+Ô,Ü�w‰w�~‰~˜g×&Ñ&ä˜q !ž�Að1ÜŸš G¨e°a©iÑ$7¸À5ÈAÐPQÉEÁ?Ñ9RÖSñ %ð-Ü—K’K °4©Ô8ðÜ˜' 3Ô'¨7Ø—M‘MÐ"DÔEØ—M‘M .´4·:²:¸d¿n¹nÓ3MÑ"MÔN÷ (Ð'ð! øð1Ú0ûð
-Ù,úç'Õ'ûðñúsC   Ã&E$Ã0E, Ä
F ÄAE3ÅF Å$E)Å,E0Å3
FÅ=F ÆF ÆFc                 óÔ  • U(       d5  [         R                   " 5       U R                  -
  nU< S[        U5      < 3nO,[         R                   " 5       U R                  -
  nSXUS-  4-  n[	        U[
        R                  S9  U R                  b)   [        U R                  S5       n[	        XES9  SSS5        [         R                   " 5       U l        g! , (       d  f       N)= f!    N0= f)z]Print the time elapsed between the last call and the current
call, with an optional message.
z: z%s: %.2fs, %.1f minr   )ÚfileNÚa)	rV   rW   r   rX   Úprintr   Ústderrr\   rc   )r1   r<   ÚtotalÚ
time_lapseÚfull_msgÚfs         r   Ú__call__ÚPrintTime.__call__¸   s°   € ö ÜŸš› t§~¡~Ñ5ˆJÛ#&¬°JÕ(?Ð@‰Hô Ÿš› t§¡Ñ6ˆJØ,°ÀÈbÁÐ/QÑQˆHÜˆhœSŸZ™ZÒ(Ø�<‰<Ñ#ðÜ˜$Ÿ,™,¨Ô,°Ü˜(Ò+÷ -ô Ÿš›ˆ�÷ -Õ,ûðñús*   ÂC# Â%
CÂ/C# Ã
C ÃC# Ã C# Ã#C')rW   r\   rX   )NN)Ú F)rI   rJ   rK   rL   rM   r3   rr   rN   r!   r   r   rP   rP   ‘   s   † Ù=ô ÷H%r   rP   )r   rH   )rM   Ú
__future__r   r8   rY   r%   r`   r   rV   Údiskr   r   r   r   r&   Úobjectr,   rP   r!   r   r   Ú<module>rx      sR   ðñõ &ã Û 	Û Û Û 
Û å òò,ò&ô.ôH=ˆVô =ôB>%�õ >%r   