AlkantarClanX12

Your IP : 18.218.38.67


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/quopri.cpython-35.opt-1.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_qpNcCsG|dkr|S|dkr |S|tkpFd|koCdkn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�+/opt/alt/python35/lib64/python3.5/quopri.py�needsquotings
rcCs0t|�}ttt|dt|df�S)zQuote a single character.�)�ordr�bytes�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)N�s 	�.���rr)�writer)�s�output�lineEndrrrr;s
2zencode.<locals>.writerrrrr s=
rr)r
�readr�readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputrrr�data�odatarZprevline�lineZoutlineZstrippedrZthislinerrrr,s@	




cCsdtdk	r"t|d|d|�Sddlm}||�}|�}t||||�|j�S)Nrrr)�BytesIO)r
�ior,r�getvalue)rrrr,�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!rr"r&r�ishexr�unhex)r(rrr)r*�newr+�i�n�partialrrrrrusR
&
)



.

L+


cCs^tdk	rt|d|�Sddlm}||�}|�}t||d|�|j�S)Nrr)r,)r	r-r,rr.)rrr,r/r0rrrr�s	cCsPd|kodknpOd|ko3dknpOd|koMdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�Fr)rrrrr3�sr3cCs�d}x�|D]�}t|f�}d|ko9dknrMtd�}n^d|koddknr|td�d}n/d	|ko�d
knr�td	�d}n|dt|�|}q
W|S)z.Get the integer value of a hexadecimal number.rr9r:�0r;r<�a�
r=r>r)rr)r�bitsrr6rrrr4�s
r4c(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 encoder1z-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)rErFZopts�args�msgZdecoZtabs�or@�sts�file�fprrr�main�sT)



 


	
rX�__main__)�__doc__�__all__rr'rr$Zbinasciir	r
�ImportErrorrrrrrrr3r4rX�__name__rrrr�<module>s*
>+.