U e5d# @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 Cs|dks tt|}t}|j}|j}|dd}|dd}|d|d@|fd|d }|r||t||d }q`|d |t |fS) Nr z\n z\rz begin %o %s iascii-s end ) AssertionErrorrreadwritereplaceencodebinasciiZb2a_uugetvaluelen) inputerrorsfilenamemodeinfileoutfiler r chunkr*/usr/lib64/python3.8/encodings/uu_codec.py uu_encodes    rc Cs|dks tt|}t}|j}|j}|}|s8td|dddkr&qLq&|}|r|dkr`qzt|}WnRtjk r}z2|ddd@d dd } t|d| }W5d}~XYnX||qL|std |t |fS) Nrz"Missing "begin" line in input datasbeginsend r ?zTruncated input data) r rreadliner ValueErrorrZa2b_uuErrorrr) rrrrr!r sdatavnbytesrrr uu_decode%s,  $ r(c@s eZdZdddZdddZdS) CodecrcCs t||SN)rselfrrrrrrGsz Codec.encodecCs t||Sr*)r(r+rrrdecodeJsz Codec.decodeN)r)r)__name__ __module__ __qualname__rr-rrrrr)Fs r)c@seZdZdddZdS)IncrementalEncoderFcCst||jdSNr)rrr,rfinalrrrrNszIncrementalEncoder.encodeN)F)r.r/r0rrrrrr1Msr1c@seZdZdddZdS)IncrementalDecoderFcCst||jdSr2)r(rr3rrrr-RszIncrementalDecoder.decodeN)F)r.r/r0r-rrrrr5Qsr5c@seZdZeZdS) StreamWriterNr.r/r0bytescharbuffertyperrrrr6Usr6c@seZdZeZdS) StreamReaderNr7rrrrr:Xsr:c CstjdttttttddS)NuuF)namerr-incrementalencoderincrementaldecoder streamreader streamwriter_is_text_encoding)codecs CodecInforr(r1r5r:r6rrrr getregentry]srD)rrr)r) __doc__rBriorrr(r)r1r5r6r:rDrrrrs    !