python (3.12.0)

(root)/
lib/
python3.12/
email/
__pycache__/
message.cpython-312.pyc

ˑedZddgZddlZddlZddlZddlmZmZddlm	Z	ddlm
Z
ddlmZdd	lm
Zdd
lmZej"ZdZej&dZd
ZddZdZdZdZGddZGddeZGddeZy)z8Basic message object for the email package object model.MessageEmailMessageN)BytesIOStringIO)utils)errors)compat32charset)decode_bz; z[ \(\)<>@,;:\\"/\[\]\?=]ct|jd\}}}|s|jdfS|j|jfS)N;)str	partitionstrip)paramasepbs    A/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/email/message.py_splitparamrsH
E
$$S)IAsAwwy$779aggic|t|dkDrt|tr,|dz
}tj|d|d|d}|d|S	|jd|stj|r|d	tj|d
S|d|S|S#t$r&|dz
}tj|dd}|d|cYSwxYw)a~Convenience function to format and return a key=value pair.

    This will quote the value if needed or if quote is true.  If value is a
    three tuple (charset, language, value), it will be encoded according
    to RFC2231 rules.  If it contains non-ascii characters it will likewise
    be encoded according to RFC2231 rules, using the utf-8 charset and
    a null language.
    r*=asciizutf-8z="")
len
isinstancetuplerencode_rfc2231encodeUnicodeEncodeError	tspecialssearchquote)rvaluer)s   r_formatparamr+'s
SZ!^eU#SLE((q58U1XFE#U++
0W%I$$U+ %u{{5'9::#U++&
0,,UGR@"'//
0sB,C	C	crdt|z}g}|dddk(r|dd}|jd}|dkDro|jdd||jdd|z
dzrE|jd|dz}|dkDr+|jdd||jdd|z
dzrE|dkrt|}|d|}d|vrL|j	d}|d|jj
dz||dzdjz}|j|j||d}|dddk(r|S)Nrrrr z\"rr)rfindcountr!indexrlowerappend)splistendfis     r_parseparamr7Is?c!fAE
BQ%3,
abEffSkAg17733/!''%C2HHAM&&cAg&CAg17733/!''%C2HHAM7a&C
dsG!8A"1
##%+a!gmmo=A
QWWY
cdGBQ%3,Lrct|tr!|d|dtj|dfStj|S)Nrrr)r"r#runquote)r*s r
_unquotevaluer:]s?
%Qxq5==q#:::}}U##rcRg}t|j}|D]G}|jds|jdj	d\}}}	t|dnt
d|D]L}|st
d|jddk(rn)	tj|}|j|Ndj|S#t$rYwxYw#tj$r/|d	d
z
dzdzd
zdz}tj|d|}YtwxYw)zDecode uuencoded data.sbegin  )basez`begin` line not foundzTruncated inputs 	
sendr ?Nr)
iter
splitlines
startswithremoveprefixrint
ValueErrorrbinasciia2b_uuErrorr1join)	encoded
decoded_linesencoded_lines_iterlinemode_pathdecoded_linenbytess	         r
_decode_uurWhs<Mg0023"
3??9% --i8BB4HMD!T
Dq!
3122"+.//
ZZ
%
/	:#??40L
	\*+88M""'

~~	:Q
b(A-1a7F#??4=9L	:s$
CC$	C! C!$?D&%D&cTeZdZdZefdZdZd2dZdZd3dZ	d	Z
d
ZdZdZ
d4d
Zd5dZdZdZdZdZdZdZdZdZdZdZdZd5dZdZdZd5dZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d6d&Z'		d6d'Z(		d7d(Z)d8d)Z*d9d*Z+d5d+Z,d5d,Z-d-Z.d5d.Z/d5d/Z0d0Z1dd1l2m3Z3y):raBasic message object.

    A message object is defined as something that has a bunch of RFC 2822
    headers and a payload.  It may optionally have an envelope header
    (a.k.a. Unix-From or From_ header).  If the message is a container (i.e. a
    multipart or a message/rfc822), then the payload is a list of Message
    objects, otherwise it is a string.

    Message objects implement part of the `mapping' interface, which assumes
    there is exactly one occurrence of the header per message.  Some headers
    do in fact appear multiple times (e.g. Received) and for those headers,
    you must use the explicit API to set or get all the headers.  Not all of
    the mapping methods are implemented.
    c||_g|_d|_d|_d|_dx|_|_g|_d|_y)N
text/plain)	policy_headers	_unixfrom_payload_charsetpreambleepiloguedefects
_default_type)selfr[s  r__init__zMessage.__init__sB


(,,

)rc"|jS)z9Return the entire formatted message as a string.
        )	as_stringrds r__str__zMessage.__str__s~~rrNcddlm}||jn|}t}||d||}|j	|||jS)aReturn the entire formatted message as a string.

        Optional 'unixfrom', when true, means include the Unix From_ envelope
        header.  For backward compatibility reasons, if maxheaderlen is
        not specified it defaults to 0, so you must override it explicitly
        if you want a different maxheaderlen.  'policy' is passed to the
        Generator instance used to serialize the message; if it is not
        specified the policy associated with the message instance is used.

        If the message object contains binary data that is not encoded
        according to RFC standards, the non-compliant data will be replaced by
        unicode "unknown character" code points.
        r)	GeneratorF)mangle_from_maxheaderlenr[unixfrom)email.generatorrkr[rflattengetvalue)rdrormr[rkfpgs       rrgzMessage.as_stringsP	. &F
Zb#(#/#
%	
		$	*{{}rc"|jS)z?Return the entire formatted message as a bytes object.
        )as_bytesrhs r	__bytes__zMessage.__bytes__s}}rcddlm}||jn|}t}||d|}|j	|||jS)aJReturn the entire formatted message as a bytes object.

        Optional 'unixfrom', when true, means include the Unix From_ envelope
        header.  'policy' is passed to the BytesGenerator instance used to
        serialize the message; if not specified the policy associated with
        the message instance is used.
        r)BytesGeneratorF)rlr[rn)rpryr[rrqrr)rdror[ryrsrts      rrvzMessage.as_bytessG	3 &F
Y2E&A			$	*{{}rc6t|jtS)z6Return True if the message consists of multiple parts.)r"r^listrhs ris_multipartzMessage.is_multiparts$--..rc||_yNr])rdros  rset_unixfromzMessage.set_unixfroms	!rc|jSr~rrhs rget_unixfromzMessage.get_unixfroms~~rc|j	|g|_y	|jj|y#t$rtdwxYw)zAdd the given payload to the current payload.

        The current payload will always be a list of objects after this method
        is called.  If you want to set the payload to a scalar object, use
        set_payload() instead.
        Nz=Attach is not valid on a message with a non-multipart payload)r^r1AttributeError	TypeError)rdpayloads  rattachzMessage.attachsO== $IDM
:

$$W-!
:!9::
:s	3Ac|jr |ry||jS|j|S|;t|jts!t	dt|jz|j}t
|jddj}t|tratj|r8|jdd}|s8	|j|jddd}n|r	|jd}|s|S|d
k(rt!j"S|dk(rPt%dj'j)\}}|D]}|j*j-|| |S|d
vr	t/St|trS|S#t$r|jdd}YwxYw#t$r|jd	}YwxYw#t0$rcYSwxYw)aZReturn a reference to the payload.

        The payload will either be a list object or a string.  If you mutate
        the list object, you modify the message's payload in place.  Optional
        i returns that index into the payload.

        Optional decode is a flag indicating whether the payload should be
        decoded or not, according to the Content-Transfer-Encoding header
        (default is False).

        When True and the message is not a multipart, the payload will be
        decoded if this header's value is `quoted-printable' or `base64'.  If
        some other encoding is used, or the header is missing, or if the
        payload has bogus data (i.e. bogus base64 or uuencoded data), the
        payload is returned as-is.

        If the message is a multipart and the decode flag is True, then None
        is returned.
        NzExpected list, got %szcontent-transfer-encodingrrsurrogateescaperreplaceraw-unicode-escapezquoted-printablebase64r)z
x-uuencodeuuencodeuuezx-uue)r|r^r"r{rtypergetr0r_has_surrogatesr%decode	get_paramLookupErrorUnicodeErrorquopridecodestringrrMrEr[
handle_defectrWrI)	rdr6rrctebpayloadr*rbdefects	         rget_payloadzMessage.get_payloadsDy}}$}}Q''
=DMM4!@3d4==6IIJJ--$((6;<BBDgs#$$W-">>'3DEF"*//$..G2TV_"`D&~~g6HN$$&&x00
H_&chhx/B/B/D&EFNE7!
8))$7
8L
>
>
 !(++gs#O='F"*//'9"EF
$D
 '~~.BCHD(
 
 s6"F+G
G,+G	G	G)(G),G:9G:ct|dr@|||_yt|tst|}|j	|j
}t|dr|j
dd|_n||_||j|yy)zSet the payload to the given value.

        Optional charset sets the message's default character set.  See
        set_charset() for details.
        r%Nrrr)hasattrr^r"Charsetr%output_charsetrset_charset)rdrrs   rset_payloadzMessage.set_payloadJs7H% '
gw/!'*nnW%;%;<G7H%#NN74EFDM#DMW%rc||jdd|_yt|tst|}||_d|vr|j	ddd|vr#|j	dd|jn |j
d|j||jk7r |j|j|_d|vr|j}	||yy#t$rw|j}|r>	|jd	d
}n*#t$r|j|j}YnwxYw|j||_|j	d|YywxYw)aSet the charset of the payload to a given character set.

        charset can be a Charset instance, a string naming a character set, or
        None.  If it is a string it will be converted to a Charset instance.
        If charset is None, the charset parameter will be removed from the
        Content-Type field.  Anything else will generate a TypeError.

        The message will be assumed to be of type text/* encoded with
        charset.input_charset.  It will be converted to charset.output_charset
        and encoded properly, if needed, when generating the plain text
        representation of the message.  MIME headers (MIME-Version,
        Content-Type, Content-Transfer-Encoding) will be added as needed.
        NrMIME-Version1.0Content-TyperZr
zContent-Transfer-Encodingrr)	del_paramr_r"r
add_headerget_output_charset	set_parambody_encoder^get_body_encodingrr%rr)rdrrrs    rrzMessage.set_charset^s`?NN9% DM'7+g&G
%OONE2%OONL$+$>$>$@

B
NN9g&@&@&BCg0022#//

>DM&d2++-C

BD	3
B--I")..:K"L'I")..1G1G"HI ' 3 3G <
 ;SA
Bs6#C--E-DE-$D?<E->D??+E-,E-c|jS)zKReturn the Charset instance associated with the message's payload.
        )r_rhs rget_charsetzMessage.get_charsets}}rc,t|jS)z9Return the total number of headers, including duplicates.)r!r\rhs r__len__zMessage.__len__s4==!!rc$|j|S)a-Get a header value.

        Return None if the header is missing instead of raising an exception.

        Note that if the header appeared multiple times, exactly which
        occurrence gets returned is undefined.  Use get_all() to get all
        the values matching a header field name.
        )r)rdnames  r__getitem__zMessage.__getitem__sxx~rcf|jj|}|r_|j}d}|jD]>\}}|j|k(s|dz
}||k\s%t	dj|||jj
|jj||y)zSet the value of a header.

        Note: this does not overwrite an existing header with the same field
        name.  Use __delitem__() first to delete any existing headers.
        rrz/There may be at most {} {} headers in a messageN)r[header_max_countr0r\rIformatr1header_store_parse)rdrval	max_countlnamefoundkvs        r__setitem__zMessage.__setitem__sKK006	JJLEE


Q1779%QJE	)(*88>y$8OQQ	
Q	


T[[;;D#FGrc|j}g}|jD],\}}|j|k7s|j||f.||_y)zwDelete all occurrences of a header, if present.

        Does not raise an exception if the header is missing.
        N)r0r\r1)rdr
newheadersrrs     r__delitem__zMessage.__delitem__sT
zz|
MM	*DAqwwyD !!1a&)	*#
rcv|j}|jD]\}}||jk(syy)NTF)r0r\)rdr
name_lowerrrs     r__contains__zMessage.__contains__s:ZZ\
MM	DAqQWWY&	rc#<K|jD]	\}}|ywr~r\)rdfieldr*s   r__iter__zMessage.__iter__s" MM	LE5K	scL|jDcgc]\}}|	c}}Scc}}w)a.Return a list of all the message's header field names.

        These will be sorted in the order they appeared in the original
        message, or were added to the message, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        rrdrrs   rkeyszMessage.keyss #mm,da,,,s c|jDcgc]!\}}|jj||#c}}Scc}}w)a)Return a list of all the message's header values.

        These will be sorted in the order they appeared in the original
        message, or were added to the message, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        r\r[header_fetch_parsers   rvalueszMessage.valuess=!MM+Aq..q!4+	++s&:c	|jDcgc]#\}}||jj||f%c}}Scc}}w)a'Get all the message's header fields and values.

        These will be sorted in the order they appeared in the original
        message, or were added to the message, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        rrs   ritemsz
Message.itemssB!MM+AqDKK221a89+	++s(<c|j}|jD]6\}}|j|k(s|jj||cS|S)z~Get a header value.

        Like __getitem__() but return failobj instead of None when the field
        is missing.
        )r0r\r[r)rdrfailobjrrs     rrzMessage.getsRzz|MM	<DAqwwyD {{55a;;	<rc>|jj||fy)zStore name and value in the model without modification.

        This is an "internal" API, intended only for use by a parser.
        N)r\r1)rdrr*s   rset_rawzMessage.set_raws
	


dE]+rcHt|jjS)zReturn the (name, value) header pairs without modification.

        This is an "internal" API, intended only for use by a generator.
        )rDr\copyrhs r	raw_itemszMessage.raw_itemss
DMM&&())rcg}|j}|jD]D\}}|j|k(s|j|jj	||F|s|S|S)aQReturn a list of all the values for the named field.

        These will be sorted in the order they appeared in the original
        message, and may contain duplicates.  Any fields deleted and
        re-inserted are always appended to the header list.

        If no such fields exist, failobj is returned (defaults to None).
        )r0r\r1r[r)rdrrrrrs      rget_allzMessage.get_allsgzz|MM	DDAqwwyD 

dkk<<QBC	DN
rc	.g}|jD]T\}}|"|j|jdd*|jt|jdd|V||j	d|t
j
|||<y)uExtended header setting.

        name is the header field to add.  keyword arguments can be used to set
        additional parameters for the header field, with underscores converted
        to dashes.  Normally the parameter will be added as key="value" unless
        value is None, in which case only the key will be added.  If a
        parameter value contains non-ASCII characters it can be specified as a
        three-tuple of (charset, language, value), in which case it will be
        encoded according to RFC2231 rules.  Otherwise it will be encoded using
        the utf-8 charset and a language of ''.

        Examples:

        msg.add_header('content-disposition', 'attachment', filename='bud.gif')
        msg.add_header('content-disposition', 'attachment',
                       filename=('utf-8', '', Fußballer.ppt'))
        msg.add_header('content-disposition', 'attachment',
                       filename='Fußballer.ppt'))
        NrS-r)rr1rr+insert	SEMISPACErM)rd_name_value_paramspartsrrs       rrzMessage.add_header"s(MMO	CDAqyQYYsC01\!))C*=qAB		C
LLF#nnU+Urc.|j}ttt|j|jD]F\}\}}|j|k(s|j
j
|||j|<yt|)zReplace a header.

        Replace the first matching header found in the message, retaining
        header order and case.  If no matching header was found, a KeyError is
        raised.
        N)r0zipranger!r\r[rKeyError)rdrrr6rrs      rreplace_headerzMessage.replace_header@s{
U3t}}#56

F	"IAv1wwyE!#';;#A#A!V#L

a 	"
5/!rct}|jd|}||ur|jSt|dj	}|jddk7ry|S)a0Return the message's content type.

        The returned string is coerced to lower case of the form
        `maintype/subtype'.  If there was no Content-Type header in the
        message, the default type as given by get_default_type() will be
        returned.  Since according to RFC 2045, messages always have a default
        type this will always return a value.

        RFC 2045 defines a message's default type to be text/plain unless it
        appears inside a multipart/digest container, in which case it would be
        message/rfc822.
        content-typer/rrZ)objectrget_default_typerr0r.)rdmissingr*ctypes    rget_content_typezMessage.get_content_typeSsc(1G((**E"1%++-;;sq rcJ|j}|jddS)zReturn the message's main content type.

        This is the `maintype' part of the string returned by
        get_content_type().
        rrrsplitrdrs  rget_content_maintypezMessage.get_content_maintypek&%%'{{3""rcJ|j}|jddS)zReturns the message's sub-content type.

        This is the `subtype' part of the string returned by
        get_content_type().
        rrrrs  rget_content_subtypezMessage.get_content_subtypetrrc|jS)aReturn the `default' content type.

        Most messages have a default content type of text/plain, except for
        messages that are subparts of multipart/digest containers.  Such
        subparts have a default content type of message/rfc822.
        rcrhs rrzMessage.get_default_type}s!!!rc||_y)zSet the `default' content type.

        ctype should be either "text/plain" or "message/rfc822", although this
        is not enforced.  The default content type is not stored in the
        Content-Type header.
        Nrrs  rset_default_typezMessage.set_default_types#rclt}|j||}||ur|Sg}t|D]K}	|jdd\}}|j	}|j	}|j
||fMtj|}|S#t
$r|j	}d}YIwxYw)Nrrr)	rrr7rrrIr1r
decode_params)	rdrheaderrr*paramsprrs	         r_get_params_preservezMessage._get_params_preserves()GNU#		'A
GGCO	czz|iik

MM4+&		'$$V,


wwy
s5BB32B3ct}|j||}||ur|S|r |Dcgc]\}}|t|fc}}S|Scc}}w)amReturn the message's Content-Type parameters, as a list.

        The elements of the returned list are 2-tuples of key/value pairs, as
        split on the `=' sign.  The left hand side of the `=' is the key,
        while the right hand side is the value.  If there is no `=' sign in
        the parameter the value is the empty string.  The value is as
        described in the get_param() method.

        Optional failobj is the object to return if there is no Content-Type
        header.  Optional header is the header to search instead of
        Content-Type.  If unquote is True, the value is unquoted.
        )rrr:)rdrrr9rrrrs        r
get_paramszMessage.get_paramssV(**7F;WN6<=daQ
a()==M>sAc||vr|S|j||D]9\}}|j|jk(s(|r
t|cS|cS|S)aReturn the parameter value if found in the Content-Type header.

        Optional failobj is the object to return if there is no Content-Type
        header, or the Content-Type header has no such parameter.  Optional
        header is the header to search instead of Content-Type.

        Parameter keys are always compared case insensitively.  The return
        value can either be a string, or a 3-tuple if the parameter was RFC
        2231 encoded.  When it's a 3-tuple, the elements of the value are of
        the form (CHARSET, LANGUAGE, VALUE).  Note that both CHARSET and
        LANGUAGE can be None, in which case you should consider VALUE to be
        encoded in the us-ascii charset.  You can usually ignore LANGUAGE.
        The parameter value (either the returned string, or the VALUE item in
        the 3-tuple) is always unquoted, unless unquote is set to False.

        If your application doesn't care whether the parameter was RFC 2231
        encoded, it can turn the return value into a string as follows:

            rawparam = msg.get_param('foo')
            param = email.utils.collapse_rfc2231_value(rawparam)

        )rr0r:)rdrrrr9rrs       rrzMessage.get_params_0N--gv>	DAqwwyEKKM)(++H	rcft|ts|r|||f}||vr|jdk(rd}n|j|}|j	||s3|st|||}ntj|t|||g}nwd}|j||D]_\}	}
d}|	j|jk(rt|||}n
t|	|
|}|s|}Itj||g}a||j|k7r|r|j||y||=|||<yy)aSet a parameter in the Content-Type header.

        If the parameter already exists in the header, its value will be
        replaced with the new value.

        If header is Content-Type and has not yet been defined for this
        message, it will be set to "text/plain" and the new parameter and
        value will be appended as per RFC 2045.

        An alternate header can be specified in the header argument, and all
        parameters will be quoted as necessary unless requote is False.

        If charset is specified, the parameter will be encoded according to RFC
        2231.  Optional language specifies the RFC 2231 language, defaulting
        to the empty string.  Both charset and language should be strings.
        rrZ)rrrr9N)
r"r#r0rrr+rrMrr)rdrr*rrequoterlanguagerr	old_param	old_valueappend_params            rrzMessage.set_paramsB$%'Gh.E&,,.N"B EHHV$E~~eF~3$UE7;!Lw?@BE(,v@G)8)I

B$	9!??$
5#/ug#FL#/	9g#NL(E%NNE<+@AE

BDHHV$$##FE2L$V%rc	*||vryd}|j||D]Y\}}|j|jk7s(|st|||}8tj	|t|||g}[||j|k7r	||=|||<yy)a>Remove the given parameter completely from the Content-Type header.

        The header will be re-written in place without the parameter or its
        value. All values will be quoted as necessary unless requote is
        False.  Optional header specifies an alternative to the Content-Type
        header.
        Nrr)rr0r+rrMr)rdrrr	new_ctyperrs       rrzMessage.del_params	OO67OC	NDAqwwyEKKM)  ,Q7 ;I )	0<Q70K0M!NI	N((V$DL)rc|jddk(st|jdk(r|d=d|d<||vr|||<y|j||}||=|||<|ddD]\}}|j	||||y)	aKSet the main type and subtype for the Content-Type header.

        type must be a string in the form "maintype/subtype", otherwise a
        ValueError is raised.

        This method replaces the Content-Type header, keeping all the
        parameters in place.  If requote is False, this leaves the existing
        header's quoting as is.  Otherwise, the parameters will be quoted (the
        default).

        An alternative header can be specified in the header argument.  When
        the Content-Type header is set, we'll always also add a MIME-Version
        header.
        rrrzmime-versionrrNr)r.rIr0rr)rdrrrrrrs       rset_typezMessage.set_type%s zz#!#<<>^+^$#(D DL@LV12J	2DAqNN1a1	2rct}|jd|d}||ur|jd|d}||ur|Stj|j	S)a@Return the filename associated with the payload if present.

        The filename is extracted from the Content-Disposition header's
        `filename' parameter, and it is unquoted.  If that header is missing
        the `filename' parameter, this method falls back to looking for the
        `name' parameter.
        filenamecontent-dispositionrr)rrrcollapse_rfc2231_valuer)rdrrrs    rget_filenamezMessage.get_filenameEs_(>>*g7LMw~~fg~FHwN++H5;;==rct}|jd|}||ur|Stj|j	S)zReturn the boundary associated with the payload if present.

        The boundary is extracted from the Content-Type header's `boundary'
        parameter, and it is unquoted.
        boundary)rrrrrstrip)rdrrrs    rget_boundaryzMessage.get_boundaryUsB(>>*g6wN++H5<<>>rct}|j|d}||urtjdg}d}|D]D\}}|j	dk(r|jdd|zfd}2|j||fF|s|jdd|zfg}|jD]\}	}
|	j	dk(rzg}|D]2\}}
|
dk(r|j||j|d|
4tj|}
|j|jj|	|
|j|	|
f||_y	)
aSet the boundary parameter in Content-Type to 'boundary'.

        This is subtly different than deleting the Content-Type header and
        adding a new one with a new boundary parameter via add_header().  The
        main difference is that using the set_boundary() method preserves the
        order of the Content-Type header in the original message.

        HeaderParseError is raised if the message has no Content-Type header.
        rzNo Content-Type header foundFrz"%s"TrrN)rrrHeaderParseErrorr0r1r\rrMr[r)rdrrr	newparamsfoundppkpvrhrrrrs              rset_boundaryzMessage.set_boundarybsc(**7NCW))*HII		+FBxxzZ'  *fx.?!@A  "b*	+
j&8*;<=
MM	*DAqwwyN*%7DAqBwQ1%56	7
 nnU+!!$++"@"@C"HI!!1a&)	*#
rcTt}|jd|}||ur|St|tr*|dxsd}	|dj	d}t||}	|j	d|jS#ttf$r|d}Y8wxYw#t$r|cYSwxYw)zReturn the charset parameter of the Content-Type header.

        The returned string is always coerced to lower case.  If there is no
        Content-Type header, or if that header has no charset parameter,
        failobj is returned.
        rrzus-asciirr)	rrr"r#r%rrrr0)rdrrrpcharsetrvs      rget_content_charsetzMessage.get_content_charsets(..G4gNgu%qz/ZH
%#1:,,-ABh1	NN:&}} .
%!!*
%
	N	s# A?B?BBB'&B'cf|jDcgc]}|j|c}Scc}w)aReturn a list containing the charset(s) used in this message.

        The returned list of items describes the Content-Type headers'
        charset parameter for this message and all the subparts in its
        payload.

        Each item will either be a string (the value of the charset parameter
        in the Content-Type header of that part) or the value of the
        'failobj' parameter (defaults to None), if the part does not have a
        main MIME type of "text", or the charset is not defined.

        The list will contain one string for each part of the message, plus
        one for the container message (i.e. self), so that a non-multipart
        message will still return a list of length 1.
        )walkr#)rdrparts   rget_charsetszMessage.get_charsetss* ?CiikJd((1JJJs.cf|jd}|yt|dj}|S)zReturn the message's content-disposition if it exists, or None.

        The return values can be either 'inline', 'attachment' or None
        according to the rfc2183.
        rNr)rrr0)rdr*c_ds   rget_content_dispositionzMessage.get_content_dispositions8./=% #))+
r)r%)FrN)FN)NFr~)NrT)rTNrF)rT)rT)4__name__
__module____qualname____doc__r	rerirgrwrvr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r#r'r*email.iteratorsr%rrrrs
'
* 
0

/": Un&(-B^"	H$
#-	+	+
",*$,<
"&0##"#*,5C DFJ5:1%f%,2@> ?,#\<K$
%rceZdZdfd	Zdfd	ZdZdZdZddZhdZ	d	Z
d
ZdddZddd
Z
dZddZddZddZdddZdZdZdZdZdZxZS)MIMEPartNc8|ddlm}|}t|
|y)Nr)default)email.policyr4superre)rdr[r4	__class__s   rrezMIMEPart.__init__s>,F
 rcb||jn|}||j}t|
|||S)aReturn the entire formatted message as a string.

        Optional 'unixfrom', when true, means include the Unix From_ envelope
        header.  maxheaderlen is retained for backward compatibility with the
        base Message class, but defaults to None, meaning that the policy value
        for max_line_length controls the header maximum length.  'policy' is
        passed to the Generator instance used to serialize the message; if it
        is not specified the policy associated with the message instance is
        used.
        )r[max_line_lengthr6rg)rdrormr[r7s    rrgzMIMEPart.as_strings9!'F!11Lw <@@rcZ|j|jjdS)NT)utf8r[)rgr[clonerhs rrizMIMEPart.__str__s%~~T[[%6%6D%6%A~BBrcJ|jd}|dS|jdk(S)NrF
attachment)rcontent_disposition)rdr)s  r
is_attachmentzMIMEPart.is_attachments+hh,-uP)@)@L)PPrc#\K|jry|jjd\}}|dk(r||vr|j||fy|dk7s|j	sy|dk7r0|jD]}|j
||Ed{yd|vr|jd|fd}|jd}|r!|jD]}|d|k(s|}n||j}|r|dnd}||j
||Ed{yy77w)Nrtext	multipartrelatedstart
content-idr)	rArrr/r|
iter_parts
_find_bodyrr)	rdr&preferencelistmaintypesubtypesubpart	candidaterFsubpartss	         rrIzMIMEPart._find_bodysW 11399#>'v.(%++G4d;;{"$*;*;*=i??,
D??7NCCC
D&!''	2D99	w'??,
<(E1 'I
'')H'/TI y.AAA!D
Bs+BD,D(AD,*7D,!D*"D,*D,cxt|}d}|j||D]\}}||ks|}|}|dk(s|S|S)aReturn best candidate mime part for display as 'body' of message.

        Do a depth first search, starting with self, looking for the first part
        matching each of the items in preferencelist, and return the part
        corresponding to the first item that has a match, or None if no items
        have a match.  If 'related' is not included in preferencelist, consider
        the root part of any multipart/related encountered as a candidate
        match.  Ignore parts with 'Content-Disposition: attachment'.
        Nr)r!rI)rdrJ	best_priobodyprior&s      rget_bodyzMIMEPart.get_body
sY'	//$?	JD$i 	19
	r>rChtmlrCplainrDrErDalternativec#K|jjd\}}|dk7s|dk(ry|j}	|j}|dk(rt|dk(ro|jd}|r@d}g}|D]*}|j
d|k(rd	}|j|,|r|Ed{y|jd
|Ed{yg}	|D]^}|jjd\}}||f|jvr&|js||	vr|	j|[|`y#t$rYywxYw77|w)aReturn an iterator over the non-main parts of a multipart.

        Skip the first of each occurrence of text/plain, text/html,
        multipart/related, or multipart/alternative in the multipart (unless
        they have a 'Content-Disposition: attachment' header) and include all
        remaining subparts in the returned iterator.  When applied to a
        multipart/related, return all parts except the root part.  Return an
        empty iterator when applied to a multipart/alternative or a
        non-multipart.
        rrDr[NrErFFrGTr)rrrrrrrr1pop_body_typesrA)
rdrKrLrrrFrattachmentsr&seens
          riter_attachmentszMIMEPart.iter_attachments%sl!11399#>'{"g&>""$	LLNE
{"w)';NN7+E !1Dxx-6 $#**40	1
***IIaL	D $ 5 5 7 = =c BHg7#t'7'77**,1DG$J
	7		$+
sI>ED0AE(D?)EEA+E0	D<9E;D<<EEc#bK|jr|jEd{yy7w)z~Return an iterator over all immediate subparts of a multipart.

        Return an empty iterator for a non-multipart.
        N)r|rrhs rrHzMIMEPart.iter_parts\s.
''))))s$/-/)content_managerc^||jj}|j|g|i|Sr~)r[rcget_contentrdrcargskws    rrezMIMEPart.get_contentds4""kk99O***4=$="==rc`||jj}|j|g|i|yr~)r[rcset_contentrfs    rrjzMIMEPart.set_contentis1""kk99O###D64626rc$|jdk(r5|j}||fz}||vrtdj||g}g}|jD]K\}}|jj
dr|j||f9|j||fM|r=t||j}	||	_|j|	_
|	g|_
ng|_
||_d|z|d<||jd|yy)NrDzCannot convert {} to {}content-r<z
multipart/rr)rrrIrr\r0rFr1rr[r^r)
rdrLdisallowed_subtypesrexisting_subtypekeep_headerspart_headersrr*r&s
          r_make_multipartzMIMEPart._make_multipartns$$&+5#779"5
"B#66 !:!A!A$g"/00==	3KD%zz|&&z2##T5M2##T5M2		3
4:T[[1D(DM MMDM!FDMDM$
+g5^NN:x0 rc*|jdd|y)NrE)r[mixedrqrdrs  rmake_relatedzMIMEPart.make_relatedsY(@(Krc*|jdd|y)Nr[)rsrtrus  rmake_alternativezMIMEPart.make_alternatives]JArc*|jdd|y)Nrsr0rtrus  r
make_mixedzMIMEPart.make_mixedsWb(3r)_dispc|jdk7s|j|k7rt|d|zt||j}|j
|i||r	d|vr||d<|j
|y)NrDmake_r<rzContent-Disposition)rrgetattrrr[rjr)rd_subtyper{rgrhr&s      r_add_multipartzMIMEPart._add_multiparts%%';6((*h6-GD'H,-/tDz-$%"%*$6*/D&'Drc4|jdg|ddi|y)NrEr{inlinerrdrgrhs   radd_relatedzMIMEPart.add_relateds!ICCHCCrc0|jdg|i|y)Nr[rrs   radd_alternativezMIMEPart.add_alternativesM7D7B7rc4|jdg|ddi|y)Nrsr{r?rrs   radd_attachmentzMIMEPart.add_attachments!GEdE,E"Erc g|_d|_yr~)r\r^rhs rclearzMIMEPart.clears

rc|jDcgc](\}}|jjds||f*c}}|_d|_ycc}}w)Nrl)r\r0rFr^)rdnrs   r
clear_contentzMIMEPart.clear_contentsJ,0MMBDAq !	 4 4Z @QB

Bs-Ar~)FNN))rErVrX)r+r,r-rergrirArIrTr^rarHrerjrqrvrxrzrrrrrr
__classcell__r7s@rr2r2s!A CQB:(1K5n*26>
267
16LB459D8Frr2ceZdZfdZxZS)rc8t||i|d|vrd|d<yy)Nrr)r6rj)rdrgrhr7s   rrjzEmailMessage.set_contents,
T(R(%#(D &r)r+r,r-rjrrs@rrrs
))r)NT)r.__all__rJreriorremailrremail._policybaser	rr_email._encoded_wordsrrrcompiler'rr+r7r:rWrr2rr0rr<module>rs
?n
%	
 &%)


	
BJJ23	  D($#>F
%F
%R\w\~)8)r