Your IP : 216.73.216.213


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__/disk.cpython-35.pyc



���W��@sdZddlZddlZddlZddlZddlZdd�Zdd�Zdd�Zd	Z	dd
d�Z
dS)z
Disk management utilities.
�NcCs�d}xxtj|�dgD]`}tjtjj||��}t|d�rd||jd7}q||jddd7}qWt|d�S)z& Return the disk usage in a directory.r�.�	st_blocksi�g�@)	�os�listdir�stat�path�join�hasattrr�st_size�int)r�size�filer�r�</opt/alt/python35/lib/python3.5/site-packages/joblib/disk.py�	disk_usedsrcCs�d}td|d|dd|d�}y,t||d
t|dd���}Wn4ttfk
r�td	|t|�f��YnX|S)z2 Convert a memory text to its value in bytes.
    i�K�M��G�rNzQInvalid literal for size give: %s (type %s) should be alike '10G', '500M', '50K'.���r)�dictr�float�KeyError�
ValueError�type)�text�kilo�unitsr
rrr�memstr_to_bytes"s#,r cCsRytj|�Wn:tk
rM}z|jtjkr;�WYdd}~XnXdS)zgEnsure directory d exists (like mkdir -p on Unix)
    No guarantee that the directory is writable.
    N)r�makedirs�OSError�errno�EEXIST)�d�errr�mkdirp0s
r'g�������?cCs0g}ytj|�}WnStjk
rn}z0|dk	rY|tj|tj��n�WYdd}~XnXx�|D]�}tjj||�}tjj|�rv|dk	r�tj	|d|�qvd}xZytj	|dd�PWq�tjk
r#|dkr�|d7}t
jt�Yq�Xq�WqvWdS)a�Remove all subdirectories in this path.

    The directory indicated by `path` is left in place, and its subdirectories
    are erased.

    If onerror is set, it is called to handle the error with arguments (func,
    path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
    path is the argument to that function that caused it to fail; and
    exc_info is a tuple returned by sys.exc_info().  If onerror is None,
    an exception is raised.
    NFrr)
rr�error�sys�exc_inforr	�isdir�shutil�rmtree�time�sleep�RM_SUBDIRS_RETRY_TIME)r�onerror�names�err�name�fullname�	err_countrrr�
rm_subdirs@s,

r7)�__doc__r#rr,r)r.rr r'r0r7rrrr�<module>s