MINI MINI MANI MO
ó
Eì]c           @   s6  d  Z  d d d g Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l	 m
 Z
 d Z d	 Z d
 Z
 d	 d Z d Z d
 Z e
 d ƒ Z e
 d ƒ Z e j d e j e j Be j Bƒ Z e j d ƒ Z e j d ƒ Z e j j Z d „  Z e e d	 d „ Z d f  d „  ƒ  YZ d „  Z  d „  Z! d S(   s+   Header encoding and decoding functionality.t   Headert
   decode_headert   make_headeriÿÿÿÿN(   t   HeaderParseError(   t   Charsets   
t    u    i   u    iL   s   us-asciis   utf-8s§  
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qb])    # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string
  \?=                   # literal ?=
  (?=[ \t]|$)           # whitespace or the end of the string
  s   [\041-\176]+:$s
   \n[^ \t]+:c         C   sG  t  |  ƒ }  t j |  ƒ s( |  d f g Sg  } d } x|  j ƒ  D]þ} t j | ƒ so | j | d f ƒ qA n  t j | ƒ } x¾| r>| j d ƒ j ƒ  } | rõ | rß | d d d k rß | d d t	 | d f | d <qõ | j | d f ƒ n  | r1g  | d d !D] } | j
 ƒ  ^ q	\ } } | d }	 d } | d k rXt j j
 |	 ƒ } nm | d k rÅt |	 ƒ d }
 |
 r|	 d	 d |
  7}	 n  y t j j |	 ƒ } WqÅt j k
 rÁt ‚ qÅXn  | d k rÚ|	 } n  | r| d d | k r| d d | | d d f | d <q1| j | | f ƒ n  | d d
 5q WqA W| S(   sÒ  Decode a message header value without converting charset.
    Returns a list of (decoded_string, charset) pairs containing each of the
    decoded parts of the header.  Charset is None for non-encoded parts of the
    header, otherwise a lower-case string containing the name of the character
    set specified in the encoded string.
    An email.errors.HeaderParseError may be raised when certain decoding error
    occurs (e.g. a base64 decoding exception).
    t    i    iÿÿÿÿi   i   t   qt   bi   s   ===i   N(   t   strt   ecret   searcht   Nonet
   splitlinest   appendt   splitt   popt   stript   SPACEt   lowert   emailt
   quoprimimet
   header_decodet   lent
   base64mimet   decodet   binasciit   ErrorR   (   t   headert   decodedt   dect   linet   partst   unenct   st   charsett   encodingt   encodedt   paderr(    (    s$   /usr/lib64/python2.7/email/header.pyR   =   sJ    
	#,
	'c         C   sq   t  d | d | d | ƒ } xO |  D]G \ } } | d k	 rY t | t ƒ rY t | ƒ } n  | j | | ƒ q"