ó
î–+[c           @€  s¹   d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 m
 Z
 d „  Z d „  Z d „  Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d S(   sE   
Helpers for logging.

This module needs much love to become useful.
iÿÿÿÿ(   t   with_statementNi   (   t   mkdirpc         C€  s+   t  j j d ƒ r# t d |  d ƒ S|  Sd S(   s¢   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
    t   wini    gš™™™™™¹?N(   t   syst   platformt
   startswitht   max(   t   t(    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   _squeeze_time   s    c         C€  s   t  |  ƒ }  d |  |  d f S(   Ns   %.1fs, %.1fming      N@(   R   (   R   (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   format_time"   s    c         C€  s0   t  |  ƒ }  |  d k r$ d |  d Sd |  Sd  S(   Ni<   s   %4.1fming      N@s    %5.1fs(   R   (   R   (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   short_format_time'   s    t   Loggerc           B€  s8   e  Z d  Z d d „ Z d „  Z d „  Z d d „ Z RS(   s&    Base class for logging messages.
    i   c         C€  s   | |  _  d S(   s†   
            Parameters
            ----------
            depth: int, optional
                The depth of objects printed.
        N(   t   depth(   t   selfR   (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   __init__6   s    c         C€  s   t  j d |  | f ƒ d  S(   Ns   [%s]: %s(   t   loggingt   warn(   R   t   msg(    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyR   ?   s    c         C€  s   t  j d |  | f ƒ d  S(   Ns   [%s]: %s(   R   t   debug(   R   R   (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyR   B   s    i    c         C€  s„   d t  j k rF d d l } | j ƒ  } | j d d d d d d	 ƒ n d } t j | d
 |  j d | ƒ} | r€ | j |   n  | S(   s;    Return the formated representation of the object.
        t   numpyiÿÿÿÿNt	   precisioni   t	   thresholdi@   t	   edgeitemsi   R   t   indent(	   R   t   modulesR   t   get_printoptionst   set_printoptionst   Nonet   pprintt   pformatR   (   R   t   objR   t   npt   print_optionst   out(    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   formatF   s    (   t   __name__t
   __module__t   __doc__R   R   R   R"   (    (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyR   2   s
   			t	   PrintTimec           B€  s,   e  Z d  Z d d d „ Z d e d „ Z RS(   s9    Print and log messages while keeping track of time.
    c      	   C€  sk  | d  k	 r' | d  k	 r' t d ƒ ‚ n  t j ƒ  |  _ |  j |  _ | d  k	 rf t j j | d ƒ } n  | |  _ | d  k	 rgt	 t j j
 | ƒ ƒ t j j | ƒ rxI t d d ƒ D]8 } y( t j | d | | d | d ƒ Wq³ q³ Xq³ Wy t j | | d ƒ WqqXn  yF t | d ƒ 1 } | j d ƒ | j d	 t j |  j ƒ ƒ Wd  QXWqgqgXn  d  S(
   Ns&   Cannot specify both logfile and logdirs
   joblib.logi   i	   s   .%is   .1t   ws   
Logging joblib python script
s
   
---%s---
(   R   t
   ValueErrort   timet	   last_timet
   start_timet   ost   patht   joint   logfileR   t   dirnamet   existst   ranget   shutilt   movet   copyt   opent   writet   ctime(   R   R/   t   logdirt   i(    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyR   \   s4    	't    c         C€  s²   | s2 t  j  ƒ  |  j } d | t | ƒ f } n* t  j  ƒ  |  j } d | | | d f } t j | IJ|  j d k	 rŸ y t |  j d ƒ | IJWqŸ qŸ Xn  t  j  ƒ  |  _ d S(   sr    Print the time elapsed between the last call and the current
            call, with an optional message.
        s   %s: %ss   %s: %.2fs, %.1f mini<   t   aN(	   R)   R*   R	   R+   R   t   stderrR/   R   t   file(   R   R   t   totalt
   time_lapset   full_msg(    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   __call__   s    	N(   R#   R$   R%   R   R   t   FalseRB   (    (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyR&   X   s   %(   R%   t
   __future__R    R)   R   R,   R3   R   R   t   diskR   R   R	   R
   t   objectR   R&   (    (    (    sU   /home/psgendb/BIRCHDEV/install/quast-5.2.0/quast_libs/site_packages/joblib2/logger.pyt   <module>   s   			&