ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ A[c@`sUdZddlmZmZmZddlmZmZmZm Z dgZ ddl Z ddl Z ddl Z ddlZddlmZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZejZd Ze jdZ dZ!de#dZ$dZ%dZ&de'fdYZ(dS(u8Basic message object for the email package object model.i(tabsolute_importtdivisiontunicode_literals(tlisttrangetstrtzipuMessageN(tBytesIOtStringIO(t as_native_str(tutils(terrors(tcompat32(tcharset(tdecode_bu; u[ \(\)<>@,;:\\"/\[\]\?=]cC`sJt|jd\}}}|s4|jdfS|j|jfS(Nu;(Rt partitiontstriptNone(tparamtatseptb((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt _splitparam"scC`s|d k rt|dkrt|trf|d7}tj|d|d|d}d||fSy|jdWn;tk r|d7}tj|dd}d||fSX|stj |rd |tj |fSd||fSn|Sd S( u~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. iu*iiu%s=%suasciiuutf-8uu%s="%s"N( Rtlent isinstancettupleR tencode_rfc2231tencodetUnicodeEncodeErrort tspecialstsearchtquote(RtvalueR((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt _formatparam,s  !  cC`s+dt|}g}x|d dkr&|d}|jd}xR|dkr|jdd||jdd|dr|jd|d}qEW|dkrt|}n|| }d|kr|jd}|| jjd||dj}n|j|j||}qW|S(Nu;iiu"u\"iu=(RtfindtcountRtindexRtlowertappend(tstplisttendtfti((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt _parseparamNs  ;   /cC`sBt|tr1|d|dtj|dfStj|SdS(Niii(RRR tunquote(R ((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt _unquotevaluebs"tMessagecB`seZdZedZedddZeddZdZ dZ d Z d Z d2ed Zd2d Zd ZdZdZdZdZdZdZdZdZdZdZd2dZdZdZd2dZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d2d$e'd%Z(d2d$e'd&Z)d'e'd2d(d)Z*d$e'd*Z+d'e'd+Z,d2d,Z-d2d-Z.d.Z/d2d/Z0d2d0Z1dd1l2m3Z3RS(3uBasic 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. cC`sV||_t|_d|_d|_d|_d|_|_g|_ d|_ dS(Nu text/plain( tpolicyRt_headersRt _unixfromt_payloadt_charsettpreambletepiloguetdefectst _default_type(tselfR0((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt__init__|s      tencodinguutf-8cC`s |jS(uwReturn the entire formatted message as a string. This includes the headers, body, and envelope header. (t as_string(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt__str__sicC`sNddlm}t}||dtd|}|j|d||jS(uWReturn the entire formatted message as a (unicode) string. Optional `unixfrom' when True, means include the Unix From_ envelope header. This is a convenience method and may not generate the message exactly as you intend. For more flexibility, use the flatten() method of a Generator instance. i(t Generatort mangle_from_t maxheaderlentunixfrom(t future.backports.email.generatorR>RtFalsetflattentgetvalue(R9RAR@R>tfptg((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyR<s  cC`st|jtS(u6Return True if the message consists of multiple parts.(RR3R(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt is_multipartscC`s ||_dS(N(R2(R9RA((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt set_unixfromscC`s|jS(N(R2(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_unixfromscC`s2|jdkr|g|_n|jj|dS(uAdd 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. N(R3RR&(R9tpayload((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytattachsc C`sZ|jr7|rdS|dkr)|jS|j|Sn|dk rrt|jt rrtdt|jn|j}t|jddj }t|trkt|}t j |r)|j dd}|shy"|j |jddd}Wq&tk r"|j dd}q&Xqhqk|rky|j d}Wqhtk rd|j d}qhXqkn|su|S|d krt j|S|d krtd j|j\}}x!|D]}|jj||qW|S|dkrCt|} t} y$tj | | dt| jSWqCtjk r?|SXnt|trV|S|S(uZReturn 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. uExpected list, got %sucontent-transfer-encodinguuasciiusurrogateescapeucharsetureplaceuraw-unicode-escapeuquoted-printableubase64tu x-uuencodeuuuencodeuuueux-uuetquietN(u x-uuencodeuuuencodeuuueux-uue(RHRR3RRt TypeErrorttypeRtgetR%R t_has_surrogatesRtdecodet get_paramt LookupErrort UnicodeErrort_qdecodeRtjoint splitlinesR0t handle_defectRtuutTrueREtError( R9R+RSRKtctetbpayloadR R7tdefecttin_filetout_file((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_payloadsX"    "     !    cC`s)||_|dk r%|j|ndS(uSet the payload to the given value. Optional charset sets the message's default character set. See set_charset() for details. N(R3Rt set_charset(R9RKR ((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt set_payloads  cC`s=|dkr&|jdd|_dSt|tsDt|}n||_d|krl|jddnd|kr|jddd|jn|jd|j||jkr|j|j |_ nd|kr9|j }y||Wq9t k r5|j|j |_ |jd|q9XndS( uSet 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. ucharsetNu MIME-Versionu1.0u Content-Typeu text/plainR uContent-Transfer-Encoding( Rt del_paramR4RtCharsett add_headertget_output_charsett set_paramt body_encodeR3tget_body_encodingRO(R9R R^((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyRds,         cC`s|jS(uKReturn the Charset instance associated with the message's payload. (R4(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_charsetEscC`s t|jS(u9Return the total number of headers, including duplicates.(RR1(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt__len__MscC`s |j|S(u-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. (RQ(R9tname((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt __getitem__Qs cC`s|jj|}|r|j}d}x`|jD]R\}}|j|kr4|d7}||krtdj||qq4q4Wn|jj|jj||dS(uSet 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. iiu/There may be at most {} {} headers in a messageN(R0theader_max_countR%R1t ValueErrortformatR&theader_store_parse(R9Rotvalt max_counttlnametfoundtktv((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt __setitem__\s    cC`sd|j}t}x?|jD]4\}}|j|kr|j||fqqW||_dS(uwDelete all occurrences of a header, if present. Does not raise an exception if the header is missing. N(R%RR1R&(R9Rot newheadersRyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt __delitem__ns   cC`s2|jg|jD]\}}|j^qkS(N(R%R1(R9RoRyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt __contains__zscc`s#x|jD]\}}|Vq WdS(N(R1(R9tfieldR ((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt__iter__}scC`s g|jD]\}}|^q S(u.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. (R1(R9RyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytkeysscC`s/g|jD]!\}}|jj||^q S(u)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. (R1R0theader_fetch_parse(R9RyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytvaluesscC`s5g|jD]'\}}||jj||f^q S(u'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. (R1R0R(R9RyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytitemsscC`sO|j}x<|jD]1\}}|j|kr|jj||SqW|S(u~Get a header value. Like __getitem__() but return failobj instead of None when the field is missing. (R%R1R0R(R9RotfailobjRyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyRQs  cC`s|jj||fdS(uStore name and value in the model without modification. This is an "internal" API, intended only for use by a parser. N(R1R&(R9RoR ((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytset_rawscC`st|jjS(uReturn the (name, value) header pairs without modification. This is an "internal" API, intended only for use by a generator. (titerR1tcopy(R9((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt raw_itemsscC`skg}|j}xH|jD]=\}}|j|kr|j|jj||qqW|sg|S|S(uQReturn 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). (R%R1R&R0R(R9RoRRRyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytget_alls  #cK`sg}xd|jD]V\}}|dkrG|j|jddq|jt|jdd|qW|dk r|jd|ntj|||Wtj|}|S(Nu=iu( RRQR,RRRrR&R t decode_params( R9RtheaderRR tparamstpRoRu((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt_get_params_preserveCs       u content-typecC`sbt}|j||}||kr+|S|rZg|D]\}}|t|f^q8S|SdS(umReturn 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. N(RRR.(R9RRR-RRRyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_paramsXs  )cC`sf||kr|SxO|j||D];\}}|j|jkr#|rWt|S|Sq#q#W|S(uReturn 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: param = msg.get_param('foo') param = email.utils.collapse_rfc2231_value(rawparam) (RR%R.(R9RRRR-RyRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyRTns   u Content-Typeuc C`swt|t r(|r(|||f}n||krO|jdkrOd}n|j|}|j|d|s|st|||}qJtj|t|||g}nd}x|jd|d|D]u\}} d} |j|jkrt|||} nt|| |} |s1| }qtj|| g}qW||j|krs||=|||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. NuRR-(RR%R!RRXRQ(R9RRRt new_ctypeRRz((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyRfs % cC`s|jddkstn|jdkrD|d=d|dt}|jd|}||kr+|Stj|jS(uReturn the boundary associated with the payload if present. The boundary is extracted from the Content-Type header's `boundary' parameter, and it is unquoted. uboundary(RRTR Rtrstrip(R9RRtboundary((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_boundarys   cC`st}|j|d}||kr9tjdng}t}xY|D]Q\}}|jdkr|jdd|ft}qL|j||fqLW|s|jdd|fng}x|jD]\} } | jdkrmg} xG|D]?\} } | dkr$| j| q| jd| | fqWt j | } |j|j j | | q|j| | fqW||_dS(uSet 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. u content-typeuNo Content-Type header founduboundaryu"%s"uu%s=%sN( RRR tHeaderParseErrorRCR%R&R\R1RRXR0Rt(R9RRRt newparamstfoundptpktpvR|thRzRRyRu((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt set_boundarys2    cC`st}|jd|}||kr+|St|tr|dpGd}y&|djd}t||}Wqttfk r|d}qXny|jdWntk r|SX|jS(uReturn 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. ucharsetiuus-asciiiuraw-unicode-escape( RRTRRRRRURVR%(R9RRR tpcharsettas_bytes((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pytget_content_charsetAs    cC`s&g|jD]}|j|^q S(uReturn 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. (twalkR(R9Rtpart((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyt get_charsets_s(RN(4t__name__t __module__t__doc__R R:R R=RCR<RHRIRJRLRRcReRdRmRnRpR{R}R~RRRRRQRRRRhRRRRRRRR\RRTRjRfRRRRRRt future.backports.email.iteratorsR(((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyR/ms\     [ &             !/  .  ()Rt __future__RRRtfuture.builtinsRRRRt__all__treR[tbase64tbinasciitioRRt future.utilsR tfuture.backports.emailR R t"future.backports.email._policybaseR R R4t%future.backports.email._encoded_wordsRRgRtcompileRRRR\R!R,R.RR/(((sO/opt/alt/python27/lib/python2.7/site-packages/future/backports/email/message.pyts,"       "