관리-도구
편집 파일: uu_codec.cpython-37.pyc
B � f# � @ s� d Z ddlZddlZddlmZ ddd�Zdd d �ZG dd� dej�ZG d d� dej�ZG dd� dej �Z G dd� deej �Z G dd� deej�Zdd� ZdS )a Python 'uu_codec' Codec - UU content transfer encoding. This codec de/encodes from bytes to bytes. Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were adapted from uu.py which was written by Lance Ellinghouse and modified by Jack Jansen and Fredrik Lundh. � N)�BytesIO�strict�<data>� c C s� |dkst �t| �}t� }|j}|j}|�dd�}|�dd�}|d|d@ |f �d�� |d �}x|r~|t�|�� |d �}qbW |d � |�� t | �fS )Nr � z\n� z\rzbegin %o %s i� �ascii�- s end ) �AssertionErrorr �read�write�replace�encode�binasciiZb2a_uu�getvalue�len) �input�errors�filename�mode�infile�outfiler r �chunk� r �7/opt/alt/python37/lib64/python3.7/encodings/uu_codec.py� uu_encode s r c C s� |dkst �t| �}t� }|j}|j}x(|� }|s:td��|d d� dkr(P q(W x�|� }|rd|dkrfP yt�|�}W nR tjk r� } z2|d d d@ d d d } t�|d | � �}W d d }~X Y nX ||� qRW |s�td��|�� t | �fS )Nr z"Missing "begin" line in input data� s begins end r � �? � � zTruncated input data) r r �readliner � ValueErrorr Za2b_uu�Errorr r ) r r r r r! r �s�data�v�nbytesr r r � uu_decode% s0 $r( c @ s e Zd Zddd�Zddd�ZdS ) �Codecr c C s t ||�S )N)r )�selfr r r r r r G s zCodec.encodec C s t ||�S )N)r( )r* r r r r r �decodeJ s zCodec.decodeN)r )r )�__name__� __module__�__qualname__r r+ r r r r r) F s r) c @ s e Zd Zddd�ZdS )�IncrementalEncoderFc C s t || j�d S )Nr )r r )r* r �finalr r r r N s zIncrementalEncoder.encodeN)F)r, r- r. r r r r r r/ M s r/ c @ s e Zd Zddd�ZdS )�IncrementalDecoderFc C s t || j�d S )Nr )r( r )r* r r0 r r r r+ R s zIncrementalDecoder.decodeN)F)r, r- r. r+ r r r r r1 Q s r1 c @ s e Zd ZeZdS )�StreamWriterN)r, r- r. �bytes�charbuffertyper r r r r2 U s r2 c @ s e Zd ZeZdS )�StreamReaderN)r, r- r. r3 r4 r r r r r5 X s r5 c C s t jdttttttdd�S )N�uuF)�namer r+ �incrementalencoder�incrementaldecoder�streamreader�streamwriter�_is_text_encoding)�codecs� CodecInfor r( r/ r1 r5 r2 r r r r �getregentry] s r? )r r r )r ) �__doc__r= r �ior r r( r) r/ r1 r2 r5 r? r r r r �<module> s !