a
    h                     @  sz   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mZ G d	d
 d
eZd
gZdS )    )annotationsN)suppress)EACCESEEXIST)Path   )BaseFileLock)ensure_directory_existsraise_on_not_writable_filec                   @  s,   e Zd ZdZddddZddddZdS )	SoftFileLockz.Simply watches the existence of the lock file.None)returnc              
   C  s   t | j t| j tjtjB tjB tjB }zt| j|| j	j
}W nD ty } z,|jtkst|jtkrrtjdkst W Y d }~nd }~0 0 || j	_d S )Nwin32)r
   	lock_filer	   osO_WRONLYO_CREATO_EXCLO_TRUNCopen_contextmodeOSErrorerrnor   r   sysplatformlock_file_fd)selfflagsZfile_handler	exception r    </var/www/auris/lib/python3.9/site-packages/filelock/_soft.py_acquire   s*    

zSoftFileLock._acquirec                 C  s`   | j jd usJ t| j j d | j _tt t| j  W d    n1 sR0    Y  d S )N)	r   r   r   closer   r   r   r   unlink)r   r    r    r!   _release%   s
    
zSoftFileLock._releaseN)__name__
__module____qualname____doc__r"   r%   r    r    r    r!   r      s   r   )
__future__r   r   r   
contextlibr   r   r   r   pathlibr   Z_apir   Z_utilr	   r
   r   __all__r    r    r    r!   <module>   s   !