ok
Direktori : /proc/thread-self/root/opt/alt/python39/lib64/python3.9/email/__pycache__/ |
Current File : //proc/thread-self/root/opt/alt/python39/lib64/python3.9/email/__pycache__/generator.cpython-39.pyc |
a ���e�N � @ s� d Z g d�ZddlZddlZddlZddlZddlmZ ddlm Z m Z ddlmZ dZ dZe�d �Ze�d ej�ZG dd� d�ZG d d� 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 |du r|du rdn|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/python39/lib64/python3.9/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 du r|j n| j }|dur*|j|d�}| jdurB|j| jd�}|j| _| �| j�| _d| _| �| j�| _| j }|j }zX|| _ ||_ |r�|� � }|s�dt �t � � � }| �|| j � | � |� W || _ ||_ n|| _ ||_ 0 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�Zmax_line_length� zFrom nobody )r �cloner r �_NL�_encode�_encoded_NLZ_EMPTY�_encoded_EMPTYZget_unixfrom�time�ctimer �_write)r �msg�unixfromr r Zold_gen_policyZold_msg_policyZufromr r r �flattenH s0 �zGenerator.flattenc C s | j || jd| jd�S )z1Clone this generator with the exact same options.Nr )� __class__r r )r �fpr r r r y s �zGenerator.clonec C s t � S r )r �r r r r �_new_buffer� s zGenerator._new_bufferc C s |S r r r r r r r � s zGenerator._encodec C sT |sd S t �|�}|d d� D ]}| �|� | �| j� q|d rP| �|d � d S )N���)�NLCRE�splitr r )r �lines�liner r r �_write_lines� s zGenerator._write_linesc C s� | j }z2d | _| �� | _ }| �|� W || _ | j}| `n|| _ | j}| `0 |r�t|�}|�d�d u rt|d |d<