
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,aa  ã                   @   s´   d Z ddddgZdZdZdZdZzd	d
lmZmZ W n e	k
rP   dZdZY nX dd„ Z
dd„ Zddd„Zddd„Zddd„Zddd„Zdd„ Zdd„ Zdd„ Zedkr°eƒ  dS ) zHConversions to/from quoted-printable transport encoding as per RFC 1521.ÚencodeÚdecodeÚencodestringÚdecodestringó   =éL   s   0123456789ABCDEFó    é    )Úa2b_qpÚb2a_qpNc                 C   sH   t | tƒst‚| dkr|S | dkr&|S | tkpFd|   ko@dkn   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ÚAssertionErrorÚESCAPE)ÚcÚ	quotetabsÚheader© r   ú+/opt/alt/python38/lib64/python3.8/quopri.pyÚneedsquoting   s    r   c                 C   sB   t | tƒrt| ƒdkst‚t| ƒ} ttt| d  t| d  fƒ S )zQuote a single character.é   é   )r   r   Úlenr   Úordr   ÚHEX©r   r   r   r   Úquote$   s    r   Fc                 C   s2  t dk	r,|  ¡ }t |||d�}| |¡ dS |dfdd„}d}|  ¡ }|sN�qg }	d}
|dd… dkrv|dd… }d}
|D ]D}t|fƒ}t|||ƒrœt|ƒ}|r´|dkr´|	 d	¡ qz|	 |¡ qz|dk	rÐ||ƒ t 	|	¡}t
|ƒtk�r||dtd
 … dd� |td
 d… }qÚ|}q>|dk	�r.|||
d� dS )av  Read '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©r   r   ó   
c                 S   sj   | r<| dd … dkr<|  | d d… t| dd … ƒ | ¡ n*| dkrX|  t| ƒ| ¡ n|  | | ¡ d S )Néÿÿÿÿr   ó   .)Úwriter   )ÚsÚoutputÚlineEndr   r   r   r$   ;   s
    (zencode.<locals>.writer   r"   r   r   r   s   =
)r'   )r
   Úreadr$   Úreadliner   r   r   ÚappendÚEMPTYSTRINGÚjoinr   ÚMAXLINESIZE)Úinputr&   r   r   ÚdataÚodatar$   ZprevlineÚlineZoutlineÚstrippedr   Zthisliner   r   r   r   ,   s>    	




c                 C   sF   t d k	rt | ||d�S ddlm} || ƒ}|ƒ }t||||ƒ | ¡ S )Nr    r   ©ÚBytesIO)r
   Úior4   r   Úgetvalue)r%   r   r   r4   ÚinfpÚoutfpr   r   r   r   j   s    c                 C   sö  t dk	r*|  ¡ }t ||d�}| |¡ dS d}|  ¡ }|s>�qâdt|ƒ }}|dkrœ||d |… dkrœd}	|d }|dkr ||d |… dkr |d }qtnd}	||k �rÊ|||d … }
|
dkrØ|rØ|d	 }|d }q |
tkrò||
 }|d }q |d |k�r|	�sd}	�qÊq |d |k �rJ||d |d
 … tk�rJ|t }|d
 }q |d
 |k �r¸t||d |d
 … ƒ�r¸t||d
 |d … ƒ�r¸|tt||d |d … ƒfƒ }|d }q ||
 }|d }q |	s.| |d ¡ d}q.|�rò| |¡ dS )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©r   r   r   r   r!   s    	r   r   é   é   )	r	   r(   r$   r)   r   r   Úishexr   Úunhex)r.   r&   r   r/   r0   Únewr1   ÚiÚnÚpartialr   r   r   r   r   u   sP    
  
 
 
 ( 
B" 
 
c                 C   sD   t d k	rt | |d�S ddlm} || ƒ}|ƒ }t|||d� | ¡ S )Nr9   r   r3   )r	   r5   r4   r   r6   )r%   r   r4   r7   r8   r   r   r   r       s    c                 C   sV   t | tƒst‚d|   ko dkn  pTd|   ko8dkn  pTd|   koPdkS   S )zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.ó   0ó   9ó   aó   fó   Aó   F)r   r   r   r   r   r   r   r<   ¬   s    r<   c                 C   s²   d}| D ]¤}t |fƒ}d|  kr*dkr8n n
tdƒ}n`d|  krLdkr^n ntdƒd }n:d	|  krrd
kr„n ntd	ƒd }nds˜tdt|ƒ ƒ‚|d t|ƒ|  }q|S )z.Get the integer value of a hexadecimal number.r   rB   rC   Ú0rD   rE   Úaé
   rF   rG   Fznon-hex digit r   )r   r   r   Úrepr)r%   Úbitsr   r?   r   r   r   r=   ±   s    

r=   c                  C   s¨  dd l } dd l}z| | jdd … d¡\}}W nV |jk
r„ } z6| j| _t|ƒ tdƒ tdƒ tdƒ |  d¡ W 5 d }~X Y nX d}d}|D ] \}}|dkr¦d}|d	kr’d}q’|rÖ|rÖ| j| _td
ƒ |  d¡ |sàdg}d}	|D ]ª}
|
dkrþ| jj	}nTzt
|
dƒ}W nD tk
�rP } z$| j d|
|f ¡ d}	W Y ¢qèW 5 d }~X Y nX z*|�rjt|| jj	ƒ nt|| jj	|ƒ W 5 |
dk�r�| ¡  X qè|	�r¤|  |	¡ d S )Nr   r   Ztdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder:   z-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ÚOSErrorr$   Úcloser   r   )rO   rP   ZoptsÚargsÚmsgZdecoZtabsÚorI   ÚstsÚfileÚfpr   r   r   ÚmainÃ   sT      
 

rb   Ú__main__)F)FF)F)F)Ú__doc__Ú__all__r   r-   r   r+   Zbinasciir	   r
   ÚImportErrorr   r   r   r   r   r   r<   r=   rb   Ú__name__r   r   r   r   Ú<module>   s*   

>

+
.