AlkantarClanX12

Your IP : 3.12.154.133


Current Path : /opt/alt/python33/lib64/python3.3/email/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/email/__pycache__/generator.cpython-33.pyc

�
��fCMc@sLdZdddgZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
dd	lmZdd
lmZddljZdZdZejd
ej�ZGdd�d�ZGdd�de�ZdZGdd�de�Zeeej d��Z!de!Z"ej#Z#dS(u:Classes to generate plain text from a message object tree.u	GeneratoruDecodedGeneratoruBytesGeneratoriN(udeepcopy(uStringIOuBytesIO(ucompat32(uHeader(u_has_surrogatesu_u
u^From cBs|EeZdZdZdd&d'd&dd�Zdd�Zd(d&dd�Z	d	d
�Z
dZdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZeZdd�Zdd�Zdd�Zd d!�Zed&d"d#��Zed$d%��Zd&S()u	Generatoru�Generates output from a Message object tree.

    This basic generator writes the message to the given file object as plain
    text.
    upolicycCs(||_||_||_||_dS(u�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), 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.  The default policy maintains
        backward compatibility.

        N(u_fpu
_mangle_from_umaxheaderlenupolicy(uselfuoutfpumangle_from_umaxheaderlenupolicy((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu__init__'s			uGenerator.__init__cCs|jj|�dS(N(u_fpuwrite(uselfus((u4/opt/alt/python33/lib64/python3.3/email/generator.pyuwriteCsuGenerator.writecCs?|jdkr|jn|j}|dk	rB|jd|�}n|jdk	ri|jd|j�}n|j|_|j|j�|_d|_|jd�|_	|j}|j}zn||_||_|r|j
�}|sdtjtj��}n|j
||j�n|j|�Wd||_||_XdS(uzPrint 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.

        ulinesepumax_line_lengthuuFrom nobody N(upolicyuNoneucloneumaxheaderlenulinesepu_NLu_encodeu_encoded_NLu_EMPTYu_encoded_EMTPYuget_unixfromutimeuctimeuwriteu_write(uselfumsguunixfromulinesepupolicyuold_gen_policyuold_msg_policyuufrom((u4/opt/alt/python33/lib64/python3.3/email/generator.pyuflattenGs,!						uGenerator.flattencCs|j||jdd|j�S(u1Clone this generator with the exact same options.upolicyN(u	__class__u
_mangle_from_uNoneupolicy(uselfufp((u4/opt/alt/python33/lib64/python3.3/email/generator.pyuclonevs	uGenerator.cloneucCst�S(N(uStringIO(uself((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_new_buffer�suGenerator._new_buffercCs|S(N((uselfus((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_encode�suGenerator._encodecCs�|s
dS|jd�}x>|dd�D],}|j|jd��|j|j�q*W|djd�}|j|�t|d�t|�kr�|j|j�ndS(Niu
Ti����i����i����(u
splitlinesuTrueuwriteurstripu_NLulen(uselfulinesulineulaststripped((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_write_lines�s
uGenerator._write_linescCs�|j}z-d|_|j�|_}|j|�Wd||_|j}|`X|r�t|�}|jd|d�|jd|d�nt|dd�}|dkr�|j|�n
||�|jj	|j
��dS(Nucontent-transfer-encodingiucontent-typeiu_write_headers(u_fpuNoneu
_munge_cteu_new_bufferu	_dispatchudeepcopyureplace_headerugetattru_write_headersuwriteugetvalue(uselfumsguoldfpusfpu	munge_cteumeth((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_write�s"				
uGenerator._writecCs�|j�}|j�}tj||f�jdd�}t|d|d�}|dkr�|jdd�}t|d|d�}|dkr�|j}q�n||�dS(Nu-u_u_handle_(uget_content_maintypeuget_content_subtypeu
UNDERSCOREujoinureplaceugetattruNoneu
_writeBody(uselfumsgumainusubuspecificumethugeneric((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu	_dispatch�s!uGenerator._dispatchcCsMx6|j�D](\}}|j|jj||��q
W|j|j�dS(N(u	raw_itemsuwriteupolicyufoldu_NL(uselfumsguhuv((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_write_headers�s uGenerator._write_headerscCs�|j�}|dkrdSt|t�sDtdt|���nt|j�r�|jd�}|dk	r�t	|�}|d=|j
||�|j�}|d|df|_q�n|jr�t
jd|�}n|j|�dS(Nustring payload expected: %sucharsetucontent-transfer-encodingucontent-typeu>From (uget_payloaduNoneu
isinstanceustru	TypeErrorutypeu_has_surrogatesu_payloadu	get_paramudeepcopyuset_payloadu
_munge_cteu
_mangle_from_ufcreusubu_write_lines(uselfumsgupayloaducharset((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_text�s"	uGenerator._handle_textcCsCg}|j�}|dkr'g}n;t|t�rG|j|�dSt|t�sb|g}nxX|D]P}|j�}|j|�}|j|ddd|j
�|j|j��qiW|j
�}|s|jj|�}|j|�}|j|�n|jdk	rY|jr0tjd|j�}	n	|j}	|j|	�|j|j
�n|jd||j
�|r�|jj|jd��nx=|D]5}
|j|j
d||j
�|jj|
�q�W|j|j
d|d|j
�|jdk	r?|jr&tjd|j�}n	|j}|j|�ndS(Nuunixfromulinesepu>From u--iF(uget_payloaduNoneu
isinstanceustruwriteulistu_new_bufferucloneuflattenuFalseu_NLuappendugetvalueuget_boundaryu_encoded_NLujoinu_make_boundaryuset_boundaryupreambleu
_mangle_from_ufcreusubu_write_linesu_fpupopuepilogue(uselfumsgumsgtextsusubpartsupartusuguboundaryualltextupreambleu	body_partuepilogue((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_multipart�sJ	

		

#		uGenerator._handle_multipartcCs@|j}|jdd�|_z|j|�Wd||_XdS(Numax_line_lengthi(upolicyucloneu_handle_multipart(uselfumsgup((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_multipart_signed6s
	u"Generator._handle_multipart_signedcCs�g}x�|j�D]�}|j�}|j|�}|j|ddd|j�|j�}|j|j�}|r�|d|j	kr�|j
|jj|dd���q|j
|�qW|jj
|jj|��dS(NuunixfromulinesepiFi����i����(uget_payloadu_new_bufferucloneuflattenuFalseu_NLugetvalueusplitu_encoded_NLu_encoded_EMPTYuappendujoinu_fpuwrite(uselfumsgublocksupartusugutextulines((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_message_delivery_statusAs&u)Generator._handle_message_delivery_statuscCs�|j�}|j|�}|j}t|t�rg|j|jd�ddd|j�|j	�}n|j
|�}|jj|�dS(NiuunixfromulinesepF(
u_new_bufferucloneu_payloadu
isinstanceulistuflattenuget_payloaduFalseu_NLugetvalueu_encodeu_fpuwrite(uselfumsgusugupayload((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_messageVs
	%uGenerator._handle_messagecCs�tjtj�}d	t|d}|dkr4|S|}d}xZ|jdtj|�dtj	�}|j
|�s|Pn|dt|�}|d7}qC|S(
Nu=iu==iu^--u(--)?$u.iu===============(urandomu	randrangeusysumaxsizeu_fmtuNoneu_compile_reureuescapeu	MULTILINEusearchustr(uclsutextutokenuboundaryubucounterucre((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_make_boundaryos&
uGenerator._make_boundarycCstj||�S(N(ureucompile(uclsusuflags((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_compile_re�suGenerator._compile_reNTF(u__name__u
__module__u__qualname__u__doc__uNoneuTrueu__init__uwriteuFalseuflattenucloneu_encoded_EMPTYu_new_bufferu_encodeu_write_linesu_writeu	_dispatchu_write_headersu_handle_textu
_writeBodyu_handle_multipartu_handle_multipart_signedu_handle_message_delivery_statusu_handle_messageuclassmethodu_make_boundaryu_compile_re(u
__locals__((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu	Generators,/
#
:csz|EeZdZdZdZdd�Zdd�Zdd�Zd	d
�Z�fdd�Z	e	Z
ed
d��Z�S(uBytesGeneratoru�Generates a bytes version of a Message object tree.

    Functionally identical to the base Generator except that the output is
    bytes and not string.  When surrogates were used in the input to encode
    bytes, these are decoded back to bytes for output.  If the policy has
    cte_type set to 7bit, then the message is transformed such that the
    non-ASCII bytes are properly content transfer encoded, using the charset
    unknown-8bit.

    The outfp object must accept bytes in its write method.
    scCs |jj|jdd��dS(Nuasciiusurrogateescape(u_fpuwriteuencode(uselfus((u4/opt/alt/python33/lib64/python3.3/email/generator.pyuwrite�suBytesGenerator.writecCst�S(N(uBytesIO(uself((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_new_buffer�suBytesGenerator._new_buffercCs
|jd�S(Nuascii(uencode(uselfus((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_encode�suBytesGenerator._encodecCsPx9|j�D]+\}}|jj|jj||��q
W|j|j�dS(N(u	raw_itemsu_fpuwriteupolicyufold_binaryu_NL(uselfumsguhuv((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_write_headers�s#uBytesGenerator._write_headerscs�|jdkrdSt|j�rl|jjdkrl|jrYtjd|j�|_n|j|j�nt	t
|�j|�dS(Nu7bitu>From (u_payloaduNoneu_has_surrogatesupolicyucte_typeu
_mangle_from_ufcreusubu_write_linesusuperuBytesGeneratoru_handle_text(uselfumsg(u	__class__(u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_handle_text�s"	uBytesGenerator._handle_textcCstj|jd�|�S(Nuascii(ureucompileuencode(uclsusuflags((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu_compile_re�suBytesGenerator._compile_re(
u__name__u
__module__u__qualname__u__doc__u_encoded_EMPTYuwriteu_new_bufferu_encodeu_write_headersu_handle_textu
_writeBodyuclassmethodu_compile_re(u
__locals__((u	__class__u4/opt/alt/python33/lib64/python3.3/email/generator.pyuBytesGenerator�s
uD[Non-text (%(type)s) part of message omitted, filename %(filename)s]cBs;|EeZdZdZddddd�Zdd�ZdS(	uDecodedGeneratoru�Generates a text representation of a message.

    Like the Generator base class, except that non-text parts are substituted
    with a format string representing the part.
    iNcCs;tj||||�|dkr.t|_n	||_dS(u�Like Generator.__init__() except that an additional optional
        argument is allowed.

        Walks through all subparts of a message.  If the subpart is of main
        type `text', then it prints the decoded payload of the subpart.

        Otherwise, fmt is a format string that is used instead of the message
        payload.  fmt is expanded with the following keywords (in
        %(keyword)s format):

        type       : Full MIME type of the non-text part
        maintype   : Main MIME type of the non-text part
        subtype    : Sub-MIME type of the non-text part
        filename   : Filename of the non-text part
        description: Description associated with the non-text part
        encoding   : Content transfer encoding of the non-text part

        The default value for fmt is None, meaning

        [Non-text (%(type)s) part of message omitted, filename %(filename)s]
        N(u	Generatoru__init__uNoneu_FMTu_fmt(uselfuoutfpumangle_from_umaxheaderlenufmt((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu__init__�suDecodedGenerator.__init__cCs�x�|j�D]�}|j�}|dkrJt|jdd�d|�q
|dkrYq
t|ji|j�d6|j�d6|j�d6|jd�d	6|j	d
d�d6|j	d
d�d6d|�q
WdS(Nutextudecodeufileu	multipartutypeumaintypeusubtypeu
[no filename]ufilenameuContent-Descriptionu[no description]udescriptionuContent-Transfer-Encodingu
[no encoding]uencodingF(
uwalkuget_content_maintypeuprintuget_payloaduFalseu_fmtuget_content_typeuget_content_subtypeuget_filenameuget(uselfumsgupartumaintype((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu	_dispatch�s 


	
	uDecodedGenerator._dispatchNT(u__name__u
__module__u__qualname__u__doc__uTrueuNoneu__init__u	_dispatch(u
__locals__((u4/opt/alt/python33/lib64/python3.3/email/generator.pyuDecodedGenerator�siu%%0%dd($u__doc__u__all__ureusysutimeurandomuwarningsucopyudeepcopyuiouStringIOuBytesIOuemail._policybaseucompat32uemail.headeruHeaderuemail.utilsu_has_surrogatesu
email.charsetucharsetu_charsetu
UNDERSCOREuNLucompileu	MULTILINEufcreu	GeneratoruBytesGeneratoru_FMTuDecodedGeneratorulenureprumaxsizeu_widthu_fmtu_make_boundary(((u4/opt/alt/python33/lib64/python3.3/email/generator.pyu<module>s.�j79