관리-도구
편집 파일: error_handler.cpython-38.pyc
U ,�e@ � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlm Z d dlm Z d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d lmZ d ddd d d�dd�Zejdd�dd��ZdS )� )�annotationsN)� Generator)�IO)�output)� FatalError)�Store)�cmd_output_b)�force_bytes�str�int� BaseException�None)�msg�ret_code�exc� formatted�returnc C s� | � dt |�j� d��� t|� }t�|� tdddd�\}}}|jdd��� }t � j }tj� |d�} t�� ��P} t�|tj�r�t�d | � �� | �t| d ��}nt�d| � �� tjj}tjtj|d�}tjtj|d�} |d � |� |d� |dtj� �� |d|� �� |d� tj�� D ]}|d|� �� �q |dtj� �� |dtj� �� |dtj � �� |d� |� |d� |� |d� | |� |d� |� |d� ||�� � |d� W 5 Q R X t!|��d S )Nz: �gitz --versionF)�check�backslashreplace)�errorszpre-commit.logzCheck the log at �wbzFailed to write to log at )�streamz### version informationz```zpre-commit version: zgit --version: zsys.version:z zsys.executable: z os.name: zsys.platform: z### error information)"�type�__name__�encoder r Zwrite_line_br �decode�rstripr � directory�os�path�join� contextlib� ExitStack�access�W_OKZ write_line� enter_context�open�sys�stdout�buffer� functools�partial�C�VERSION�version� splitlines� executable�name�platform� SystemExit)r r r r � error_msg�_Z git_version_bZgit_versionZstoredir�log_path�ctx�logZ _log_lineZ_log_line_b�line� r; �F/opt/hc_python/lib/python3.8/site-packages/pre_commit/error_handler.py� _log_and_exit sJ " r= zGenerator[(None, None, None)])r c c sx z d V W nh t tfk rr } zFt| t�r4d\}}nt| t�rHd\}}nd\}}t||| t�� � W 5 d } ~ X Y nX d S )N)zAn error has occurred� )zInterrupted (^C)� )z An unexpected error has occurred� )� Exception�KeyboardInterrupt� isinstancer r= � traceback� format_exc)�er r r; r; r<