Viewing File: /opt/alt/python35/lib64/python3.5/email/__pycache__/generator.cpython-35.opt-2.pyc



]M@sdddgZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZdZd	Z
ejd
ZejdejZGdddZGd
ddeZdZGdddeZeeejdZdeZejZdS)	GeneratorDecodedGeneratorBytesGeneratorN)deepcopy)StringIOBytesIO)_has_surrogates_
z
\r\n|\r|\nz^From c@seZdZddddddZddZdddd	Zd
dZdd
ZddZddZ	ddZ
ddZddZddZ
e
ZddZddZddZd d!Zedd"d#Zed$d%ZdS)&rNpolicycCsO|dkr'|dkrdn|j}||_||_||_||_dS)NT)mangle_from__fp
_mangle_from_maxheaderlenr)selfoutfprrrr./opt/alt/python35/lib64/python3.5/generator.py__init__$s			zGenerator.__init__cCs|jj|dS)N)r
write)rsrrrrDszGenerator.writeFcCs6|jdkr|jn|j}|dk	r?|jd|}|jdk	rc|jd|j}|j|_|j|j|_d|_|j|j|_|j}|j}zh||_||_|r|j	}|sdt
jt
j
}|j||j|j
|Wd||_||_XdS)Nlinesepmax_line_lengthzFrom nobody )rclonerr_NL_encode_encoded_NLZ_EMPTY_encoded_EMPTYZget_unixfromtimectimer_write)rmsgunixfromrrZold_gen_policyZold_msg_policyZufromrrrflattenHs,!						zGenerator.flattencCs|j||jdd|jS)Nr)	__class__rr)rfprrrrys	zGenerator.clonecCstS)N)r)rrrr_new_bufferszGenerator._new_buffercCs|S)Nr)rrrrrrszGenerator._encodecCsp|s
dStj|}x5|ddD]#}|j||j|jq*W|drl|j|ddS)Nr)r))NLCREsplitrr)rlineslinerrr_write_liness

zGenerator._write_linescCs|j}z-d|_|j|_}|j|Wd||_|j}|`X|rt|}|jd|d|jd|dt|dd}|dkr|j|n
|||jj|j	dS)Nzcontent-transfer-encodingrzcontent-typer(_write_headers)
r

_munge_cter'	_dispatchrZreplace_headergetattrr/rgetvalue)rr"ZoldfpZsfpZ	munge_ctemethrrrr!s"				
zGenerator._writecCs|j}|j}tj||fjdd}t|d|d}|dkr|jdd}t|d|d}|dkr|j}||dS)N-r	Z_handle_)get_content_maintypeget_content_subtype
UNDERSCOREjoinreplacer2
_writeBody)rr"mainsubZspecificr4Zgenericrrrr1s!	zGenerator._dispatchcCsMx6|jD](\}}|j|jj||q
W|j|jdS)N)	raw_itemsrrZfoldr)rr"hvrrrr/s zGenerator._write_headerscCs|j}|dkrdSt|tsAtdt|t|jr|jd}|dk	rt|}|d=|j	|||j}|d|df|_
|jrtj
d|}|j|dS)Nzstring payload expected: %scharsetzcontent-transfer-encodingzcontent-typez>From )get_payload
isinstancestr	TypeErrortyper_payloadZ	get_paramrZset_payloadr0rfcrer=r.)rr"payloadrArrr_handle_texts"	zGenerator._handle_textcCs4g}|j}|dkr'g}n8t|trG|j|dSt|ts_|g}xX|D]P}|j}|j|}|j|ddd|j|j	|j
qfW|j}|s|jj
|}|j|}|j||jdk	rP|jr*tjd|j}	n	|j}	|j|	|j|j|jd||j|r|jj|jdx=|D]5}
|j|jd||j|jj|
qW|j|jd|d|j|jdk	r0|jrtjd|j}n	|j}|j|dS)Nr#Frz>From z--r)rBrCrDrlistr'rr$rappendr3Zget_boundaryrr9_make_boundaryZset_boundarypreamblerrHr=r.r
popepilogue)rr"ZmsgtextsZsubpartspartrgboundaryZalltextrNZ	body_partrPrrr_handle_multipartsJ	
	

		

#		zGenerator._handle_multipartcCs@|j}|jdd|_z|j|Wd||_XdS)Nrr)rrrT)rr"prrr_handle_multipart_signed8s
	z"Generator._handle_multipart_signedcCsg}x|jD]}|j}|j|}|j|ddd|j|j}|j|j}|r|d|jkr|j	|jj
|ddq|j	|qW|jj|jj
|dS)Nr#Frr(r)r))
rBr'rr$rr3r+rrrLr9r
r)rr"ZblocksrQrrRtextr,rrr_handle_message_delivery_statusCs&z)Generator._handle_message_delivery_statuscCs|j}|j|}|j}t|trg|j|jdddd|j|j}n|j	|}|j
j|dS)Nrr#Fr)r'rrGrCrKr$rBrr3rr
r)rr"rrRrIrrr_handle_messageXs
	%zGenerator._handle_messagecCstjtj}d	t|d}|dkr4|S|}d}xX|jdtj|dtj}|j	|syP|dt
|}|d7}qCW|S)
N=z==rz^--z(--)?$.r(z===============)random	randrangesysmaxsize_fmt_compile_rereescape	MULTILINEsearchrD)clsrWtokenrSbZcounterZcrerrrrMqs&zGenerator._make_boundarycCstj||S)N)rccompile)rgrflagsrrrrbszGenerator._compile_re)__name__
__module____qualname__rrr$rr'rr.r!r1r/rJr;rTrVrXrYclassmethodrMrbrrrrrs(
	1#
:csjeZdZddZddZddZddZfd	d
ZeZe	ddZ
S)
rcCs |jj|jdddS)Nasciisurrogateescape)r
rencode)rrrrrrszBytesGenerator.writecCstS)N)r)rrrrr'szBytesGenerator._new_buffercCs
|jdS)Nrp)rr)rrrrrrszBytesGenerator._encodecCsPx9|jD]+\}}|jj|jj||q
W|j|jdS)N)r>r
rrZfold_binaryr)rr"r?r@rrrr/s#zBytesGenerator._write_headerscs|jdkrdSt|jri|jjdkri|jrVtjd|j|_|j|jntt	|j
|dS)NZ7bitz>From )rGrrZcte_typerrHr=r.superrrJ)rr")r%rrrJs"	zBytesGenerator._handle_textcCstj|jd|S)Nrp)rcrjrr)rgrrkrrrrbszBytesGenerator._compile_re)rlrmrnrr'rr/rJr;rorbrr)r%rrs

zD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s1eZdZdddddZddZdS)rNNcCs;tj|||||dkr.t|_n	||_dS)N)rr_FMTra)rrrrfmtrrrrszDecodedGenerator.__init__cCsx|jD]}|j}|dkrJt|jddd|q
|dkrYq
t|jd|jd|jd|jd	|jd
d|jdd
d|jddid|q
WdS)NrWdecodeFfileZ	multipartrFmaintypesubtypefilenamez
[no filename]descriptionzContent-Descriptionz[no description]encodingzContent-Transfer-Encodingz
[no encoding])	walkr6printrBraZget_content_typer7get_filenameget)rr"rQryrrrr1s 	
zDecodedGenerator._dispatch)rlrmrnrr1rrrrrsr(z%%0%dd)__all__rcr_rr]copyriorrZemail.utilsrr8NLrjr*rerHrrrurlenreprr`_widthrarMrrrr<module>s&o39

Back to Directory File Manager