3 \¡ ã @ 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úé¶ c C s€ |dkst ‚t| ƒ}tƒ }|j}|j}|d|d@ |f jdƒƒ |dƒ}x|rf|tj|ƒƒ |dƒ}qJW |dƒ |jƒ t| ƒfS )Nr zbegin %o %s iÿ Úasciié- s end ) ÚAssertionErrorr ÚreadÚwriteÚencodeÚbinasciiZb2a_uuÚgetvalueÚlen) ÚinputÚerrorsÚfilenameÚmodeÚinfileÚoutfiler r Úchunk© r ú*/usr/lib64/python3.6/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„|ƒ }| sf|dkrhP ytj|ƒ}W nR tjk rÈ } z4|d d d@ d d d } tj|d | … ƒ}W Y d d }~X nX ||ƒ qRW |sâtdƒ‚|jƒ 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 C s zCodec.encodec C s t ||ƒS )N)r% )r' r r r r r ÚdecodeF s zCodec.decodeN)r )r )Ú__name__Ú __module__Ú__qualname__r r( r r r r r&