Viewing File: /opt/hc_python/lib/python3.12/site-packages/pre_commit/__pycache__/util.cpython-312.pyc
�
i0i� � �� � d dl mZ d dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlm
Z
d dlmZ d dlmZ d dlmZ d dlmZ dd�Zej, d d �� Zd!d
�Zd"d�Z G d� d
e� Zd#d�Zd$d�Zdd� d%d�Zd&d�Zej@ dk7 r#d dlm!Z! d dl"Z" G d� d� Z#dd� d%d�Z$neZ$ d'd�Z%ejL dk r d(d�Z'd)d�Z(nd)d�Z(d*d�Z)y)+� )�annotationsN)�Callable)� Generator)�
TracebackType)�Any)�
parse_shebangc �T � t j t � 5 t | � cd d d � S # 1 sw Y nxY wt j t � 5 t | � j
� cd d d � S # 1 sw Y nxY wdt | � j � d�j
� S )Nz
<unprintable z object>) �
contextlib�suppress� TypeError�bytes� Exception�str�encode�type�__name__)�excs �>/opt/hc_python/lib/python3.12/site-packages/pre_commit/util.py�force_bytesr sn � � � � �Y� '��S�z�
(� '� '�� � � �Y� '��3�x��� �
(� '� '��
�4��9�-�-�.�h�7�>�>�@�@s �/�8�A7�7B c # � K � d�� y# t $ r, t j j | � rt | � � w xY w�w)z2Cleans up the directory on an exceptional failure.N)�
BaseException�os�path�exists�rmtree�r s r �clean_path_on_failurer s6 � �� ��
��� �
�7�7�>�>�$���4�L�
��s �A� �A�5>�Ac �~ � t j j d� }|j | � j � S )Nzpre_commit.resources)� importlib� resources�files�joinpath� read_text)�filenamer! s r �
resource_textr% &