????
Current Path : /usr/lib/python3.6/site-packages/future/backports/email/__pycache__/ |
Current File : //usr/lib/python3.6/site-packages/future/backports/email/__pycache__/generator.cpython-36.pyc |
3 �c@L � @ s. d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd d gZ ddl Z ddlZddlZddl Z ddlZddlmZmZ dd lmZ ddlmZ ddlmZ ddljjjZdZdZe jde 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 �/usr/lib/python3.6/generator.py�__init__+ s zGenerator.__init__c C s | j 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| j�| _d| _| jd�| _| j }|j }zL|| _ ||_ |r�|j � }|s�dt jt j � � }| j|| j � | 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_EMTPYZget_unixfrom�timeZctimer �_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 |j d�}x0|d d� D ] }| j|jd�� | j| j� q W |d jd�}| j|� t|d �t|�kr|| j| j� d S )NT� z ���r. r. )� splitlinesr �rstripr"