관리-도구
편집 파일: file_proxy.cpython-38.pyc
U ʗReP � @ s^ d dl Z d dlmZmZmZmZ ddlmZ ddlm Z erHddl mZ G dd� de j�Z dS ) � N)�IO� TYPE_CHECKING�Any�List� )�AnsiDecoder)�Text)�Consolec @ sj e Zd ZdZdee dd�dd�Zeee d�dd ��Zee d �dd�Z eed �dd�Zdd�dd�Z dS )� FileProxyzAWraps a file (e.g. sys.stdout) and redirects writes to a console.r N)�console�file�returnc C s || _ || _g | _t� | _d S �N)�_FileProxy__console�_FileProxy__file�_FileProxy__bufferr �_FileProxy__ansi_decoder)�selfr r � r ��/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/rich/file_proxy.py�__init__ s zFileProxy.__init__)r c C s | j S )zGet proxied file.)r �r r r r �rich_proxied_file s zFileProxy.rich_proxied_file)�namer c C s t | j|�S r )�getattrr )r r r r r �__getattr__ s zFileProxy.__getattr__)�textr c s� t |t�stdt|�j� ���� j}g }|rn|�d�\}}}|r`|�d�|�| � |d d �= q(|�|� qnq(|r�� j }|�, t d��� fdd�|D ��}|�|� W 5 Q R X t|�S )Nz"write() argument must be str, not � � c 3 s | ]}� j �|�V qd S r )r �decode_line)�.0�liner r r � <genexpr>, s z"FileProxy.write.<locals>.<genexpr>) � isinstance�str� TypeError�type�__name__r � partition�append�joinr r �print�len)r r �buffer�linesr! �new_liner �outputr r r �write s&