h _cc@s gdZdZdZdZdZzddlmZmZWneyHdZdZYn0dd Z d d Z dd dZ dddZ dddZ dddZddZddZddZedkredSdS) )encodedecode encodestring decodestrings=iLs0123456789ABCDEF)a2b_qpb2a_qpNcCs< |dvr|S|dkr|S|tkp:d|ko4dkn S)N _ s~)ESCAPE)c quotetabsheaderr/usr/lib64/python3.10/quopri.py needsquotings"rcCs* t|}ttt|dt|dfS)N)ordr bytesHEXr rrrquote$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) Nr r cSsn|r>|dddvr>||ddt|dd|dS|dkr\|t||dS|||dS)Nrs.)writer)soutputlineEndrrrr;s*zencode..writerrr r s= )r) rreadrreadlinerrrZappend EMPTYSTRINGZjoinlen MAXLINESIZE) inputrr rdataodatarZprevlinelineZoutlineZstrippedr Zthislinerrrr,sD          rcCsFtdurt|||dSddlm}||}|}t|||||S)NrrBytesIO)rior*rgetvalue)rr rr*infpoutfprrrrjs 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) Nrrrrrs r r i) rr rr!r#r ishexrunhex) r%rrr&r'Znewr(iZnZpartialr rrrrusF      (B,rcCsDtdurt||dSddlm}||}|}t|||d|S)Nr/rr))rr+r*rr,)rrr*r-r.rrrrs  rcCsJ d|kodknpHd|ko,dknpHd|koDdkSS)N09afAFrrrrrr1sHr1cCs d}|D]}t|f}d|kr,dkr:nn td}nLd|krNdkr`nntdd}n&d |krtd krnntd d}n|d t||}q |S) Nrr4r5Z0r6r7ai r8r9r)rr)rZbitsr r3rrrr2s  r2c 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)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder0Fz-tTz-dz -t and -d are mutually exclusivez-Zrbz%s: can't open (%s) )sysgetoptZargvZerrorZstderrZstdoutZprintZexitZstdinZbufferZopenZOSErrorrrrZclose) r;r<ZoptsZargsZmsgZdecoZtabsZor:ZstsZfileZfprrrmains^          r=Z__main__F)FFr>r>)Z__all__r r$rr"ZbinasciirrZ ImportErrorrrrrrrr1r2r=Z__name__rrrrZs0    > + .