mò
­fIc           @   sj   d  Z  d k Z d k Z d d g Z d e f d „  ƒ  YZ d f  d „  ƒ  YZ e d j o e ƒ  GHn d S(   s-   An object-oriented interface to .netrc files.Nt   netrct   NetrcParseErrorc           B   s&   t  Z d  Z e e d „ Z d „  Z RS(   s5   Exception raised on syntax errors in the .netrc file.c         C   s/   | |  _  | |  _ | |  _ t i |  | ƒ d  S(   N(   t   filenamet   selft   linenot   msgt	   Exceptiont   __init__(   R   R   R   R   (    (    t"   /mit/python/lib/python2.4/netrc.pyR      s    			c         C   s   d |  i |  i |  i f S(   Ns   %s (%s, line %s)(   R   R   R   R   (   R   (    (    R   t   __str__   s    (   t   __name__t
   __module__t   __doc__t   NoneR   R	   (    (    (    R   R   
   s    c           B   s&   t  Z d  d „ Z d „  Z d „  Z RS(   Nc         C   sÅ  | d  j oF y  t i i t i d d ƒ } WqS t j
 o t d ƒ ‚ qS Xn t | ƒ } h  |  _ h  |  _ t i | ƒ } | i d 7_ x/| i ƒ  } }	 |	 p PnÒ |	 d j o | i ƒ  } nµ |	 d j o
 d } nž |	 d j ow | i ƒ  } g  |  i | <d	 | _ xK | i i ƒ  } | p | d
 j o d | _ Pn |  i | i | ƒ qWq’ n t d |	 | | i ƒ ‚ d }
 d  } } h  |  i | <x| i ƒ  }	 |	 d j p' |	 d j p |	 d j p |	 d j o[ | o( |
 | | f |  i | <| i |	 ƒ Pq·t d | | t |	 ƒ f | | i ƒ ‚ qŸ|	 d j p |	 d j o | i ƒ  }
 qŸ|	 d j o | i ƒ  } qŸ|	 d j o | i ƒ  } qŸt d |	 | | i ƒ ‚ qŸWq’ Wd  S(   Nt   HOMEs   .netrcs'   Could not find .netrc: $HOME is not sets    !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~i   t   machinet   defaultt   macdefs    	s   
s    	
s   bad toplevel token %rt    s&   malformed %s entry %s terminated by %st   logint   usert   accountt   passwords   bad follower token %r(    t   fileR   t   ost   patht   joint   environt   KeyErrort   IOErrort   opent   fpR   t   hostst   macrost   shlext   lexert	   wordcharst	   get_tokent   toplevelt   ttt	   entrynamet
   whitespacet   instreamt   readlinet   linet   appendR   R   R   R   R   t
   push_tokent   repr(   R   R   R   R#   R(   R&   R   R,   R   R'   R   (    (    R   R      sj     		  
	  	
  4
c         C   sF   | |  i j o |  i | Sn$ d |  i j o |  i d Sn d Sd S(   s8   Return a (user, account, password) tuple for given host.R   N(   t   hostR   R    R   (   R   R0   (    (    R   t   authenticatorsU   s     c         C   sð   d } x‹ |  i i ƒ  D]z } |  i | } | d | d t | d ƒ d } | d o | d t | d ƒ } n | d t | d	 ƒ d } q WxU |  i i ƒ  D]D } | d
 | d } x |  i | D] } | | } qÊ W| d } q¤ W| S(   s3   Dump the class data in the format of a .netrc file.R   s   machine s   
	login i    s   
i   s   account s
   	password i   s   macdef N(
   t   repR   R    t   keysR0   t   attrsR/   R!   t   macroR,   (   R   R5   R0   R4   R,   R2   (    (    R   t   __repr__^   s"      $   (   R
   R   R   R   R1   R6   (    (    (    R   R       s   >		t   __main__(   R   R   R"   t   __all__R   R   R    R
   (   R8   R    R   R"   R   (    (    R   t   ?   s   X