AlkantarClanX12

Your IP : 3.145.57.41


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/uu.cpython-34.pyc

�
e fn�@s�dZddlZddlZddlZdddgZGdd�de�Zdddd�Zdddd	d�Zd
d�Z	e
dkr�e	�ndS)
z�Implementation of the UUencode and UUdecode functions.

encode(in_file, out_file [,name, mode])
decode(in_file [, out_file, mode])
�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�'/opt/alt/python34/lib64/python3.4/uu.pyr'scCs�g}z�|dkr$tjj}n�t|t�r�|dkrTtjj|�}n|dkr�ytj|�j	}Wq�t
k
r�Yq�Xnt|d�}|j|�n|dkr�tj
j}n.t|t�r�t|d�}|j|�n|dkrd}n|dkr d}n|jd|d@|fjd��|jd	�}x;t|�d
kr�|jtj|��|jd	�}qVW|jd�Wdx|D]}|j�q�WXdS)z
Uuencode file�-N�rb�wbi�zbegin %o %s
i��ascii�-rs 
end
)�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�writer�read�len�binasciiZb2a_uu�close)�in_file�out_file�name�mode�opened_files�data�frrr	r*s>
		$
Fc
Cs�g}|dkr!tjj}n.t|t�rOt|d�}|j|�nz~x�|j�}|svtd��n|j	d�s�qUn|j
dd�}t|�dkrU|ddkrUyt|d	d
�PWq�t
k
r�Yq�XqUqUW|dkrA|djd�jd
�}tjj|�rAtd|��qAn|dkrct|d	d
�}n|dkr~tjj}n`t|t�r�t|d�}ytjj||�Wntk
r�YnX|}|j|�n|j�}x�|r�|jd�dkr�ytj|�}	Wn|tjk
r�}
zY|ddd@ddd}tj|d|��}	|s�tjjd|
�nWYdd}
~
XnX|j|	�|j�}q�W|s�td��nWdx|D]}|j�q�WXdS)zDecode uuencoded filer
rz'No valid begin line found in input filesbegin� ��r��Ns 	
r
z"Cannot overwrite existing file: %srsend� �?��zWarning: %s
zTruncated input file)rrrrrrr�readliner�
startswith�splitr�int�
ValueError�rstriprrr�existsr�chmodr�stripr Za2b_uu�stderrrr!)
r"r#r%�quietr&ZhdrZ	hdrfields�fp�sr'�v�nbytesr(rrr	rZsf"

*

cCs�ddl}|jdd�}|jddddd	d
ddd
d�|jddddd	dddd
d�|j�\}}t|�dkr�|jd�tjd�ntjj	}tj
j	}t|�dkr�|d}nt|�dkr|d}n|jrl|jr\t
|t�r8t|d�}q\ttjdd�tjd�nt||�n[|jr�t
|t�r�t|d�}q�ttjdd�tjd�nt||�dS)zuuencode/uudecode main programrNZusagez'usage: %prog [-d] [-t] [input [output]]z-dz--decode�destr�helpzDecode (instead of encode)?�defaultF�action�
store_truez-tz--text�textz2data is text, encoded format unix-compatible text?r*zincorrect number of argumentsr,rz: cannot do -t to stdoutrz: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr�errorr�exitrrrrrFrrr�print�argvr)rG�parserZoptions�args�input�outputrrr	�test�s6((


			rQ�__main__)�__doc__r rr�__all__�	ExceptionrrrrQrrrrr	�<module>s0F&