관리-도구
편집 파일: store.cpython-38.pyc
U ,�e)$ � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlm Z d dlm Z d dlmZ d dlm Z d dlmZ d dlmZ d dlmZ d d lmZ d d lmZ d dlmZ d dlmZ e�d �Zdd�dd�ZdZddd�dd�ZG dd� d�ZdS )� )�annotationsN)�Callable)� Generator)�Sequence)� file_lock)�git)�CalledProcessError)�clean_path_on_failure��cmd_output_b)� resource_text)�rmtree� pre_commit�str��returnc C s: t j�d�p,t j�t j�d�p(t j�d�d�} t j�| �S )a7 Returns the default directory for the Store. This is intentionally underscored to indicate that `Store.get_default_directory` is the intended way to get this information. This is also done so `Store.get_default_directory` can be mocked in tests and `_get_default_directory` can be tested. ZPRE_COMMIT_HOME�XDG_CACHE_HOMEz~/.cachez pre-commit)�os�environ�get�path�join� expanduser�realpath)�ret� r �>/opt/hc_python/lib/python3.8/site-packages/pre_commit/store.py�_get_default_directory s �r )z Cargo.tomlzmain.gozgo.modzmain.rsz .npmignorezpackage.jsonz!pre-commit-package-dev-1.rockspecz&pre_commit_placeholder_package.gemspeczsetup.pyzenvironment.ymlzMakefile.PLzpubspec.yamlz renv.lockzrenv/activate.Rzrenv/LICENSE.renv�None�� directoryr c C sv t D ]l}tj�|�\}}td|� ��}tj�| |�}tj�||�}tj|dd� t|d��}|�|� W 5 Q R X qd S )NZempty_template_T��exist_ok�w) �_LOCAL_RESOURCESr r �splitr r �makedirs�open�write)r �resourceZresource_dirnameZresource_basename�contents� target_dirZtarget_file�fr r r �_make_local_repo0 s r- c @ s( e Zd Zee�Zd8ddd�dd�Zejdd�d d ��Z ejd9ddd�d d��Z edddd�dd��Zdddddd�dd�Z dddd�dd�Zdddd�dd�Zd:ddddd�d d!�Zddd"�d#d$�Zd%dd&�d'd(�Zddd)�d*d+�Zd,d�d-d.�Zd,dd/�d0d1�Zd2d�d3d4�Zddddd5�d6d7�ZdS );�StoreN� str | Noner r c C s( |p t �� | _tj�| jd�| _tj�| j�o>t�| jtj � | _ tj�| j�s�tj| jdd� ttj�| jd�d��}|� d� W 5 Q R X tj�| j�r�d S | �� �x tj�| j�r�W 5 Q R � d S tj| jd�\}}t�|� | j|d��}|�d � | �|� W 5 Q R X t�|| j� W 5 Q R X d S ) Nzdb.dbTr! ZREADMEr# zmThis directory is maintained by the pre-commit project. Learn more: https://github.com/pre-commit/pre-commit )�dir)�db_pathzuCREATE TABLE repos ( repo TEXT NOT NULL, ref TEXT NOT NULL, path TEXT NOT NULL, PRIMARY KEY (repo, ref));)r. �get_default_directoryr r r r r1 �exists�access�W_OK�readonlyr&