ok

Mini Shell

Direktori : /proc/thread-self/root/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/thread-self/root/lib64/python3.6/__pycache__/quopri.cpython-36.pyc

3


 \T�@s�dZddddgZdZdZdZdZyd	d
lmZmZWne	k
rPdZdZYnXdd
�Z
dd�Zddd�Zddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�Zedkr�e�dS) zHConversions to/from quoted-printable transport encoding as per RFC 1521.�encode�decode�encodestring�decodestring�=�Ls0123456789ABCDEF��)�a2b_qp�b2a_qpNcCsHt|t�st�|dkr|S|dkr&|S|tkpFd|ko@dknS)z�Decide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
    s 	�_� �~)�
isinstance�bytes�AssertionError�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.6/quopri.py�needsquotingsrcCsBt|t�rt|�dkst�t|�}ttt|dt|df�S)zQuote a single character.��)rr�lenr�ordr�HEX)rrrr�quote$srFc
Cs<tdk	r,|j�}t|||d�}|j|�dS|dfdd�}d}x�|j�}|sNPg}	d}
|dd�dkrv|dd
�}d}
xL|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	jd	�q||	j|�q|W|dk	r�||�tj	|	�}x:t
|�tk�r||dtd�d
d�|tdd�}q�W|}q@W|dk	�r8|||
d�dS)avRead 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.N)rr�
cSsj|r<|dd�dkr<|j|dd�t|dd��|�n*|dkrX|jt|�|�n|j||�dS)Nrs 	�.���r r )�writer)�s�output�lineEndrrrr!;s
(zencode.<locals>.writerrrrs=
)r$r r )r
�readr!�readlinerrr�append�EMPTYSTRING�joinr�MAXLINESIZE)
�inputr#rr�data�odatar!Zprevline�lineZoutline�strippedrZthislinerrrr,s@	





cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|j�S)N)rrr)�BytesIO)r
�ior0r�getvalue)r"rrr0�infp�outfprrrrjscCstdk	r*|j�}t||d�}|j|�dSd}�x�|j�}|s@Pdt|�}}|dkr�||d|�dkr�d}	|d}x.|dkr�||d|�dkr�|d}qxWnd}	�x.||k�r�|||d�}
|
dkr�|r�|d	}|d}q�|
tk�r�||
}|d}q�|d|k�r|	�rd}	Pq�|d|k�rV||d|d
�tk�rV|t}|d
}q�|d
|k�r�t||d|d
���r�t||d
|d���r�|tt||d|d��f�}|d}q�||
}|d}q�W|	s2|j|d�d}q2W|�r|j|�dS)z�Read 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).N)rrrrrs 	
rr��)	r	r%r!r&rr�ishexr�unhex)r+r#rr,r-�newr.�i�n�partialrrrrrusR



(
B"
cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|j�S)N)rr)r0)r	r1r0rr2)r"rr0r3r4rrrr�scCsVt|t�st�d|ko dknpTd|ko8dknpTd|koPdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�F)rrr)rrrrr7�sr7cCs�d}x�|D]�}t|f�}d|ko*dknr:td�}n`d|koLdknr`td�d}n:d	|kord
knr�td	�d}nds�tdt|���|d
t|�|}q
W|S)z.Get the integer value of a hexadecimal number.rr=r>�0r?r@�a�
rArBFznon-hex digit r)rrr�repr)r"�bitsrr:rrrr8�s


r8c(Cs�ddl}ddl}y|j|jdd�d�\}}WnV|jk
r�}z8|j|_t|�td�td�td�|jd�WYdd}~XnXd}d}x(|D] \}}|dkr�d}|d	kr�d}q�W|r�|r�|j|_td
�|jd�|s�dg}d}	x�|D]�}
|
dk�r|jj	}nNyt
|
d�}Wn>tk
�rR}z |jjd
|
|f�d}	w�WYdd}~XnXz*|�rlt
||jj	�nt||jj	|�Wd|
dk�r�|j�Xq�W|	�r�|j|	�dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder5z-tz-dz -t and -d are mutually exclusive�-�rbz%s: can't open (%s)
)�sys�getopt�argv�error�stderr�stdout�print�exit�stdin�buffer�open�OSErrorr!rr�close)rJrKZopts�args�msgZdecoZtabs�orD�sts�file�fprrr�main�sT




r]�__main__)F)FF)F)F)�__doc__�__all__rr*rr(Zbinasciir	r
�ImportErrorrrrrrrr7r8r]�__name__rrrr�<module>s*

>

+
.

Zerion Mini Shell 1.0