h _c@s gdZdZdZdZdZzddlmZmZWneyHdZdZYn0dd Z d d Z dd dZ dddZ dddZ dddZddZddZddZedkredSdS) )encodedecode encodestring decodestring=Ls0123456789ABCDEF)a2b_qpb2a_qpNcCs< |dvr|S|dkr|S|tkp:d|ko4dkn S)N _ ~)ESCAPE)c quotetabsheaderr/usr/lib64/python3.10/quopri.py needsquotings"rcCs* t|}ttt|dt|dfS)N)ordrbytesHEXrrrrquote$s rFc Cs8 tdur.|}t|||d}||dS|dfdd}d}|}|sPqg} d} |dddkrx|dd}d} |D]D} t| f} t| ||rt| } |r| dkr| dq|| | q||dur||t | } t | t kr|| dt d d d | t d d} q| }q@|dur4||| d dSdS) Nrr cSsn|r>|dddvr>||ddt|dd|dS|dkr\|t||dS|||dS)Nr .)writer)soutputlineEndrrrr ;s*zencode..writerrr r s= )r#) r readr readlinerrrappend EMPTYSTRINGjoinlen MAXLINESIZE) inputr"rrdataodatar ZprevlinelineZoutlinestrippedrZthislinerrrr,sD          rcCsFtdurt|||dSddlm}||}|}t|||||S)NrrBytesIO)r ior2rgetvalue)r!rrr2infpoutfprrrrjs rc Cs tdur,|}t||d}||dSd}|}|s@qdt|}}|dkr||d|dkrd} |d}|dkr||d|dvr|d}qvd} ||kr|||d} | dkr|r|d}|d}q| tkr|| }|d}q|d|kr| sd} q|d|krH||d|d tkrH|t}|d }q|d |krt||d|d rt||d |d r|tt||d|d f}|d }q|| }|d}q| s0||dd}q0|r||dSdS) Nrrrr$rs r r ) r r%r r&r*rishexrunhex) r,r"rr-r.newr/inpartialrrrrrusF      (B,rcCsDtdurt||dSddlm}||}|}t|||d|S)Nr7rr1)r r3r2rr4)r!rr2r5r6rrrrs  rcCsJ d|kodknpHd|ko,dknpHd|koDdkSS)N09afAFrrrrrr:sHr:cCs d}|D]}t|f}d|kr,dkr:nn td}nLd|krNdkr`nntdd}n&d |krtd krnntd d}n|d t||}q |S) Nrr@rA0rBrCa rDrEr)rr)r!bitsrr=rrrr;s  r;c Csddl}ddl}z||jddd\}}WnX|jy}z>|j|_t|tdtdtd|dWYd}~nd}~0d}d}|D] \}}|d krd }|d krd }q|r|r|j|_td |d|sd g}d} |D]} | d kr|jj } nLzt | d} Wn<t y}z$|j d| |fd} WYd}~qd}~0z:|rft | |jj nt| |jj |W| d kr| q| d kr| 0| r|| dS0dS0)Nrr$Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder8Fz-tTz-dz -t and -d are mutually exclusive-rbz%s: can't open (%s) )sysgetoptargverrorstderrstdoutprintexitstdinbufferopenOSErrorr rrclose) rLrMZoptsargsmsgZdecoZtabsorGstsfilefprrrmains^          r___main__)F)FF)F)F)__all__rr+rr(Zbinasciir r ImportErrorrrrrrrr:r;r___name__rrrrs0    > + .