mς
­fIc           @   sΒ   d  Z  d k Z d k Z y d k l Z Wn  e j
 o d k l Z n Xd d  Z d d  Z d e i f d     YZ d e e i	 f d	     YZ	 d
 e e i
 f d     YZ
 d   Z d S(   sg   Codec for quoted-printable encoding.

Like base64 and rot13, this returns Python strings, not Unicode.
N(   s   StringIOt   strictc         C   sX   | d j p t  t |   } t   } t i | | d  | i   } | t
 |   f S(   sκ   Encode the input, returning a tuple (output object, length consumed).

    errors defines the error handling to apply. It defaults to
    'strict' handling which is the only currently supported
    error handling for this codec.

    R    i   N(   t   errorst   AssertionErrort   StringIOt   inputt   ft   gt   quoprit   encodet   getvaluet   outputt   len(   R   R   R   R   R
   (    (    t3   /mit/python/lib/python2.4/encodings/quopri_codec.pyt   quopri_encode   s     	c         C   sU   | d j p t  t |   } t   } t i | |  | i   } | t
 |   f S(   sκ   Decode the input, returning a tuple (output object, length consumed).

    errors defines the error handling to apply. It defaults to
    'strict' handling which is the only currently supported
    error handling for this codec.

    R    N(   R   R   R   R   R   R   R   t   decodeR	   R
   R   (   R   R   R   R   R
   (    (    R   t   quopri_decode   s     	t   Codecc           B   s    t  Z d d  Z d d  Z RS(   NR    c         C   s   t  | |  S(   N(   R   R   R   (   t   selfR   R   (    (    R   R   ,   s    c         C   s   t  | |  S(   N(   R   R   R   (   R   R   R   (    (    R   R   .   s    (   t   __name__t
   __module__R   R   (    (    (    R   R   *   s   t   StreamWriterc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R   1   s   t   StreamReaderc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R   4   s   c           C   s   t  t t t f S(   N(   R   R   R   R   (    (    (    R   t   getregentry9   s    (   t   __doc__t   codecsR   t	   cStringIOR   t   ImportErrorR   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R   (    (    R   t   ?   s   