\d# dZddlZddlZddlmZddZddZGd d ejZGd d ejZGd dej Z Gddeej Z Gddeej Z dZ 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|dksJt|}t}|j}|j}|dd}|dd}|d|dz|fzd|d }|r*|t j||d }|*|d |t|fS) Nr z\n z\rz begin %o %s iascii-s end ) rreadwritereplaceencodebinasciib2a_uugetvaluelen) inputerrorsfilenamemodeinfileoutfiler r chunks #..\python\lib\encodings\uu_codec.py uu_encoders X     U^^FiiG ;D MEU++HU++H E?dUlH5 5 = =g F FGGG DHHE  hoe$$%%%R  E+     E ++c2|dksJt|}t}|j}|j} |}|std|dddkrn+ |}|r|dkrnq t j|}nO#tj$r=}|dd z d zd zdzd z} t j|d| }Yd}~nd}~wwxYw|||std |t|fS)Nrz"Missing "begin" line in input datasbeginTsend r ?zTruncated input data) rreadliner ValueErrorra2b_uuErrorrr) rrrrr%r sdatavnbytess r uu_decoder-%s] X     U^^FiiGH ME HJJ CABB B RaR5H      HJJ AMM  /?1%%DD~ / / /!R2~*Q.14F?1WfW:..DDDDDD / d   1/000     E ++s5B C3CCceZdZddZddZdS)Codecrc"t||SN)rselfrrs rrz Codec.encodeG'''rc"t||Sr1)r-r2s rdecodez Codec.decodeJr4rNr)__name__ __module__ __qualname__rr6rrr/r/Fs<((((((((((rr/ceZdZddZdS)IncrementalEncoderFc8t||jdSNr)rrr3rfinals rrzIncrementalEncoder.encodeN ,,Q//rNF)r8r9r:rr;rrr=r=M(000000rr=ceZdZddZdS)IncrementalDecoderFc8t||jdSr?)r-rr@s rr6zIncrementalDecoder.decodeRrBrNrC)r8r9r:r6r;rrrFrFQrDrrFceZdZeZdS) StreamWriterNr8r9r:bytescharbuffertyper;rrrIrIUNNNrrIceZdZeZdS) StreamReaderNrJr;rrrOrOXrMrrOc vtjdtttt t tdS)NuuF)namerr6incrementalencoderincrementaldecoder streamreader streamwriter_is_text_encoding)codecs CodecInforr-r=rFrOrIr;rr getregentryrZ]s4   --!!    r)rrrr7) __doc__rXriorrr-r/r=rFrIrOrZr;rrr]s[ ,,,,*,,,,B(((((FL(((0000020000000020005&-5&-     r