o
    if                     @  sv   d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl	m
Z
 ddlmZ ddlmZ G d	d
 d
eZd
gZdS )    )annotationsN)suppress)EACCESEEXIST)Path   )BaseFileLock)raise_on_not_writable_filec                   @  s$   e Zd ZdZd	ddZd	ddZdS )
SoftFileLockz.Simply watches the existence of the lock file.returnNonec              
   C  s   t | j tjtjB tjB tjB }zt| j|| jj	}W n* t
yG } z|jtks5|jtkr4tjdks< W Y d }~d S W Y d }~d S d }~ww || j_d S )Nwin32)r	   	lock_fileosO_WRONLYO_CREATO_EXCLO_TRUNCopen_contextmodeOSErrorerrnor   r   sysplatformlock_file_fd)selfflagsfile_handler	exception r    I/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/filelock/_soft.py_acquire   s(   

zSoftFileLock._acquirec                 C  sb   | j jd usJ t| j j d | j _tt t| j  W d    d S 1 s*w   Y  d S )N)	r   r   r   closer   r   r   r   unlink)r   r    r    r!   _release$   s   
"zSoftFileLock._releaseN)r   r   )__name__
__module____qualname____doc__r"   r%   r    r    r    r!   r
      s    
r
   )
__future__r   r   r   
contextlibr   r   r   r   pathlibr   _apir   _utilr	   r
   __all__r    r    r    r!   <module>   s     