ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
M\¬Qc@s¹dZddlZddlmZedddƒddd    d
d gZd d fZdfd„ƒYZd„Zd„Zd„Z    dfd„ƒYZ
de
fd„ƒYZ d„Z ddddddddddd d!d"d#d$d%dd&d'd(d)d*d+d,gZ d-d.d/d0d1d2d3gZid4d56d4d66d4d76d4d86d9d:6d;d<6d=d>6d9d?6d@dA6d=dB6dCdD6d@dE6dFdG6dCdH6ZdI„ZdJ„ZdK„ZedL„ZedMkrµddlZddlZejjejdNdOƒZejdPrejdPZneedQƒZeeƒZdRGej dSƒGHdTGej!dUƒGHdVGej"dWƒGHdXGej"dYƒGHej#dYƒZ$e$dZ%ej&ee$ƒƒZ$e$rdZGej'e$ƒGe%Z(e)e(d[ƒ\Z*Z+e)e*d[ƒ\Z,Z-d\e,e-fGe+rÿd]e+GnHn    dZGeGHej.ƒd4Z/xej0ƒr8e/dP7Z/qWd^Ge/GHd_d`GHdaGe1eƒGHdbekrvdcGedbGHnddekr…ndeGej2ƒGHdfGej3ƒGHdgGej4ƒGHndS(hs* RFC 2822 message manipulation.
 
Note: This is only a very rough sketch of a full RFC-822 parser; in particular
the tokenizing of addresses does not adhere to all the quoting rules.
 
Note: RFC 2822 is a long awaited update to RFC 822.  This module should
conform to RFC 2822, and is thus mis-named (it's not worth renaming it).  Some
effort at RFC 2822 updates have been made, but a thorough audit has not been
performed.  Consider any RFC 2822 non-conformance to be a bug.
 
    RFC 2822: http://www.faqs.org/rfcs/rfc2822.html
    RFC 822 : http://www.faqs.org/rfcs/rfc822.html (obsolete)
 
Directions for use:
 
To create a Message object: first open a file, e.g.:
 
  fp = open(file, 'r')
 
You can use any other legal way of getting an open file object, e.g. use
sys.stdin or call os.popen().  Then pass the open file object to the Message()
constructor:
 
  m = Message(fp)
 
This class can work with any input object that supports a readline method.  If
the input object has seek and tell capability, the rewindbody method will
work; also illegal lines will be pushed back onto the input stream.  If the
input object lacks seek but has an `unread' method that can push back a line
of input, Message will use that to push back illegal lines.  Thus this class
can be used to parse messages coming from a buffered stream.
 
The optional `seekable' argument is provided as a workaround for certain stdio
libraries in which tell() discards buffered data before discovering that the
lseek() system call doesn't work.  For maximum portability, you should set the
seekable argument to zero to prevent that initial \code{tell} when passing in
an unseekable object such as a file object created from a socket object.  If
it is 1 on entry -- which it is by default -- the tell() method of the open
file object is called once; if this raises an exception, seekable is reset to
0.  For other nonzero values of seekable, this test is not made.
 
To get the text of a particular header there are several methods:
 
  str = m.getheader(name)
  str = m.getrawheader(name)
 
where name is the name of the header, e.g. 'Subject'.  The difference is that
getheader() strips the leading and trailing whitespace, while getrawheader()
doesn't.  Both functions retain embedded whitespace (including newlines)
exactly as they are specified in the header, and leave the case of the text
unchanged.
 
For addresses and address lists there are functions
 
  realname, mailaddress = m.getaddr(name)
  list = m.getaddrlist(name)
 
where the latter returns a list of (realname, mailaddr) tuples.
 
There is also a method
 
  time = m.getdate(name)
 
which parses a Date-like field and returns a time-compatible tuple,
i.e. a tuple such as returned by time.localtime() or accepted by
time.mktime().
 
See the class definition for lower level access methods.
 
There are also some utility functions here.
iÿÿÿÿN(twarnpy3ks=in 3.x, rfc822 has been removed in favor of the email packaget
stacklevelitMessaget AddressListt    parsedatet parsedate_tzt    mktime_tzs
s
cBseZdZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d    „Z
d
„Z dd „Z e Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s/Represents a single RFC 2822-compliant message.icCsí|dkr=y|jƒWq=ttfk
r9d}q=Xn||_||_d|_d|_|jr y|jjƒ|_Wq tk
rœd|_q Xn|jƒ|jréy|jjƒ|_Wqétk
råd|_qéXndS(s3Initialize the class instance and read the headers.iiN(    ttelltAttributeErrortIOErrortfptseekabletNonetstartofheaderst startofbodyt readheaders(tselfR
R ((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__init__Xs(                       
     cCs,|jstd‚n|jj|jƒdS(s7Rewind the file to the start of the body (if seekable).sunseekable fileN(R R    R
tseekR(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt
rewindbodyts     c    Cs8i|_d|_g|_}d|_d}d}d }}}t|jdƒrc|jj}n|jr{|jj    }nx¶|r»y |ƒ}Wq»t
k
r·d }}d|_q»Xn|jj ƒ}|sÝd|_Pn|r|j dƒr|j||_q~nd}|re|ddkre|j |ƒ|j|d|jƒ}|jƒ|j|<q~n(|j|ƒrzq~n|j|ƒrPn|j|ƒ}|rÖ|j |ƒ|t|ƒdjƒ|j|<q~q~|jsëd    |_n    d
|_|r||ƒn)|r |jj|ƒn|jd |_Pq~d S( s¾Read header lines.
 
        Read header lines up to the entirely blank line that terminates them.
        The (normally blank) line that ends the headers is skipped, but not
        included in the returned list.  If a non-header line ends the headers,
        (which is an error), an attempt is made to backspace over it; it is
        never included in the returned list.
 
        The variable self.status is set to the empty string if all went well,
        otherwise it is an error message.  The variable self.headers is a
        completely uninterpreted list of lines contained in the header (so
        printing them will reproduce the header exactly as it appears in the
        file).
        titunreadisEOF in headerssFrom s     s
 s
No headerss%Non-header line where header expecteds
; bad seekN(tdicttunixfromtheaderststatusR thasattrR
RR RR    treadlinet
startswithtappendtstript    iscommenttislasttisheadertlenR(    Rtlstt
headerseent    firstlinet startoflineRRtlinetx((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRzsb                   
      !          cCs-|jdƒ}|dkr)|| jƒSdS(sDetermine whether a given line is a legal header.
 
        This method should return the header name, suitably canonicalized.
        You may override this method in order to use Message parsing on tagged
        data in RFC 2822-like formats with special header formats.
        t:iN(tfindtlowerR (RR'ti((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR!Ås cCs
|tkS(sfDetermine whether a line is a legal end of RFC 2822 headers.
 
        You may override this method if your application wants to bend the
        rules, e.g. to strip trailing whitespace, or to recognize MH template
        separators ('--------').  For convenience (e.g. for code reading from
        sockets) a line consisting of \r\n also matches.
        (t _blanklines(RR'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR ÑscCstS(síDetermine whether a line should be skipped entirely.
 
        You may override this method in order to use Message parsing on tagged
        data in RFC 2822-like formats that support embedded comments or
        free-text data.
        (tFalse(RR'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRÛscCsŽ|jƒd}t|ƒ}g}d}x_|jD]T}|| jƒ|krWd}n|d jƒspd}n|r2|j|ƒq2q2W|S(s¹Find all header lines matching a given header name.
 
        Look through the list of headers and find all lines matching a given
        header name (and their continuation lines).  A list of the lines is
        returned, without interpretation.  If the header does not occur, an
        empty list is returned.  If the header occurs multiple times, all
        occurrences are returned.  Case is not important in the header name.
        R)ii(R+R"RtisspaceR(RtnametnR#thitR'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytgetallmatchingheadersäs             cCs’|jƒd}t|ƒ}g}d}xc|jD]X}|rU|d jƒstPqtn|| jƒ|krtd}n|r2|j|ƒq2q2W|S(s¸Get the first header line matching name.
 
        This is similar to getallmatchingheaders, but it returns only the
        first matching header (and its continuation lines).
        R)ii(R+R"RR/R(RR0R1R#R2R'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytgetfirstmatchingheaderús     cCsB|j|ƒ}|sdS|dt|ƒd|d<dj|ƒS(s2A higher-level interface to getfirstmatchingheader().
 
        Return a string containing the literal text of the header but with the
        keyword stripped.  All leading, trailing and embedded whitespace is
        kept in the string, however.  Return None if the header does not
        occur.
        iiRN(R4R R"tjoin(RR0R#((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt getrawheaders
   cCs|jj|jƒ|ƒS(s Get the header value for a name.
 
        This is the normal interface: it returns a stripped version of the
        header value for a given header name, or None if it doesn't exist.
        This uses the dictionary version which finds the *last* such header.
        (RtgetR+(RR0tdefault((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt    getheaderscCs½g}d}d}xŽ|j|ƒD]}}|djƒrf|rWd||jƒf}qŸ|jƒ}q"|r||j|ƒn||jdƒdjƒ}d}q"W|r¹|j|ƒn|S(s    Get all values for a header.
 
        This returns a list of values for headers given more than once; each
        value in the result list is stripped in the same way as the result of
        getheader().  If the header is not given, return an empty list.
        Ris%s
 %sR)i(R3R/RRR*(RR0tresulttcurrentt have_headerts((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt
getheaders's
cCs%|j|ƒ}|r|dSdSdS(s‡Get a single address from a header, as a tuple.
 
        An example return value:
        ('Guido van Rossum', 'guido@cwi.nl')
        iN(NN(t getaddrlistR (RR0talist((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytgetaddr@scCs±g}x†|j|ƒD]u}|ddkr<|j|ƒq|rR|jdƒn|jdƒ}|dkr~||d}n|j|ƒqWdj|ƒ}t|ƒ}|jS(s
Get a list of addresses from a header.
 
        Retrieves a list of addresses from a header, where each address is a
        tuple as returned by getaddr().  Scans all named headers, so it works
        properly with multiple To: or Cc: headers for example.
        is     s, R)iR(R3RR*R5Rt addresslist(RR0trawthR,taddrtalladdrsta((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR?Ms  cCs-y||}Wntk
r"dSXt|ƒS(sRetrieve a date field from a header.
 
        Retrieves a date field from the named header, returning a tuple
        compatible with time.mktime().
        N(tKeyErrorR R(RR0tdata((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytgetdatecs
 cCs-y||}Wntk
r"dSXt|ƒS(sÓRetrieve a date field from a header as a 10-tuple.
 
        The first 9 elements make up a tuple compatible with time.mktime(),
        and the 10th is the offset of the poster's time zone from GMT/UTC.
        N(RHR R(RR0RI((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt
getdate_tzos
 cCs t|jƒS(s'Get the number of headers in a message.(R"R(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__len__~scCs|j|jƒS(s,Get a specific header, as from a dictionary.(RR+(RR0((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt __getitem__‚scCsZ||=||j|jƒ<|d|}x+|jdƒD]}|jj|dƒq8WdS(såSet the value of a header.
 
        Note: This is not a perfect inversion of __getitem__, because any
        changed headers get stuck at the end of the raw-headers list rather
        than where the altered header was.
        s: s
N(RR+tsplitRR(RR0tvaluettextR'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt __setitem__†s
cCsë|jƒ}||jkrdS|j|=|d}t|ƒ}g}d}xxtt|jƒƒD]a}|j|}|| jƒ|kr“d}n|d jƒs¬d}n|ra|j|ƒqaqaWxt|ƒD]}|j|=qÓWdS(s>Delete all occurrences of a specific header, if it is present.NR)ii(R+RR"trangeRR/Rtreversed(RR0R1R#R2R,R'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt __delitem__“s$ 
 
          RcCsw|jƒ}||jkr&|j|S|d|}x+|jdƒD]}|jj|dƒqDW||j|<|SdS(Ns: s
(R+RRNRR(RR0R8t    lowernameRPR'((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt
setdefault¨s   cCs|jƒ|jkS(s6Determine whether a message contains the named header.(R+R(RR0((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pythas_key³scCs|jƒ|jkS(s6Determine whether a message contains the named header.(R+R(RR0((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt __contains__·scCs t|jƒS(N(titerR(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__iter__»scCs |jjƒS(s*Get all of a message's header field names.(Rtkeys(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR[¾scCs |jjƒS(s+Get all of a message's header field values.(Rtvalues(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR\ÂscCs |jjƒS(sWGet all of a message's headers.
 
        Returns a list of name, value tuples.
        (Rtitems(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR]ÆscCsdj|jƒS(NR(R5R(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__str__ÍsN( t__name__t
__module__t__doc__RRRR!R RR3R4R6R R9R7R>RAR?RJRKRLRMRQRTRVRWRXRZR[R\R]R^(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRUs:         K        
                                                                                cCsƒt|ƒdkr|jdƒrS|jdƒrS|dd!jddƒjddƒS|jdƒr|jdƒr|dd!Sn|S(    sRemove quotes from a string.it"iÿÿÿÿs\\s\s\"t<t>(R"Rtendswithtreplace(R=((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytunquoteØs #cCs|jddƒjddƒS(sAdd quotes around a string.s\s\\Rbs\"(Rf(R=((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytquoteâscCs't|ƒ}|j}|sdS|dS(s3Parse an address into a (realname, mailaddr) tuple.iN(NN(RRBR (taddressRGR#((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt    parseaddrçs
     t AddrlistClasscBs‰eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z    dd    „Z
d
„Z d „Z d „Z dd „Zd„ZRS(s)Address parser class by Ben Escoto.
 
    To understand what this class does, it helps to have a copy of
    RFC 2822 in front of you.
 
    http://www.faqs.org/rfcs/rfc2822.html
 
    Note: this class interface is deprecated and may be removed in the future.
    Use rfc822.AddressList instead.
    cCsld|_d|_d|_d|_|j|j|j|_|jjddƒ|_||_g|_dS(sƒInitialize a new instance.
 
        `field' is an unparsed address header field, containing one or more
        addresses.
        s ()<>@,:;."[]is     s
t.RN(    tspecialstpostLWStCRtatomendsRft
phraseendstfieldt commentlist(RRs((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRüs                    cCsƒx||jt|jƒkr~|j|j|jdkrK|jd|_q|j|jdkrz|jj|jƒƒqPqWdS(s*Parse up to the start of the next address.s
it(N(RnR"RsRoRtRt
getcomment(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pytgotonexts cCs9g}|jƒ}x |r4||7}|jƒ}qW|S(sVParse all addresses.
 
        Returns a list containing all of the addresses.
        (t
getaddress(RR:tad((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR?s      
cCsžg|_|jƒ|j}|j}|jƒ}|jƒg}|jt|jƒkr„|rPdj|jƒ|dfg}qPnÌ|j|jdkrÖ||_||_|jƒ}dj|jƒ|fg}nz|j|jdkr„g}t|jƒ}|jd7_x=|jt|jƒkr€|jƒ|j|krm|j|jdkrm|jd7_Pn||jƒ}qWnÌ|j|jdkrý|j    ƒ}|jrâdj|ƒddj|jƒd    |fg}qPdj|ƒ|fg}nS|r%dj|jƒ|dfg}n+|j|j|j
krP|jd7_n|jƒ|jt|jƒkrš|j|jd
krš|jd7_n|S( sParse the next address.t is.@R)it;Rcs (t)t,( RtRwRnt getphraselistR"RsR5t getaddrspecRxt getrouteaddrRm(Rtoldpostoldcltplistt
returnlisttaddrspectfieldlent    routeaddr((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRx#sL    
         
%         
%     3"
.cCs |j|jdkrdSd}|jd7_|jƒd}xÚ|jt|jƒkr|rs|jƒd}n›|j|jdkrœ|jd7_Pnr|j|jdkrÊ|jd7_d}nD|j|jdkrò|jd7_n|jƒ}|jd7_P|jƒqBW|S(    sParse a route address (Return-path value).
 
        This method just skips all the route stuff and returns the addrspec.
        RcNiiRRdt@R)(RsRnRwR"t    getdomainR(Rt expectroutetadlist((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR€]s.
 
         cCsFg}|jƒx»|jt|jƒkrÍ|j|jdkr`|jdƒ|jd7_n`|j|jdkr|jd|jƒƒn0|j|j|jkr­Pn|j|jƒƒ|jƒqW|jt|jƒksü|j|jdkr    dj|ƒS|jdƒ|jd7_|jƒdj|ƒ|j    ƒS(sParse an RFC 2822 addr-spec.RliRbs"%s"RˆR(
RwRnR"RsRtgetquoteRqtgetatomR5R‰(Rtaslist((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR}s$
 .  
cCsg}x|jt|jƒkr|j|j|jkrL|jd7_q    |j|jdkr{|jj|jƒƒq    |j|jdkr§|j|jƒƒq    |j|jdkrÜ|jd7_|jdƒq    |j|j|jkrùPq    |j|j    ƒƒq    Wdj
|ƒS(s-Get the complete domain name from an address.iRut[RlR( RnR"RsRoRtRRvtgetdomainliteralRqRR5(Rtsdlist((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR‰•sicCs3|j|j|krdSdg}d}|jd7_xë|jt|jƒkr%|dkr|j|j|jƒd}n”|j|j|kr¨|jd7_Pnk|rÝ|j|jdkrÝ|j|jƒƒq;n6|j|jdkrüd}n|j|j|jƒ|jd7_q;Wdj|ƒS(sçParse a header fragment delimited by special characters.
 
        `beginchar' is the start character for the fragment.  If self is not
        looking at an instance of `beginchar' then getdelimited returns the
        empty string.
 
        `endchars' is a sequence of allowable end-delimiting characters.
        Parsing stops when one of these is encountered.
 
        If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed
        within the parsed fragment.
        RiiRus\(RsRnR"RRvR5(Rt    beginchartendcharst allowcommentstslistRh((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt getdelimited§s(              cCs|jdddƒS(s1Get a quote-delimited fragment from self's field.Rbs" i(R–(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRŒÌscCs|jdddƒS(s7Get a parenthesis-delimited fragment from self's field.Rus) i(R–(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRvÐscCsd|jdddƒS(s!Parse an RFC 2822 domain-literal.s[%s]Rs] i(R–(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRÔscCsdg}|dkr!|j}nx\|jt|jƒkr|j|j|krVPn|j|j|jƒ|jd7_q$Wdj|ƒS(sParse an RFC 2822 atom.
 
        Optional atomends specifies a different set of end token delimiters
        (the default is to use self.atomends).  This is used e.g. in
        getphraselist() since phrase endings must not include the `.' (which
        is legal in phrases).RiN(R RqRnR"RsRR5(RRqtatomlist((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRØs      cCsåg}xØ|jt|jƒkrà|j|j|jkrL|jd7_q    |j|jdkrx|j|jƒƒq    |j|jdkr§|jj|jƒƒq    |j|j|jkrÄPq    |j|j    |jƒƒq    W|S(sýParse a sequence of RFC 2822 phrases.
 
        A phrase is a sequence of words, which are in turn either RFC 2822
        atoms or quoted-strings.  Phrases are canonicalized by squeezing all
        runs of continuous whitespace into one space.
        iRbRu(
RnR"RsRoRRŒRtRvRrR(RRƒ((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR~ësN(R_R`RaRRwR?RxR€RR‰R–RŒRvRR RR~(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRkðs
                    :              %             cBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
RS(    s@An AddressList encapsulates a list of parsed RFC 2822 addresses.cCs5tj||ƒ|r(|jƒ|_n    g|_dS(N(RkRR?RB(RRs((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRscCs t|jƒS(N(R"RB(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRL scCsdjtt|jƒƒS(Ns, (R5tmaptdump_address_pairRB(R((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR^scCsStdƒ}|j|_x3|jD](}||jkr#|jj|ƒq#q#W|S(N(RR RBR(RtothertnewaddrR(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__add__s   cCs:x3|jD](}||jkr
|jj|ƒq
q
W|S(N(RBR(RRšR(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__iadd__scCsFtdƒ}x3|jD](}||jkr|jj|ƒqqW|S(N(RR RBR(RRšR›R(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__sub__!s
 cCs:x3|jD](}||jkr
|jj|ƒq
q
W|S(N(RBtremove(RRšR(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt__isub__)scCs |j|S(N(RB(Rtindex((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRM0s( R_R`RaRRLR^RœRRžR RM(((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRs                                cCs2|dr&d|dd|ddS|dSdS(s4Dump a (name, address) pair in a canonicalized form.iRbs" <iRdN((tpair((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR™4s
tjantfebtmartaprtmaytjuntjultaugtseptocttnovtdectjanuarytfebruarytmarchtapriltjunetjulytaugustt    septembertoctobertnovembertdecembertmonttuetwedtthutfritsattsunitUTtUTCtGMTtZipþÿÿtASTiÔþÿÿtADTi þÿÿtESTtEDTi¨ýÿÿtCSTtCDTiDýÿÿtMSTtMDTiàüÿÿtPSTtPDTc Csá|s
dS|jƒ}|dddks@|djƒtkrJ|d=n8|djdƒ}|dkr‚|d|d|d<nt|ƒdkrÍ|djdƒ}t|ƒdkrÍ||d}qÍnt|ƒdkr3|d}|jd    ƒ}|dkr#|| ||dg|d)q3|jd
ƒnt|ƒd krIdS|d  }|\}}}}}|jƒ}|tkr¦||jƒ}}|tkr¦dSntj    |ƒd}|d krÒ|d }n|ddkrï|d }n|jd ƒ}|dkr||}}n|ddkr7|d }n|dj
ƒsW||}}n|ddkrt|d }n|jd ƒ}t|ƒdkrª|\}    }
d} n(t|ƒdkrÎ|\}    }
} ndSy@t |ƒ}t |ƒ}t |    ƒ}    t |
ƒ}
t | ƒ} Wnt k
r&dSXd} |j ƒ}|tkrRt|} n$yt |ƒ} Wnt k
runX| r¿| dkr˜d} | } nd} | | dd| dd} n||||    |
| ddd| f
S(sQConvert a date string to a time tuple.
 
    Accounts for military timezones.
    iiÿÿÿÿR}Rliit-it+Rii R)it0idii<N(R}Rl(R RNR+t    _daynamestrfindR"R*Rt _monthnamesR¡tisdigittintt
ValueErrortuppert
_timezones(RIR,tstuffR=tddtmmtyyttmttztthhttmmttssttzoffsetttzsign((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyRRsŽ *
 
 
                       
!cCs$t|ƒ}|dkr|S|d S(s&Convert a time string to a time tuple.i    N(RR (RItt((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR§s  cCsS|ddkr%tj|d dƒStj|d dƒ}||dtjSdS(sCTurn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.i    iiÿÿÿÿiN(iÿÿÿÿ(i(R ttimetmktimettimezone(RIRå((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyR¯scCso|dkrtjƒ}ntj|ƒ}dd|d    |d
d|dd|d|d|d|dfS(s\Returns time format preferred for Internet standards.
 
    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
 
    According to RFC 1123, day and month names must always be in
    English.  If not for that, this code could use strftime().  It
    can't because strftime() honors the locale and could generated
    non-English names.
    s#%s, %02d %s %04d %02d:%02d:%02d GMTtMontTuetWedtThutFritSattSuniitJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDeciiiiiN(RéRêRëRìRíRîRï( RðRñRòRóRôRõRöR÷RøRùRúRû(R Rætgmtime(ttimeval((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt
formatdate¸s
 t__main__tHOMEs Mail/inbox/1itrsFrom:tfromsTo:ttosSubject:tsubjectsDate:tdates ParsedDate:i<s    %+03d%02ds.%02dsLines:RÏiFslen =tDatesDate =s
X-Nonsenseskeys =svalues =sitems =(5RaRætwarningsRt__all__R-RRgRhRjRkRR™RÔRÒRÙRRRR RþR_tsystostpathR5tenvirontfiletargvtopentftmRAR?R9RKRRßt    localtimetasctimethhmmsstdivmodthhmmtssthhRÜRR1RR"R[R\R](((sN/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/rfc822.pyt<module>Gsˆ      ÿ„    
           ÿ2            U