Current Path : /lib/python3.10/__pycache__/ |
Current File : //lib/python3.10/__pycache__/uu.cpython-310.pyc |
o �*�g��@sldZddlZddlZddlZgd�ZGdd�de�Zddd�dd �Zdd d�Zdd �Z e dkr4e �dSdS)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@seZdZdS)rN)�__name__� __module__�__qualname__�rr�/usr/lib/python3.10/uu.pyr'srF��backtickc Csxg}z�|dkrtjj}n/t|t�r;|durtj�|�}|dur1zt�|�j }Wn t y0Ynwt|d�}|�|�|dkrDtj j}nt|t�rSt|d�}|�|�|durYd}|dur_d}|�dd�}|�dd �}|�d |d@|f�d��|�d �}t|�dkr�|�tj||d��|�d �}t|�dks�|r�|�d�n|�d�W|D]}|��q�dS|D]}|��q�w)z Uuencode file�-N�rb�wbi�� z\n� z\rzbegin %o %s i��ascii�-rr s` end s end )�sys�stdin�buffer� isinstance�str�os�path�basename�stat�st_mode�AttributeError�open�append�stdout�replace�writer�read�len�binascii�b2a_uu�close)�in_file�out_file�name�moder�opened_files�data�frrr r*sR � � � � �rc Cs~g}|dkrtjj}nt|t�rt|d�}|�|��z |��}|s'td��|� d�s-q|� dd�}t|�dkrR|d dkrRz t|d d�Wn t yQYnwq|dur�|d�d ��d�}tj�|�rntd|����|� tj�s�dtj��|vs�tjr�|� tj�s�dtj��|vr�td|�d���|dur�t|d d�}|dkr�tjj}nt|t�r�t|d�}t�||�|}|�|�|��}|�r |�d �dk�r zt�|�} Wn6tj�y} z(|d dd@ddd}t�|d|��} |�stj�d| �WYd} ~ nd} ~ ww|�| �|��}|�r |�d �dks�|�s'td��W|D]}|���q*dS|D]}|���q6w)zDecode uuencoded filerr Tz'No valid begin line found in input filesbegin� ��r��Ns rz Cannot overwrite existing file: z..zRefusing to write to z due to directory traversalrsend� �?��zWarning: %s zTruncated input file)rrrrrrr�readliner� startswith�splitr$�int� ValueError�rstriprrr�exists�sep�altsepr �chmod�stripr%�a2b_uu�stderrr"r') r(r)r+�quietr,�hdr� hdrfields�fp�sr-�v�nbytesr.rrr rds� �� � � �� ����rcCs2ddl}|jdd�}|jddddd d d�|jdd ddd d d�|��\}}t|�dkr6|�d�t�d�tjj }tj j }t|�dkrH|d}t|�dkrR|d}|jrw|jrpt |t�rct|d�}n ttjdd�t�d�t||�dS|jr�t |t�r�t|d�}n ttjdd�t�d�t||�dS)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])�usagez-dz--decoderzDecode (instead of encode)?F� store_true)�dest�help�default�actionz-tz--text�textz2data is text, encoded format unix-compatible text?r0zincorrect number of argumentsr2rz: cannot do -t to stdoutr z: cannot do -t from stdin)�optparse�OptionParser� add_option� parse_argsr$�errorr�exitrrr rrRrrr�print�argvr)rS�parser�options�args�input�outputrrr �test�s6 r`�__main__)NN)NNF)�__doc__r%rr�__all__� Exceptionrrrr`rrrrr �<module>s :J& �
Sorry, this page is not available...