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__/quopri.cpython-35.pyc



��Yfa�@s�dZddddgZdZdZdZdZyd	d
lmZmZWne	k
rjdZdZYnXdd
�Z
dd�Zddd�Zdddd�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\t|t�st�|dkr%|S|dkr5|S|tkp[d|koXdkn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�+/opt/alt/python35/lib64/python3.5/quopri.py�needsquotingsrcCsWt|t�r!t|�dks't�t|�}ttt|dt|df�S)zQuote a single character.��)rr�lenr�ordr�HEX)rrrr�quote$s'rFc
Cs�tdk	rA|j�}t|d|d|�}|j|�dS|ddd�}d}x2|j�}|soPg}	d}
|d
d�dkr�|dd�}d}
xj|D]b}t|f�}t|||�r�t|�}|r|d	kr|	jd
�q�|	j|�q�W|dk	r*||�tj	|	�}xHt
|�tkr�||dtd�dd�|tdd�}q<W|}q\W|dk	r�||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.Nrrs
cSs�|rN|dd�dkrN|j|dd�t|dd��|�n7|dkrt|jt|�|�n|j||�dS)Nrs 	�.���rr)�writer)�s�output�lineEndrrrr ;s
2zencode.<locals>.writerrrrr#s=
rr)r
�readr �readlinerrr�append�EMPTYSTRING�joinr�MAXLINESIZE)
�inputr"rr�data�odatar Zprevline�lineZoutlineZstrippedrZthislinerrrr,s@	




cCsdtdk	r"t|d|d|�Sddlm}||�}|�}t||||�|j�S)Nrrr)�BytesIO)r
�ior.r�getvalue)r!rrr.�infp�outfprrrrjs	cCs�tdk	r;|j�}t|d|�}|j|�dSd}x.|j�}|sWPdt|�}}|dkr�||d|�dkr�d}	|d}x=|dkr�||d|�dkr�|d}q�Wnd}	xn||krP|||d�}
|
dkr,|r,|d	}|d}q�|
tkrO||
}|d}q�|d|krp|	rpd}	Pq�|d|kr�||d|d
�tkr�|t}|d
}q�|d
|kr9t||d|d
��r9t||d
|d��r9|tt||d|d��f�}|d}q�||
}|d}q�W|	sD|j|d�d}qDW|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).Nrrrrs
s 	
rr��)	r	r$r r%rr�ishexr�unhex)r*r"rr+r,�newr-�i�n�partialrrrrrusR
&
)



.

L+


cCs^tdk	rt|d|�Sddlm}||�}|�}t||d|�|j�S)Nrr)r.)r	r/r.rr0)r!rr.r1r2rrrr�s	cCset|t�st�d|ko,dknpdd|koHdknpdd|kobdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�F)rrr)rrrrr5�sr5cCs�d}x�|D]�}t|f�}d|ko9dknrMtd�}nzd|koddknr|td�d}nKd	|ko�d
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�
r?r@Fznon-hex digit r)rrr�repr)r!�bitsrr8rrrr6�s
r6c(Cs)ddl}ddl}y)|j|jdd�d�\}}Wni|jk
r�}zF|j|_t|�td�td�td�|jd�WYdd}~XnXd}d}x8|D]0\}}|dkr�d}|d	kr�d}q�W|r#|r#|j|_td
�|jd�|s2dg}d}	x�|D]�}
|
dkr`|jj	}n^yt
|
d�}WnHtk
r�}z(|jjd
|
|f�d}	w?WYdd}~XnXz6|r�t
||jj	�nt||jj	|�Wd|
dkr
|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�OSErrorr rr�close)rHrIZopts�args�msgZdecoZtabs�orB�sts�file�fprrr�main�sT)



 


	
r[�__main__)�__doc__�__all__rr)rr'Zbinasciir	r
�ImportErrorrrrrrrr5r6r[�__name__rrrr�<module>s*
>+.