o
    "if                     @  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W n	 eyQ   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   G/var/www/html/corbot_env/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 t| jj}d | j_t|tj t| d S r   )	r   intr*   r5   r.   r/   LOCK_UNr$   r3   )r   r7   r   r   r   r   7   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.   ImportError__all__r   r   r   r   <module>   s,    

 