관리-도구
편집 파일: header.cpython-37.pyc
B �A�[�_ � @ sP d Z ddlmZ ddlmZ ddlmZ ddlmZmZmZm Z m Z dddgZdd lZdd l Z dd lmZ ddlmZ ddlmZ dd lm m mZ dd lmZmZ ejZdZdZdZdZdZ dZ!dZ"ed�Z#ed�Z$e�%dej&ej'B ej(B �Z)e�%d�Z*e�%d�Z+dd� Z,d!dd�Z-G dd� de.�Z/G dd� de.�Z0G dd � d e1�Z2d S )"z+Header encoding and decoding functionality.� )�unicode_literals)�division)�absolute_import)�bytes�range�str�super�zip�Header� decode_header�make_headerN)�email)� base64mime)�HeaderParseError)�_max_append� header_decode� � � z � �N z zus-asciizutf-8ai =\? # 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 ?= z[\041-\176]+:$z \n[^ \t]+:c C s� t | d�rdd� | jD �S t�| �s.| dfgS g }x�| �� D ]�}t�|�}d}xp|r�|�d�}|rn|�� }d}|r�|�|ddf� |rP|�d�� � }|�d�� � }|�d�}|�|||f� qPW q<W ddl } g } xVt|�D ]J\}}|dkr�|d r�||d d r�||d d �� r�| �|d � q�W xt | �D ]} || = �q2W g }x�|D ]�\}}}|dk�rp|�||f� n�|d k�r�t|�}|�||f� n||dk�rt|�d }|�r�|d dd| � 7 }yt�|�}W n tjk �r� td��Y nX |�||f� ntd| ���qLW g }d }}x~|D ]v\}}t|t��rDt|d�}|dk�rX|}|}nB||k�rz|�||f� |}|}n |dk�r�|t| 7 }n||7 }�q&W |�||f� |S )a; Decode a message header value without converting charset. Returns a list of (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. header may be a string that may or may not contain RFC2047 encoded words, or it may be a Header object. An email.errors.HeaderParseError may be raised when certain decoding error occurs (e.g. a base64 decoding exception). �_chunksc S s( g | ] \}}t �|t|��t|�f�qS � )�_charset�_encoder )�.0�string�charsetr r �N/opt/alt/python37/lib/python3.7/site-packages/future/backports/email/header.py� <listcomp>N s z!decode_header.<locals>.<listcomp>NTr F� � �q�b� z===zBase64 decoding errorzUnexpected encoding: zraw-unicode-escape)�hasattrr �ecre�search� splitlines�split�pop�lstrip�append�lower�sys� enumerate�isspace�reversedr �lenr �decode�binascii�Errorr �AssertionError� isinstancer r �BSPACE)�header�words�line�parts�first� unencodedr �encoding�encodedr. �droplist�n�w�d� decoded_words�encoded_string�word�paderr� collapsed� last_word�last_charsetr r r r >