grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026B ¶¾`áþ}sã@s´dZddddgZdZdZdZdZyd d lmZmZWne k rPd Zd ZYnXd d „Z dd„Z ddd„Z ddd„Z ddd„Zddd„Zdd„Zdd„Zdd„Zedkr°eƒd S) zHConversions to/from quoted-printable transport encoding as per RFC 1521.ÚencodeÚdecodeÚ encodestringÚ decodestringó=éLs0123456789ABCDEFóé)Úa2b_qpÚb2a_qpNcCsHt|tƒst‚|dkr|S|dkr&|S|tkpFd|ko@dkn S)zìDecide whether a particular byte ordinal 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 ó_ó ó~)Ú isinstanceÚbytesÚAssertionErrorÚESCAPE)ÚcÚ quotetabsÚheader©rú+/opt/alt/python37/lib64/python3.7/quopri.pyÚ needsquotings rcCsBt|tƒrt|ƒdkst‚t|ƒ}ttt|dt|dfƒS)zQuote a single character.éé)rrÚlenrÚordrÚHEX)rrrrÚquote$srFc Cs<tdk r,| ¡}t|||d�}| |¡dS|dfdd„}d}xâ| ¡}|sNPg} d} |dd…dkrv|dd…}d} xL|D]D} t| fƒ} t| ||ƒržt| ƒ} |r¶| dkr¶|  d ¡q||  | ¡q|W|dk rÔ||ƒt  | ¡} x:t | ƒt k�r|| dt d …d d �| t d d…} qàW| }q@W|dk �r8||| d �dS) avRead 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are binary file objects. 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.N)rró cSsj|r<|dd…dkr<| |dd…t|dd…ƒ|¡n*|dkrX| t|ƒ|¡n| ||¡dS)Néÿÿÿÿs ó.)Úwriter)ÚsÚoutputÚlineEndrrrr!;s (zencode..writerrr r rs= )r$) r Úreadr!ÚreadlinerrrÚappendÚ EMPTYSTRINGÚjoinrÚ MAXLINESIZE) Úinputr#rrÚdataÚodatar!ZprevlineÚlineZoutlineÚstrippedrZthislinerrrr,s@           cCsFtdk rt|||d�Sddlm}||ƒ}|ƒ}t||||ƒ| ¡S)N)rrr)ÚBytesIO)r Úior0rÚgetvalue)r"rrr0ÚinfpÚoutfprrrrjs c Cstdk r*| ¡}t||d�}| |¡dSd}�x¼| ¡}|s@Pdt|ƒ}}|dkr¢||d|…dkr¢d} |d}x.|dkrž||d|…dkrž|d}qxWnd} �x*||k�rÒ|||d…} | dkrâ|râ|d }|d}qª| tkrü|| }|d}qª|d|k�r| �sd} Pqª|d|k�rR||d|d …tk�rR|t}|d }qª|d |k�rÀt||d|d …ƒ�rÀt||d |d …ƒ�rÀ|tt||d|d …ƒfƒ}|d }qª|| }|d}qªW| s2| |d¡d}q2W|�rþ| |¡dS) z»Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are binary file objects. If 'header' is true, decode underscore as space (per RFC 1522).N)rrrrrs r r éé) r r%r!r&rrÚishexrÚunhex) r+r#rr,r-Únewr.ÚiÚnÚpartialrrrrrusR     ( B"  cCsDtdk rt||d�Sddlm}||ƒ}|ƒ}t|||d�| ¡S)N)rr)r0)r r1r0rr2)r"rr0r3r4rrrr s  cCsVt|tƒst‚d|ko dknpTd|ko8dknpTd|koPdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.ó0ó9óaófóAóF)rrr)rrrrr7¬sr7cCs¶d}x¬|D]¤}t|fƒ}d|kr,dkr:nn tdƒ}n`d|krNdkr`nntdƒd}n:d |krtd kr†nntd ƒd}nd sštd t|ƒƒ‚|d t|ƒ|}q W|S)z.Get the integer value of a hexadecimal number.rr=r>Ú0r?r@Úaé rArBFznon-hex digit r)rrrÚrepr)r"Úbitsrr:rrrr8±s   r8c Cs¬ddl}ddl}y| |jdd…d¡\}}WnV|jk r„}z6|j|_t|ƒtdƒtdƒtdƒ| d¡Wdd}~XYnXd}d}x(|D] \}}|dkr¨d}|d kr”d}q”W|rÚ|rÚ|j|_td ƒ| d¡|säd g}d} x®|D]¦} | d k�r|jj } nNyt | d ƒ} Wn>t k �rR}z|j  d | |f¡d} wîWdd}~XYnXz*|�rlt | |jj ƒnt| |jj |ƒWd| d k�r’|  ¡XqîW| �r¨| | ¡dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder5z-tz-dz -t and -d are mutually exclusiveú-Úrbz%s: can't open (%s) )ÚsysÚgetoptÚargvÚerrorÚstderrÚstdoutÚprintÚexitÚstdinÚbufferÚopenÚOSErrorr!rrÚclose) rJrKZoptsÚargsÚmsgZdecoZtabsÚorDÚstsÚfileÚfprrrÚmainÃsT     r]Ú__main__)F)FF)F)F)Ú__doc__Ú__all__rr*rr(Zbinasciir r Ú ImportErrorrrrrrrr7r8r]Ú__name__rrrrÚs*   > + .