File: //usr/lib/python2.7/quopri.pyc
�
�I	ec           @   s�   d  Z  d d d d g Z d Z d Z d Z d Z y d	 d
 l m Z m Z Wn e	 k
 ri d Z d Z n Xd �  Z d �  Z d
 d � Z
 d
 d
 d � Z d
 d � Z d
 d � Z d �  Z d �  Z d �  Z e d k r� e �  n  d S(   sH   Conversions to/from quoted-printable transport encoding as per RFC 1521.t   encodet   decodet   encodestringt   decodestringt   =iL   t   0123456789ABCDEFt    i����(   t   a2b_qpt   b2a_qpc         C   sG   |  d k r | S|  d k r  | S|  t  k pF d |  k oC d k n S(   s�   Decide whether a particular character 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    	t   _t    t   ~(   t   ESCAPE(   t   ct	   quotetabst   header(    (    s   /usr/lib/python2.7/quopri.pyt   needsquoting   s
    c         C   s(   t  |  � } t t | d t | d S(   s   Quote a single character.i   (   t   ordR   t   HEX(   R
   t   i(    (    s   /usr/lib/python2.7/quopri.pyt   quote#   s    i    c   
      C   s�  t  d k	 rA |  j �  } t  | d | d | �} | j | � d S| d d � } d } x|  j �  } | so Pn  g  }	 d }
 | d d k r� | d  } d }
 n  x^ | D]V } t | | | � r� t | � } n  | r� | d k r� |	 j d	 � q� |	 j | � q� W| d k	 r| | � n  t j	 |	 � } x<