???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................
Yft                 @   s|   d  Z  d d l Z d d l Z d d l Z d d g Z Gd d   d e  Z Gd d   d  Z e d k rx e	 e    d S)z-An object-oriented interface to .netrc files.    NnetrcNetrcParseErrorc               @   s4   e  Z d  Z d Z d d d d  Z d d   Z d S)r   z5Exception raised on syntax errors in the .netrc file.Nc             C   s/   | |  _  | |  _ | |  _ t j |  |  d  S)N)filenamelinenomsg	Exception__init__)selfr   r   r    r
   */opt/alt/python35/lib64/python3.5/netrc.pyr      s    			zNetrcParseError.__init__c             C   s   d |  j  |  j |  j f S)Nz%s (%s, line %s))r   r   r   )r	   r
   r
   r   __str__   s    zNetrcParseError.__str__)__name__
__module____qualname____doc__r   r   r
   r
   r
   r   r   
   s   c               @   sC   e  Z d  Z d d d  Z d d   Z d d   Z d d	   Z d S)
r   Nc             C   s   | d  k } | d  k rY y  t  j j t  j d d  } Wn t k
 rX t d   Yn Xi  |  _ i  |  _ t |   } |  j	 | | |  Wd  QRXd  S)NHOMEz.netrcz'Could not find .netrc: $HOME is not set)
ospathjoinenvironKeyErrorOSErrorhostsmacrosopen_parse)r	   filedefault_netrcfpr
   r
   r   r      s     		znetrc.__init__c             C   s  t  j  |  } | j d 7_ | j j d d  | _ x\| j } | j   } } | s\ Pn| d d k r | j | k r9 t |  d k r9 | j j   q9 n | d k r | j   } n | d k r d } n | d k rK| j   } g  |  j	 | <d	 | _
 xD | j j   }	 |	 s#|	 d
 k r-d | _
 P|  j	 | j |	  qWq9 n t d | | | j   d }
 d  } } i  |  j | <x| j   } | j d  s| d k r| r|
 | | f |  j | <| j |  Pqt d | | t |  f | | j   q| d k s| d k r*| j   }
 q| d k rE| j   } q| d k rtt j d k re| ret j | j    } | j t j   k r9d d  l } y | j | j  d } Wn t k
 rd | j } Yn Xy | j t j    d } Wn" t k
 rd t j   } Yn Xt d | | f | | j   | j t j t j B@ret d | | j   | j   } qt d | | | j   qWq9 Wd  S)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~# r      machinedefaultmacdefz 	
z 	
zbad toplevel token %rz&malformed %s entry %s terminated by %sloginuseraccountpasswordposixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>   r    r#   r$   r"   )shlexZ	wordcharsZ
commentersreplacer   Z	get_tokenlenZinstreamreadliner   Z
whitespaceappendr   r   
startswithZ
push_tokenreprr   namefstatfilenost_uidgetuidpwdgetpwuidr   st_modestatS_IRWXGS_IRWXO)r	   r   r   r   ZlexerZsaved_linenoZtoplevelZttZ	entrynameliner&   r(   r)   Zpropr7   Zfownerr'   r
   r
   r   r   #   s    	!			


znetrc._parsec             C   s<   | |  j  k r |  j  | Sd |  j  k r4 |  j  d Sd Sd S)z8Return a (user, account, password) tuple for given host.r#   N)r   )r	   hostr
   r
   r   authenticatorst   s
    znetrc.authenticatorsc             C   s   d } x |  j  j   D]u } |  j  | } | d | d t | d  d } | d ro | d t | d  } | d t | d	  d } q WxU |  j j   D]D } | d
 | d } x |  j | D] } | | } q W| d } q W| S)z3Dump the class data in the format of a .netrc file.r    zmachine z
	login r   r%   r!   zaccount z
	password    zmacdef )r   keysr1   r   )r	   Zrepr>   ZattrsZmacror=   r
   r
   r   __repr__}   s    $
 znetrc.__repr__)r   r   r   r   r   r?   rB   r
   r
   r
   r   r      s   Q	__main__)
r   r   r+   r:   __all__r   r   r   r   printr
   r
   r
   r   <module>   s   $w