
    7Th                         S 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rSrSS	 jrSS
 jrg! \	 a    \
r N"f = f)z
Disk management utilities.
    N)utilc                 @   Sn[         R                  " U 5      S/-    Hq  n[         R                  " [         R                  R	                  X5      5      n[        US5      (       a  XR                  S-  -  nMZ  XR                  S-  S-   S-  -  nMs     [        US-  5      $ )z%Return the disk usage in a directory.r   .	st_blocksi      g      @)	oslistdirstatpathjoinhasattrr   st_sizeint)r   sizefiler
   s       C/var/www/auris/envauris/lib/python3.13/site-packages/joblib/disk.py	disk_usedr      s    D

4 C5(wwrww||D/04%%NNS((D \\S(1,33D ) tf}    c           	          Sn[        XS-  US-  S9n [        X S      [        U SS 5      -  5      nU$ ! [        [        4 a#  n[	        SU < S[        U 5      < S	35      UeSnAff = f)
z,Convert a memory text to its value in bytes.i         )KMGNzInvalid literal for size give: z (type z') should be alike '10G', '500M', '50K'.)dictr   floatKeyError
ValueErrortype)textkilounitsr   es        r   memstr_to_bytesr%   '   s~    D47dAg.E5b?U49%556 K j! -14:?
 	s   5 A(A##A(c                      [         R                  " U 5        g! [         a)  nUR                  [        R                  :w  a  e  SnAgSnAff = f)z_Ensure directory d exists (like mkdir -p on Unix)
No guarantee that the directory is writable.
N)r   makedirsOSErrorerrnoEEXIST)dr$   s     r   mkdirpr,   5   s:    
A 77ell" #s    
AAAg?
   c                 *   / n [         R                  " U 5      nU H+  n[         R
                  R                  X5      n[        XAS9  M-     g! [         R                   a2    Ub-  U" [         R                  U [        R                  " 5       5         Nve f = f)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.
N)onerror)r   r	   errorsysexc_infor   r   delete_folder)r   r/   namesnamefullnames        r   
rm_subdirsr7   H   sv      E

4  77<<+h0  88 BJJclln5	s   A ABBc                 (   [         R                  R                  U 5      (       a  Ub  [        R                  " U SU5        gSn [         R
                  " U 5      n [        U5      S:X  d  U(       a<  [        R                  " U SSS9  [        R                  " SR                  U 5      5        g[        SR                  U [        U5      5      5      eg! [        [        4 a    US-  nU[        :  a  e  Of = f[        R                  " [        5        M  )zBUtility function to cleanup a temporary folder if it still exists.NFr   )ignore_errorsr/   zSuccessfully deleted {}z*Expected empty folder {} but got {} files.r   )r   r   isdirshutilrmtreer	   lenr   debugformatr(   WindowsErrorRM_SUBDIRS_N_RETRYtimesleepRM_SUBDIRS_RETRY_TIME)folder_pathr/   allow_non_empty	err_countfiless        r   r3   r3   f   s    	ww}}[!!MM+ug6 I

;/5zQ/kPTU

#<#C#CK#PQ%HOO +SZ  "(  . NI #55 	 6 

01) s   AC -$C  C54C5)N)NT)__doc__r)   r   r;   r1   rB   multiprocessingr   r@   	NameErrorr(   r   r%   r,   rD   rA   r7   r3    r   r   <module>rM      sd     	  
   
    1<2g  Ls   8 AA