%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/mimify.pyo

ó
Męáac@sídZdZdZdZddlZddlZejdedƒdd	d
dgZej	dej
ƒZej	d
ej
ƒZej	dej
ej
BƒZej	dej
ej
BƒZej	dƒZej	dej
ƒZej	dej
ƒZej	dej
ƒZdd0d„ƒYZdd1d„ƒYZd„Zd„Zdd„Zdd„Zej	dƒZej	dƒZd„Zej	d ƒZd!„Zej	d"ej
ƒZej	d#ej
ƒZ ej	d$ƒZ!d%„Z"d&„Z#ddl$Z$e%d'kse&e$j'ƒdkrée$j'ddkréddl(Z(d(Z)dZ*e(j(e$j'd)d*ƒ\Z+Z,e&e,ƒd2kr}e)GHe$j-d)ƒnd3e+kd4e+kks­d5e+krÂd6e+krÂe)GHe$j-d)ƒnxže+D]–\Z.Z/e.d+kręe#Z0qÉe.d-kr˙eZ0qÉe.d/krJye1e/ƒZWq_e2e3fk
rFe)GHe$j-d)ƒq_XqÉe.d.krÉd)Z*qÉqÉWe&e,ƒdkrŠe$j4e$j5fZ6n<e&e,ƒd)kr˛e,de$j5fZ6ne,de,d)fZ6e*rÜe6e*fZ6ne0e6ŒndS(7sžMimification and unmimification of mail messages.

Decode quoted-printable parts of a mail message or encode using
quoted-printable.

Usage:
        mimify(input, output)
        unmimify(input, output, decode_base64 = 0)
to encode and decode respectively.  Input and output may be the name
of a file or an open file object.  Only a readline() method is used
on the input file, only a write() method is used on the output file.
When using file names, the input and output file names may be the
same.

Interactive usage:
        mimify.py -e [infile [outfile]]
        mimify.py -d [infile [outfile]]
to encode and decode respectively.  Infile defaults to standard
input and outfile to standard output.
iČs
ISO-8859-1s> i˙˙˙˙Ns>the mimify module is deprecated; use the email package insteaditmimifytunmimifytmime_encode_headertmime_decode_headers.^content-transfer-encoding:\s*quoted-printables$^content-transfer-encoding:\s*base64s0^content-type:.*multipart/.*boundary="?([^;"
]*)s:^(content-type:.*charset=")(us-ascii|iso-8859-[0-9]+)(".*)s^-*
s=([0-9a-f][0-9a-f])s=\?iso-8859-1\?q\?([^? 	
]+)\?=s^subject:\s+re: tFilecBs eZdZd„Zd„ZRS(s{A simple fake file object that knows about limited read-ahead and
    boundaries.  The only supported method is readline().cCs||_||_d|_dS(N(tfiletboundarytNonetpeek(tselfRR((s"/usr/local/lib/python2.7/mimify.pyt__init__3s		cCs||jdk	rdS|jjƒ}|s,|S|jrx||jdkrU||_dS||jdkrx||_dSn|S(Nts
s--
(RRRtreadlineR(R	tline((s"/usr/local/lib/python2.7/mimify.pyR8s			(t__name__t
__module__t__doc__R
R(((s"/usr/local/lib/python2.7/mimify.pyR/s	t
HeaderFilecBseZd„Zd„ZRS(cCs||_d|_dS(N(RRR(R	R((s"/usr/local/lib/python2.7/mimify.pyR
Hs	cCsÂ|jdk	r$|j}d|_n|jjƒ}|s=|Stj|ƒrP|Sxk|jjƒ|_t|jƒdks |jddkr¤|jddkr¤|S||j}d|_qSWdS(Nit s	(RRRRthetmatchtlen(R	R
((s"/usr/local/lib/python2.7/mimify.pyRLs	&
(RRR
R(((s"/usr/local/lib/python2.7/mimify.pyRGs	cCs†d}d}xktj||ƒ}|dkr1Pn||||jdƒ!tt|jdƒdƒƒ}|jdƒ}qW|||S(s6Decode a single line of quoted-printable text to 8bit.RiiiN(t	mime_codetsearchRtstarttchrtinttgrouptend(R
tnewlinetpostres((s"/usr/local/lib/python2.7/mimify.pytmime_decode^scCs›d}d}x€tj||ƒ}|dkr1Pn|jdƒ}dj|jdƒƒ}||||jdƒ!t|ƒ}|jdƒ}qW|||S(sDecode a header line to 8bit.RiiRt_N(	t	mime_headRRRtjointsplitRR R(R
RRRR((s"/usr/local/lib/python2.7/mimify.pyRks$icCsGd}d}d}d}|jr=|jd tkr=t}nd}t|ƒ}x|jƒ}	|	shdS|r|	t|ƒ |kr|	t|ƒ}	|}
nd}
t|	ƒ}	tj|	ƒrĘd}qRn|rët	j|	ƒrëd}qRn|j
|
|	ƒ|rtj|	ƒrd}ntj|	ƒ}|rFd|j
dƒ}ntj|	ƒrRPqRqRW|rx|so|rxd}nxČ|jƒ}	|	s‘dStjtd|	ƒ}	|rŰ|	t|ƒ |krŰ|	t|ƒ}	|}
nd}
x•|rx|	|dkr|j
|
|	ƒd}d}	Pn|	|d	krt|j
|
|	ƒt||ƒ}t|||ƒ|j}	|	säPqäqänPqäW|	rô|rôx]|	d
dkrä|	d
 }	|jƒ}
|
ttƒ tkr×|
ttƒ}
n|	|
}	qˆWt|	ƒ}	n|	r%|r%|
r%ddl}|j|	ƒ}	n|	r{|j
|
|	ƒq{q{WdS(
s?Convert a quoted-printable part of a MIME mail message to 8bit.iiRNis--s\1s--
s
iţ˙˙˙s=
i˙˙˙˙(RRtQUOTERRRRtqpRt	base64_retwritetrepltmpRRtretsubR"Rt
unmimify_partRR tbase64tdecodestring(tifiletofilet
decode_base64t	multiparttquoted_printablet	is_base64tis_repltprefixthfileR
tpreftmp_restnifileRR.((s"/usr/local/lib/python2.7/mimify.pyR-zsŒ							
c	Csřt|ƒtdƒkr•t|ƒ}t|ƒtdƒkr›||kr›ddl}|jj|ƒ\}}|j||jj|d|ƒƒq›n|}t|ƒtdƒkrĹt|dƒ}n|}t|dƒ}t	|||ƒ|j
ƒdS(s>Convert quoted-printable parts of a MIME mail message to 8bit.Ri˙˙˙˙Nt,tw(ttypetopentostpathR$trenameR#RRR-tflush(	tinfiletoutfileR2R0R@tdtfR1R;((s"/usr/local/lib/python2.7/mimify.pyRĎs$)s[=-˙]s[=?-˙]cCsg|rt}nt}d}d}t|ƒdkrb|d dkrbdtdƒjƒ}d}nxl|j||ƒ}|dkr‡Pn||||jdƒ!dt|jdƒƒjƒ}|j	dƒ}qeW|||}d}xwt|ƒdkr^d	}x2||d
ks'||dd
kr4|d}qW|d}||| d}||}qčW||S(
sZCode a single line as quoted-printable.
    If header is set, quote some extra characters.RiisFrom s=%02xtFiiKiIt=s=
N(
tmime_header_chart	mime_charRtordtupperRRRRR(R
theadertregRRRti((s"/usr/local/lib/python2.7/mimify.pytmime_encodeäs2	"	 '
s<([ 	(]|^)([-a-zA-Z0-9_+]*[-˙][-a-zA-Z0-9_+-˙]*)(?=[ 	)]|
)cCs”d}d}xytj||ƒ}|dkr1Pnd||||jdƒ!|jdƒtt|jdƒdƒf}|jdƒ}qW|||S(s.Code a single header line as quoted-printable.Ris%s%s%s=?%s?Q?%s?=iiN(tmime_headerRRRRtCHARSETRQR(R
RRR((s"/usr/local/lib/python2.7/mimify.pyRs"s^mime-version:s^content-transfer-encoding:s[-˙]cCs3d}}}d}d}}}	g}
d}g}d}
t|ƒ}xę|jƒ}|s_Pn|r~tj|ƒr~d}ntj|ƒr–d}ntj|ƒrŢd}tj|ƒrĂd}qŢt	j|ƒrŢd}qŢnt
j|ƒ}|r	d|jdƒ}ntj|ƒr"|}Pn|
j
|ƒqIWx;|jƒ}|sLPn|r‰||dkrl|}
Pn||dkr‰|}
Pq‰n|r˘|j
|ƒq6n|rx]|ddkr|d }|jƒ}|ttƒ tkrú|ttƒ}n||}qŤWt|ƒ}n|j
|ƒ|	sItj|ƒrId}	}qIn|s6t|ƒtkrmd}qmq6q6Wxř|
D]đ}|r“t|ƒ}ntj|ƒ}|r
|	rô|jd	ƒjƒd
kr
d|jdƒt|jdƒf}q
q
d
|jddƒ}n|r[tj|ƒr[d}|r;|d}q[|rN|d}q[|d}n|j|ƒqxW|sx|rĂ|rĂ|jdƒ|jdƒ|	rł|jdtƒqĂ|jdƒn|rŕ|rŕ|jdƒn|j|ƒx3|D]+}|rt|dƒ}n|j|ƒqôW|j|
ƒ|
}xö|r.||dkr”xB|jƒ}|shdS|r€t|dƒ}n|j|ƒqRWn||dkrét||ƒ}t||dƒ|j}|sÖPn|j|ƒq9nx?|jƒ}|sdS|rt|dƒ}n|j|ƒqěWq9WdS(s@Convert an 8bit part of a MIME mail message to quoted-printable.iRis--s--
s
iţ˙˙˙s=
isus-asciis%s%s%sis%sus-ascii%ssContent-Transfer-Encoding: sbase64
squoted-printable
s7bit
sMime-Version: 1.0
sContent-Type: text/plain; s
charset="%s"
scharset="us-ascii"
s,Content-Transfer-Encoding: quoted-printable
N(RRRtiso_charRtmvRtcteR&R'R*RRtappendRR%R tMAXLENRtchrsettlowerRSR(RQRtmimify_partR(R0R1tis_mimethas_ctetis_qpR5R3tmust_quote_bodytmust_quote_headert
has_iso_charsRNt
header_endtmessagetmessage_endR8R
R:Rt
chrset_resR;((s"/usr/local/lib/python2.7/mimify.pyR[sč			












		
cCsřt|ƒtdƒkr•t|ƒ}t|ƒtdƒkr›||kr›ddl}|jj|ƒ\}}|j||jj|d|ƒƒq›n|}t|ƒtdƒkrĹt|dƒ}n|}t|dƒ}t	||dƒ|j
ƒdS(s>Convert 8bit parts of a MIME mail message to quoted-printable.Ri˙˙˙˙NR<R=i(R>R?R@RAR$RBR#RRR[RC(RDRER0R@RFRGR1R;((s"/usr/local/lib/python2.7/mimify.pyRŸs$)t__main__s/Usage: mimify [-l len] -[ed] [infile [outfile]]isl:edbs-eRs-ds-bs-l(((iii(s-eR(s-dR(s-bR(s-dR(7RRXRSR%R+twarningstwarntDeprecationWarningt__all__tcompiletIR&R'tSR*RYRRR"R)RRR RR-RRKRJRQRRRRURVRTR[RtsysRRtargvtgetopttusageR2toptstargstexittotatencodeRt
ValueErrort
OverflowErrortstdintstdouttencode_args(((s"/usr/local/lib/python2.7/mimify.pyt<module>s„	
	
	U	 		‡	4		


Zerion Mini Shell 1.0