o
0¦iq ã @ s² d Z g d¢ZdZdZdZdZz
ddlmZmZ W n
e y% dZdZY nw d d
„ Z
dd„ Zddd„Zddd„Z
ddd„Zddd„Zdd„ Zdd„ Zdd„ ZedkrWeƒ dS dS )zHConversions to/from quoted-printable transport encoding as per RFC 1521.)ÚencodeÚdecodeÚencodestringÚdecodestringó =éL s 0123456789ABCDEFó é )Úa2b_qpÚb2a_qpNc C sH t | tƒsJ ‚| dv r
|S | dkr|S | tkp#d| 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.
ó ó _ó ó ~)Ú
isinstanceÚbytesÚESCAPE)ÚcÚ quotetabsÚheader© r ú-/opt/alt/python310/lib64/python3.10/quopri.pyÚneedsquoting s "r c C sB t | tƒrt| ƒdks
J ‚t| ƒ} ttt| d t| d fƒ S )zQuote a single character.é é )r r ÚlenÚordr ÚHEX©r r r r Úquote$ s r Fc
C s< t dur| ¡ }t |||d�}| |¡ dS |dfdd„}d} | ¡ }|s'nig } d}
|dd… dkr;|dd… }d}
|D ]"}t|fƒ}t|||ƒrNt|ƒ}|rZ|d krZ| d
¡ q=| |¡ q=|durh||ƒ t | ¡}t
|ƒtkr�||dtd … dd� |td d… }t
|ƒtkss|}q |durœ|||
d� dS dS )
av Read '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©r r ó
c S sn | r| dd … dv r| | d d… t| dd … ƒ | ¡ d S | dkr.| t| ƒ| ¡ d S | | | ¡ d S )Néÿÿÿÿr ó .)Úwriter )ÚsÚoutputÚlineEndr r r r# ; s
*zencode.