Your IP : 3.143.7.112


Current Path : /opt/alt/python310/lib64/python3.10/email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/email/__pycache__/header.cpython-310.opt-2.pyc

o

6��f&^�@s�	gd�ZddlZddlZddlZddlZddlmZddlmZ	e	j
Z
dZdZdZ
dZd	Zd
ZdZe
d�Ze
d
�Ze�dejejB�Ze�d�Ze�d�ZejjZdd�Z		ddd�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]A}t�|�}d}|r_|�d�}|r6|��}d}|r@|�|ddf�|r]|�d��	�}|�d��	�}|�d�}|�|||f�|s)qg}	t
|�D]%\}
}|
dkr�|dr�||
ddr�||
dd��r�|	�|
d�qft|	�D]}||=q�g}
|D][\}}}|dur�|
�||f�q�|d	kr�t
j�|�}|
�||f�q�|d
kr�t|�d}|r�|ddd|�7}zt
j�|�}Wntjy�td
��w|
�||f�q�td|��g}d}}|
D]:\}}t|t��r
t|d�}|du�r|}|}q�||k�r(|�||f�|}|}q�|du�r4|t|7}q�||7}q�|�||f�|S)N�_chunkscSs(g|]\}}t�|t|��t|�f�qS�)�_charsetZ_encode�str)�.0�stringrrr�3/opt/alt/python310/lib64/python3.10/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��




rcCsH	t|||d�}|D]\}}|durt|t�st|�}|�||�q
|S)N)�
maxlinelen�header_name�continuation_ws)rr-�Charsetr!)Zdecoded_seqr9r:r;�h�srrrrr�s
�rc@sPeZdZ			ddd�Zdd�Zdd	�Zdd
d�Zdd
�Zddd�Zdd�Z	dS)rNr�strictcCs�	|durt}n	t|t�st|�}||_||_g|_|dur%|�|||�|dur+t}||_|dur7d|_	dSt
|�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]O\}}|}|tjkr%|�dd�}|�dd�}|rM|o/|�|d�}|dvrB|dvrA|sA|�t�d}n|dvrM|sM|�t�|oU|�|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__sz
Header.__eq__cCs�	|dur	|j}n	t|t�st|�}t|t�s.|jpd}|tjkr(|�dd�}n|�||�}|jp2d}|tjkrQz|�||�Wnt	yP|dkrL�t
}Ynw|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|dvS)N)�(�)�\)r$)rEr>rrrrP4szHeader._nonctext�;, 	rcCs�	|��|dur|j}|dkrd}t|j||j|�}d}d}}|jD]�\}}	|durN|o4|�|d�}|dvrD|r?|	dvrC|��n
|	dvrN|sN|��|oV|�|d�}|	}d}|��}
|
rk|�	d|
d|	�n|�	dd|	�|
dd�D]/}|�
�|	jdur�|�	|jd|��|	�qx|��}|dt
|�t
|��}
|�	|
||	�qxt
|
�dkr�|�
�q$|jr�|��|�|�}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�valuerrrrO9s^ ��
��

�z
Header.encodecCsxg}d}g}|jD]!\}}||kr|�|�q	|dur%|�t�|�|f�|g}|}q	|r7|�t�|�|f�||_dSrX)r
r!rQrS)rEZchunksr8Z
last_chunkrrrrrrM�s
zHeader._normalize)NNNNrr?)Nr?)r`Nr)
�__name__�
__module__�__qualname__rGrWrZr!rPrOrMrrrrr�s
�/ 
+
Prc@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�sz_ValueFormatter._strcCs
|�t�SrX)rf�NL�rErrrrW��
z_ValueFormatter.__str__cCsv|j��}|dkr|jj|�t|j�dkr4|j��r+|jr+|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
)rvr{ryrrrrb��z_ValueFormatter.add_transitioncCs�|jdur|�|||j�dS|�||���}z|�d�}Wn
ty(YdSw|dur3|�||�z|��}Wn
tyCYdSw|��|j	�
|j|�|D]}|j�
|j|�qRdS�Nr)re�_ascii_splitrsZheader_encode_lines�_maxlengthsr�
IndexError�
_append_chunkrdrvr{rArtr!)rErlrrZ
encoded_linesZ
first_line�	last_liner1rrrrc�s*
���z_ValueFormatter.feedccs&�|jt|j�V	|j|jVqrX)rqr(rvrrryrrrr��s
��z_ValueFormatter._maxlengthscCsft�dtd||�}|drdg|dd�<n|�d�tt|�gd�D]
\}}|�||�q&dS)Nz([z]+)rr
r)�rer�FWSr�zip�iterr�)rErlrrir2�partrrrr��s
�z_ValueFormatter._ascii_splitcCs|j�||�t|j�|jkr�|jD]:}t|j��ddd�D]*}|��r6|j|d}|r6|d|kr6n|j|dd}|rI|d|krInqqn|j��\}}|jj	dkrb|�
�|sbd}|j�||�dS|j�|�}|j�
t|j��|j�|�dSdS)NrrrLr)rvr{r(rqrs�range�
part_countr$r�
_initial_sizerd�pop_fromrtr!rr})rErlrZch�iZprevpartr�Z	remainderrrrr��s2
��z_ValueFormatter._append_chunkN)rnrorprGrfrWrdrbrcr�r�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!)rErlrrrrr{#r~z_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>1s�"z'_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"|durg}||dd�<d|_dSr)r�)rEZstartvalrrrr}8s
z_Accumulator.resetcCs|jdko
|p
t|���Sr)r�rr$ryrrrr|>sz_Accumulator.is_onlywscs
t���SrX)r�r�ryr�rrr�Arzz_Accumulator.part_count)rrX)
rnrorprGr{r�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>sB
�

_
�k

?>