AlkantarClanX12

Your IP : 18.216.42.122


Current Path : /opt/alt/python36/lib64/python3.6/email/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/email/__pycache__/header.cpython-36.opt-2.pyc

3

��2a&^�@s�dddgZddlZddlZddlZddlZddlmZddlmZ	e	j
Z
dZdZd	Z
dZdZdZd
Ze
d�Ze
d�ZejdejejBejB�Zejd�Zejd�ZejjZdd�Zddd�ZGdd�d�ZGdd�d�Z Gdd�de!�Z"dS)�Header�
decode_header�make_header�N)�HeaderParseError)�charset�
� � ���Nz 	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Cs�t|d�rdd�|jD�Stj|�s.|dfgSg}x�|j�D]�}tj|�}d}xp|r�|jd�}|rn|j�}d}|r�|j|ddf�|rP|jd�j	�}|jd�j	�}|jd�}|j|||f�qPWq<Wg}	xVt
|�D]J\}
}|
dkr�|dr�||
ddr�||
ddj�r�|	j|
d�q�Wxt|	�D]}||=�q*Wg}
x�|D]�\}}}|dk�rh|
j||f�n�|d	k�r�t
jj|�}|
j||f�n~|d
k�rt|�d}|�r�|ddd|�7}yt
jj|�}Wn tjk
�r�td
��YnX|
j||f�ntd|���qDWg}d}}x~|
D]v\}}t|t��rBt|d�}|dk�rV|}|}nB||k�rx|j||f�|}|}n |dk�r�|t|7}n||7}�q$W|j||f�|S)N�_chunkscSs(g|] \}}tj|t|��t|�f�qS�)�_charsetZ_encode�str)�.0�stringrrr�+/opt/alt/python36/lib64/python3.6/header.py�
<listcomp>Msz!decode_header.<locals>.<listcomp>TrF���q�b�z===zBase64 decoding errorzUnexpected encoding: zraw-unicode-escape)�hasattrr
�ecre�search�
splitlines�split�pop�lstrip�append�lower�	enumerate�isspace�reversed�email�
quoprimimeZ
header_decode�lenZ
base64mime�decode�binascii�Errorr�AssertionError�
isinstancer�bytes�BSPACE)�headerZwords�line�parts�firstZ	unencodedr�encodingZencodedZdroplist�n�w�dZ
decoded_wordsZencoded_stringZwordZpaderrZ	collapsedZ	last_word�last_charsetrrrr=sz






4






cCsLt|||d�}x8|D]0\}}|dk	r8t|t�r8t|�}|j||�qW|S)N)�
maxlinelen�header_name�continuation_ws)rr-�Charsetr!)Zdecoded_seqr9r:r;�h�srrrrr�sc@sJeZdZddd�Zdd�Zdd	�Zdd
d�Zdd
�Zddd�Zdd�Z	dS)rNr�strictcCs||dkrt}nt|t�s t|�}||_||_g|_|dk	rH|j|||�|dkrTt}||_|dkrjd|_	nt
|�d|_	dS)Nrr)�USASCIIr-r<r�_continuation_wsr
r!�
MAXLINELEN�_maxlinelen�
_headerlenr()�selfr>rr9r:r;�errorsrrr�__init__�s
zHeader.__init__c	Cs�|j�g}d}d}x�|jD]�\}}|}|tjkrJ|jdd�}|jdd�}|r�|o^|j|d�}|dkr�|dkr�|r�|jt�d}n|d	kr�|r�|jt�|o�|j|d
�}|}|j|�qWt	j
|�S)N�ascii�surrogateescape�replacer�us-asciir)NrK)NrK)NrK���)�
_normalizer
r�UNKNOWN8BIT�encoder)�	_nonctextr!�SPACE�EMPTYSTRING�join)	rEZuchunks�lastcs�	lastspacerrZnextcsZoriginal_bytes�hasspacerrr�__str__�s*


zHeader.__str__cCs|t|�kS)N)r)rE�otherrrr�__eq__sz
Header.__eq__cCs�|dkr|j}nt|t�s"t|�}t|t�sZ|jp4d}|tjkrN|jdd�}n|j||�}|jpbd}|tjkr�y|j||�Wn"t	k
r�|dkr��t
}YnX|jj||f�dS)Nzus-asciirI)
rr-r<rZinput_codecrNr)Zoutput_codecrO�UnicodeEncodeError�UTF8r
r!)rEr>rrFZ
input_charset�output_charsetrrrr!	s$






z
Header.appendcCs|j�p|dkS)N�(�)�\)r]r^r_)r$)rEr>rrrrP4szHeader._nonctext�;, 	rcCs�|j�|dkr|j}|dkr"d}t|j||j|�}d}d}}�x4|jD�](\}}	|dk	r�|ol|j|d�}|d	kr�|s�|	d
kr�|j�n|	dkr�|r�|j�|o�|j|d�}|	}d}|j�}
|
r�|j	d|
d|	�n|j	dd|	�xr|
dd�D]b}|j
�|	jdk	�r,|j	|jd|j�|	�n.|j�}|dt
|�t
|��}
|j	|
||	��q�Wt
|
�dkrJ|j
�qJW|j�r�|j�|j|�}tj|��r�tdj|���|S)
Nri@B�us-asciirFrrz8header value appears to contain an embedded header: {!r})Nra)Nra)NrarL)rMrC�_ValueFormatterrDrAr
rP�add_transitionr�feed�newline�header_encodingr r(�_str�_embedded_headerrr�format)rE�
splitcharsr9�linesep�	formatterrTrVrUrr�linesr1Zsline�fws�valuerrrrO9sR!


z
Header.encodecCs|g}d}g}xL|jD]B\}}||kr0|j|�q|dk	rL|jtj|�|f�|g}|}qW|rr|jtj|�|f�||_dS)N)r
r!rQrS)rE�chunksr8Z
last_chunkrrrrrrM�szHeader._normalize)NNNNrr?)Nr?)r`Nr)
�__name__�
__module__�__qualname__rGrWrYr!rPrOrMrrrrr�s
- 
+
Pc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)rbcCs0||_||_t|�|_||_g|_t|�|_dS)N)�_maxlenrAr(�_continuation_ws_len�_splitchars�_lines�_Accumulator�
_current_line)rEZ	headerlen�maxlenr;rjrrrrG�s
z_ValueFormatter.__init__cCs|j�|j|j�S)N)rerSrw)rErkrrrrg�sz_ValueFormatter._strcCs
|jt�S)N)rg�NL)rErrrrW�sz_ValueFormatter.__str__cCsp|jj�}|dkr|jj|�t|j�dkrb|jj�rP|jdt|j�7<n|jjt|j��|jj�dS)Nrrrr)rrrL)	ryr�pushr(�	is_onlywsrwrr!�reset)rEZend_of_linerrrre�s

z_ValueFormatter.newlinecCs|jjdd�dS)Nrr)ryr|)rErrrrc�sz_ValueFormatter.add_transitioncCs�|jdkr|j|||j�dS|j||j��}y|jd�}Wntk
rPdSX|dk	rf|j||�y|j�}Wntk
r�dSX|j�|j	j
|j|�x|D]}|jj
|j|�q�WdS)Nr)rf�_ascii_splitrvZheader_encode_lines�_maxlengthsr�
IndexError�
_append_chunkreryr|rArwr!)rErnrrZ
encoded_linesZ
first_line�	last_liner1rrrrd�s$

z_ValueFormatter.feedccs*|jt|j�Vx|j|jVqWdS)N)rtr(ryru)rErrrr��sz_ValueFormatter._maxlengthscCsjtjdtd||�}|dr0dg|dd�<n
|jd�x*tt|�gd�D]\}}|j||�qNWdS)Nz([z]+)rrr)�rer�FWSr�zip�iterr�)rErnrrjr2�partrrrr�s
z_ValueFormatter._ascii_splitcCs
|jj||�t|j�|jk�rx�|jD]t}xlt|jj�ddd�D]P}|j�rp|j|d}|rp|d|krpP|j|dd}|rD|d|krDPqDWq(Pq(W|jj�\}}|jj	dkr�|j
�|s�d}|jj||�dS|jj|�}|jj
t|j��|jj|�dS)NrrrrLrL)ryr|r(rtrv�range�
part_countr$r�
_initial_sizere�pop_fromrwr!rr~)rErnrZch�iZprevpartr�Z	remainderrrrr��s.z_ValueFormatter._append_chunkN)rqrrrsrGrgrWrercrdr�rr�rrrrrb�s%rbcsjeZdZd�fdd�	Zdd�Zddd�Z�fdd	�Zd
d�Zdd
�Zddd�Z	dd�Z
�fdd�Z�ZS)rxrcs||_t�j�dS)N)r��superrG)rEZinitial_size)�	__class__rrrGsz_Accumulator.__init__cCs|j||f�dS)N)r!)rErnrrrrr|#sz_Accumulator.pushcCs||d�}g||d�<|S)Nr)rEr�Zpoppedrrrr�&sz_Accumulator.pop_fromcs|j�dkrdSt�j�S)Nrr)rr)r�r�r)rE)r�rrr+sz_Accumulator.popcCstdd�|D�|j�S)Ncss"|]\}}t|�t|�VqdS)N)r()rrnr�rrr�	<genexpr>1sz'_Accumulator.__len__.<locals>.<genexpr>)�sumr�)rErrr�__len__0sz_Accumulator.__len__cCstjdd�|D��S)Ncss |]\}}tj||f�VqdS)N)rRrS)rrnr�rrrr�5sz'_Accumulator.__str__.<locals>.<genexpr>)rRrS)rErrrrW4s
z_Accumulator.__str__NcCs"|dkrg}||dd�<d|_dS)Nr)r�)rEZstartvalrrrr~8sz_Accumulator.resetcCs|jdko|pt|�j�S)Nr)r�rr$)rErrrr}>sz_Accumulator.is_onlywscs
t�j�S)N)r�r�)rE)r�rrr�Asz_Accumulator.part_count)r)r)N)
rqrrrsrGr|r�rr�rWr~r}r��
__classcell__rr)r�rrxs

rxz        )NNr)#�__all__r�r*Zemail.quoprimimer&Zemail.base64mimeZemail.errorsrrrr<r{rQr/ZSPACE8rRrBr�r@r[�compile�VERBOSE�
IGNORECASE�	MULTILINErZfcrerhr'Z_max_appendrrrrb�listrxrrrr�<module>s>

_
k