AlkantarClanX12

Your IP : 18.117.70.64


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



��Yfn�@s�dZddlZddlZddlZdddgZGdd�de�Zdddd�Zdddd	d�Zd
d�Z	e
dkr�e	�dS)
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/python35/lib64/python3.5/uu.pyr'scCs�g}z�|dkr$tjj}n�t|t�r�|dkrQtjj|�}|dkr�ytj|�j	}Wnt
k
r�YnXt|d�}|j|�|dkr�tj
j}n+t|t�r�t|d�}|j|�|dkr�d}|dkrd}|jd|d@|fjd��|jd	�}x;t|�d
kr~|jtj|��|jd	�}qDW|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�rLt|d�}|j|�zcx�|j�}|sptd��|j	d�s�qR|j
dd�}t|�dkrR|ddkrRyt|d	d
�PWqRt
k
r�YqRXqRW|dkr/|djd�jd
�}tjj|�r/td|��|dkrNt|d	d
�}|dkritjj}n]t|t�r�t|d�}ytjj||�Wntk
r�YnX|}|j|�|j�}x�|r�|jd�dkr�ytj|�}	Wnytjk
r~}
zV|ddd@ddd}tj|d|��}	|sltjjd|
�WYdd}
~
XnX|j|	�|j�}q�W|s�td��Wdx|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�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr`|jrPt
|t�r/t|d�}n!ttjdd�tjd�t||�nX|jr�t
|t�r�t|d�}n!ttjdd�tjd�t||�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&