Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/isort/__pycache__/hooks.cpython-39.pyc
Ðазад
a g�h � @ s� d Z ddlZddlZddlmZ ddlmZmZ ddlm Z m Z mZ ee ed�dd�Z ee ee d�d d �Zdeeeeeee ed �dd�ZdS )z�Defines a git hook to allow pre-commit warnings and errors about import order. usage: exit_code = git_hook(strict=True|False, modify=True|False) � N)�Path)�List�Optional)�Config�api� exceptions)�command�returnc C s t j| t jdd�}|j�� S )z�Run a command and return raw output :param str command: the command to run :returns: the stdout output of the command T)�stdout�check)� subprocess�run�PIPEr �decode)r �result� r �{/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/isort/hooks.py� get_output s r c C s t | �}dd� |�� D �S )z�Run a command and return lines of output :param str command: the command to run :returns: list of whitespace-stripped lines output by command c S s g | ]}|� � �qS r )�strip)�.0�liner r r � <listcomp> � zget_lines.<locals>.<listcomp>)r � splitlines)r r r r r � get_lines s r F� )�strict�modify�lazy� settings_file�directoriesr c C s� g d�}|r|� d� |r$|�|� t|�}|s4dS d}t|tj�tj�|d ��d�}|D ]n} | �d�r\ddd| � �g} t | �}z2t j|t| �|d �s�|d 7 }|r�t j | |d� W q\ tjy� Y q\0 q\| r�|S dS )a; Git pre-commit hook to check staged files for isort errors :param bool strict - if True, return number of errors on exit, causing the hook to fail. If False, return zero so it will just act as a warning. :param bool modify - if True, fix the sources if they are not sorted properly. If False, only report result without modifying anything. :param bool lazy - if True, also check/fix unstaged files. This is useful if you frequently use ``git commit -a`` for example. If False, only check/fix the staged files for isort errors. :param str settings_file - A path to a file to be used as the configuration file for this run. When settings_file is the empty string, the configuration file will be searched starting at the directory containing the first staged file, if any, and going upward in the directory structure. :param list[str] directories - A list of directories to restrict the hook to. :return number of errors if in strict mode, 0 otherwise. )�gitz diff-index�--cachedz--name-onlyz--diff-filter=ACMRTUXB�HEADr"