관리-도구
편집 파일: docker.cpython-38.pyc
U ,�e � @ s( d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl m Z d dlmZ d dlm Z dZd ZejZejZejZd d�dd �Zdd�dd�Zddd�dd�Zddd�dd�Zddd�dd�Zdd dd�dd�Zddddd �d!d"�Zd#d�d$d%�Zd#d�d&d'�Zddddd d d d(d)�d*d+�ZdS ),� )�annotationsN)�Sequence)� lang_base)�Prefix)�CalledProcessError)�cmd_output_b�dockerZ PRE_COMMIT�bool)�returnc C sL z0t dd��} d| �� kW 5 Q R � W S Q R X W n tk rF Y dS X d S )N�/proc/1/cgroup�rbs dockerF)�open�read�FileNotFoundError)�f� r �I/opt/hc_python/lib/python3.8/site-packages/pre_commit/languages/docker.py� _is_in_docker s $r �strc C sp t dd��T} | �� D ]D}|�d�d dkrtj�|�d�d ��� �� W 5 Q R � S qW 5 Q R X td��d S )Nr r � :� s cpuset� z2Failed to find the container ID in /proc/1/cgroup.) r � readlines�split�os�path�basename�strip�decode�RuntimeError)r �liner r r �_get_container_id s :r! )r r c C s� t � s | S t� }ztdd|�\}}}W n tk r> | Y S X t�|�\}|d D ]8}|d }|d }tj�| |f�|krT| � ||� S qT| S )Nr �inspectZMountsZSourceZDestination) r r! r r �json�loadsr r � commonpath�replace)r Zcontainer_id�_�out� container�mountZsrc_pathZto_pathr r r �_get_docker_path'