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mZ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rFG dd deZn&zd dlZejejejejfZW n eefya   Y nw dZG dd deZddgZdS )    )annotationsN)suppress)EAGAINENOSYSEWOULDBLOCK)Path)cast   )BaseFileLock)ensure_directory_existsF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   J/home/jeff/fluffinator/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tjB }ttdd }|d ur||O }|tjO }zt| j|| jj	}W n- t
yW   t| j s9 zt| j|tj @ | jj	}W n tyT   Y Y d S w Y nw tt
 t|| jj	 W d    n1 sow   Y  zt|tjtjB  W n, ty } z t| |jtkrd}t|||jtthvr W Y d }~d S d }~ww t|jdkrt| d S || j_d S )N
O_NOFOLLOWzEFileSystem does not appear to support flock; use SoftFileLock insteadr   )r   	lock_fileosO_RDWRO_TRUNCgetattrO_CREATopen_contextmodePermissionErrorr   existsFileNotFoundErrorr   fchmodfcntlflockLOCK_EXLOCK_NBOSErrorcloseerrnor   r   r   r   fstatst_nlinklock_file_fd)r   
open_flags
o_nofollowfd	exceptionmsgr   r   r   r   '   sH   

 
	



r   c                 C  sh   t d| jj}d | j_tt t| j  W d    n1 s!w   Y  t	|tj
 t| d S )Nint)r   r-   r<   r   r7   r   r&   unlinkr3   r4   LOCK_UNr'   r8   )r   r?   r   r   r   r   L   s   
r   Nr   r    r   r   r   r   r   $   s    
%	has_fcntl)
__future__r   r'   sys
contextlibr   r9   r   r   r   pathlibr   typingr   _apir
   _utilr   rE   platformr   r3   r4   r5   r6   rD   _ImportErrorAttributeError__all__r   r   r   r   <module>   s.    

2