ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/rfc822.pyc

�
�[
bc@s�dZddlZddlmZeddd�ddd	d
dgZdd
fZdfd��YZd�Zd�Zd�Z	dfd��YZ
de
fd��YZd�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
stacklevelitMessagetAddressListt	parsedatetparsedate_tzt	mktime_tzs
s
cBseZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zdd�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(	ttelltAttributeErrortIOErrortfptseekabletNonetstartofheaderststartofbodytreadheaders(tselfR
R((s+/opt/alt/python27/lib64/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(RR	R
tseekR(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt
rewindbodyts	c	CsKi|_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~|dk	r�q~q~|js�d	|_n	d
|_|r||�n)|r2|jj|�n|jd|_Pq~Wd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
RRRR	treadlinet
startswithtappendtstript	iscommenttislasttisheadertlenR(	Rtlstt
headerseent	firstlinetstartoflineRRtlinetx((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRzsf		
		


	

!		
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:i����N(tfindtlowerR(RR'ti((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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#((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt	getheader"scCs�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*(RR0tresulttcurrentthave_headerts((s+/opt/alt/python27/lib64/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(tgetaddrlistR(RR0talist((s+/opt/alt/python27/lib64/python2.7/rfc822.pytgetaddrEscCs�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*R5Rtaddresslist(RR0trawthR,taddrtalladdrsta((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR?Rs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((s+/opt/alt/python27/lib64/python2.7/rfc822.pytgetdatehs

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((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt
getdate_tzts

cCs
t|j�S(s'Get the number of headers in a message.(R"R(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__len__�scCs|j|j�S(s,Get a specific header, as from a dictionary.(RR+(RR0((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/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'((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt
setdefault�s
cCs|j�|jkS(s6Determine whether a message contains the named header.(R+R(RR0((s+/opt/alt/python27/lib64/python2.7/rfc822.pythas_key�scCs|j�|jkS(s6Determine whether a message contains the named header.(R+R(RR0((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__contains__�scCs
t|j�S(N(titerR(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__iter__�scCs
|jj�S(s*Get all of a message's header field names.(Rtkeys(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR[�scCs
|jj�S(s+Get all of a message's header field values.(Rtvalues(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR\�scCs
|jj�S(sWGet all of a message's headers.

        Returns a list of name, value tuples.
        (Rtitems(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR]�scCsdj|j�S(NR(R5R(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__str__�sN( t__name__t
__module__t__doc__RRRR!R RR3R4R6RR9R7R>RAR?RJRKRLRMRQRTRVRWRXRZR[R\R]R^(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRUs:		P		
							
						
							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=((s+/opt/alt/python27/lib64/python2.7/rfc822.pytunquote�s#cCs|jdd�jdd�S(sAdd quotes around a string.s\s\\Rbs\"(Rf(R=((s+/opt/alt/python27/lib64/python2.7/rfc822.pytquote�scCs't|�}|j}|sdS|dS(s3Parse an address into a (realname, mailaddr) tuple.iN(NN(RRBR(taddressRGR#((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt	parseaddr�s
	t
AddrlistClasscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zd�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
phraseendstfieldtcommentlist(RRs((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRs					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((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/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"RsR5tgetaddrspecRxtgetrouteaddrRm(Rtoldpostoldcltplistt
returnlisttaddrspectfieldlent	routeaddr((s+/opt/alt/python27/lib64/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(Rtexpectroutetadlist((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR�bs.

		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((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/python2.7/rfc822.pytgetdelimited�s(
			cCs|jddd�S(s1Get a quote-delimited fragment from self's field.Rbs"
i(R�(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR��scCs|jddd�S(s7Get a parenthesis-delimited fragment from self's field.Rus)
i(R�(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRv�scCsd|jddd�S(s!Parse an RFC 2822 domain-literal.s[%s]R�s]
i(R�(R((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/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�((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR~�sN(R_R`RaRRwR?RxR�RR�R�R�RvR�RR�R~(((s+/opt/alt/python27/lib64/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((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR	scCs
t|j�S(N(R"RB(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRLscCsdjtt|j��S(Ns, (R5tmaptdump_address_pairRB(R((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR^scCsStd�}|j|_x3|jD](}||jkr#|jj|�q#q#W|S(N(RRRBR(RtothertnewaddrR(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__add__s
cCs:x3|jD](}||jkr
|jj|�q
q
W|S(N(RBR(RR�R(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__iadd__scCsFtd�}x3|jD](}||jkr|jj|�qqW|S(N(RRRBR(RR�R�R(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__sub__&s
cCs:x3|jD](}||jkr
|jj|�q
q
W|S(N(RBtremove(RR�R(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt__isub__.scCs|j|S(N(RB(Rtindex((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRM5s(R_R`RaRRLR^R�R�R�R�RM(((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRs								cCs2|dr&d|dd|ddS|dSdS(s4Dump a (name, address) pair in a canonicalized form.iRbs" <iRdN((tpair((s+/opt/alt/python27/lib64/python2.7/rfc822.pyR�9s
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|�dkrIdS|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((s+/opt/alt/python27/lib64/python2.7/rfc822.pyRWs�*






	



!cCs$t|�}|dkr|S|d S(s&Convert a time string to a time tuple.i	N(RR(RItt((s+/opt/alt/python27/lib64/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�((s+/opt/alt/python27/lib64/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 generate
    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((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt
formatdate�s
t__main__tHOMEsMail/inbox/1itrsFrom:tfromsTo:ttosSubject:tsubjectsDate:tdatesParsedDate: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](((s+/opt/alt/python27/lib64/python2.7/rfc822.pyt<module>Gs�	��	
			�2			U			

	
		

Zerion Mini Shell 1.0