관리-도구
편집 파일: _unix.cpython-38.pyc
U *�em � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm Z ddl mZ ddlm Z d Zejd krxG dd� de�Zn6zd dlZW n ek r� Y nX d ZG dd� de�ZddgZdS )� )�annotationsN)�suppress)�ENOSYS)�cast� )�BaseFileLock)�ensure_directory_existsF�win32c @ s, e Zd ZdZdd�dd�Zdd�dd�ZdS ) �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 �</opt/hc_python/lib/python3.8/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 Zd ZdZdd�dd�Zdd�dd�ZdS ) r r r r c C s� t | j� tjtjB tjB }t�| j|| jj�}t t �� t�|| jj� W 5 Q R X zt� |tjtjB � W nD tk r� } z&t�|� |jtkr�d}t|�|�W 5 d }~X Y n X || j_d S )NzFFileSystem does not appear to support flock; user SoftFileLock instead)r Z lock_file�os�O_RDWR�O_CREAT�O_TRUNC�open�_context�moder �PermissionError�fchmod�fcntl�flockZLOCK_EXZLOCK_NB�OSError�close�errnor r �lock_file_fd)r Z open_flags�fd� exception�msgr r r r $ s r c C s2 t t| jj�}d | j_t�|tj� t�|� d S r ) r �intr$ r- r( r) ZLOCK_UNr r+ )r r. r r r r 4 s r Nr r r r r r ! s � has_fcntl)� __future__r r �sys� contextlibr r, r �typingr Z_apir Z_utilr r2 �platformr r( �ImportError�__all__r r r r �<module> s&