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Zejd	kr6G d
d deZnzd dlZW n	 eyE   Y nw dZG dd deZddgZdS )    )annotationsN)suppress)ENOSYS)cast   )BaseFileLockF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/edux/Edux_v2/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B t jB }t | j|| jj}tt	 t 
|| jj W d    n1 s*w   Y  zt|tjtjB  W n$ ty_ } zt | |jtkrTd}t||W Y d }~d S d }~ww || j_d S )NzFFileSystem does not appear to support flock; user SoftFileLock instead)osO_RDWRO_CREATO_TRUNCopen	lock_file_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'   r2   r+   r,   LOCK_UNr!   r0   )r   r4   r   r   r   r   2   s   r   Nr   r   r   r   r   r   r
       s    
	has_fcntl)
__future__r   r!   sys
contextlibr   r1   r   typingr   _apir   r9   platformr
   r+   ImportError__all__r   r   r   r   <module>   s(    

