Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/isort/__pycache__/format.cpython-39.pyc
Ðазад
a g�hk � @ s* d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlmZm Z zd dl Z W n eyf dZY n0 dZe � d�Ze � d �Zeed �dd�Zeed �d d�Zddd�eeee ee edd�dd�Zeed�dd�Zd"eeed�dd�ZG dd� d�ZG dd� de�Zd#eee eeed�d d!�ZdS )$� N)�datetime)�unified_diff)�Path)�Optional�TextIOTFz\+[^+]z-[^-])�import_line�returnc C sF | � � } | �d�r,| �dd�} | �dd�} n| �d�rB| �dd�} | S )N�from � � import �.�import )�strip� startswith�replace)r � r �|/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/isort/format.py�format_simplified s r c C s\ | � � } | �d�sX| �d�sXd| vr.d| � �S | �d�}|�d�}dd�|�� d|� �S | S )Nr r r ���r )r r �split�pop�join)r �parts�endr r r �format_natural s r )�output�color_output)� file_input�file_output� file_pathr r r c C s� t ||�}|du rdnt|�}t|du r0t�� nt�|�� j��}t| jdd�|jdd�|d |d |tt�� �d�}|D ]} |� | � qzdS )a� Shows a unified_diff for the provided input and output against the provided file path. - **file_input**: A string that represents the contents of a file before changes. - **file_output**: A string that represents the contents of a file after changes. - **file_path**: A Path object that represents the file path of the file being changed. - **output**: A stream to output the diff to. If non is provided uses sys.stdout. - **color_output**: Use color in output if True. Nr T)�keependsz:beforez:after)�fromfile�tofileZfromfiledateZ tofiledate) �create_terminal_printer�strr �now� fromtimestamp�stat�st_mtimer � splitlines� diff_line) r r r r r �printer� file_nameZ file_mtimeZunified_diff_lines�liner r r �show_unified_diff+ s � �r. )r r c C sH d }|dvrDt d| � d��}|�� }|dv r0dS |dv rt�d� qdS ) N)�yes�y�no�n�quit�qzApply suggested changes to 'z' [y/n/q]? )r1 r2 F)r3 r4 � T)�input�lower�sys�exit)r Zanswerr r r �$ask_whether_to_apply_changes_to_fileL s r: � )�content�line_separatorr c C s | � |d�� dd�� dd�} | S )Nr � �)r )r<