U AT^T@sddddgZdZdZdZdZzdd 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)N _ ~)ESCAPE)c quotetabsheaderr/usr/lib64/python3.8/quopri.py needsquotings rcCs(t|}ttt|dt|dfS)N)ordrbytesHEXrrrrquote$srFc Cs2tdk r,|}t|||d}||dS|dfdd}d}|}|sNqg} d} |dddkrv|dd}d} |D]D} t| f} t| ||rt| } |r| dkr| dqz| | qz|dk r||t | } t | t kr|| dt d d d | t d d} q| }q>|dk r.||| d dS) Nrr cSsj|r<|dddkr<||ddt|dd|n*|dkrX|t||n|||dS)Nr .)writer)soutputlineEndrrrr ;s (zencode..writerrr r s= )r#) r readr readlinerrrappend EMPTYSTRINGjoinlen MAXLINESIZE) inputr"rrdataodatar ZprevlinelineZoutlinestrippedrZthislinerrrr,s>           cCsFtdk rt|||dSddlm}||}|}t|||||S)NrrBytesIO)r ior2rgetvalue)r!rrr2infpoutfprrrrjs c Cstdk r*|}t||d}||dSd}|}|s>qdt|}}|dkr||d|dkrd} |d}|dkr||d|dkr|d}qtnd} ||kr|||d} | dkr|r|d}|d}q| tkr|| }|d}q|d|kr| sd} qq|d|krJ||d|d tkrJ|t}|d }q|d |krt||d|d rt||d |d r|tt||d|d f}|d }q|| }|d}q| s.||dd}q.|r||dS) Nrrrr$rs r r ) r r%r r&r*rishexrunhex) r,r"rr-r.newr/inpartialrrrrrusP       ( B"  cCsDtdk rt||dSddlm}||}|}t|||d|S)Nr7rr1)r r3r2rr4)r!rr2r5r6rrrrs  cCsHd|kodknpFd|ko*dknpFd|koBdkSS)N09afAFrrrrrr:sr:cCsd}|D]}t|f}d|kr*dkr8nn td}nLd|krLdkr^nntdd}n&d |krrd krnntd d}n|d t||}q|S) Nrr@rA0rBrCa rDrEr)rr)r!bitsrr=rrrr;s  r;c Csddl}ddl}z||jddd\}}WnV|jk r}z6|j|_t|tdtdtd|dW5d}~XYnXd}d}|D] \}}|dkrd}|d krd}q|r|r|j|_td |d|sd g}d} |D]} | d kr|jj } nTzt | d } WnDt k rP}z$|j d | |fd} WYqW5d}~XYnXz*|rjt| |jj nt| |jj |W5| d kr| Xq| r|| dS)Nrr$Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder8z-tz-dz -t and -d are mutually exclusive-rbz%s: can't open (%s) )sysgetoptargverrorstderrstdoutprintexitstdinbufferopenOSErrorr closerr) rLrMZoptsargsmsgZdecoZtabsorGstsfilefprrrmainsT     r___main__)F)FF)F)F)__all__rr+rr(Zbinasciir r ImportErrorrrrrrrr:r;r___name__rrrrs(   > + .