Your IP : 3.145.92.213


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/quopri.cpython-310.pyc

o

6��fq�@s�dZgd�ZdZdZdZdZz
ddlmZmZWn
e	y%dZdZYnwd	d
�Z
dd�Zddd�Zddd�Z
ddd�Zddd�Zdd�Zdd�Zdd�ZedkrWe�dSdS)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|tkp#d|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/python310/lib64/python3.10/quopri.py�needsquotings"rcCsBt|t�rt|�dks
J�t|�}ttt|dt|df�S)zQuote a single character.��)rr�len�ordr�HEX�rrrr�quote$s rFc
Cs<tdur|��}t|||d�}|�|�dS|dfdd�}d}	|��}|s'nig}	d}
|dd�dkr;|dd�}d}
|D]"}t|f�}t|||�rNt|�}|rZ|d	krZ|	�d
�q=|	�|�q=|durh||�t�	|	�}t
|�tkr�||dtd�dd�|tdd�}t
|�tkss|}q |dur�|||
d�dSdS)
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�
cSsn|r|dd�dvr|�|dd�t|dd��|�dS|dkr.|�t|�|�dS|�||�dS)N���r�.)�writer)�s�output�lineEndrrrr#;s
*zencode.<locals>.writerrr!r
rs=
)r&)r
�readr#�readlinerrr�append�EMPTYSTRING�joinr�MAXLINESIZE)
�inputr%rr�data�odatar#Zprevline�lineZoutline�strippedrZthislinerrrr,sF	



��!�rcCsFtdurt|||d�Sddlm}||�}|�}t||||�|��S)Nrr��BytesIO)r
�ior3r�getvalue)r$rrr3�infp�outfprrrrjsrcCstdur|��}t||d�}|�|�dSd}	|��}|sn�dt|�}}|dkr[||d|�dkr[d}	|d}|dkrZ||d|�dvrZ|d}|dkrZ||d|�dvsHnd}	||kr�|||d�}
|
dkrx|rx|d	}|d}no|
tkr�||
}|d}nb|d|kr�|	s�d}	n[|d|kr�||d|d
�tkr�|t}|d
}n<|d
|kr�t||d|d
��r�t||d
|d��r�|tt||d|d��f�}|d}n||
}|d}||ksa|	s�|�|d�d}q|�r|�|�dSdS)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�partialrrrrrusL
��$<,���rcCsDtdur
t||d�Sddlm}||�}|�}t|||d�|��S)Nr8rr2)r	r4r3rr5)r$rr3r6r7rrrr�srcCsVt|t�sJ�d|kodknp*d|kodknp*d|ko(dkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�F)rrrrrrr;�sHr;cCs�d}|D]P}t|f�}d|krdkrnntd�}n.d|kr&dkr/nntd�d}nd	|kr9d
krBnntd	�d}nJd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�\}}Wn,|jyC}z|j|_t|�td�td�td�|�d�WYd}~nd}~wwd}d}|D]\}}|d	krTd
}|dkrZd
}qJ|rl|rl|j|_td�|�d�|sqd
g}d}	|D]W}
|
d
kr�|jj	}n&zt
|
d�}Wnty�}z|j�d|
|f�d}	WYd}~qud}~wwz|r�t
||jj	�nt||jj	|�W|
d
kr�|��qu|
d
kr�|��ww|	r�|�|	�dSdS)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�sd���


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

>

+.
�

?>