Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/future/backports/email/ |
| [Home] [System Details] [Kill Me] |
�
,�]c@`s�dZddlmZddlmZddlmZddlmZddlmZddlmZdd d
gZ ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZdd
lmZddlmZddlmZddljjjZdZdZe
jde
j
�Z!de"fd��YZ#de#fd��YZ$dZ%de#fd��YZ&e'e(ej)d��Z*de*Z+e#j,Z,dS(u:Classes
to generate plain text from a message object
tree.i(tprint_function(tunicode_literals(tdivision(tabsolute_import(tsuper(tstru GeneratoruDecodedGeneratoruBytesGeneratorN(tStringIOtBytesIO(tcompat32(tHeader(t_has_surrogatesu_u
u^From t GeneratorcB`s�eZdZedd�Zd�Zedd�Zd�Z dZ
d�Zd�Zd�Z
d �Zd
�Zd�Zd�ZeZd
�Zd�Zd�Zd�Zedd��Zed��ZRS(u�Generates
output from a Message object tree.
This basic generator writes the message to the given file object as
plain
text.
cK`sNd|kr
|d}|d=nd}||_||_||_||_dS(Nupolicy(tNonet_fpt
_mangle_from_tmaxheaderlentpolicy(tselftoutfptmangle_from_Rt_3to2kwargsR((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt__init__+s
cC`s|jj|�dS(N(R
twrite(Rts((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyRHscC`s?|jdkr|jn|j}|dk rB|jd|�}n|jdk ri|jd|j�}n|j|_|j|j�|_d|_|jd�|_ |j}|j}zn||_||_|r|j
�}|sdtjtj��}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.
tlineseptmax_line_lengthuuFrom nobody
N(RRtcloneRRt_NLt_encodet_encoded_NLt_EMPTYt_encoded_EMTPYtget_unixfromttimetctimeRt_write(RtmsgtunixfromRRtold_gen_policytold_msg_policytufrom((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pytflattenLs,! cC`s|j||jdd|j�S(u1Clone
this generator with the exact same
options.RN(t __class__RRR(Rtfp((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR{s ucC`st�S(N(R(R((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_new_buffer�scC`s|S(N((RR((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR�scC`s�|s
dS|jt�}x8|d
D],}|j|jd��|j|j�q$W|djd�}|j|�t|d�t|�kr�|j|j�ndS(Ni����u
(t
splitlinestTrueRtrstripRtlen(Rtlinestlinetlaststripped((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_write_lines�s
cC`s�|j}z$|j�|_}|j|�Wd||_Xt|dd�}|dkrh|j|�n
||�|jj|j��dS(Nu_write_headers(R
R,t _dispatchtgetattrRt_write_headersRtgetvalue(RR$toldfptsfptmeth((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR#�s
cC`s�|j�}|j�}tj||f�jdd�}t|d|d�}|dkr�|jdd�}t|d|d�}|dkr�|j}q�n||�dS(Nu-u_u_handle_(tget_content_maintypetget_content_subtypet
UNDERSCOREtjointreplaceR6Rt
_writeBody(RR$tmaintsubtspecificR;tgeneric((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR5�s!cC`sMx6|j�D](\}}|j|jj||��q
W|j|j�dS(N(t raw_itemsRRtfoldR(RR$thtv((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR7�s
cC`s�|j�}|dkrdSt|t�sDtdt|���nt|j�r�|jd�}|dk r�|d=|j ||�|j�}q�n|j
r�tjd|�}n|j
|�dS(Nustring payload expected:
%sucharsetucontent-transfer-encodingu>From (tget_payloadRt
isinstanceRt TypeErrorttypeR
t_payloadt get_paramtset_payloadRtfcreRCR4(RR$tpayloadtcharset((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_handle_text�s cC`sLg}|j�}|dkr'g}n;t|t�rG|j|�dSt|t�sb|g}nxX|D]P}|j�}|j|�}|j|dt d|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�|jdk rH|j|j
�|jr/tjd|j�}n |j}|j|�ndS(NR%Ru>From
u--i(RJRRKRRtlistR,RR)tFalseRtappendR8tget_boundaryRR?t_make_boundarytset_boundarytpreambleRRQRCR4R
tpoptepilogue(RR$tmsgtextstsubpartstpartRtgtboundarytalltextR[t body_partR]((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_handle_multipart�sL
cC`s@|j}|jdd�|_z|j|�Wd||_XdS(NRi(RRRe(RR$tp((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_handle_multipart_signed/s
cC`s�g}x�|j�D]�}|j�}|j|�}|j|dtd|j�|j�}|j|j�}|r�|d|j kr�|j
|jj|d ��q|j
|�qW|jj
|jj|��dS(NR%Ri����(RJR,RR)RVRR8tsplitRt_encoded_EMPTYRWR?R
R(RR$tblocksR`RRattextR1((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_handle_message_delivery_status:s
cC`s�|j�}|j|�}|j}t|t�rg|j|jd�dtd|j�|j �}n|j
|�}|jj|�dS(NiR%R(
R,RRNRKRUR)RJRVRR8RR
R(RR$RRaRR((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt_handle_messageOs
%cC`s�tjtj�}d t|d}|dkr4|S|}d}xatr�|jdtj |�dtj
�}|j|�s�Pn|dt|�}|d7}qCW|S(
Nu=iu==iu^--u(--)?$u.iu===============(
trandomt randrangetsystmaxsizet_fmtRR.t_compile_retretescapet MULTILINEtsearchR(tclsRkttokenRbtbtcountertcre((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyRYhs &cC`stj||�S(N(Rttcompile(RxRtflags((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyRszsN(t__name__t
__module__t__doc__R.RRRRVR)RRiR,RR4R#R5R7RTRAReRgRlRmtclassmethodRYRs(((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR!s* /
; tBytesGeneratorcB`sVeZdZdZd�Zd�Zd�Zd�Zd�ZeZ e
d��ZRS(u�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.
tcC`s&|jjt|�jdd��dS(Nuasciiusurrogateescape(R
RRtencode(RR((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR�scC`st�S(N(R(R((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR,�scC`s
|jd�S(Nuascii(R�(RR((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR�scC`sPx9|j�D]+\}}|jj|jj||��q
W|j|j�dS(N(RFR
RRtfold_binaryR(RR$RHRI((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR7�s#cC`s�|jdkrdSt|j�rl|jjdkrl|jrYtjd|j�|_n|j|j�nt t
|�j|�dS(Nu7bitu>From (RNRR
Rtcte_typeRRQRCR4RR�RT(RR$((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyRT�s" cC`stj|jd�|�S(Nuascii(RtR}R�(RxRR~((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyRs�s(RR�R�RiRR,RR7RTRAR�Rs(((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR�~s
uD[Non-text
(%(type)s) part of message omitted, filename
%(filename)s]tDecodedGeneratorcB`s)eZdZeddd�Zd�ZRS(u�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.
iNcC`s;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(RRRt_FMTRr(RRRRtfmt((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR�scC`s�x�|j�D]�}|j�}|dkrJt|jdt�d|�q
|dkrYq
t|ji|j�d6|j�d6|j�d6|jd�d 6|j d
d�d6|j d
d�d6d|�q
WdS(Nutexttdecodetfileu multipartutypeumaintypeusubtypeu
[no
filename]ufilenameuContent-Descriptionu[no
description]udescriptionuContent-Transfer-Encodingu
[no
encoding]uencoding(
twalkR<tprintRJRVRrtget_content_typeR=tget_filenametget(RR$R`tmaintype((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR5�s
N(RR�R�R.RRR5(((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyR��siu%%0%dd(-R�t
__future__RRRRtfuture.builtinsRRt__all__RtRpR!RntwarningstioRRt"future.backports.email._policybaseRtfuture.backports.email.headerR tfuture.backports.email.utilsR
tfuture.backports.email.charsett backportstemailRSt_charsetR>tNLR}RvRQtobjectRR�R�R�R0treprRqt_widthRrRY(((sD/usr/lib/python2.7/site-packages/future/backports/email/generator.pyt<module>s8�^68