U e@szddlmZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZmZGd d d e Zd gZdS) ) annotationsN)suppress)EACCESEEXIST)Path) BaseFileLock)ensure_directory_existsraise_on_not_writable_filec@s,eZdZdZddddZddddZdS) SoftFileLockz.Simply watches the existence of the lock file.None)returnc Cst|jt|jtjtjBtjBtjB}zt|j||j j }WnBt k r}z$|j t ksv|j tkrttjdksvW5d}~XYn X||j _dS)Nwin32)r lock_filer osO_WRONLYO_CREATO_EXCLO_TRUNCopen_contextmodeOSErrorerrnorrsysplatform lock_file_fd)selfflags file_handler exceptionr!s    !