Your IP : 3.23.103.140


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/quopri.cpython-36.opt-1.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_qpNcCs:|dkr|S|dkr|S|tkp8d|ko2dkn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 	�_� �~)�ESCAPE)�c�	quotetabs�header�r�/usr/lib64/python3.6/quopri.py�needsquotings
rcCs(t|�}ttt|dt|df�S)zQuote a single character.�)�ordr�bytes�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)N�s 	�.���rr)�writer)�s�output�lineEndrrrr;s
(zencode.<locals>.writerrrrs=
)r!rr)r
�readr�readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputr rr�data�odatarZprevline�lineZoutline�strippedrZthislinerrrr,s@	





cCsFtdk	rt|||d�Sddlm}||�}|�}t||||�|j�S)N)rrr)�BytesIO)r
�ior.r�getvalue)rrrr.�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"rr#r'r�ishexr�unhex)r)r rr*r+�newr,�i�n�partialrrrrrusR



(
B"
cCsDtdk	rt||d�Sddlm}||�}|�}t|||d�|j�S)N)rr)r.)r	r/r.rr0)rrr.r1r2rrrr�scCsHd|kodknpFd|ko*dknpFd|koBdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�Fr)rrrrr5�sr5cCs�d}x�|D]�}t|f�}d|ko*dknr:td�}nLd|koLdknr`td�d}n&d	|kord
knr�td	�d}n|dt|�|}q
W|S)z.Get the integer value of a hexadecimal number.rr;r<�0r=r>�a�
r?r@r)rr)r�bitsrr8rrrr6�s


r6c(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 encoder3z-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�OSErrorrrr�close)rGrHZopts�args�msgZdecoZtabs�orB�sts�file�fprrr�main�sT




rZ�__main__)F)FF)F)F)�__doc__�__all__rr(rr%Zbinasciir	r
�ImportErrorrrrrrrr5r6rZ�__name__rrrr�<module>s*

>

+
.