B @sddddgZdZdZdZdZydd lmZmZWnek rLd Zd ZYnXd d Z d dZ dddZ dddZ dddZ dddZddZddZddZedkred S)encodedecode encodestring decodestring=Ls0123456789ABCDEF)a2b_qpb2a_qpNcCs:|dkr |S|dkr|S|tkp8d|ko2dkn S)Ns _ ~)ESCAPE)c quotetabsheaderr)/opt/alt/python37/lib/python3.7/quopri.py needsquotings rcCs(t|}ttt|dt|dfS)N)ordrbytesHEX)rrrrquote$srFc Cs<tdk r,|}t|||d}||dS|dfdd}d}x|}|sNPg} d} |dddkrv|dd}d} xL|D]D} t| f} t| ||rt| } |r| dkr| dq|| | q|W|dk r||t | } x:t | t kr|| dt d d d | t d d} qW| }q@W|dk r8||| d dS) N)rr cSsj|r<|dddkr<||ddt|dd|n*|dkrX|t||n|||dS)Ns .)writer)soutputlineEndrrrr;s (zencode..writerrr r s= )r ) r readrreadlinerrrappend EMPTYSTRINGjoinlen MAXLINESIZE) inputrrrdataodatarZprevlinelineZoutlinestrippedrZthislinerrrr,s@           cCsFtdk rt|||dSddlm}||}|}t|||||S)N)rrr)BytesIO)r ior.rgetvalue)rrrr.infpoutfprrrrjs c Cstdk r*|}t||d}||dSd}x|}|s@Pdt|}}|dkr||d|dkrd} |d}x.|dkr||d|dkr|d}qxWnd} x*||kr|||d} | dkr|r|d}|d}q| tkr|| }|d}q|d|kr| sd} Pq|d|krR||d|d tkrR|t}|d }q|d |krt||d|d rt||d |d r|tt||d|d f}|d }q|| }|d}qW| s2||dd}q2W|r||dS) N)rrrr!rs r r ) r r"rr#r'rishexrunhex) r)rrr*r+newr,inpartialrrrrrusR     ( B"  cCsDtdk rt||dSddlm}||}|}t|||d|S)N)rr)r.)r r/r.rr0)rrr.r1r2rrrrs  cCsHd|kodknpFd|ko*dknpFd|koBdkSS)N09afAFr)rrrrr5sr5cCsd}x|D]}t|f}d|kr,dkr:nn td}nLd|krNdkr`nntdd}n&d |krtd krnntd d}n|d t||}q W|S) Nrr;r<0r=r>a r?r@r)rr)rbitsrr8rrrr6s   r6c Csddl}ddl}y||jddd\}}WnV|jk r}z6|j|_t|tdtdtd|dWdd}~XYnXd}d}x(|D] \}}|dkrd}|d krd}qW|r|r|j|_td |d|sd g}d} x|D]} | d kr|jj } nNyt | d } Wn>t k rR}z|j d | |fd} wWdd}~XYnXz*|rlt | |jj nt| |jj |Wd| d kr| XqW| r|| dS)Nrr!Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder3z-tz-dz -t and -d are mutually exclusive-rbz%s: can't open (%s) )sysgetoptargverrorstderrstdoutprintexitstdinbufferopenOSErrorrrrclose) rGrHZoptsargsmsgZdecoZtabsorBstsfilefprrrmainsT     rZ__main__)F)FF)F)F)__all__rr(rr%Zbinasciir r ImportErrorrrrrrrr5r6rZ__name__rrrrs(   > + .