Viewing File: /opt/alt/python-internal/lib64/python3.11/email/__pycache__/generator.cpython-311.opt-1.pyc



!A?hNQdZgdZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZdZd	Zejd
ZejdejZejdZGd
dZGddeZdZGddeZeeejdz
ZdezZejZdS)z:Classes to generate plain text from a message object tree.)	GeneratorDecodedGeneratorBytesGeneratorN)deepcopy)StringIOBytesIO)_has_surrogates)HeaderWriteError_
z
\r\n|\r|\nz^From z\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]ceZdZdZddddZdZddZdZd	Zd
Z	dZ
dZd
ZdZ
dZeZdZdZdZdZeddZedZdS)rzGenerates output from a Message object tree.

    This basic generator writes the message to the given file object as plain
    text.
    NpolicycX||dn|j}||_||_||_||_dS)aCreate 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)selfoutfprrrs     </opt/alt/python-internal/lib64/python3.11/email/generator.py__init__zGenerator.__init__%s<2#)>44v7JL)(c:|j|dSN)rwriterss  rrzGenerator.writeEsqrFc|j|jn|j}|||}|j||j}|j|_||j|_d|_||j|_|j}|j}	||_||_|r[|	}|s(dtjtj
z}|||jz|
|||_||_dS#||_||_wxYw)aPrint 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)linesepmax_line_lengthzFrom nobody )rclonerr _NL_encode_encoded_NL_EMPTY_encoded_EMPTYget_unixfromtimectimer_write)rmsgunixfromr rold_gen_policyold_msg_policyufroms        rflattenzGenerator.flattenIsE* ${2\\'\22F(\\$2C\DDF><<11"ll4;77
	( DKCJ
-((**E*TZ	-D-DDE

548+,,,KK(DK'CJJJ)DK'CJ''''s
0BEEcH|||jd|jS)z1Clone this generator with the exact same options.Nr)	__class__rr)rfps  rr$zGenerator.clonezs-~~b"0"%)[22	2rctSr)rrs r_new_bufferzGenerator._new_bufferszzrc|Srrs  rr&zGenerator._encodesrc|sdSt|}|ddD]1}||||j2|dr||ddSdS)N)NLCREsplitrr%)rlineslines   r_write_lineszGenerator._write_liness	FE""#2#J	!	!DJJtJJtx    9	"JJuRy!!!!!	"	"rcd|j}	d|_|x|_}||||_|j}|`n#||_|j}|`wxYw|rht	|}|d|d|d<n|d|d|d|dt|dd}|||n|||j	|
dS)Ncontent-transfer-encodingrContent-Transfer-Encodingcontent-type_write_headers)r
_munge_cter9	_dispatchrgetreplace_headergetattrrHrgetvalue)rr.oldfpsfp	munge_ctemeths      rr-zGenerator._writesD	 "DO!--///DHsNN3DHIDHI	=3--Cww233;3<Q</00""#>	!MMM~y|<<<s,d33<$$$$DJJJs||~~&&&&&s7AA#c^|}|}t||fdd}t|d|zd}|3|dd}t|d|zd}||j}||dS)N-r_handle_)get_content_maintypeget_content_subtype
UNDERSCOREjoinreplacerM
_writeBody)rr.mainsubspecificrRgenerics       rrJzGenerator._dispatchs
''))%%''??D#;//77SAAtZ(2D99<ll3,,G4g!5t<<D|S					rc|D]\}}|j||}|jjr|jj}||jjst
d|d|t|	|rt
d||
||
|jdS)Nz folded header does not end with z: z folded header contains newline: )	raw_itemsrfoldverify_generated_headersr endswithr
NEWLINE_WITHOUT_FWSPsearchremovesuffixrr%)rr.hvfoldedr s      rrHzGenerator._write_headerssMMOO
	
	DAq[%%a++F{3
G+-t{':;;T*R7RRRRTTT'..v/B/B7/K/KLLG*E6EEGGGJJv

48rc|}|dSt|tstdt	|zt|jrm|d}|Vt|}|d=|	|j||}|d|df|_
|jrt
d|}||dS)Nzstring payload expected: %scharsetrDrF>From )get_payload
isinstancestr	TypeErrortyper	_payload	get_paramrset_payloadrIrfcrer]rB)rr.payloadrls    r_handle_textzGenerator._handle_texts//##?F'3''	K9DMMIJJJ3<((
	8mmI..G"smm34g666//++#&'B#C#&~#6#8	2hhx11G'"""""rcBg}|}|g}nDt|tr||dSt|ts|g}|D]o}|}||}||d|j|	|
p|}|sD|j
|}||}|||j^|jr!t$d|j}	n|j}	||	||j|d|z|jz|r-|j|d|D]D}
||jdz|z|jz|j|
E||jdz|zdz|jz|jF|jr!t$d|j}n|j}||dSdS)NFr/r rmz--r)rnrorprlistr9r$r3r%appendrNget_boundaryr'rY_make_boundaryset_boundarypreamblerrvr]rBrpopepilogue)rr.msgtextssubpartspartrgboundaryalltextr	body_partrs            r_handle_multipartzGenerator._handle_multiparts??$$HH
#
&
&	"JJx   FHd++	" zH	*	*D  ""A

1

A
IIdUDHI===OOAJJLL))))##%%	'&++H55G**733HX&&&<#!
(88Hcl;;<h'''JJtx   

4(?TX-...	,HNN8<<??+++"	&	&IJJtx$1DH<===HNN9%%%%

48d?X-4tx?@@@<#!
(88Hcl;;<h'''''$#rc|j}|d|_	||||_dS#||_wxYw)Nrr!)rr$r)rr.ps   r_handle_multipart_signedz"Generator._handle_multipart_signedFsS
Kggag00	""3'''DKKK!DKOOOOsA	Ac@g}|D]}|}||}||d|j|}||j}|rG|d|jkr6|	|j
|dd|	||j|j
|dS)NFrzr=)
rnr9r$r3r%rNr?r'r)r|rYrr)rr.blocksrrrtextr@s        r_handle_message_delivery_statusz)Generator._handle_message_delivery_statusQsOO%%
	$
	$D  ""A

1

A
IIdUDHI===::<<DJJt/00E
$rd&999

d.33E#2#J??@@@@

d####	
t',,V4455555rcx|}||}|j}t|trE||dd|j|}n|	|}|j
|dS)NrFrz)r9r$rsror{r3rnr%rNr&rr)rr.rrrws     r_handle_messagezGenerator._handle_messagefsJJqMM,gt$$	,
IIcooa((5$(IKKKjjllGGll7++GwrcFtjtj}dt|zzdz}||S|}d}	|dt
j|zdztj}|	|sn|dzt|z}|dz
}i|S)	Nz===============z==rTz^--z(--)?$.rG)random	randrangesysmaxsize_fmt_compile_rereescape	MULTILINErfrp)clsrtokenrbcountercres       rr~zGenerator._make_boundarys --.5<O	//%")A,,"6"A2<PPC::d##
3W-AqLG	rc,tj||Sr)rcompilerrflagss   rrzGenerator._compile_resz!U###r)NN)FNr)__name__
__module____qualname____doc__rrr3r$r9r&rBr-rJrHrxr[rrrrclassmethodr~rr;rrrrs\@/(/(/(/(b222(	"	"	" %'%'%'N(


&###,J8(8(8(t			666*   2["$$[$$$rrcTeZdZdZdZdZdZdZfdZeZ	e
dZxZS)raGenerates 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.
    cb|j|dddS)Nasciisurrogateescape)rrencoders  rrzBytesGenerator.writes+qxx):;;<<<<<rctSr)rr8s rr9zBytesGenerator._new_buffersyyrc,|dSNr)rrs  rr&zBytesGenerator._encodesxx   rc|D]8\}}|j|j||9||jdSr)rarrrfold_binaryr%)rr.rhris    rrHzBytesGenerator._write_headerssbMMOO	:	:DAqHNN4;221a889999

48rcB|jdSt|jrX|jjdksH|jr%t
d|j|_||jdStt|
|dS)N7bitrm)rsr	rcte_typerrvr]rBsuperrrx)rr.r5s  rrxzBytesGenerator._handle_texts<F3<((	91Ev1M1M!
@#xx#,??cl+++++.&&33C88888rcRtj|d|Sr)rrrrs   rrzBytesGenerator._compile_res z!((7++U333r)
rrrrrr9r&rHrxr[rr
__classcell__)r5s@rrrs

===!!!
9
9
9
9
9J44[44444rrzD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c&eZdZdZddddZdZdS)rzGenerates 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.
    Nrcrt||||||t|_dS||_dS)aLike 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]
        rN)rr_FMTr)rrrrfmtrs      rrzDecodedGenerator.__init__sG.	4l"(		*	*	*;DIIIDIIIrc
|D]}|}|dkr&t|d|B|dkrIt|j||||d|dd|d	d
dz|dS)NrF)decode)file	multipartz
[no filename]zContent-Descriptionz[no description]rEz
[no encoding])rrmaintypesubtypefilenamedescriptionencoding)	walkrVprintrnrget_content_typerWget_filenamerK)rr.rrs    rrJzDecodedGenerator._dispatchsHHJJ	"	"D0022H6!!d&&e&444@@@@@[((di#'#8#8#:#:#'#<#<#>#>#'#;#;#=#=#'#4#4_#E#E#'88,A,>$@$@#'88,G,;$=$=	#	#	!	"	"	"	"	"	"	"r)NNN)rrrrrrJr;rrrrsN
<"""""rrrGz%%0%dd) r__all__rrr+rcopyriorremail.utilsr	email.errorsr
rXNLrr>rrvrerrrrlenreprr_widthrr~r;rr<module>rs
A@
=
=
=				







        ''''''))))))

	
=!!rz)R\**!rz"CDDx$x$x$x$x$x$x$x$v/4/4/4/4/4Y/4/4/4dN6"6"6"6"6"y6"6"6"t

TT#+a-
 
 	!	!&)r
Back to Directory File Manager