3  f# @sdZddlZddlZddlmZdddZdd d ZGd d d ejZGd ddejZGdddej Z Gdddeej Z Gdddeej Z ddZ dS)aPython '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)BytesIOstrictc Cst|}t}|j}|j}|jdd}|jdd}|d|d@|fjd|d}x|rr|tj||d}qVW|d |jt|fS) N z\n z\rz begin %o %s iascii-s end ) rreadwritereplaceencodebinasciiZb2a_uugetvaluelen) inputerrorsfilenamemodeinfileoutfiler r chunkr7/opt/alt/python36/lib64/python3.6/encodings/uu_codec.py uu_encodes   rc Cst|}t}|j}|j}x(|}|s.td|dddkrPqWx|}| sZ|dkr\Pytj|}WnRtjk r}z4|ddd@ddd } tj|d| }WYdd}~XnX||qFW|std |jt|fS) Nz"Missing "begin" line in input datasbeginsend r ?zTruncated input data) rreadliner ValueErrorrZa2b_uuErrorrr) rrrrr r sdatavnbytesrrr uu_decode%s.$ r'c@s eZdZdddZdddZdS) CodecrcCs t||S)N)r)selfrrrrrr Gsz Codec.encodecCs t||S)N)r')r)rrrrrdecodeJsz Codec.decodeN)r)r)__name__ __module__ __qualname__r r*rrrrr(Fs r(c@seZdZdddZdS)IncrementalEncoderFcCst||jdS)Nr)rr)r)rfinalrrrr NszIncrementalEncoder.encodeN)F)r+r,r-r rrrrr.Msr.c@seZdZdddZdS)IncrementalDecoderFcCst||jdS)Nr)r'r)r)rr/rrrr*RszIncrementalDecoder.decodeN)F)r+r,r-r*rrrrr0Qsr0c@seZdZeZdS) StreamWriterN)r+r,r-bytescharbuffertyperrrrr1Usr1c@seZdZeZdS) StreamReaderN)r+r,r-r2r3rrrrr4Xsr4c CstjdttttttddS)NuuF)namer r*incrementalencoderincrementaldecoder streamreader streamwriter_is_text_encoding)codecs CodecInforr'r.r0r4r1rrrr getregentry]sr>)rrr)r) __doc__r<riorrr'r(r.r0r1r4r>rrrrs   !