Current Path : /usr/lib/python2.7/email/ |
Current File : //usr/lib/python2.7/email/header.pyc |
|_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_headeriN( 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 rt | d } | r| d d | 7} n y t j j | } Wqt j k rt qXn | 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 ii 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"