î ±+e¡ ã@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²|dkst‚t|ƒ}tƒ}|j}|j}|d|d@|fjdƒƒ|dƒ}x)|r‘|tj|ƒƒ|dƒ}qiW|dƒ|jƒt|ƒfS)Nrz begin %o %s iÿÚasciié-s end ) ÚAssertionErrorrÚreadÚwriteÚencodeÚbinasciiZb2a_uuÚgetvalueÚlen) ÚinputÚerrorsÚfilenameÚmodeÚinfileÚoutfilerrÚchunk©rú7/opt/alt/python34/lib64/python3.4/encodings/uu_codec.pyÚ uu_encodes    !   rc CsI|dkst‚t|ƒ}tƒ}|j}|j}x<|ƒ}|sZtdƒ‚n|dd…dkr<Pq<q<Wx£|ƒ}| s—|dkr›Pnytj|ƒ}Wn_tjk r}z<|ddd@d dd } tj|d| …ƒ}WYdd}~XnX||ƒq{W|s3td ƒ‚n|jƒt |ƒfS) Nrz"Missing "begin" line in input dataésbeginsend ré é?éézTruncated input data) rrÚreadlinerÚ ValueErrorr Za2b_uuÚErrorr r ) r rrrrrÚsÚdataÚvÚnbytesrrrÚ uu_decode!s0      ,r#c@s.eZdZddd„Zddd„ZdS)ÚCodecrcCs t||ƒS)N)r)Úselfr rrrrr Csz Codec.encodecCs t||ƒS)N)r#)r%r rrrrÚdecodeFsz Codec.decodeN)Ú__name__Ú __module__Ú __qualname__r r&rrrrr$Bs r$c@seZdZddd„ZdS)ÚIncrementalEncoderFcCst||jƒdS)Nr)rr)r%r Úfinalrrrr JszIncrementalEncoder.encodeN)r'r(r)r rrrrr*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/rrrrr0Ts r0cCs:tjdddtdtdtdtdtdtd d ƒS) NÚnameÚuur r&ÚincrementalencoderÚincrementaldecoderÚ streamreaderÚ streamwriterÚ_is_text_encodingF)ÚcodecsÚ CodecInforr#r*r,r0r-rrrrÚ getregentryYs r:) Ú__doc__r8r Úiorrr#r$r*r,r-r0r:rrrrÚs  !