Hacked By AnonymousFox

Current Path : /lib64/python3.8/email/__pycache__/
Upload File :
Current File : //lib64/python3.8/email/__pycache__/header.cpython-38.opt-2.pyc

U

e5d&^�@s�dddgZddlZddlZddlZddlZddlmZddlmZ	e	j
Z
dZdZd	Z
d
ZdZdZd
Ze
d�Ze
d�Ze�dejejB�Ze�d�Ze�d�ZejjZdd�Zddd�ZGdd�d�ZGdd�d�ZGdd�de �Z!dS)�Header�
decode_header�make_header�N)�HeaderParseError)�charset�
� � z        ��Nz 	�us-asciizutf-8ai
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qQbB])  # 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�St�|�s.|dfgSg}|��D]�}t�|�}d}|r:|�d�}|rj|��}d}|r~|�|ddf�|rL|�d��	�}|�d��	�}|�d�}|�|||f�qLq:g}	t
|�D]J\}
}|
dkr�|dr�||
ddr�||
dd��r�|	�|
d�q�t|	�D]}||=�qg}
|D]�\}}}|dk�rV|
�||f�n�|d	k�r|t
j�|�}|
�||f�n~|d
k�r�t|�d}|�r�|ddd|�7}zt
j�|�}Wn tjk
�r�td
��YnX|
�||f�ntd|���q2g}d}}|
D]v\}}t|t��r,t|d�}|dk�r@|}|}nB||k�rb|�||f�|}|}n |dk�rz|t|7}n||7}�q|�||f�|S)N�_chunkscSs(g|] \}}t�|t|��t|�f�qS�)�_charsetZ_encode�str)�.0�stringrrr�$/usr/lib64/python3.8/email/header.py�
<listcomp>Ms�z!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=s|
�




4







cCsFt|||d�}|D].\}}|dk	r4t|t�s4t|�}|�||�q|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|�|||�|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�|��g}d}d}|jD]�\}}|}|tjkrH|�dd�}|�dd�}|r�|o\|�|d�}|dkr�|dkr�|s�|�t�d}n|dkr�|s�|�t�|o�|�|d�}|}|�|�qt	�
|�S)N�ascii�surrogateescape�replacer�Nr���)�
_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|�dd�}n|�||�}|jpbd}|tjkr�z|�||�Wn"t	k
r�|dkr��t
}YnX|j�||f�dS)NrrI)
rr-r<rZinput_codecrNr)Zoutput_codecrO�UnicodeEncodeError�UTF8r
r!)rEr>rrFZ
input_charsetZoutput_charsetrrrr!	s$






z
Header.appendcCs|��p|dkS)N)�(�)�\)r$)rEr>rrrrP4szHeader._nonctext�;, 	rcCs�|��|dkr|j}|dkr"d}t|j||j|�}d}d}}|jD�]\}}	|dk	r�|oh|�|d�}|dkr�|r~|	dkr�|��n|	dkr�|s�|��|o�|�|d�}|	}d}|��}
|
r�|�	d|
d|	�n|�	dd|	�|
dd�D]`}|�
�|	jdk	�r"|�	|jd|��|	�q�|��}|dt
|�t
|��}
|�	|
||	�q�t
|
�dkrF|�
�qF|j�rx|��|�|�}t�|��r�td	�|���|S)
Nri@BrKrLFr
rrz8header value appears to contain an embedded header: {!r})rMrC�_ValueFormatterrDrAr
rP�add_transitionr�feed�newline�header_encodingr r(�_str�_embedded_headerrr�format)rE�
splitcharsr9�linesepZ	formatterrTrVrUrr�linesr1Zsline�fws�valuerrrrO9sZ!�
�

�z
Header.encodecCsxg}d}g}|jD]B\}}||kr.|�|�q|dk	rJ|�t�|�|f�|g}|}q|rn|�t�|�|f�||_dSrX)r
r!rQrS)rEZchunksr8Z
last_chunkrrrrrrM�szHeader._normalize)NNNNrr?)Nr?)r`Nr)
�__name__�
__module__�__qualname__rGrWrZr!rPrOrMrrrrr�s�
/ 
+
Pc@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)racCs0||_||_t|�|_||_g|_t|�|_dSrX)�_maxlenrAr(�_continuation_ws_len�_splitchars�_lines�_Accumulator�
_current_line)rEZ	headerlen�maxlenr;rirrrrG�s
z_ValueFormatter.__init__cCs|��|�|j�SrX)rdrSrt)rErjrrrrf�sz_ValueFormatter._strcCs
|�t�SrX)rf�NL�rErrrrW�sz_ValueFormatter.__str__cCsv|j��}|dkr|jj|�t|j�dkrh|j��rV|jrV|jdt|j�7<n|j�t|j��|j��dS)N)rr
rrL)	rvr�pushr(�	is_onlywsrtrr!�reset)rEZend_of_linerrrrd�s
z_ValueFormatter.newlinecCs|j�dd�dS)Nrr
)rvrzryrrrrb�sz_ValueFormatter.add_transitioncCs�|jdkr|�|||j�dS|�||���}z|�d�}Wntk
rRYdSX|dk	rh|�||�z|��}Wntk
r�YdSX|��|j	�
|j|�|D]}|j�
|j|�q�dS�Nr)re�_ascii_splitrsZheader_encode_lines�_maxlengthsr�
IndexError�
_append_chunkrdrvrzrArtr!)rErlrrZ
encoded_linesZ
first_line�	last_liner1rrrrc�s$
z_ValueFormatter.feedccs&|jt|j�V|j|jVqdSrX)rqr(rvrrryrrrr�sz_ValueFormatter._maxlengthscCsft�dtd||�}|dr0dg|dd�<n
|�d�tt|�gd�D]\}}|�||�qLdS)Nz([z]+)rr
r)�rer�FWSr�zip�iterr�)rErlrrir2�partrrrr~�s
z_ValueFormatter._ascii_splitcCs|j�||�t|j�|jk�r|jD]v}t|j��ddd�D]T}|��rn|j|d}|rn|d|krnq�|j|dd}|r@|d|kr@q�q@q&q�q&|j��\}}|jj	dkr�|�
�|s�d}|j�||�dS|j�|�}|j�
t|j��|j�|�dS)NrrrLr)rvrzr(rqrs�range�
part_countr$r�
_initial_sizerd�pop_fromrtr!rr|)rErlrZch�iZprevpartr�Z	remainderrrrr��s.
z_ValueFormatter._append_chunkN)rnrorprGrfrWrdrbrcrr~r�rrrrra�s%racsjeZdZd�fdd�	Zdd�Zddd�Z�fdd	�Zd
d�Zdd
�Zddd�Z	dd�Z
�fdd�Z�ZS)rurcs||_t���dSrX)r��superrG)rEZinitial_size��	__class__rrrGsz_Accumulator.__init__cCs|�||f�dSrX)r!)rErlrrrrrz#sz_Accumulator.pushcCs||d�}g||d�<|SrXr)rEr�Zpoppedrrrr�&sz_Accumulator.pop_fromcs|��dkrdSt���S)Nr)r
r
)r�r�rryr�rrr+sz_Accumulator.popcCstdd�|D�|j�S)Ncss"|]\}}t|�t|�VqdSrX)r(�rrlr�rrr�	<genexpr>1sz'_Accumulator.__len__.<locals>.<genexpr>)�sumr�ryrrr�__len__0s�z_Accumulator.__len__cCst�dd�|D��S)Ncss |]\}}t�||f�VqdSrX�rRrSr�rrrr�5s�z'_Accumulator.__str__.<locals>.<genexpr>r�ryrrrrW4s
�z_Accumulator.__str__NcCs"|dkrg}||dd�<d|_dSr})r�)rEZstartvalrrrr|8sz_Accumulator.resetcCs|jdko|pt|���Sr})r�rr$ryrrrr{>sz_Accumulator.is_onlywscs
t���SrX)r�r�ryr�rrr�Asz_Accumulator.part_count)r)r)N)
rnrorprGrzr�rr�rWr|r{r��
__classcell__rrr�rrus

ru)NNr)"�__all__r�r*Zemail.quoprimimer&Zemail.base64mimeZemail.errorsrrrr<rxrQr/ZSPACE8rRrBr�r@r\�compile�VERBOSE�	MULTILINErZfcrergr'Z_max_appendrrrra�listrurrrr�<module>sD�
�

_�
k

Hacked By AnonymousFox1.0, Coded By AnonymousFox