a
    &ñ»j/	  ã                	   @  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r„G dd„ deƒZnLz d dlZejejejejfZW n eefyº   Y n0 dZG dd„ deƒZddgZdS )é    )ÚannotationsN)Úsuppress)ÚENOSYS)ÚPath)Úcasté   )ÚBaseFileLock)Úensure_directory_existsFÚwin32c                   @  s,   e Zd ZdZddœdd„Zddœdd„ZdS )	ÚUnixFileLockúHUses the :func:`fcntl.flock` to hard lock the lock file on unix systems.ÚNone©Úreturnc                 C  s   t ‚d S ©N©ÚNotImplementedError©Úself© r   ú4E:\soccer\ml_env\Lib\site-packages\filelock/_unix.pyÚ_acquire   s    úUnixFileLock._acquirec                 C  s   t ‚d S r   r   r   r   r   r   Ú_release   s    úUnixFileLock._releaseN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s   r   Tc                   @  s,   e Zd ZdZddœdd„Zddœdd„ZdS )	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 sp0    Y  zt |tjtjB ¡ W nF tyØ } z.t |¡ |jtkrÄd}t|ƒ|‚W Y d }~nd }~0 0 || 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   ÚPermissionErrorZfchmodÚfcntlÚflockÚLOCK_EXÚLOCK_NBÚOSErrorÚcloseÚerrnor   r   Úlock_file_fd)r   Z
open_flagsÚfdÚ	exceptionÚmsgr   r   r   r   '   s    


.

 r   c                 C  s2   t d| jjƒ}d | j_t |tj¡ t |¡ d S )NÚint)r   r'   r1   r*   r+   ÚLOCK_UNr!   r/   )r   r2   r   r   r   r   9   s    r   Nr   r   r   r   r   r   $   s   Ú	has_fcntl)Ú
__future__r   r!   ÚsysÚ
contextlibr   r0   r   Úpathlibr   Útypingr   Z_apir   Z_utilr	   r7   Úplatformr   r*   r+   r,   r-   r6   Ú_ÚImportErrorÚAttributeErrorÚ__all__r   r   r   r   Ú<module>   s*   

 þ