Your IP : 13.58.191.60


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

U

e5d�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\eZdZdd�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�(/usr/lib64/python3.8/email/feedparser.py�__init__5szBufferedSubFile.__init__cCs|j�|�dS�N)r�append)rZpredrrr�push_eof_matcher@sz BufferedSubFile.push_eof_matchercCs
|j��Sr)r�poprrrr�pop_eof_matcherCszBufferedSubFile.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.readlinecCs|j�|�dSr)r
r#�rr$rrr�
unreadline`szBufferedSubFile.unreadlinecCsx|j�|�d|kr d|kr dS|j�d�|j��}|j�d�|j��|d�d�sj|j�|���|�|�dS)Nr	�
r���)r�writerrr�endswithrr)r�data�partsrrr�pushes

zBufferedSubFile.pushcCs|j�|�dSr)r
�extend)r�linesrrrrzszBufferedSubFile.pushlinescCs|Srrrrrr�__iter__}szBufferedSubFile.__iter__cCs|��}|dkrt�|Sr)r%�
StopIterationr&rrr�__next__�szBufferedSubFile.__next__N)
�__name__�
__module__�__qualname__rrrrr%r'r.rr1r3rrrrr
-sr
c@s\eZdZded�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)rN��policycCs�||_d|_|dkr<|jdkr2ddlm}||_qn|j|_n2||_z||jd�Wntk
rld|_YnXt�|_g|_	|�
�j|_d|_
d|_d|_dS)NFr)�Messager7T)r8�_old_style_factoryZmessage_factoryZ
email.messager9�_factory�	TypeErrorr
�_input�	_msgstack�	_parsegenr3�_parse�_cur�_last�_headersonly)rr;r8r9rrrr�s$

zFeedParser.__init__cCs
d|_dS)NT)rCrrrr�_set_headersonly�szFeedParser._set_headersonlycCs|j�|�|��dSr)r=r.�_call_parse�rr,rrr�feed�szFeedParser.feedcCs&z|��Wntk
r YnXdSr)r@r2rrrrrE�szFeedParser._call_parsecCsH|j��|��|��}|��dkrD|��sDt��}|j�	||�|S)N�	multipart)
r=rrE�_pop_message�get_content_maintypeZis_multipartrZ!MultipartInvariantViolationDefectr8�
handle_defect)r�root�defectrrrr�s
�zFeedParser.closecCsn|jr|��}n|j|jd�}|jr<|j��dkr<|�d�|jrR|jd�|�|j�|�||_||_	dS)Nr7zmultipart/digestzmessage/rfc822r))
r:r;r8rA�get_content_typeZset_default_typer>ZattachrrB)r�msgrrr�_new_message�s

zFeedParser._new_messagecCs(|j��}|jr|jd|_nd|_|S)Nr))r>rrA)r�retvalrrrrI�s

zFeedParser._pop_messageccs|��g}|jD]Z}|tkr&tVqt�|�sbt�|�s^t��}|j�	|j
|�|j�|�qn|�|�q|�
|�|jr�g}|j��}|tkr�tVq�|dkr�q�|�|�q�|j
�t�|��dS|j
��dk�r�|j�tj�|��D]}|tk�rtVq��qq�|��}|j��|j��}|tk�rDtV�q�qD�q|j��}|tk�rjtV�qD�qj�qD|dk�rx�q�|j�|�q�dS|j
��dk�r�|��D] }|tk�r�tV�q��qĐq�|��dS|j
��dk�r�|j
��}|dk�rRt��}|j�	|j
|�g}|jD]$}|tk�r.tV�q|�|��q|j
�t�|��dSt|j
�dd����dk�r�t��}|j�	|j
|�d|}t� d	t�!|�d
�}	d}
g}d}d}
|j��}|tk�r�tV�q�|dk�r�q�|	�|�}|�r�|�"d
��rd}
|�"d�}�q�|
�rr|�r^|d}t#�$|�}|�rP|dt%|�"d���|d<t�|�|j
_&d}
|j�|��q�|j��}|tk�r�tV�qr|	�|�}|�sr|j�|��q��qr|j�|	j�|��D] }|tk�r�tV�q��q�q�|j'��dk�rT|j'j(}|dk�rd|j'_(n:|dk	�r�t#�$|�}|�r�t%|�"d��}|d|�|j'_(nD|j'j)}t*|t��r�t#�$|�}|�r�|dt%|�"d���}||j'_)|j��|��|j
|_'n
|�|��q�|
�r*t�+�}|j�	|j
|�|j
�t�|��g}|jD]}|tk�r�tV�q��q�t�|�|j
_(dS|
�sLt�,�}|j�	|j
|�dS|�rZdg}ng}|jD]$}|tk�r|tV�qd|�|��qd|�r�|d}t-�|�}|�r�|t%|�"d��d�|d<t�|�|j
_(dSg}|jD]$}|tk�r�tV�q�|�|��q�|j
�t�|��dS)Nrzmessage/delivery-status�messagerHzcontent-transfer-encoding�8bit)Z7bitrSZbinaryz--z(?P<sep>z4)(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$TF�end�linesepr)r).rPr=r �headerRE�match�NLCRErZ MissingHeaderBodySeparatorDefectr8rKrAr'r�_parse_headersrCr%Zset_payload�EMPTYSTRING�joinrNrr?rIrrJZget_boundaryZNoBoundaryInMultipartDefect�str�get�lowerZ-InvalidMultipartContentTransferEncodingDefect�re�compile�escape�group�	NLCRE_eol�search�len�preamblerB�epilogueZ_payload�
isinstanceZStartBoundaryNotFoundDefectZCloseBoundaryNotFoundDefect�	NLCRE_bol)rZheadersr$rMr0rQrO�boundaryZ	separatorZ
boundaryreZcapturing_preamblerfrUZclose_boundary_seen�moZlastlineZeolmorgrTZpayload�	firstlineZbolmorrrr?�s`

















���
























zFeedParser._parsegenc	CsXd}g}t|�D�]&\}}|ddkrR|sFt�|�}|j�|j|�q|�|�q|rt|jj|j�|��dg}}|�	d�r�|dkr�t
�|�}|r�|dt|�
d���}|j�|�qn<|t|�dkr�|j�|�dSt�|�}|jj�|�q|�d�}|dk�r&t�d�}|jj�|�q|d|�}|g}q|�rT|jj|j�|��dS)Nrrz 	zFrom ��:zMissing header name.)�	enumeraterZ#FirstHeaderLineIsContinuationDefectr8rKrArZset_rawZheader_source_parse�
startswithrcrdrerbZset_unixfromr=r'ZMisplacedEnvelopeHeaderDefectZdefects�findZInvalidHeaderDefect)	rr0Z
lastheaderZ	lastvalue�linenor$rMrk�irrrrY�sF








zFeedParser._parse_headers)N)
r4r5r6rrrDrGrErrPrIr?rYrrrrr�s

~cseZdZ�fdd�Z�ZS)rcst��|�dd��dS)N�ascii�surrogateescape)�superrG�decoderF��	__class__rrrGszBytesFeedParser.feed)r4r5r6rG�
__classcell__rrrxrrs)�__all__r_ZemailrZemail._policybaser�collectionsr�iorr`rXrircZNLCRE_crackrVrZ�NL�objectr r
rrrrrr�<module>s&




[

?>