Hacked By AnonymousFox
B
�A�[@L � @ s8 d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd d
gZ ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZ dd
lmZ ddlmZ ddlmZ ddlm m mZ dZdZe
�de
j �Z!G dd� de"�Z#G dd
� d
e#�Z$dZ%G dd � d e#�Z&e'e(ej)d ��Z*de* Z+e#j,Z,dS )z:Classes to generate plain text from a message object tree.� )�print_function)�unicode_literals)�division)�absolute_import)�super)�str� Generator�DecodedGenerator�BytesGeneratorN)�StringIO�BytesIO)�compat32)�Header)�_has_surrogates�_�
z^From c @ s� e Zd ZdZd(dd�Zdd� Zd)d d
�Zdd� Zd
Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd� ZeZdd� Zdd� Zd d!� Zd"d#� Zed*d$d%��Zed&d'� �ZdS )+r z�Generates output from a Message object tree.
This basic generator writes the message to the given file object as plain
text.
TNc K s8 d|kr|d }|d= nd }|| _ || _|| _|| _d S )N�policy)�_fp�
_mangle_from_�maxheaderlenr )�self�outfp�mangle_from_r Z_3to2kwargsr � r �Q/opt/alt/python37/lib/python3.7/site-packages/future/backports/email/generator.py�__init__+ s zGenerator.__init__c C s | j �|� d S )N)r �write)r �sr r r r H s zGenerator.writeFc C s� | j dkr|j n| j }|dk r*|j|d�}| jdk rB|j| jd�}|j| _| �| j�| _d| _| �d�| _| j }|j }zL|| _ ||_ |r�|� � }|s�dt
�t
�
� � }| �|| j � | �
|� W d|| _ ||_ X dS )az Print the message object tree rooted at msg to the output file
specified when the Generator instance was created.
unixfrom is a flag that forces the printing of a Unix From_ delimiter
before the first object in the message tree. If the original message
has no From_ delimiter, a `standard' one is crafted. By default, this
is False to inhibit the printing of any From_ delimiter.
Note that for subobjects, no From_ line is printed.
linesep specifies the characters used to indicate a new line in
the output. The default value is determined by the policy.
N)�linesep)�max_line_length� zFrom nobody )r �cloner r �_NL�_encode�_encoded_NLZ_EMPTYZ_encoded_EMTPY�get_unixfrom�time�ctimer �_write)r �msg�unixfromr r Zold_gen_policyZold_msg_policyZufromr r r �flattenL s,
zGenerator.flattenc C s | j || jd| jd�S )z1Clone this generator with the exact same options.N)r )� __class__r r )r �fpr r r r! { s zGenerator.cloner c C s t � S )N)r )r r r r �_new_buffer� s zGenerator._new_bufferc C s |S )Nr )r r r r r r# � s zGenerator._encodec C s� |sd S |� d�}x0|d d� D ] }| �|�d�� | �| j� q W |d �d�}| �|� t|d �t|�kr|| �| j� d S )NT���z
)�
splitlinesr �rstripr"