o
    h/	                  	   @  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   b/var/www/html/construction_image-detection-poc/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| j s|tjO }t| j|| j	j
}tt t|| j	j
 W d    n1 s8w   Y  zt|tjtjB  W n$ tym } zt| |jtkrbd}t||W Y d }~d S d }~ww || j	_d S )NzEFileSystem does not appear to support flock; use SoftFileLock instead)r	   	lock_fileosO_RDWRO_TRUNCr   existsO_CREATopen_contextmoder   PermissionErrorfchmodfcntlflockLOCK_EXLOCK_NBOSErrorcloseerrnor   r   lock_file_fd)r   
open_flags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*   r5   r.   r/   LOCK_UNr$   r3   )r   r7   r   r   r   r   9   s   r   Nr   r   r   r   r   r   r   $   s    
	has_fcntl)
__future__r   r$   sys
contextlibr   r4   r   pathlibr   typingr   _apir   _utilr	   r<   platformr   r.   r/   r0   r1   r;   _ImportErrorAttributeError__all__r   r   r   r   <module>   s.    

 