usr/lib64/python2.7/uu.pyo000064400000010446147204445770011252 0ustar00 zfc@sdZddlZddlZddlZdddgZdefdYZdddZdddd Z d Z e d kre ndS( sImplementation of the UUencode and UUdecode functions. encode(in_file, out_file [,name, mode]) decode(in_file [, out_file, mode]) iNtErrortencodetdecodecBseZRS((t__name__t __module__(((s/usr/lib64/python2.7/uu.pyR'scCsg}z|dkr!tj}nt|tr|dkrQtjj|}n|dkrytj|j }Wqt k rqXnt |d}|j |n|dkrtj }n.t|trt |d}|j |n|dkrd}n|dkrd}n|jdd}|jdd}|jd |d @|f|jd }x;t|d kr|jtj||jd }qjW|jd Wdx|D]}|jqWXdS(s Uuencode filet-trbtwbis s\ns s\rs begin %o %s ii-is end N(tsyststdint isinstancet basestringtNonetostpathtbasenametstattst_modetAttributeErrortopentappendtstdouttreplacetwritetreadtlentbinasciitb2a_uutclose(tin_filetout_filetnametmodet opened_filestdatatf((s/usr/lib64/python2.7/uu.pyR*sB            ic Csg}|dkrtj}n+t|trIt|}|j|nz^xtr|j}|svtdn|j dsqOn|j dd}t |dkrO|ddkrOyt |dd PWqt k rqXqOqOW|dkr4|dj}tjj|r4td |q4n|dkrVt |dd }n|dkrntj}n_t|trt|d }ytjj||Wntk rnX|}|j|n|j}x|r|jd krytj|} Wnjtjk rs} t|dd d@ddd} tj|| } |sttjjd| qtnX|j| |j}qW|stdnWdx|D]} | jqWXdS(sDecode uuencoded fileRs'No valid begin line found in input filetbegint iiiiis"Cannot overwrite existing file: %sRtendi i?iis Warning: %s sTruncated input fileN(RR R R RRtTruetreadlineRt startswithtsplitRtintt ValueErrorR trstripR RtexistsRtchmodRtstripRta2b_uutordtstderrRR( RRR tquietR!thdrt hdrfieldstfptsR"tvtnbytesR#((s/usr/lib64/python2.7/uu.pyRasf     "        $  c Csddl}|jdd}|jddddd d d td d |jddddd dd td d |j\}}t|dkr|jdtjdntj }tj }t|dkr|d}nt|dkr|d}n|j rb|j rRt |tr2t|d}qRtjdGdGHtjdnt ||nW|j rt |trt|d}qtjdGdGHtjdnt||dS(suuencode/uudecode main programiNtusages'usage: %prog [-d] [-t] [input [output]]s-ds--decodetdestRthelpsDecode (instead of encode)?tdefaulttactiont store_trues-ts--textttexts2data is text, encoded format unix-compatible text?isincorrect number of argumentsiitws: cannot do -t to stdouttrs: cannot do -t from stdin(toptparset OptionParsert add_optiontFalset parse_argsRterrorRtexitR RRRAR R RtargvR(RDtparsertoptionstargstinputtoutput((s/usr/lib64/python2.7/uu.pyttests6 ((        t__main__( t__doc__RR Rt__all__t ExceptionRR RRRQR(((s/usr/lib64/python2.7/uu.pyts   7D %