
    7Th                         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 $ )zRemove .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    E/var/www/auris/envauris/lib/python3.13/site-packages/joblib/logger.py_squeeze_timer      s.    
 ||u%%1a#g    c                 *    [        U 5      n SX S-  4-  $ )Nz%.1fs, %.1fmin      N@r   r   s    r   format_timer   "   s    aAqd(m++r   c                 >    [        U 5      n U S:  a  SU S-  -  $ SU -  $ )N<   z%4.1fminr   z %5.1fsr   r   s    r   short_format_timer   '   s,    aA2v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$ )	Nnumpyr      @   r   )	precision	threshold	edgeitems)depthindent )r   modulesr   get_printoptionsset_printoptionspprintpformat)objr    r   npprint_optionsouts         r   r&   r&   /   sb    #++++-
a2C
..&
9C
,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)Loggerr   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__C   s     
!T
x
r   c                 r    [         R                  " U R                  5      R                  SU < SU< 35        g N[z]: )logging	getLoggerr/   warningr0   msgs     r   warnLogger.warnO   s$    $**%--D#.FGr   c                 @    [         R                  " SU < SU< 35        g r5   )r7   infor:   s     r   r?   Logger.infoR   s    4-.r   c                 r    [         R                  " U R                  5      R                  SU < SU< 35        g r5   )r7   r8   r/   debugr:   s     r   rB   Logger.debugU   s$    $**%++$,DEr   c                 *    [        XU R                  S9$ )z2Return the formatted representation of the object.)r    r   )r&   r   )r0   r'   r    s      r   formatLogger.formatY   s    s<<r   )r/   r   )   N)r   )__name__
__module____qualname____firstlineno____doc__r2   r<   r?   rB   rE   __static_attributes__r!   r   r   r,   r,   @   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)		PrintTimea   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)r0   r[   logdiris       r   r2   PrintTime.__init__d   s;   6#5EFF..ggll6<8G277??7+,ww~~g&&q!A1Geai$75APQE?9RS %-KK48'3'7MM"DEMM.4::dnn3M"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)	rU   rV   r   rW   printr   stderrr[   rb   )r0   r;   total
time_lapsefull_msgfs         r   __call__PrintTime.__call__   s     t~~5J#&J(?@H t6J,b/QQHhSZZ(<<#$,,,(+ -  -,s*   C# %
C/C# 
C C#  C# #C')rV   r[   rW   )NN) F)rH   rI   rJ   rK   rL   r2   rq   rM   r!   r   r   rO   rO   a   s    = H%r   rO   )r   rG   )rL   
__future__r   r7   rX   r%   r_   r   rU   diskr   r   r   r   r&   objectr,   rO   r!   r   r   <module>rw      sQ    &  	   
  ,
"=V =B>% >%r   