b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 / email /
Filename/usr/lib64/python2.6/email/generator.pyc
Size10.14 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 09:43
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc @súdZddgZddkZddkZddkZddkZddkZddklZddk l
Z
dZ dZ ei
d ei�Zd
�Zdfd ��YZd Zdefd
��YZeeeid��ZdeZed�ZdS(s:Classes to generate plain text from a message object tree.t GeneratortDecodedGeneratoriÿÿÿÿN(tStringIO(tHeadert_s
s^From cCs@t|t�o,yt|d�Wq<tj
otSXntS(Nsus-ascii(t
isinstancetstrtunicodet UnicodeErrortTruetFalse(ts((s'/usr/lib64/python2.6/email/generator.pyt
_is8bitstrings 
cBs�eZdZedd�Zd�Zed�Zd�Zd�Z d�Z
d�Z d �Z e Z
d
�Zd �Zd �Zd
�ZRS(s�Generates output from a Message object tree.

This basic generator writes the message to the given file object as plain
text.
iNcCs||_||_||_dS(sá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.
N(t_fpt
_mangle_from_t
_maxheaderlen(tselftoutfpt mangle_from_t maxheaderlen((s'/usr/lib64/python2.6/email/generator.pyt__init__*s  cCs|ii|�dS(N(R
twrite(RR ((s'/usr/lib64/python2.6/email/generator.pyR?scCsY|oA|i�}|pdtiti��}n|i|IJn|i|�dS(sì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.
s From nobody N(t get_unixfromttimetctimeR
t_write(Rtmsgtunixfromtufrom((s'/usr/lib64/python2.6/email/generator.pytflattenCs  cCs|i||i|i�S(s1Clone this generator with the exact same options.(t __class__RR(Rtfp((s'/usr/lib64/python2.6/email/generator.pytcloneUscCs�|i}z!t�|_}|i|�Wd||_Xt|dd�}|djo|i|�n ||�|ii|i��dS(Nt_write_headers(R
Rt _dispatchtgetattrtNoneR!Rtgetvalue(RRtoldfptsfptmeth((s'/usr/lib64/python2.6/email/generator.pyR]s 


cCs°|i�}|i�}ti||f�idd�}t|d|d�}|djoF|idd�}t|d|d�}|djo
|i}q¢n||�dS(Nt-Rt_handle_(tget_content_maintypetget_content_subtypet
UNDERSCOREtjointreplaceR#R$t
_writeBody(RRtmaintsubtspecificR(tgeneric((s'/usr/lib64/python2.6/email/generator.pyR"xs  !

c CsÍx¿|i�D]±\}}|id|I|idjo|i|IJq
t|t�o|i|i�IJq
t|�o|i|IJq
|it|d|id|dd�i�IJq
W|iJdS(Ns%s:it
maxlinelent header_nametcontinuation_wss (titemsR
RRRtencodeR (RRthtv((s'/usr/lib64/python2.6/email/generator.pyR!�s


cCs||i�}|djodSt|t�ptdt|���n|iotid|�}n|i i
|�dS(Nsstring payload expected: %ss>From ( t get_payloadR$Rt
basestringt TypeErrorttypeRtfcreR2R
R(RRtpayload((s'/usr/lib64/python2.6/email/generator.pyt _handle_text©s 

c
CsÚg}|i�}|djo
g}nCt|t�o|ii|�dSt|t�p
|g}nxL|D]D}t�}|i|�}|i |dt
�|i |i ��qrWt
i|�}|idt|��}|i�|jo|i|�n|idj o|i|iIJn|id|IJ|o|ii|id��nx/|D]'} |id|IJ|ii| �qeW|iid|d�|idj o|iJ|ii|i�ndS(NRtfailobjs--is
--(R<R$RR=R
RtlistRR RR
tappendR%tNLR.t get_boundaryt_make_boundaryt set_boundarytpreambletpoptepilogue(
RRtmsgtextstsubpartstpartR tgtalltexttboundaryt body_part((s'/usr/lib64/python2.6/email/generator.pyt_handle_multipart¶s@ 


 cCs4|i}zd|_|i|�Wd||_XdS(Ni(RRT(RRtold_maxheaderlen((s'/usr/lib64/python2.6/email/generator.pyt_handle_multipart_signedís
  cCsÃg}x�|i�D]�}t�}|i|�}|i|dt�|i�}|id�}|o/|ddjo|iti |d ��q|i|�qW|i
i ti |��dS(NRs
iÿÿÿÿt( R<RR RR
R%tsplitRERFR.R
R(RRtblocksROR RPttexttlines((s'/usr/lib64/python2.6/email/generator.pyt_handle_message_delivery_statusøs
  cCstt�}|i|�}|i�}t|t�o,|i|id�dt�|i�}n|ii |�dS(NiR(
RR R<RRDRR
R%R
R(RRR RPRA((s'/usr/lib64/python2.6/email/generator.pyt_handle_message
s 
(t__name__t
__module__t__doc__R RRR
RR RR"R!RBR0RTRVR\R](((s'/usr/lib64/python2.6/email/generator.pyR s        7 sD[Non-text (%(type)s) part of message omitted, filename %(filename)s]cBs)eZdZeddd�Zd�ZRS(s±Generator 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=ti||||�|djo
t|_n
||_dS(s�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(RRR$t_FMTt_fmt(RRRRtfmt((s'/usr/lib64/python2.6/email/generator.pyR)s

cCsÍxÆ|i�D]¸}|i�}|djo||idt�IJq
|djoq
||ih|i�d6|i�d6|i�d6|id�d6|id d
�d 6|id d
�d6IJq
WdS(NRZtdecodet multipartR?tmaintypetsubtypes
[no filename]tfilenamesContent-Descriptions[no description]t descriptionsContent-Transfer-Encodings
[no encoding]tencoding( twalkR+R<R Rbtget_content_typeR,t get_filenametget(RRRORf((s'/usr/lib64/python2.6/email/generator.pyR"Es 
 





 
 N(R^R_R`R R$RR"(((s'/usr/lib64/python2.6/email/generator.pyR#sis%%0%ddcCs®titi�}d t|d}|djo|S|}d}xeto]tidti |�dti
�}|i |�pPn|dt |�}|d7}qEW|S(
Nt=is==is^--s(--)?$t.is===============(
trandomt randrangetsystmaxintRbR$R tretcompiletescapet MULTILINEtsearchR(RZttokenRRtbtcountertcre((s'/usr/lib64/python2.6/email/generator.pyRH_s
&(R`t__all__RuRsRRqtwarningst cStringIORt email.headerRR-RFRvRxR@R RRaRtlentreprRtt_widthRbR$RH(((s'/usr/lib64/python2.6/email/generator.pyt<module>s&      
ÿ9