Your IP : 18.119.255.183


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/quopri.cpython-39.pyc

a

R�fo�@s�dZgd�ZdZdZdZdZzddlmZmZWne	yJdZdZYn0d	d
�Z
dd�Zddd�Zddd�Z
ddd�Zd dd�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�sJ�|dvr|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.
    � 	�_� �~)�
isinstance�bytes�ESCAPE)�c�	quotetabs�header�r�+/opt/alt/python39/lib64/python3.9/quopri.py�needsquotingsrcCsBt|t�rt|�dksJ�t|�}ttt|dt|df�S)zQuote a single character.��)rr�len�ordr�HEX�rrrr�quote$srFc
Cs2tdur,|��}t|||d�}|�|�dS|dfdd�}d}|��}|sN�qg}	d}
|dd�dkrv|dd�}d}
|D]D}t|f�}t|||�r�t|�}|r�|dkr�|	�d	�qz|	�|�qz|dur�||�t�	|	�}t
|�tk�r||dtd
�dd�|td
d�}q�|}q>|du�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.N�rr�
cSsj|r<|dd�dvr<|�|dd�t|dd��|�n*|dkrX|�t|�|�n|�||�dS)N���r�.)�writer)�s�output�lineEndrrrr#;s
(zencode.<locals>.writerr!r
rrs=
)r&)r
�readr#�readlinerrr�append�EMPTYSTRING�joinr�MAXLINESIZE)
�inputr%rr�data�odatar#Zprevline�lineZoutline�strippedrZthislinerrrr,s>	




rcCsFtdurt|||d�Sddlm}||�}|�}t||||�|��S)Nrr��BytesIO)r
�ior3r�getvalue)r$rrr3�infp�outfprrrrjsrcCs�tdur*|��}t||d�}|�|�dSd}|��}|s>�q�dt|�}}|dkr�||d|�dkr�d}	|d}|dkr�||d|�dvr�|d}qtnd}	||k�r�|||d�}
|
dkr�|r�|d	}|d}q�|
tkr�||
}|d}q�|d|k�r|	�sd}	�q�q�|d|k�rJ||d|d
�tk�rJ|t}|d
}q�|d
|k�r�t||d|d
���r�t||d
|d���r�|tt||d|d��f�}|d}q�||
}|d}q�|	s.|�|d�d}q.|�r�|�|�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�rrrrr s 	
rr
��)	r	r'r#r(rr�ishexr�unhex)r-r%rr.r/�newr0�i�n�partialrrrrrus@


(B,rcCsDtdurt||d�Sddlm}||�}|�}t|||d�|��S)Nr8rr2)r	r4r3rr5)r$rr3r6r7rrrr�srcCsVt|t�sJ�d|ko dknpTd|ko8dknpTd|koPdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�F)rrrrrrr;�sr;cCs�d}|D]�}t|f�}d|kr*dkr8nn
td�}n`d|krLdkr^nntd�d}n:d	|krrd
kr�nntd	�d}nds�Jdt|���|d
t|�|}q|S)z.Get the integer value of a hexadecimal number.rrArB�0rCrD�a�
rErFFznon-hex digit r)rr�repr)r$�bitsrr>rrrr<�s

r<cCs�ddl}ddl}z|�|jdd�d�\}}WnX|jy�}z>|j|_t|�td�td�td�|�d�WYd}~n
d}~00d}d}|D] \}}|d	kr�d
}|dkr�d
}q�|r�|r�|j|_td�|�d�|s�d
g}d}	|D]�}
|
d
k�r|jj	}nZzt
|
d�}WnJt�yZ}z0|j�d|
|f�d}	WYd}~q�WYd}~n
d}~00z<|�rtt
||jj	�nt||jj	|�W|
d
k�r�|��q�|
d
k�r�|��0q�|	�r�|�|	�dS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder9Fz-tTz-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)rNrOZopts�args�msgZdecoZtabs�orH�sts�file�fprrr�main�sR 



"

�
ra�__main__)F)FF)F)F)�__doc__�__all__rr,rr*Zbinasciir	r
�ImportErrorrrrrrrr;r<ra�__name__rrrr�<module>s*

>

+
.

?>