ó
è¾bc           @   sþ   d  Z  d d l Z d d l Z y d d l m Z Wn! e k
 rU d d l m Z n Xd d „ Z d d „ Z d e j f d „  ƒ  YZ d	 e j	 f d
 „  ƒ  YZ	 d e j
 f d „  ƒ  YZ
 d e e j f d „  ƒ  YZ d e e j f d „  ƒ  YZ d „  Z d S(   sg   Codec for quoted-printable encoding.

Like base64 and rot13, this returns Python strings, not Unicode.
iÿÿÿÿN(   t   StringIOt   strictc         C   s_   | d k s t  ‚ t t |  ƒ ƒ } t ƒ  } t j | | d t ƒ| j ƒ  } | 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   t	   quotetabs(   t   AssertionErrorR    t   strt   quoprit   encodet   Truet   getvaluet   len(   t   inputt   errorst   ft   gt   output(    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyt   quopri_encode   s    	c         C   sY   | d k s t  ‚ t t |  ƒ ƒ } t ƒ  } t j | | ƒ | j ƒ  } | 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   (   R   R    R   R   t   decodeR   R	   (   R
   R   R   R   R   (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyt   quopri_decode   s    	t   Codecc           B   s    e  Z d  d „ Z d  d „ Z RS(   R   c         C   s   t  | | ƒ S(   N(   R   (   t   selfR
   R   (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   -   s    c         C   s   t  | | ƒ S(   N(   R   (   R   R
   R   (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   /   s    (   t   __name__t
   __module__R   R   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   +   s   t   IncrementalEncoderc           B   s   e  Z e d  „ Z RS(   c         C   s   t  | |  j ƒ d S(   Ni    (   R   R   (   R   R
   t   final(    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   3   s    (   R   R   t   FalseR   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   2   s   t   IncrementalDecoderc           B   s   e  Z e d  „ Z RS(   c         C   s   t  | |  j ƒ d S(   Ni    (   R   R   (   R   R
   R   (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   7   s    (   R   R   R   R   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   6   s   t   StreamWriterc           B   s   e  Z RS(    (   R   R   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   :   s   t   StreamReaderc           B   s   e  Z RS(    (   R   R   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyR   =   s   c           C   s:   t  j d d d t d t d t d t d t d t d	 t ƒ S(
   Nt   nameR   R   R   t   incrementalencodert   incrementaldecodert   streamwritert   streamreadert   _is_text_encoding(	   t   codecst	   CodecInfoR   R   R   R   R   R   R   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyt   getregentryB   s    	(   t   __doc__R"   R   t	   cStringIOR    t   ImportErrorR   R   R   R   R   R   R   R$   (    (    (    s,   /usr/lib/python2.7/encodings/quopri_codec.pyt   <module>   s   