관리-도구
편집 파일: _windows.cpython-38.pyc
U *�e� � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z d dl mZ ddlm Z dd lmZmZ ejd kr�d dlZG dd� de �ZnG d d� de �ZdgZdS )� )�annotationsN)�suppress)�EACCES)�Path)�cast� )�BaseFileLock)�ensure_directory_exists�raise_on_not_writable_file�win32c @ s, e Zd ZdZdd�dd�Zdd�dd�ZdS ) �WindowsFileLock�WUses the :func:`msvcrt.locking` function to hard lock the lock file on Windows systems.�None��returnc C s� t | j� t| j� tjtjB tjB }zt�| j|| jj �}W n. t k rl } z|jtkr\� W 5 d }~X Y nXX zt �|t jd� W n8 t k r� } zt�|� |jtkr�� W 5 d }~X Y n X || j_d S �Nr )r � lock_filer �os�O_RDWR�O_CREAT�O_TRUNC�open�_context�mode�OSError�errnor �msvcrt�lockingZLK_NBLCK�close�lock_file_fd)�self�flags�fd� exception� r$ �?/opt/hc_python/lib/python3.8/site-packages/filelock/_windows.py�_acquire s( ��� �WindowsFileLock._acquirec C sV t t| jj�}d | j_t�|tjd� t�|� t t �� t| j�� � W 5 Q R X d S r )r �intr r r r ZLK_UNLCKr r r r r r �unlink)r r"