o
    ^i	                  	   @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ ddlmZ dd	lmZ d
ZejdkrBG dd deZn&zd dlZejejejejfZW n eefy]   Y nw dZG dd deZddgZdS )    )annotationsN)suppress)ENOSYS)Path)cast   )BaseFileLock)ensure_directory_existsFwin32c                   @  $   e Zd ZdZd	ddZd	ddZdS )
UnixFileLockHUses the :func:`fcntl.flock` to hard lock the lock file on unix systems.returnNonec                 C     t NNotImplementedErrorself r   I/var/www/html/RAG/RAG_venv/lib/python3.10/site-packages/filelock/_unix.py_acquire      UnixFileLock._acquirec                 C  r   r   r   r   r   r   r   _release   r   UnixFileLock._releaseNr   r   __name__
__module____qualname____doc__r   r   r   r   r   r   r      s    
r   Tc                   @  r   )
r   r   r   r   c              
   C  s  t | j tjtjB }ttdd }|d ur||O }t| j s%|tjO }t	| j|| j
j}tt t|| j
j W d    n1 sFw   Y  zt|tjtjB  W n$ ty{ } zt| |jtkrpd}t||W Y d }~d S d }~ww || j
_d S )N
O_NOFOLLOWzEFileSystem does not appear to support flock; use SoftFileLock instead)r	   	lock_fileosO_RDWRO_TRUNCgetattrr   existsO_CREATopen_contextmoder   PermissionErrorfchmodfcntlflockLOCK_EXLOCK_NBOSErrorcloseerrnor   r   lock_file_fd)r   
open_flags
o_nofollowfd	exceptionmsgr   r   r   r   '   s,   





r   c                 C  s2   t d| jj}d | j_t|tj t| d S )Nint)r   r,   r7   r0   r1   LOCK_UNr%   r5   )r   r:   r   r   r   r   <   s   r   Nr   r   r   r   r   r   r   $   s    
	has_fcntl)
__future__r   r%   sys
contextlibr   r6   r   pathlibr   typingr   _apir   _utilr	   r?   platformr   r0   r1   r2   r3   r>   _ImportErrorAttributeError__all__r   r   r   r   <module>   s.    

#