Hacked By AnonymousFox
B
� fN � @ s� d Z dddgZddlZddlZddlZddlZddlmZ ddlm Z m
Z
ddlmZ d Z
d
Ze�d�Ze�dej�ZG d
d� d�ZG dd� de�ZdZG dd� de�Zeeejd ��Zde ZejZdS )z:Classes to generate plain text from a message object tree.� Generator�DecodedGenerator�BytesGenerator� N)�deepcopy)�StringIO�BytesIO)�_has_surrogates�_�
z
\r\n|\r|\nz^From c @ s� e Zd ZdZd'dd�dd�Zdd� Zd(d d
�Zdd� Zd
d� Zdd� Z dd� Z
dd� Zdd� Zdd� Z
dd� ZeZdd� Zdd� Zdd � 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.
N)�policyc C s6 |dkr|dkrdn|j }|| _|| _|| _|| _dS )a� Create the generator for message flattening.
outfp is the output file-like object for writing the message to. It
must have a write() method.
Optional mangle_from_ is a flag that, when True (the default if policy
is not set), escapes From_ lines in the body of the message by putting
a `>' in front of them.
Optional maxheaderlen specifies the longest length for a non-continued
header. When a header line is longer (in characters, with tabs
expanded to 8 spaces) than maxheaderlen, the header will split as
defined in the Header class. Set maxheaderlen to zero to disable
header wrapping. The default is 78, as recommended (but not required)
by RFC 2822.
The policy keyword specifies a policy object that controls a number of
aspects of the generator's operation. If no policy is specified,
the policy associated with the Message object passed to the
flatten method is used.
NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr )�self�outfpr r r � r �4/opt/alt/python37/lib64/python3.7/email/generator.py�__init__$ s zGenerator.__init__c C s | j �|� d S )N)r
�write)r �sr r r r D s zGenerator.writeFc C s� | j dkr|j n| j }|dk r*|j|d�}| jdk rB|j| jd�}|j| _| �| j�| _d| _| �| j�| _| j }|j }zL|| _ ||_ |r�|� � }|s�dt
�t
�
� � }| �|| j � | �
|� W d|| _ ||_ X dS )a� 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 specified
when the Generator instance was created or, if none was specified,
from the policy associated with the msg.
N)�linesep)�max_line_length� zFrom nobody )r �cloner r �_NL�_encode�_encoded_NLZ_EMPTY�_encoded_EMPTYZget_unixfrom�timeZctimer �_write)r �msg�unixfromr r Zold_gen_policyZold_msg_policyZufromr r r �flattenH 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 y s zGenerator.clonec 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 sX |sd S t �|�}x*|d d� D ]}| �|� | �| j� q W |d rT| �|d � d S )N���)�NLCRE�splitr r )r �lines�liner r r �_write_lines� s
zGenerator._write_linesc C s� | j }z"d | _| �� | _ }| �|� W d || _ | j}| `X |rht|�}|�d|d � |�d|d � t|dd �}|d kr�| �|� n|| � | j �|� � � d S )Nzcontent-transfer-encodingr zcontent-type� �_write_headers)
r
�
_munge_cter&