B /g^# c@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 }x|r~|t||d }qbW|d |t |fS) NrZ z\nz z\rz begin %o %s iZasciii-s end ) AssertionErrorrreadwriteZreplaceencodebinasciiZb2a_uugetvaluelen) inputerrorsZfilenameZmodeinfileoutfilerrZchunkr*/usr/lib64/python3.7/encodings/uu_codec.py uu_encodes    rc Cs|dks tt|}t}|j}|j}x(|}|s:td|dddkr(Pq(Wx|}|rd|dkrfPyt|}WnRtjk r}z2|ddd@d dd } t|d| }Wdd}~XYnX||qRW|std |t |fS) Nrz"Missing "begin" line in input dataisbeginsend ri i?iizTruncated input data) rrreadlinerZ ValueErrorr Za2b_uuZErrorr r ) r r rrrrZsZdataZvZnbytesrrr uu_decode%s0  $ rc@s eZdZdddZdddZdS) CodecrcC t||SN)rselfr r rrrrGz Codec.encodecCrr)rrrrrdecodeJrz Codec.decodeNrr)__name__ __module__ __qualname__rrrrrrrFs rc@eZdZdddZdS)IncrementalEncoderFcCt||jdSNr)rr rr ZfinalrrrrNrzIncrementalEncoder.encodeNF)rrrrrrrrr!Mr!c@r )IncrementalDecoderFcCr"r#)rr r$rrrrRrzIncrementalDecoder.decodeNr%)rrrrrrrrr'Qr&r'c@eZdZeZdS) StreamWriterNrrrZbytesZcharbuffertyperrrrr)Ur&r)c@r() StreamReaderNr*rrrrr+Xr&r+c CstjdttttttddS)NZuuF)ZnamerrZincrementalencoderZincrementaldecoderZ streamreaderZ streamwriterZ_is_text_encoding)codecsZ CodecInforrr!r'r+r)rrrr getregentry]sr-)rrrr) Z__doc__r,r Ziorrrrr!r'r)r+r-rrrrZs   !