Your IP : 216.73.216.61


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.opt-1.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�numpyrZ	precision��	threshold�@Z	edgeitemsr�depth�indent)r�modulesrZget_printoptionsZset_printoptions�pprint�pformat)�objrrZnpZ
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)rr"rrrr#OszLogger.debugrcCst|d|d|j�S)z; Return the formated representation of the object.
        rr)rr)rrrrrr�formatSsz
Logger.formatN)�__name__�
__module__�__qualname__�__doc__rr!r#r$rrrrr?s
	rc@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�shutilZmove�copy�open�writeZctime)rr3Zlogdir�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)	r-r.rr/�printr�stderrr3r9)rr"ZtotalZ
time_lapseZfull_msg�frrr�__call__�s	zPrintTime.__call__)r%r&r'r(rrBrrrrr)\s%r))r(Z
__future__rr-rr0r7r rZdiskrr
rrr�objectrr)rrrr�<module>s