관리-도구
편집 파일: _util.cpython-38.pyc
U *�e� � @ sl d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm Z ddd�dd �Z d dd�dd�Zd dgZdS ) � )�annotationsN)�EACCES�EISDIR)�Path�str�None)�filename�returnc C s| zt �| �}W n tk r$ Y dS X |jdkrx|jtj@ sHttd| ��t�|j�rxt j dkrlttd| ��nttd| ��dS )a/ Raise an exception if attempting to open the file for writing would fail. This is done so files that will never be writable can be separated from files that are writable but currently locked :param filename: file to check :raises OSError: as if the file was opened for writing. Nr zPermission denied�win32zIs a directory) �os�stat�OSError�st_mtime�st_mode�S_IWUSR�PermissionErrorr �S_ISDIR�sys�platform�IsADirectoryErrorr )r Z file_stat� r �</opt/hc_python/lib/python3.8/site-packages/filelock/_util.py�raise_on_not_writable_file s r z Path | strc C s t | �jjddd� dS )zm Ensure the directory containing the file exists (create it if necessary) :param filename: file. T)�parents�exist_okN)r �parent�mkdir)r r r r �ensure_directory_exists$ s r ) � __future__r r r r �errnor r �pathlibr r r �__all__r r r r �<module> s �