
    &`i                     T    d dl Z d dlZd dlmZ d dlmZ d dlZdZ G d d          ZdS )    N)Path)FileLock_ray_lockfilesc                   0    e Zd ZdZdefdZd Zd Zd ZdS )TempFileLocka  FileLock wrapper that uses temporary file locks.

    The temporary directory that these locks are saved to can be configured via
    the `RAY_TMPDIR` environment variable.

    Args:
        path: The file path that this temporary file lock is used for.
            This will be used to generate the lockfile filename.
            Ex: For concurrent writes to a file, this is the common filepath
            that multiple processes are writing to.
        **kwargs: Additional keyword arguments to pass to the underlying `FileLock`.
    pathc                 @   || _         t          t          j        j                                                                                  }|t          z  | _        t          j
        t          t          | j                                                                                 d                                                    | _        | j        | j         dz  | _        t!          j        t          | j                  d           t%          | j        fi || _        d S )Nzutf-8z.lockT)exist_ok)r   r   ray_commonutilsget_user_temp_dirresolveRAY_LOCKFILE_DIR	_lock_dirhashlibsha1strencode	hexdigest
_path_hash
_lock_pathosmakedirsr   _lock)selfr   kwargstemp_dirs       n/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/air/_internal/filelock.py__init__zTempFileLock.__init__   s    	);;==>>FFHH!$44!,TY''))**11'::
 

)++ 	 .do+D+D+DD
C''$7777do8888


    c                 8    | j                                          | S N)r   acquire)r   s    r   	__enter__zTempFileLock.__enter__&   s    
r!   c                 8    | j                                          d S r#   )r   release)r   typevalue	tracebacks       r   __exit__zTempFileLock.__exit__*   s    
r!   c                 ,    t          | j        |          S r#   )getattrr   )r   names     r   __getattr__zTempFileLock.__getattr__-   s    tz4(((r!   N)	__name__
__module____qualname____doc__r   r    r%   r+   r/    r!   r   r   r      sf         
9S 
9 
9 
9 
9    ) ) ) ) )r!   r   )	r   r   pathlibr   filelockr   r   r   r   r4   r!   r   <module>r7      s|     				             



# ") ") ") ") ") ") ") ") ") ")r!   