Your IP : 3.145.92.96


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/netrc.cpython-35.opt-2.pyc



���]t�@svddlZddlZddlZddgZGdd�de�ZGdd�d�Zedkrree��dS)�N�netrc�NetrcParseErrorc@s.eZdZdddd�Zdd�ZdS)rNcCs/||_||_||_tj||�dS)N)�filename�lineno�msg�	Exception�__init__)�selfrrr�r
�*/opt/alt/python35/lib64/python3.5/netrc.pyrs			zNetrcParseError.__init__cCsd|j|j|jfS)Nz%s (%s, line %s))rrr)r	r
r
r�__str__szNetrcParseError.__str__)�__name__�
__module__�__qualname__rrr
r
r
rr
sc@sCeZdZddd�Zdd�Zdd�Zdd	�ZdS)
rNcCs�|dk}|dkrYy tjjtjdd�}Wntk
rXtd��YnXi|_i|_t|��}|j	|||�WdQRXdS)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
rrs 
		znetrc.__init__cCs�tj|�}|jd7_|jjdd�|_x\|j}|j�}}|s\Pn|ddkr�|j|kr9t|�dkr9|jj�q9n�|dkr�|j�}n�|dkr�d}n�|dkrK|j�}g|j	|<d	|_
xD|jj�}	|	s#|	d
kr-d|_
P|j	|j|	�qWq9ntd|||j��d}
d}}i|j
|<x
|j�}|jd�s�|dkr|r�|
||f|j
|<|j|�Pq�td
||t|�f||j��q�|dks|dkr*|j�}
q�|dkrE|j�}q�|dkrttjdkre|retj|j��}
|
jtj�kr9ddl}y|j|
j�d}Wntk
r�d|
j}YnXy|jtj��d}Wn"tk
rdtj�}YnXtd||f||j��|
jtjtjB@retd||j��|j�}q�td|||j��q�Wq9WdS)Nz !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~�#�r��machine�default�macdefz 	�
z 	
zbad toplevel token %rz&malformed %s entry %s terminated by %s�login�user�account�password�posixzuid %sz9~/.netrc file owner (%s) does not match current user (%s)zY~/.netrc access too permissive: access permissions must restrict access to only the ownerzbad follower token %r>rr"r#r!)�shlexZ	wordcharsZ
commenters�replacerZ	get_token�lenZinstream�readliner�
whitespace�appendrr�
startswithZ
push_token�reprr�name�fstat�fileno�st_uid�getuid�pwd�getpwuidr�st_mode�stat�S_IRWXG�S_IRWXO)r	rrrZlexerZsaved_linenoZtoplevel�ttZ	entryname�liner%r'r(Zpropr7Zfownerr&r
r
rr#s�	!
	
		






znetrc._parsecCs<||jkr|j|Sd|jkr4|jdSdSdS)Nr")r)r	�hostr
r
r�authenticatorsts
znetrc.authenticatorscCs�d}x�|jj�D]u}|j|}|d|dt|d�d}|dro|dt|d�}|dt|d	�d}qWxU|jj�D]D}|d
|d}x|j|D]}||}q�W|d}q�W|S)Nrzmachine z
	login rr$r zaccount z
	password �zmacdef )r�keysr1r)r	Zrepr?ZattrsZmacror>r
r
r�__repr__}s
$
 znetrc.__repr__)r
rrrrr@rCr
r
r
rrsQ	�__main__)	rr*r:�__all__rrrr
�printr
r
r
r�<module>s
$w

?>