N
u9c       s6    d  Z  9 < k Z = k Z @ d d f Z C d f  d     YZ d   Z d   Z d   Z d f  d	     YZ d
 e f d     YZ	 d   Z
 d d d d d d d d d d d d d d d d d d d d d  d! d" d# g Z d$ d% d& d' d( d) d* g Z h  d+ d, <d+ d- <d+ d. <d+ d/ <d0 d1 <d2 d3 <d4 d5 <d0 d6 <d7 d8 <d4 d9 <d: d; <d7 d< <d= d> <d: d? <Z d@   Z [dA   Z cdB   Z qe dC j o\rk Z k Z se i i e i dD dE  Z te i dF o te i dF Z n ue e dG  Z ve e  Z wdH Ge i dI  GHxdJ Ge i dK  GHydL Ge i dM  GHzdN Ge i dO  GH{e i dO  Z  |e  o }dP Ge i! e  dF   G~e  dF Z" e# e" dQ  \ Z$ Z% e# e$ dQ  \ Z& Z' dR e& e' f Ge% o dS e% Gn Hn dP Ge( GHe i)   d+ Z* x" e i+   o e* dF Z* qkWdT Ge* GHdU dV GHdW Ge, e  GHe i- dX  o dY Ge dX GHn e i- dZ  o n d[ Ge i.   GHd\ Ge i/   GHd] Ge i0   GHn d^ S(_   s	  RFC-822 message manipulation class.

XXX 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.

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 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) and
  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.
s   
s   
s   Messagec      s1  C d  Z  D F d d  Z d d   Z j d   Z  d   Z  d   Z  d   Z  d   Z  d	   Z  d
   Z	 e
 d  Z e Z d   Z +d   Z Bd   Z Nd   Z ^d   Z bd   Z fd   Z td   Z d   Z d   Z d   Z d   Z d   Z RS(   s.   Represents a single RFC-822-compliant message.c    s2  F G H | d j o7 K y L | i   Wn M N d } n
 XP d } n Q | |  _ R | |  _  S t |  _ T t |  _ V |  i  oE W y X |  i i   |  _ Wn" Y t j
 o Z d |  _  n Xn \ |  i   ^ |  i  oE _ y ` |  i i   |  _ Wn" a t j
 o b d |  _  n Xn d S(   s3   Initialize the class instance and read the headers.i   i    N(	   s   seekables   fps   tells   selfs   Nones   startofheaderss   startofbodys   IOErrors   readheaders(   s   selfs   fps   seekables*   /usr/lib/python1.5/site-packages/rfc822.pys   __init__F s,   i   c    s>   d e f |  i o g t d  n h |  i i |  i  d S(   s7   Rewind the file to the start of the body (if seekable).s   unseekable fileN(   s   selfs   seekables   IOErrors   fps   seeks   startofbody(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys
   rewindbodyd s   c 	   s  j y z h  |  _ { d |  _ | g  |  _ } } d |  _ ~ d }  d }  t } } }  t |  i d  o  |  i i
 } n!  |  i o  |  i i } n  x d o | o  |   } n  |  i i   }  | o  d |  _  Pn  | o | d  d j o  |  i | |  _  q n  d }  | o | d d j oT  | i |   |  i | d	 t i |  }  t i |  |  i | < q n9  |  i |  o
  q n  |  i |  o  Pn  |  i |  }  | oA  | i |   t i | t |  d
  |  i | < q n~  |  i o  d |  _ n  d |  _  | o  | |  n5  | o  |  i i |  n  |  i d |  _  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).
        s    i   s   unreads   EOF in headersi   s   From i    s    	s   
 i   s
   No headerss%   Non-header line where header expecteds
   ; bad seekN(   s   selfs   dicts   unixfroms   headerss   lists   statuss
   headerseens	   firstlines   Nones   startoflines   unreads   tells   hasattrs   fps   seekables   readlines   lines   appends   strings   strips   xs	   iscomments   islasts   isheaders   lens   seek(	   s   selfs   lists
   headerseens	   firstlines   startoflines   unreads   tells   lines   xs*   /usr/lib/python1.5/site-packages/rfc822.pys   readheadersj s^   		 


	!


'


c    sN      t  i | d  }  | d j o  t  i | |   Sn  t Sd S(   s  Determine 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 RFC822-like formats with special header formats.
        s   :i    N(   s   strings   finds   lines   is   lowers   None(   s   selfs   lines   is*   /usr/lib/python1.5/site-packages/rfc822.pys   isheader s
   c    s      | t j Sd S(   s  Determine whether a line is a legal end of RFC-822 headers.
        
        You may override this method if your application wants
        to bend the rules, e.g. to strip trailing whitespace,
        or to recognise MH template separators ('--------').
        For convenience (e.g. for code reading from sockets) a
        line consisting of 
 also matches.                
        N(   s   lines   _blanklines(   s   selfs   lines*   /usr/lib/python1.5/site-packages/rfc822.pys   islast s   c    s      t  Sd S(   s   Determine whether a line should be skipped entirely.

        You may override this method in order to use Message parsing
        on tagged data in RFC822-like formats that support embedded
        comments or free-text data.
        N(   s   None(   s   selfs   lines*   /usr/lib/python1.5/site-packages/rfc822.pys	   iscomment s   c    s      t  i |  d }  t |  }  g  }  d }  x |  i d  rr }  t  i | |   | j o  d } n%  | d  t  i
 j o  d } n  | o  | i |  n qL W | Sd 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.
        s   :i    i   N(   s   strings   lowers   names   lens   ns   lists   hits   selfs   headerss   lines
   whitespaces   append(   s   selfs   names   ns   lists   hits   lines*   /usr/lib/python1.5/site-packages/rfc822.pys   getallmatchingheaders s   
		 	
c    s      t  i |  d }  t |  }  g  }  d }  x |  i d  r{ }  | o#  | d  t  i
 j o  Pn n+  t  i | |   | j o  d } n  | o  | i |  n qL W | Sd 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).
        s   :i    i   N(   s   strings   lowers   names   lens   ns   lists   hits   selfs   headerss   lines
   whitespaces   append(   s   selfs   names   ns   lists   hits   lines*   /usr/lib/python1.5/site-packages/rfc822.pys   getfirstmatchingheader s   		 	

c    sd    
|  i |  } | o t Sn | d t |  d | d <t i | d  Sd S(   sA  A 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.
        i    i   s    N(   s   selfs   getfirstmatchingheaders   names   lists   Nones   lens   strings
   joinfields(   s   selfs   names   lists*   /usr/lib/python1.5/site-packages/rfc822.pys   getrawheader s   c    sH   y |  i t i |  SWn t j
 o | Sn Xd S(   s  Get the header value for a name.
        
        This is the normal interface: it return 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.
        N(   s   selfs   dicts   strings   lowers   names   KeyErrors   default(   s   selfs   names   defaults*   /usr/lib/python1.5/site-packages/rfc822.pys	   getheaders
   c    sB   #%|  i |  } &| o '| d Sn )t t f Sd S(   s   Get a single address from a header, as a tuple.
        
        An example return value:
        ('Guido van Rossum', 'guido@cwi.nl')
        i    N(   s   selfs   getaddrlists   names   alists   None(   s   selfs   names   alists*   /usr/lib/python1.5/site-packages/rfc822.pys   getaddrs
   
c    s   +23g  } 4x |  i |  d 4r } 5| d d j o 6| i |  ni 8| o 9| i d  n :t i | d  } ;| d j o <| | d } n =| i |  q$ W>t i
 | d  } ?t |  } @| i   Sd S(   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.

        i    s    	s   , s   :i   s    N(   s   raws   selfs   getallmatchingheaderss   names   hs   appends   strings   finds   is   addrs   joins   alladdrss   AddrlistClasss   as   getaddrlist(   s   selfs   names   raws   hs   is   addrs   alladdrss   as*   /usr/lib/python1.5/site-packages/rfc822.pys   getaddrlist+s   	 	
c    sK   BGHy I|  | } Wn Jt j
 o Kt Sn XLt |  Sd 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(   s   selfs   names   datas   KeyErrors   Nones	   parsedate(   s   selfs   names   datas*   /usr/lib/python1.5/site-packages/rfc822.pys   getdateBs   c    sK   NTUy V|  | } Wn Wt j
 o Xt Sn XYt |  Sd 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(   s   selfs   names   datas   KeyErrors   Nones   parsedate_tz(   s   selfs   names   datas*   /usr/lib/python1.5/site-packages/rfc822.pys
   getdate_tzNs   c    s   ^_`t  |  i  Sd S(   s'   Get the number of headers in a message.N(   s   lens   selfs   dict(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   __len__^s   c    s!   bcd|  i t i |  Sd S(   s,   Get a specific header, as from a dictionary.N(   s   selfs   dicts   strings   lowers   name(   s   selfs   names*   /usr/lib/python1.5/site-packages/rfc822.pys   __getitem__bs   c    s   flm|  | =n| |  i t i |  <o| d | } pt i | d  } qx* | d qr } r|  i
 i | d  q[ Wd S(   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   
i    N(   s   selfs   names   values   dicts   strings   lowers   texts   splits   liness   lines   headerss   append(   s   selfs   names   values   texts   liness   lines*   /usr/lib/python1.5/site-packages/rfc822.pys   __setitem__fs   
 	c    sP  tuvt  i |  } w|  i i |  o xd Sn y|  i | =z| d } {t |  } |g  } }d } ~x t
 t |  i   d ~r } |  i | } t  i | |   | j o d } n% | d  t  i j o d } n | o | i |  n q W| i   x  | d r } |  i | =q2Wd S(   s>   Delete all occurrences of a specific header, if it is present.Ns   :i    i   (   s   strings   lowers   names   selfs   dicts   has_keys   lens   ns   lists   hits   ranges   headerss   is   lines
   whitespaces   appends   reverse(   s   selfs   names   ns   lists   hits   is   lines*   /usr/lib/python1.5/site-packages/rfc822.pys   __delitem__ts,   		 	
 	c    s&   |  i i t i |   Sd S(   s6   Determine whether a message contains the named header.N(   s   selfs   dicts   has_keys   strings   lowers   name(   s   selfs   names*   /usr/lib/python1.5/site-packages/rfc822.pys   has_keys   c    s   |  i i   Sd S(   s*   Get all of a message's header field names.N(   s   selfs   dicts   keys(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   keyss   c    s   |  i i   Sd S(   s+   Get all of a message's header field values.N(   s   selfs   dicts   values(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   valuess   c    s   |  i i   Sd S(   s_   Get all of a message's headers.
        
        Returns a list of name, value tuples.
        N(   s   selfs   dicts   items(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   itemss   c    s@   d } x# |  i d r } | | } q W| Sd  S(   Ns    i    (   s   strs   selfs   headerss   hdr(   s   selfs   strs   hdrs*   /usr/lib/python1.5/site-packages/rfc822.pys   __str__s
   	 	(   s   __doc__s   __init__s
   rewindbodys   readheaderss   isheaders   islasts	   iscomments   getallmatchingheaderss   getfirstmatchingheaders   getrawheaders   Nones	   getheaders   gets   getaddrs   getaddrlists   getdates
   getdate_tzs   __len__s   __getitem__s   __setitem__s   __delitem__s   has_keys   keyss   valuess   itemss   __str__(    s*   /usr/lib/python1.5/site-packages/rfc822.pys   MessageC s2   	H		c    s   t  |   d j ov |  d d j o |  d d j o |  d d !Sn |  d d j o |  d d j o |  d d !Sn n |  Sd S(   s   Remove quotes from a string.i   i    s   "s   <s   >N(   s   lens   str(   s   strs*   /usr/lib/python1.5/site-packages/rfc822.pys   unquotes   &&c    sN   d t  i t  i t  i t  i |  d  d  d  d  Sd S(   s   Add quotes around a string.s   "%s"s   \s   \\s   "s   \"N(   s   strings   joins   splits   str(   s   strs*   /usr/lib/python1.5/site-packages/rfc822.pys   quotes
   '		c    sO   t  |   } | i   } | o t t f Sn | d Sd S(   s3   Parse an address into a (realname, mailaddr) tuple.i    N(   s   AddrlistClasss   addresss   as   getaddrlists   lists   None(   s   addresss   as   lists*   /usr/lib/python1.5/site-packages/rfc822.pys	   parseaddrs   s   AddrlistClassc      s   d  Z  d   Z d   Z d   Z d   Z .d   Z Od   Z gd   Z yd	 d  Z d
   Z	 d   Z
 d   Z d   Z d   Z RS(   s  Address parser class by Ben Escoto.
    
    To understand what this class does, it helps to have a copy of
    RFC-822 in front of you.

    Note: this class interface is deprecated and may be removed in the future.
    Use rfc822.AddressList instead.
    c    so   d |  _ d |  _ d |  _ d |  _ |  i |  i |  i |  _ | |  _ g  |  _ d S(   s   Initialize a new instance.
        
        `field' is an unparsed address header field, containing
        one or more addresses.
        s   ()<>@,:;."[]i    s    	s   
N(   s   selfs   specialss   poss   LWSs   CRs   atomendss   fields   commentlist(   s   selfs   fields*   /usr/lib/python1.5/site-packages/rfc822.pys   __init__s   c    s   x |  i t |  i  j  ow |  i |  i |  i d j o |  i d |  _ n< |  i |  i d j o |  i i |  i    n Pq Wd S(   s*   Parse up to the start of the next address.s   
i   s   (N(   s   selfs   poss   lens   fields   LWSs   commentlists   appends
   getcomment(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   gotonexts    !c    s?   |  i   } | o | |  i   Sn g  Sd S(   s^   Parse all addresses.
        
        Returns a list containing all of the addresses.
        N(   s   selfs
   getaddresss   ads   getaddrlist(   s   selfs   ads*   /usr/lib/python1.5/site-packages/rfc822.pys   getaddrlists
   
c    s  g  |  _ |  i   |  i } |  i } |  i   } |  i   g  } |  i t	 |  i
  j o4 | o& t i |  i  | d f g } n n
|  i
 |  i d j oI 	| |  _ 
| |  _ |  i   } t i |  i  | f g } n|  i
 |  i d j o g  } |  i d |  _ xv |  i t	 |  i
  j  oY |  i   |  i
 |  i d j o |  i d |  _ Pn | |  i   } qKWn |  i
 |  i d j or |  i   } |  i o7 t i |  d t i |  i  d | f g } n !t i |  | f g } ne $| o& %t i |  i  | d f g } n5 &|  i
 |  i |  i j o '|  i d |  _ n )|  i   *|  i t	 |  i
  j  o |  i
 |  i d	 j o +|  i d |  _ n ,| Sd
 S(   s   Parse the next address.i    s   .@s   :i   s   ;s   <s    (s   )s   ,N(   s   selfs   commentlists   gotonexts   poss   oldposs   oldcls   getphraselists   plists
   returnlists   lens   fields   strings   joins   getaddrspecs   addrspecs
   getaddresss   getrouteaddrs	   routeaddrs   specials(   s   selfs   oldposs   oldcls   plists
   returnlists   addrspecs	   routeaddrs*   /usr/lib/python1.5/site-packages/rfc822.pys
   getaddresssN   	
*"	 7
&3c    s  .23|  i |  i d j o 4d Sn 6d } 7|  i d |  _ 8|  i   9t } :x!:|  i t |  i  j  o;| o <|  i   =d } n >|  i |  i d j o ?|  i d |  _ @Pn A|  i |  i d j o  B|  i d |  _ Cd } na D|  i |  i d j o  E|  i d |  _ Fd } n' H|  i
   } I|  i d |  _ JPK|  i   qc WM| Sd S(   s   Parse a route address (Return-path value).
        
        This method just skips all the route stuff and returns the addrspec.
        s   <Ni    i   s   >s   @s   :(   s   selfs   fields   poss   expectroutes   gotonexts   Nones   adlists   lens	   getdomains   expectaddrspecs   getaddrspec(   s   selfs   expectroutes   adlists   expectaddrspecs*   /usr/lib/python1.5/site-packages/rfc822.pys   getrouteaddr.s4   		 
c    s  OPQg  } S|  i   Tx T|  i t |  i  j  o U|  i |  i d j o' V| i d  W|  i d |  _ np X|  i |  i d j o Y| i |  i    n< Z|  i |  i |  i j o [Pn \| i |  i	    ]|  i   q" W_|  i t |  i  j p |  i |  i d j o `t
 i | d  Sn b| i d  c|  i d |  _ d|  i   et
 i | d  |  i   Sd S(   s   Parse an RFC-822 addr-spec.s   .i   s   "s   @s    N(   s   aslists   selfs   gotonexts   poss   lens   fields   appends   getquotes   atomendss   getatoms   strings   joins	   getdomain(   s   selfs   aslists*   /usr/lib/python1.5/site-packages/rfc822.pys   getaddrspecOs(   	 3c    sh  ghig  } jx<j|  i t |  i  j  ok|  i |  i |  i j o l|  i d |  _ n m|  i |  i d j o n|  i i |  i    n o|  i |  i d j o p| i |  i	    n} q|  i |  i d j o' r|  i d |  _ s| i d  n< t|  i |  i |  i
 j o uPn v| i |  i    q Wwt i | d  Sd S(   s-   Get the complete domain name from an address.i   s   (s   [s   .s    N(   s   sdlists   selfs   poss   lens   fields   LWSs   commentlists   appends
   getcomments   getdomainliterals   atomendss   getatoms   strings   join(   s   selfs   sdlists*   /usr/lib/python1.5/site-packages/rfc822.pys	   getdomaings"   	 c    s  y|  i |  i | j o d Sn d g } d } |  i d |  _ x|  i t |  i  j  o | d j o' | i |  i |  i  d } n |  i |  i | j o |  i d |  _ Pn} | o |  i |  i d j o | i |  i
    nB |  i |  i d j o d } n | i |  i |  i  |  i d |  _ qY Wt i | d  Sd 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-822 comments
        are allowed within the parsed fragment.
        s    i    i   s   (s   \N(   s   selfs   fields   poss	   beginchars   slists   quotes   lens   appends   endcharss   allowcommentss
   getcomments   strings   join(   s   selfs	   beginchars   endcharss   allowcommentss   slists   quotes*   /usr/lib/python1.5/site-packages/rfc822.pys   getdelimitedys*   	 !i   c    s    |  i d d d  Sd S(   s1   Get a quote-delimited fragment from self's field.s   "s   "i    N(   s   selfs   getdelimited(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   getquotes   c    s    |  i d d d  Sd S(   s7   Get a parenthesis-delimited fragment from self's field.s   (s   )i   N(   s   selfs   getdelimited(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys
   getcomments   c    s    |  i d d d  Sd S(   s    Parse an RFC-822 domain-literal.s   [s   ]i    N(   s   selfs   getdelimited(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   getdomainliterals   c    s   d g } xs |  i t |  i  j  oV |  i |  i |  i j o Pn | i |  i |  i  |  i d |  _ q Wt i | d  Sd S(   s   Parse an RFC-822 atom.s    i   N(	   s   atomlists   selfs   poss   lens   fields   atomendss   appends   strings   join(   s   selfs   atomlists*   /usr/lib/python1.5/site-packages/rfc822.pys   getatoms    c    s  g  } x |  i t |  i  j  o |  i |  i |  i j o |  i d |  _ n |  i |  i d j o | i |  i    ns |  i |  i d j o |  i i |  i	    n< |  i |  i |  i
 j o Pn | i |  i    q W| Sd S(   s  Parse a sequence of RFC-822 phrases.
        
        A phrase is a sequence of words, which are in turn either
        RFC-822 atoms or quoted-strings.  Phrases are canonicalized
        by squeezing all runs of continuous whitespace into one space.
        i   s   "s   (N(   s   plists   selfs   poss   lens   fields   LWSs   appends   getquotes   commentlists
   getcomments   atomendss   getatom(   s   selfs   plists*   /usr/lib/python1.5/site-packages/rfc822.pys   getphraselists   	 (   s   __doc__s   __init__s   gotonexts   getaddrlists
   getaddresss   getrouteaddrs   getaddrspecs	   getdomains   getdelimiteds   getquotes
   getcomments   getdomainliterals   getatoms   getphraselist(    s*   /usr/lib/python1.5/site-packages/rfc822.pys   AddrlistClasss   		
9!$s   AddressListc      sV   d  Z  d   Z d   Z d   Z d   Z d   Z d   Z RS(   s>   An AddressList encapsulates a list of parsed RFC822 addresses.c    sF   t  i |  |  | o |  i   |  _ n g  |  _ d  S(   N(   s   AddrlistClasss   __init__s   selfs   fields   getaddrlists   addresslist(   s   selfs   fields*   /usr/lib/python1.5/site-packages/rfc822.pys   __init__s   
c    s   t  |  i  Sd  S(   N(   s   lens   selfs   addresslist(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   __len__s   c    s&   t  i t t |  i  d  Sd  S(   Ns   , (   s   strings
   joinfieldss   maps   dump_address_pairs   selfs   addresslist(   s   selfs*   /usr/lib/python1.5/site-packages/rfc822.pys   __str__s   c    st   t  t  } |  i | _ xA | i d r1 } | |  i j o | i i |  n q1 W| Sd  S(   Ni    (   s   AddressLists   Nones   newaddrs   selfs   addresslists   others   xs   append(   s   selfs   others   newaddrs   xs*   /usr/lib/python1.5/site-packages/rfc822.pys   __add__s    	c    sd   t  t  } xA |  i d r1 } | | i j o | i i |  n q! W| Sd  S(   Ni    (   s   AddressLists   Nones   newaddrs   selfs   addresslists   xs   others   append(   s   selfs   others   newaddrs   xs*   /usr/lib/python1.5/site-packages/rfc822.pys   __sub__s    	c    s   |  i | Sd  S(   N(   s   selfs   addrlists   index(   s   selfs   indexs*   /usr/lib/python1.5/site-packages/rfc822.pys   __getitem__s   (   s   __doc__s   __init__s   __len__s   __str__s   __add__s   __sub__s   __getitem__(    s*   /usr/lib/python1.5/site-packages/rfc822.pys   AddressLists   		c    sF   |  d o# d |  d d |  d d Sn |  d Sd S(   s4   Dump a (name, address) pair in a canonicalized form.i    s   "s   " <i   s   >N(   s   pair(   s   pairs*   /usr/lib/python1.5/site-packages/rfc822.pys   dump_address_pairs   #s   jans   febs   mars   aprs   mays   juns   juls   augs   seps   octs   novs   decs   januarys   februarys   marchs   aprils   junes   julys   augusts	   septembers   octobers   novembers   decembers   mons   tues   weds   thus   fris   sats   suni    s   UTs   UTCs   GMTs   Zi  s   ASTi,  s   ADTi  s   ESTs   EDTiX  s   CSTs   CDTi  s   MSTs   MDTi   s   PSTs   PDTc  
  s  t  i |   }  |  d d d d f j p t  i |  d  t j o |  d =n t |   d j oH t  i |  d d  } t |  d j o | |  d }  n n t |   d j oi |  d } t  i | d  } | d j o# | |  | | d g |  d )n  |  i
 d	  n !t |   d
 j  o "t Sn #|  d
  }  $|  ] } } } } } %t  i |  } &| t j o> '| t  i |  f \ } } (| t j o )t Sn n *t i |  d } +| d d j o ,| d  } n -t  i | d  } .| d j o /| | f \ } } n 0| d d j o 1| d  } n 2| d t  i j o 3| | f \ } } n 4| d d j o 5| d  } n 6t  i | d  } 7t |  d j o 8| ] }	 }
 9d } n4 :t |  d j o ;| ] }	 }
 } n =t S>y^ ?t  i |  } @t  i |  } At  i |	  }	 Bt  i |
  }
 Ct  i |  } Wn  Dt  i j
 o Et Sn XFt } Gt  i |  } Ht i |  o It | } n9 Ky Lt  i |  } Wn Mt  i j
 o
 Nn XP| oV Q| d j  o Rd } S| } n
 Ud } V| | d d | d d } n W| | | |	 |
 | d d d | f
 } X| Sd S(   sU   Convert a date string to a time tuple.
    
    Accounts for military timezones.
    i    i   s   ,s   .i   s   -i   s   +s    i   s   :i   s   0id   i  i<   N(    s   strings   splits   datas   lowers	   _daynamess   lens   stuffs   ss   finds   is   appends   Nones   dds   mms   yys   tms   tzs   _monthnamess   indexs   digitss   splitfieldss   thhs   tmms   tsss   atois
   atoi_errors   tzoffsets   uppers
   _timezoness   has_keys   tzsigns   tuple(   s   datas   stuffs   ss   is   dds   mms   yys   tms   tzs   thhs   tmms   tsss   tzoffsets   tzsigns   tuples*   /usr/lib/python1.5/site-packages/rfc822.pys   parsedate_tzs   9#	

	%'c    sK   [\]t  |   } ^t |  t f   j o _| d  Sn `| Sd S(   s&   Convert a time string to a time tuple.i	   N(   s   parsedate_tzs   datas   ts   type(   s   datas   ts*   /usr/lib/python1.5/site-packages/rfc822.pys	   parsedate[s
   c    sq   cde|  d t j o  gt i |  d  d f  Sn4 it i |  d  d f  } j| |  d t i Sd S(   sC   Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.i	   i   i   i    N(   s   datas   Nones   times   mktimes   ts   timezone(   s   datas   ts*   /usr/lib/python1.5/site-packages/rfc822.pys	   mktime_tzcs
    s   __main__s   HOMEs   Mail/inbox/1i   s   rs   From:s   froms   To:s   tos   Subject:s   subjects   Date:s   dates   ParsedDate:i<   s	   %+03d%02ds   .%02ds   Lines:s   -iF   s   len =s   Dates   Date =s
   X-Nonsenses   keys =s   values =s   items =N(1   s   __doc__s   strings   times   _blankliness   Messages   unquotes   quotes	   parseaddrs   AddrlistClasss   AddressLists   dump_address_pairs   _monthnamess	   _daynamess
   _timezoness   parsedate_tzs	   parsedates	   mktime_tzs   __name__s   syss   oss   paths   joins   environs   files   argvs   opens   fs   ms   getaddrs   getaddrlists	   getheaders
   getdate_tzs   dates   asctimes   hhmmsss   divmods   hhmms   sss   hhs   mms   Nones
   rewindbodys   ns   readlines   lens   has_keys   keyss   valuess   items(    s*   /usr/lib/python1.5/site-packages/rfc822.pys   ?9 sn   		 i

 $	Q	N 

 	   