Ńň §ÚęLc@sčdZddddgZdZdZdZdZyd d klZlZWne j odZdZnXd „Z d „Z d d„Z d d d„Zd d„Zd d„Zd„Zd„Zd„Zedjo eƒndS(sHConversions to/from quoted-printable transport encoding as per RFC 1521.tencodetdecodet encodestringt decodestringt=iLt0123456789ABCDEFti˙˙˙˙(ta2b_qptb2a_qpcCsM|djo|S|djo|S|tjpd|jo djn S(séDecide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. s t_t t~(tESCAPE(tct quotetabstheader((s/usr/lib64/python2.6/quopri.pyt needsquotings   cCs(t|ƒ}tt|dt|dS(sQuote a single character.i(tordR tHEX(R ti((s/usr/lib64/python2.6/quopri.pytquote#s ic CsŁtdj o6|iƒ}t|d|d|ƒ}|i|ƒdS|dd„}d}x#|iƒ}|pPng} d} |ddjo|d }d} nxc|D][} t| ||ƒot| ƒ} n|o| djo| id ƒqŤ| i| ƒqŤW|dj o||ƒnti | ƒ} x>t | ƒt jo*|| t d  d d ƒ| t d } q7W| }q[|dj o||d | ƒndS( s–Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. The 'header' flag indicates whether we are encoding spaces as _ as per RFC 1522. RRNs cSs||o8|ddjo'|i|d t|dƒ|ƒn:|djo|it|ƒ|ƒn|i||ƒdS(Ni˙˙˙˙s t.(twriteR(tstoutputtlineEnd((s/usr/lib64/python2.6/quopri.pyR;s ' Ri˙˙˙˙R R iRs= ( RtNonetreadRtreadlineRRtappendt EMPTYSTRINGtjointlent MAXLINESIZE( tinputRRRtdatatodataRtprevlinetlinetoutlinetstrippedR tthisline((s/usr/lib64/python2.6/quopri.pyR*sB          cCsftdj ot|d|d|ƒSddkl}||ƒ}|ƒ}t||||ƒ|iƒS(NRRi˙˙˙˙(tStringIO(RRt cStringIOR*Rtgetvalue(RRRR*tinfptoutfp((s/usr/lib64/python2.6/quopri.pyRis   c Csvtdj o0|iƒ}t|d|ƒ}|i|ƒdSd}x|iƒ}|pPndt|ƒ}}|djo]||ddjoHd} |d}x;|djo#||ddjo|d}qŚWnd} xQ||joC||} | djo|o|d }|d}qä| tjo|| }|d}qä|d|jo| o d} Pqä|d|jo-||dtjo|t}|d }qä|d |jo]t||dƒoHt||d ƒo3|tt ||d|d !ƒƒ}|d }qä|| }|d}qäW| p|i|dƒd}qFqF|o|i|ƒndS( sŃRead 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. If 'header' is true, decode underscore as space (per RFC 1522).RNRiis s R R ii( RRRRRR R tishextchrtunhex( R"RRR#R$tnewR&RtntpartialR ((s/usr/lib64/python2.6/quopri.pyRtsV    " "     & ;%  cCs`tdj ot|d|ƒSddkl}||ƒ}|ƒ}t||d|ƒ|iƒS(NRi˙˙˙˙(R*(RRR+R*RR,(RRR*R-R.((s/usr/lib64/python2.6/quopri.pyRŸs   cCsUd|jo djnp7d|jo djnpd|jodjSS(s8Return true if the character 'c' is a hexadecimal digit.t0t9tatftAtF((R ((s/usr/lib64/python2.6/quopri.pyR/ŤscCsĆd}xš|D]ą}d|jo djnotdƒ}nfd|jo djnotdƒd}n4d|jo djnotdƒd}nP|d t|ƒ|}q W|S( s.Get the integer value of a hexadecimal number.iR5R6R7R8i R9R:i(R(RtbitsR R((s/usr/lib64/python2.6/quopri.pyR1Żsc Csüddk}ddk}y#|i|iddƒ\}}WnE|ij o6}|i|_|GHdGHdGHdGH|idƒnXd}d}xB|D]:\}}|d jo d}n|d jo d}q–q–W|o)|o"|i|_d GH|idƒn|p d g}nd} xż|D]ˇ} | d jo |i} nLyt| ƒ} Wn8t j o,}|ii d | |fƒd} q%nX|ot | |iƒnt | |i|ƒ| |ij o| i ƒq%q%W| o|i| ƒndS(Ni˙˙˙˙ittds"usage: quopri [-t | -d] [file] ...s-t: quote tabss-d: decode; default encodeiis-ts-ds -t and -d are mutually exclusivet-s%s: can't open (%s) (tsystgetopttargvterrortstderrtstdouttexittstdintopentIOErrorRRRtclose( R>R?toptstargstmsgtdecottabstoR7tststfiletfp((s/usr/lib64/python2.6/quopri.pytmainŔsV  #        t__main__N(t__doc__t__all__R R!RRtbinasciiRRt ImportErrorRRRRRRRR/R1RRt__name__(((s/usr/lib64/python2.6/quopri.pyts*    ? +   ,