Your IP : 216.73.216.85


Current Path : /opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/logger.cpython-35.pyc



���W�@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
dd�Zdd	�Zd
d�Z
ddd
d�ZGdd�de�ZGdd�de�ZdS)zE
Helpers for logging.

This module needs much love to become useful.
�)�print_functionN�)�mkdirpcCs+tjjd�r#td|d�S|SdS)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
    �winrg�������?N)�sys�platform�
startswith�max)�t�r�>/opt/alt/python35/lib/python3.5/site-packages/joblib/logger.py�
_squeeze_timesr
cCst|�}d||dfS)Nz%.1fs, %.1fmingN@)r
)r
rrr�format_time"srcCs0t|�}|dkr$d|dSd|SdS)N�<z%4.1fmingN@z %5.1fs)r
)r
rrr�short_format_time'sr�cCs~dtjkrFddl}|j�}|jdddddd�nd}tj|d	|d
|�}|rz|j|�|S)N�numpyr�	precision��	threshold�@�	edgeitemsr�depth�indent)r�modulesr�get_printoptions�set_printoptions�pprint�pformat)�objrr�np�
print_options�outrrrr/s
rc@sLeZdZdZddd�Zdd�Zdd�Zd	d
d�ZdS)
�Loggerz& Base class for logging messages.
    rcCs
||_dS)z�
            Parameters
            ----------
            depth: int, optional
                The depth of objects printed.
        N)r)�selfrrrr�__init__CszLogger.__init__cCstjd||f�dS)Nz[%s]: %s)�logging�warn)r$�msgrrrr'LszLogger.warncCstjd||f�dS)Nz[%s]: %s)r&�debug)r$r(rrrr)OszLogger.debugrcCst|d|d|j�S)z; Return the formated representation of the object.
        rr)rr)r$rrrrr�formatSsz
Logger.formatN)�__name__�
__module__�__qualname__�__doc__r%r'r)r*rrrrr#?s
	r#c@s:eZdZdZdddd�Zdddd�ZdS)	�	PrintTimez9 Print and log messages while keeping track of time.
    NcCsc|dk	r$|dk	r$td��tj�|_|j|_|dk	r`tjj|d�}||_|dk	r_ttjj	|��tjj
|�r
xJtdd�D]9}y(tj
|d||d|d�Wq�Yq�Xq�Wytj||d�WnYnXyGt|d��1}|jd�|jd	tj|j��WdQRXWnYnXdS)
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)r$r9�logdir�irrrr%`s4		
(zPrintTime.__init__�FcCs�|s2tj�|j}d|t|�f}n*tj�|j}d|||df}t|dtj�|jdk	r�y0t|jd��}t|d|�WdQRXWnYnXtj�|_dS)zr Print the time elapsed between the last call and the current
            call, with an optional message.
        z%s: %sz%s: %.2fs, %.1f minr�fileN�a)	r3r4rr5�printr�stderrr9r@)r$r(�total�
time_lapse�full_msg�frrr�__call__�s	zPrintTime.__call__)r+r,r-r.r%rNrrrrr/\s%r/)r.�
__future__rr3rr6r=r&r�diskrr
rrr�objectr#r/rrrr�<module>s