AlkantarClanX12

Your IP : 18.118.37.85


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/uu.cpython-37.opt-1.pyc

B

� fm�@sjdZddlZddlZddlZdddgZGdd�de�Zddd�d	d�Zdd
d�Zdd�Z	e
d
krfe	�dS)z�Implementation of the UUencode and UUdecode functions.

encode(in_file, out_file [,name, mode], *, backtick=False)
decode(in_file [, out_file, mode, quiet])
�N�Error�encode�decodec@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�'/opt/alt/python37/lib64/python3.7/uu.pyr&sF)�backtickc	Csrg}�zL|dkrtjj}n`t|t�rz|dkr8tj�|�}|dkrfyt�|�j	}Wnt
k
rdYnXt|d�}|�|�|dkr�tj
j}nt|t�r�t|d�}|�|�|dkr�d}|dkr�d}|�dd�}|�dd	�}|�d
|d@|f�d��|�d
�}x2t|�dk�r2|�tj||d��|�d
�}�qW|�rF|�d�n
|�d�Wdx|D]}|���qZWXdS)z
Uuencode file�-N�rb�wbi��
z\n�
z\rzbegin %o %s
i��ascii�-r)r
s`
end
s 
end
)�sys�stdin�buffer�
isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�replace�writer�read�len�binasciiZb2a_uu�close)�in_file�out_file�name�moder
�opened_files�data�frrr	r)sF









c

Cszg}|dkrtjj}nt|t�r4t|d�}|�|��z$xr|��}|sNtd��|�	d�sZq:|�
dd�}t|�dkr:|ddkr:yt|d	d
�PWq:t
k
r�Yq:Xq:W|dk�r<|d�d��d
�}tj�|�r�td|����|�	tj��s,dtj��|k�s,tj�r<|�	tj��s,dtj��|k�r<td|�d���|dk�rTt|d	d
�}|dk�rhtjj}n0t|t��r�t|d�}t�||�|}|�|�|��}x�|�rH|�d�dk�rHyt�|�}	Wnjtjk
�r0}
zH|ddd@ddd}t�|d|��}	|�s tj�d|
�Wdd}
~
XYnX|�|	�|��}�q�W|�sXtd��Wdx|D]}|���qbWXdS)zDecode uuencoded filerrz'No valid begin line found in input filesbegin� ��r��Ns 	
rz Cannot overwrite existing file: z..zRefusing to write to z due to directory traversalr
send� �?��zWarning: %s
zTruncated input file)rrrrrrr�readliner�
startswith�splitr#�int�
ValueError�rstriprrr�exists�sep�altsepr�chmod�stripr$Za2b_uu�stderrr!r%)
r&r'r)�quietr*ZhdrZ	hdrfields�fp�sr+�v�nbytesr,rrr	rcsl











"

cCs4ddl}|jdd�}|jddddd	d
d�|jdd
ddd	d
d�|��\}}t|�dkrl|�d�t�d�tjj	}tj
j	}t|�dkr�|d}t|�dkr�|d}|jr�|jr�t
|t�r�t|d�}nttjdd�t�d�t||�nD|j�r&t
|t��rt|d�}nttjdd�t�d�t||�dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])Zusagez-dz--decoderzDecode (instead of encode)?F�
store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r.zincorrect number of argumentsr0r
z: cannot do -t to stdoutrz: cannot do -t from stdin)�optparseZOptionParserZ
add_option�
parse_argsr#�errorr�exitrrrrrLrrr�print�argvr)rM�parserZoptions�args�input�outputrrr	�test�s6




rW�__main__)NN)NNF)�__doc__r$rr�__all__�	ExceptionrrrrWrrrrr	�<module>s
:
J&