?ŠMa¡ ã@sådZddlZddlZddlmZddddd„Zdd d „ZGd d „d ejƒZGd d„dejƒZGdd„dej ƒZ Gdd„deej ƒZ Gdd„deej ƒZ dd„Z 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)ÚBytesIOÚstrictzi¶c Cs t|ƒ}tƒ}|j}|j}|d|d@|fjdƒƒ|dƒ}x)|r|tj|ƒƒ|dƒ}qWW|dƒ|jƒt|ƒfS)Nz begin %o %s iÿÚasciié-s end )rÚreadÚwriteÚencodeÚbinasciiZb2a_uuÚgetvalueÚlen) ÚinputÚerrorsÚfilenameÚmodeÚinfileÚoutfilerrÚchunk©rú7/opt/alt/python35/lib64/python3.5/encodings/uu_codec.pyÚ uu_encodes    !   rc Cs+t|ƒ}tƒ}|j}|j}x6|ƒ}|sEtdƒ‚|dd…dkr*Pq*Wx |ƒ}| s|dkr€Pytj|ƒ}Wn_tjk rô}z<|ddd@ddd } tj|d| …ƒ}WYdd}~XnX||ƒqcW|std ƒ‚|jƒt|ƒfS) Nz"Missing "begin" line in input dataésbeginsend ré é?éézTruncated input data) rÚreadlinerÚ ValueErrorr Za2b_uuÚErrorr r ) r r rrrrÚsÚdataÚvÚnbytesrrrÚ uu_decode!s.       , r"c@s.eZdZddd„Zddd„ZdS)ÚCodecrcCs t||ƒS)N)r)Úselfr r rrrrCsz Codec.encodecCs t||ƒS)N)r")r$r r rrrÚdecodeFsz Codec.decodeN)Ú__name__Ú __module__Ú __qualname__rr%rrrrr#Bs r#c@seZdZddd„ZdS)ÚIncrementalEncoderFcCst||jƒdS)Nr)rr )r$r ÚfinalrrrrJszIncrementalEncoder.encodeN)r&r'r(rrrrrr)Is r)c@seZdZddd„ZdS)ÚIncrementalDecoderFcCst||jƒdS)Nr)r"r )r$r r*rrrr%NszIncrementalDecoder.decodeN)r&r'r(r%rrrrr+Ms r+c@seZdZeZdS)Ú StreamWriterN)r&r'r(ÚbytesÚcharbuffertyperrrrr,Qs r,c@seZdZeZdS)Ú StreamReaderN)r&r'r(r-r.rrrrr/Ts r/cCs:tjdddtdtdtdtdtdtd d ƒS) NÚnameÚuurr%ÚincrementalencoderÚincrementaldecoderÚ streamreaderÚ streamwriterÚ_is_text_encodingF)ÚcodecsÚ CodecInforr"r)r+r/r,rrrrÚ getregentryYs r9) Ú__doc__r7r Úiorrr"r#r)r+r,r/r9rrrrÚs  !