Your IP : 18.227.21.101


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/quopri.cpython-310.opt-1.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_qpNcCs:|dvr|S|dkr|S|tkpd|kodkn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.
    � 	�_� �~)�ESCAPE)�c�	quotetabs�header�r�-/opt/alt/python310/lib64/python3.10/quopri.py�needsquotings
"rcCs(t|�}ttt|dt|df�S)zQuote a single character.�)�ordr�bytes�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>.write�rrr
rs=
)r#)r
�readr �readlinerrr�append�EMPTYSTRING�join�len�MAXLINESIZE)
�inputr"rr�data�odatar Zprevline�lineZoutline�strippedrZthislinerrrr,sF	



��!�rcCsFtdurt|||d�Sddlm}||�}|�}t||||�|��S)Nrr��BytesIO)r
�ior2r�getvalue)r!rrr2�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�rrr$rrs 	
rr
��)	r	r%r r&r*r�ishexr�unhex)r,r"rr-r.�newr/�i�n�partialrrrrrusL
��$<,���rcCsDtdur
t||d�Sddlm}||�}|�}t|||d�|��S)Nr7rr1)r	r3r2rr4)r!rr2r5r6rrrr�srcCsHd|ko	dknp#d|kodknp#d|ko!dkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.�0�9�a�f�A�Frrrrrr:�sHr:cCs�d}|D]G}t|f�}d|krdkrnntd�}n%d|kr&dkr/nntd�d}nd	|kr9d
krAnntd	�d}|dt|�|}q|S)z.Get the integer value of a hexadecimal number.rr@rA�0rBrC�a�
rDrEr)rr)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)Nrr$Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder8Fz-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)rLrMZopts�args�msgZdecoZtabs�orG�sts�file�fprrr�main�sd���


�����
��r_�__main__)F)FF)�__doc__�__all__rr+rr(Zbinasciir	r
�ImportErrorrrrrrrr:r;r_�__name__rrrr�<module>s0�

>

+.
�

?>