Your IP : 18.118.32.6


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

o

6��f�X�@s�	ddgZddlZddlmZddlmZddlmZddlm	Z	e�
d�Ze�
d	�Ze�
d
�Z
e�
d	�Ze�
d�ZdZd
Ze�ZGdd�de�ZGdd�d�ZGdd�de�ZdS)�
FeedParser�BytesFeedParser�N)�errors)�compat32)�deque)�StringIOz
\r\n|\r|\nz(\r\n|\r|\n)z(\r\n|\r|\n)\Zz%^(From |[\041-\071\073-\176]*:|[\t ])��
c@s^eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�BufferedSubFilecCs$tdd�|_t�|_g|_d|_dS)Nr)�newlineF)r�_partialr�_lines�	_eofstack�_closed��self�r�7/opt/alt/python310/lib64/python3.10/email/feedparser.py�__init__5s
zBufferedSubFile.__init__cC�|j�|�dS�N)r�append)rZpredrrr�push_eof_matcher@�z BufferedSubFile.push_eof_matchercCs
|j��Sr)r�poprrrr�pop_eof_matcherC�
zBufferedSubFile.pop_eof_matchercCs<|j�d�|�|j���|j�d�|j��d|_dS)NrT)r�seek�	pushlines�	readlines�truncaterrrrr�closeFs


zBufferedSubFile.closecCsL|js
|jrdStS|j��}t|j�D]}||�r#|j�|�dSq|S�Nr)r
r�NeedMoreData�popleft�reversedr�
appendleft)r�lineZateofrrr�readlineNs
�zBufferedSubFile.readlinecCrr)r
r&�rr'rrr�
unreadline`szBufferedSubFile.unreadlinecCsz	|j�|�d|vrd|vrdS|j�d�|j��}|j�d�|j��|d�d�s6|j�|���|�|�dS)Nr	�
r���)r�writerrr �endswithrr)r�data�partsrrr�pushes

zBufferedSubFile.pushcCrr)r
�extend)r�linesrrrrzrzBufferedSubFile.pushlinescCs|Srrrrrr�__iter__}szBufferedSubFile.__iter__cCs|��}|dkr
t�|Sr")r(�
StopIterationr)rrr�__next__�szBufferedSubFile.__next__N)
�__name__�
__module__�__qualname__rrrr!r(r*r1rr4r6rrrrr
-sr
c@s^eZdZ	ded�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)rN��policycCs�	||_d|_|dur|jdurddlm}||_n|j|_n||_z||jd�Wnty6d|_Ynwt�|_g|_	|�
�j|_d|_
d|_d|_dS)NFr)�Messager:T)r;�_old_style_factoryZmessage_factoryZ
email.messager<�_factory�	TypeErrorr
�_input�	_msgstack�	_parsegenr6�_parse�_cur�_last�_headersonly)rr>r;r<rrrr�s(


�
zFeedParser.__init__cCs
d|_dS)NT)rFrrrr�_set_headersonly�rzFeedParser._set_headersonlycCs	|j�|�|��dSr)r@r1�_call_parse�rr/rrr�feed�szFeedParser.feedcCs$z|��WdStyYdSwr)rCr5rrrrrH�s
�zFeedParser._call_parsecCsJ	|j��|��|��}|��dkr#|��s#t��}|j�	||�|S)N�	multipart)
r@r!rH�_pop_message�get_content_maintypeZis_multipartrZ!MultipartInvariantViolationDefectr;�
handle_defect)r�root�defectrrrr!�s
�zFeedParser.closecCsn|jr|��}n|j|jd�}|jr|j��dkr|�d�|jr)|jd�|�|j�|�||_||_	dS)Nr:zmultipart/digestzmessage/rfc822r,)
r=r>r;rD�get_content_typeZset_default_typerAZattachrrE)r�msgrrr�_new_message�s


zFeedParser._new_messagecCs*|j��}|jr|jd|_|Sd|_|S)Nr,)rArrD)r�retvalrrrrL�s
�zFeedParser._pop_messageccs��|��g}|jD]-}|turtVq
t�|�s2t�|�s0t��}|j�	|j
|�|j�|�n|�|�q
|�
|�|jrfg}	|j��}|turPtVqB|dkrUn|�|�qC|j
�t�|��dS|j
��dkr�	|j�tj�|��D]
}|tur�tVqy|��}|j��	|j��}|tur�tVq�		|j��}|tur�tVq�	|dkr�	dS|j�|�qn|j
��dkr�|��D]
}|tur�tVq�|��dS|j
��dk�r�|j
��}|du�rt��}|j�	|j
|�g}|jD]}|tu�rtVq�|�|�q�|j
�t�|��dSt|j
�dd����dv�r.t��}|j�	|j
|�d	|}t� d
t�!|�d�}	d}
g}d}d}
	|j��}|tu�rVtV�qF|dk�r\n�|	�|�}|�r@|�"d
��rrd}
|�"d�}n�|
�r�|�r�|d}t#�$|�}|�r�|dt%|�"d���|d<t�|�|j
_&d}
|j�|��qF	|j��}|tu�r�tV�q�|	�|�}|�s�|j�|�n�q�|j�|	j�|��D]}|tu�r�tV�q�|j'��dk�r|j'j(}|dk�r�d|j'_(n@|du�rt#�$|�}|�rt%|�"d��}|d|�|j'_(n"|j'j)}t*|t��r2t#�$|�}|�r2|dt%|�"d���}||j'_)|j��|��|j
|_'n|�|��qG|
�r{t�+�}|j�	|j
|�|j
�t�|��g}|jD]
}|tu�rptV�qd�qdt�|�|j
_(dS|
�s�t�,�}|j�	|j
|�dS|�r�dg}ng}|jD]}|tu�r�tV�q�|�|��q�|�r�|d}t-�|�}|�r�|t%|�"d��d�|d<t�|�|j
_(dSg}|jD]}|tu�r�tV�q�|�|��q�|j
�t�|��dS)NTrzmessage/delivery-status�messagerKzcontent-transfer-encoding�8bit)Z7bitrVZbinaryz--z(?P<sep>z4)(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$F�end�linesepr,r).rSr@r#�headerRE�match�NLCRErZ MissingHeaderBodySeparatorDefectr;rNrDr*r�_parse_headersrFr(Zset_payload�EMPTYSTRING�joinrQrrBrLrrMZget_boundaryZNoBoundaryInMultipartDefect�str�get�lowerZ-InvalidMultipartContentTransferEncodingDefect�re�compile�escape�group�	NLCRE_eol�search�len�preamblerE�epilogueZ_payload�
isinstanceZStartBoundaryNotFoundDefectZCloseBoundaryNotFoundDefect�	NLCRE_bol)rZheadersr'rPr3rTrR�boundaryZ	separatorZ
boundaryreZcapturing_preamblerirXZclose_boundary_seen�moZlastlineZeolmorjrWZpayload�	firstlineZbolmorrrrB�sz�





�


��!



���








�




�



�S

�




zFeedParser._parsegenc	CsTd}g}t|�D]�\}}|ddvr(|s"t�|�}|j�|j|�q|�|�q|r9|jj|j�|��dg}}|�	d�rz|dkr\t
�|�}|rU|dt|�
d���}|j�|�q|t|�dkrm|j�|�dSt�|�}|jj�|�q|�d�}|dkr�t�d�}|jj�|�q|d|�}|g}q|r�|jj|j�|��dSdS)Nrrz 	zFrom ��:zMissing header name.)�	enumeraterZ#FirstHeaderLineIsContinuationDefectr;rNrDrZset_rawZheader_source_parse�
startswithrfrgrhreZset_unixfromr@r*ZMisplacedEnvelopeHeaderDefectZdefects�findZInvalidHeaderDefect)	rr3Z
lastheaderZ	lastvalue�linenor'rPrn�irrrr\�sH







�zFeedParser._parse_headersr)
r7r8r9rrrGrJrHr!rSrLrBr\rrrrr�s

~cseZdZ	�fdd�Z�ZS)rcst��|�dd��dS)N�ascii�surrogateescape)�superrJ�decoderI��	__class__rrrJszBytesFeedParser.feed)r7r8r9rJ�
__classcell__rrr{rrs)�__all__rbZemailrZemail._policybaser�collectionsr�iorrcr[rlrfZNLCRE_crackrYr]�NL�objectr#r
rrrrrr�<module>s*




[

?>