o
    éT•jú  ã                   @   sP   d Z g d¢ZddlmZ ddlmZ dd„ Zdd„ Z	d	d
„ Z
dd„ Zdd„ ZdS )z Encodings and related functions.)Úencode_7or8bitÚencode_base64Úencode_noopÚencode_quoprié    )Úencodebytes)Úencodestringc                 C   s   t | dd�}| dd¡S )NT)Ú	quotetabsó    s   =20)Ú_encodestringÚreplace)ÚsÚenc© r   ú%/usr/lib/python3.10/email/encoders.pyÚ_qencode   s   r   c                 C   s0   | j dd�}tt|ƒdƒ}|  |¡ d| d< dS )zlEncode the message's payload in Base64.

    Also, add an appropriate Content-Transfer-Encoding header.
    T©ÚdecodeÚasciiÚbase64úContent-Transfer-EncodingN)Úget_payloadÚstrÚ_bencodeÚset_payload©ÚmsgÚorigÚencdatar   r   r   r      s   
r   c                 C   s*   | j dd�}t|ƒ}|  |¡ d| d< dS )zvEncode the message's payload in quoted-printable.

    Also, add an appropriate Content-Transfer-Encoding header.
    Tr   zquoted-printabler   N)r   r   r   r   r   r   r   r   &   s   
r   c                 C   sX   | j dd�}|du rd| d< dS z| d¡ W n ty%   d| d< Y dS w d| d< dS )z9Set the Content-Transfer-Encoding header to 7bit or 8bit.Tr   NÚ7bitr   r   Ú8bit)r   r   ÚUnicodeError)r   r   r   r   r   r   2   s   ÿr   c                 C   s   dS )zDo nothing.Nr   )r   r   r   r   r   D   s    r   N)Ú__doc__Ú__all__r   r   r   Úquoprir   r
   r   r   r   r   r   r   r   r   r   Ú<module>   s   