usr/lib64/python3.6/__pycache__/uu.cpython-36.pyc000064400000006654147204652060015355 0ustar003 \k@sddZddlZddlZddlZdddgZGdddeZd ddZdd dZd d Z e d kr`e dS)zImplementation of the UUencode and UUdecode functions. encode(in_file, out_file [,name, mode]) decode(in_file [, out_file, mode]) NErrorencodedecodec@s eZdZdS)rN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/uu.pyr'scCsBg}z|dkrtjj}n`t|trz|dkr8tjj|}|dkrfytj|j }Wnt k rdYnXt |d}|j ||dkrtj j}nt|trt |d}|j ||dkrd}|dkrd}|jd|d@|fjd|jd }x,t|d kr|jtj||jd }qW|jd Wdx|D]}|jq*WXdS) z Uuencode file-Nrbwbiz begin %o %s iascii-rs end )sysstdinbuffer isinstancestrospathbasenamestatst_modeAttributeErroropenappendstdoutwriterreadlenbinasciiZb2a_uuclose)in_fileout_filenamemode opened_filesdatafrrr r*s>           Fc Cs:g}|dkrtjj}nt|tr4t|d}|j|zxr|j}|sNtd|j dsZq:|j dd}t |dkr:|ddkr:yt |d d PWq:t k rYq:Xq:W|d kr|djd jd }tjj|rtd||d krt |d d }|dkr tjj}nNt|trXt|d}ytjj||Wntk rHYnX|}|j||j}x|r|jd dkrytj|} Wnjtjk r} zJ|ddd@ddd} tj|d | } |stjjd| WYd d } ~ XnX|j| |j}qbW|stdWd x|D]} | jq"WXd S)zDecode uuencoded filer r z'No valid begin line found in input filesbegin rNs r z"Cannot overwrite existing file: %sr send ?z Warning: %s zTruncated input file)rrrrrrrreadliner startswithsplitrint ValueErrorrstriprrrexistsrchmodrstripr Za2b_uustderrrr!) r"r#r%quietr&ZhdrZ hdrfieldsfpsr'vnbytesr(rrr rZsf              "   cCs4ddl}|jdd}|jddddd d d |jd d ddd d d |j\}}t|dkrl|jdtjdtjj }tj j }t|dkr|d}t|dkr|d}|j r|j rt |trt|d}nttjddtjdt ||nD|j r&t |tr t|d}nttjddtjdt||dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F store_true)desthelpdefaultactionz-tz--texttextz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,r z: cannot do -t to stdoutr z: cannot do -t from stdin)optparseZ OptionParserZ add_option parse_argsrerrorrexitrrrrrFrrrprintargvr)rGparserZoptionsargsinputoutputrrr tests6              rQ__main__)NN)NNF) __doc__r rr__all__ ExceptionrrrrQrrrrr s  0 F&