g# dZddlZddlZddlmZddZddZGddejZGdd ejZGd d ejZ Gd d eejZ GddeejZ dZ y)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)BytesIOct|}t}|j}|j}|jdd}|jdd}|d|dz|fzj d|d}|r&|t j ||d}|r&|d |jt|fS) N z\n z\rz begin %o %s iascii-s end ) rreadwritereplaceencodebinasciib2a_uugetvaluelen) inputerrorsfilenamemodeinfileoutfiler r chunks 9/opt/alt/python312/lib64/python3.12/encodings/uu_codec.py uu_encoders U^FiG ;;D MMEU+HU+H ?dUlH5 5 = =g FG HE  hooe$%R  +    E ++ct|}t}|j}|j} |}|s td|dddk(rn |}|r|dk(rn t j |}||.|s td |jt|fS#tj $r6}|ddz dzdzdzd z} t j |d| }Yd}~ud}~wwxYw) Nz"Missing "begin" line in input datasbeginsend r ?zTruncated input data) rreadliner ValueErrorr a2b_uuErrorrr) rrrrr!r sdatavnbytess r uu_decoder)%s U^FiGH MME JAB B Ra5H     JAM  /??1%D d   /00    E ++~~ /!R2~*Q.14F??1Wf:.D /sB$$C-7,C((C-ceZdZddZddZy)Codecct||SN)rselfrrs rr z Codec.encodeG''rct||Sr-)r)r.s rdecodez Codec.decodeJr0rNstrict)__name__ __module__ __qualname__r r2rrr+r+Fs ((rr+ceZdZddZy)IncrementalEncoderc4t||jdSNr)rrr/rfinals rr zIncrementalEncoder.encodeN ,Q//rNF)r5r6r7r r8rrr:r:M0rr:ceZdZddZy)IncrementalDecoderc4t||jdSr<)r)rr=s rr2zIncrementalDecoder.decodeRr?rNr@)r5r6r7r2r8rrrCrCQrArrCceZdZeZy) StreamWriterNr5r6r7bytescharbuffertyper8rrrFrFUNrrFceZdZeZy) StreamReaderNrGr8rrrLrLXrJrrLc ltjdtttt t tdS)NuuF)namer r2incrementalencoderincrementaldecoder streamreader streamwriter_is_text_encoding)codecs CodecInforr)r:rCrLrFr8rr getregentryrW]s-    --!!  r)r4zir3) __doc__rUr iorrr)r+r:rCrFrLrWr8rrrZs,*,B(FLL(022002205&--5&-- r