o
    lZh                     @  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mZ ejd
krFd dlZG dd deZnG dd deZdgZdS )    )annotationsN)suppress)EACCES)Path)cast   )BaseFileLock)ensure_directory_existsraise_on_not_writable_filewin32c                   @  $   e Zd ZdZd	ddZd	ddZdS )
WindowsFileLockWUses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.returnNonec              
   C  s   t | j t| j tjtjB tjB }zt| j|| jj	}W n t
y8 } z|jtkr- W Y d }~d S d }~ww z
t|tjd W n t
ya } zt| |jtkrV W Y d }~d S d }~ww || j_d S Nr   )r
   	lock_filer	   osO_RDWRO_CREATO_TRUNCopen_contextmodeOSErrorerrnor   msvcrtlockingZLK_NBLCKcloselock_file_fd)selfflagsfd	exception r$   H/var/www/html/lang_env/lib/python3.10/site-packages/filelock/_windows.py_acquire   s4   




WindowsFileLock._acquirec                 C  sl   t t| jj}d | j_t|tjd t| t	t
 t| j  W d    d S 1 s/w   Y  d S r   )r   intr   r   r   r   ZLK_UNLCKr   r   r   r   r   r   unlink)r    r"   r$   r$   r%   _release*   s   

"WindowsFileLock._releaseNr   r   __name__
__module____qualname____doc__r&   r*   r$   r$   r$   r%   r      s    
r   c                   @  r   )
r   r   r   r   c                 C     t NNotImplementedErrorr    r$   r$   r%   r&   8      r'   c                 C  r2   r3   r4   r6   r$   r$   r%   r*   ;   r7   r+   Nr,   r-   r$   r$   r$   r%   r   5   s    
)
__future__r   r   sys
contextlibr   r   r   pathlibr   typingr   Z_apir   Z_utilr	   r
   platformr   r   __all__r$   r$   r$   r%   <module>   s    
%