Your IP : 3.129.253.21


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/quopri.cpython-34.pyo

�
i fa�@sdZddddgZdZdZdZdZyd	d
lmZmZWne	k
rjdZdZYnXdd
�Z
dd�Zddd�Zdddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�Zedkr�e�ndS)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/python34/lib64/python3.4/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}x>|j�}|srPng}	d}
|d
d�dkr�|dd�}d}
nxm|D]e}t|f�}t|||�r�t|�}n|r|d	kr|	jd
�q�|	j|�q�W|dk	r6||�ntj	|	�}xHt
|�tkr�||dtd�dd�|tdd�}qHW|}q\W|dk	r�||d|
�ndS)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}x4|j�}|sZPndt|�}}|dkr�||d|�dkr�d}	|d}x=|dkr�||d|�dkr�|d}q�Wnd}	xn||krS|||d�}
|
dkr/|r/|d	}|d}q�|
tkrR||
}|d}q�|d|krs|	rsd}	Pq�|d|kr�||d|d
�tkr�|t}|d
}q�|d
|kr<t||d|d
��r<t||d
|d��r<|tt||d|d��f�}|d}q�||
}|d}q�W|	sD|j|d�d}qDqDW|r�|j|�ndS)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}x>|D]6\}}|dkr�d}n|d	kr�d}q�q�W|r,|r,|j|_td
�|jd�n|s>dg}nd}	x�|D]�}
|
dkrl|jj	}n^yt
|
d�}WnHtk
r�}z(|jjd
|
|f�d}	wKWYdd}~XnXz6|r�t
||jj	�nt||jj	|�Wd|
dkr|j�nXqKW|	r7|j|	�ndS)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*
>+.

?>