%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/email/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/email/__pycache__/feedparser.cpython-312.pyc

�

���fY��R�dZddgZddlZddlmZddlmZddlmZddl	m
Z
ejd	�Zejd
�Z
ejd�Zejd
�Zejd�Zd
ZdZe�ZGd�de�ZGd�d�ZGd�de�Zy)aFeedParser - An email feed parser.

The feed parser implements an interface for incrementally parsing an email
message, line by line.  This has advantages for certain applications, such as
those reading email messages off a socket.

FeedParser.feed() is the primary interface for pushing new data into the
parser.  It returns when there's nothing more it can do with the available
data.  When you have no more data to push into the parser, call .close().
This completes the parsing and returns the root message object.

The other advantage of this parser is that it will never raise a parsing
exception.  Instead, when it finds something unexpected, it adds a 'defect' to
the current message.  Defects are just instances that live on the message
object's .defects attribute.
�
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�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�BufferedSubFileakA file-ish object that can have new data loaded into it.

    You can also push and pop line-matching predicates onto a stack.  When the
    current predicate matches the current line, a false EOF response
    (i.e. empty string) is returned instead.  This lets the parser adhere to a
    simple abstraction -- it parses until EOF closes the current message.
    c�`�td��|_t�|_g|_d|_y)Nr	)�newlineF)r�_partialr�_lines�	_eofstack�_closed��selfs �'/usr/lib/python3.12/email/feedparser.py�__init__zBufferedSubFile.__init__4s'��!��,��
��g���������c�:�|jj|�y�N)r�append)r�preds  r�push_eof_matcherz BufferedSubFile.push_eof_matcher?s�������d�#rc�6�|jj�Sr)r�poprs r�pop_eof_matcherzBufferedSubFile.pop_eof_matcherBs���~�~�!�!�#�#rc��|jjd�|j|jj��|jjd�|jj	�d|_y)NrT)r�seek�	pushlines�	readlines�truncaterrs r�closezBufferedSubFile.closeEsV���
�
���1�����t�}�}�.�.�0�1��
�
���1���
�
��� ���rc��|js|jrytS|jj�}t	|j
�D]'}||�s�|jj
|�y|S�Nr	)rr�NeedMoreData�popleft�reversedr�
appendleft)r�line�ateofs   r�readlinezBufferedSubFile.readlineMsj���{�{��|�|�����{�{�"�"�$���d�n�n�-�	�E��T�{����&�&�t�,��		�
�rc�N�|tusJ�|jj|�yr)r(rr+�rr,s  r�
unreadlinezBufferedSubFile.unreadline_s"���<�'�'�'������t�$rc��|jj|�d|vrd|vry|jjd�|jj�}|jjd�|jj	�|djd�s)|jj|j
��|j|�y)z$Push some new data into this object.r
�
Nr���)r�writer!r#r$�endswithrr")r�data�partss   r�pushzBufferedSubFile.pushds����
�
���D�!��t���D� 0��	
�
�
���1���
�
�'�'�)���
�
���1���
�
��� ��R�y�!�!�$�'��M�M����	�	��,����u�rc�:�|jj|�yr)r�extend)r�liness  rr"zBufferedSubFile.pushlinesys�������5�!rc��|Sr�rs r�__iter__zBufferedSubFile.__iter__|s���rc�<�|j�}|dk(rt�|Sr')r.�
StopIterationr0s  r�__next__zBufferedSubFile.__next__s���}�}����2�:����rN)�__name__�
__module__�__qualname__�__doc__rrrr%r.r1r9r"r?rBr>rrrr,s9���	�$�$���$%�
�*"��rrc�N�eZdZdZd
ed�d�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
y)rzA feed-style parser of email.N��policyc�r�||_d|_|�,|j�ddlm}||_n-|j|_n||_	||j��t�|_g|_	|j�j|_d|_
d|_d|_y#t$r
d|_Y�]wxYw)a_factory is called with no arguments to create a new message obj

        The policy keyword specifies a policy object that controls a number of
        aspects of the parser's operation.  The default policy maintains
        backward compatibility.

        FNr)�MessagerHT)rI�_old_style_factory�message_factory�
email.messagerK�_factory�	TypeErrorr�_input�	_msgstack�	_parsegenrB�_parse�_cur�_last�_headersonly)rrOrIrKs    rrzFeedParser.__init__�s������"'������%�%�-�1� '��
� &� 6� 6��
�$�D�M�
/�����,�&�'�������n�n�&�/�/�����	���
�!�����
/�*.��'�
/�s�B#�#B6�5B6c��d|_y)NT)rWrs r�_set_headersonlyzFeedParser._set_headersonly�s
�� ��rc�Z�|jj|�|j�y)zPush more data into the parser.N)rQr9�_call_parse)rr7s  r�feedzFeedParser.feed�s ������������rc�D�	|j�y#t$rYywxYwr)rTrArs rr[zFeedParser._call_parse�s"��	��K�K�M���	��	�s��	�c�T�|jj�|j�|j�}|jrJ�|j�dk(rL|j
�s<|js0tj�}|jj||�|S)z<Parse all remaining data and return the root message object.�	multipart)rQr%r[�_pop_messagerR�get_content_maintype�is_multipartrWr�!MultipartInvariantViolationDefectrI�
handle_defect)r�root�defects   rr%zFeedParser.close�s�������������� � �"���>�>�!�!��$�$�&�+�5��(�(�*�4�3D�3D��=�=�?�F��K�K�%�%�d�F�3��rc��|jr|j�}n|j|j��}|jr.|jj	�dk(r|jd�|jr|jdj|�|jj|�||_||_	y)NrHzmultipart/digestzmessage/rfc822r4)
rLrOrIrU�get_content_type�set_default_typerR�attachrrV)r�msgs  r�_new_messagezFeedParser._new_message�s����"�"��-�-�/�C��-�-�t�{�{�-�3�C��9�9����3�3�5�9K�K�� � �!1�2��>�>��N�N�2��%�%�c�*������c�"���	���
rc��|jj�}|jr|jd|_|Sd|_|S)Nr4)rRrrU)r�retvals  rr`zFeedParser._pop_message�s@�����#�#�%���>�>����r�*�D�I��
��D�I��
rc#�JK�|j�g}|jD]�}|tur	t���tj	|�slt
j	|�sUt
j�}|jj|j|�|jj|�n|j|���|j|�|jrug}	|jj�}|tur	t���,|dk(rn|j|��C|jj!t"j%|��y|jj'�dk(r�	|jj)t
j�|j+�D]}|tur	t���n|j-�|jj/�	|jj�}|tur	t���,		|jj�}|tur	t���,	|dk(r	y|jj|���|jj1�dk(r8|j+�D]}|tur	t���n|j-�y|jj1�dk(�r�|jj3�}|��t
j4�}|jj|j|�g}|jD]$}|tur	t���|j|��&|jj!t"j%|��yt7|jj9dd��j;�dvr:t
j<�}|jj|j|�d	|z}t?j@d
t?jB|�zdz�}d}	g}
d}d}	|jj�}|tur	t���,|dk(r�n�|j	|�}
|
�r�|
jEd
�rd}|
jEd�}�n}|	r�|
ra|
d}tFjI|�}|r!|dtK|jEd��|
d<t"j%|
�|j_&d}	|jj|���	|jj�}|tur	t���,|j	|�}
|
s|jj|�n�[|jj)|j�|j+�D]}|tur	t���n|jNj1�dk(rv|jNjP}|dk(rd|jN_(n�|��tFjI|�}
|
r�tK|
jEd��}|d||jN_(nl|jNjR}tU|t6�rFtFjI|�}
|
r/|dtK|
jEd��}||jN_)|jj/�|j-�|j|_'n|	sJ�|
j|����|	r�t
jV�}|jj|j|�|jj!t"j%|
��g}|jD]}|tus�t���t"j%|�|j_(y|s;t
jX�}|jj|j|�y|rdg}ng}|jD]$}|tur	t���|j|��&|r<|d}tZj	|�}|r |tK|jEd��d|d<t"j%|�|j_(yg}|jD]$}|tur	t���|j|��&|jj!t"j%|��y�w)NTr	zmessage/delivery-status�messager_zcontent-transfer-encoding�8bit)�7bitrq�binaryz--z(?P<sep>z4)(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$F�end�linesepr4r).rlrQr(�headerRE�match�NLCREr� MissingHeaderBodySeparatorDefectrIrdrUr1r�_parse_headersrWr.�set_payload�EMPTYSTRING�joinrhrrSr`rra�get_boundary�NoBoundaryInMultipartDefect�str�get�lower�-InvalidMultipartContentTransferEncodingDefect�re�compile�escape�group�	NLCRE_eol�search�len�preamblerV�epilogue�_payload�
isinstance�StartBoundaryNotFoundDefect�CloseBoundaryNotFoundDefect�	NLCRE_bol)r�headersr,rfr<rn�boundary�	separator�
boundaryre�capturing_preambler�ru�close_boundary_seen�mo�lastline�eolmor�rt�payload�	firstline�bolmos                     rrSzFeedParser._parsegen�s������������K�K�
	!�D��|�#�"�"���>�>�$�'��{�{�4�(�#�D�D�F�F��K�K�-�-�d�i�i��@��K�K�*�*�4�0���N�N�4� �
	!� 	
���G�$�����E���{�{�+�+�-���<�'�&�&���2�:�����T�"��
�I�I�!�!�+�"2�"2�5�"9�:���9�9�%�%�'�+D�D�����,�,�U�[�[�9�"�n�n�.��F���-�*�*� ��	�
�!�!�#����+�+�-�
��;�;�/�/�1�D��|�+�*�*� ����;�;�/�/�1�D��|�+�*�*� ���2�:��
����&�&�t�,�?�B�9�9�)�)�+�y�8��.�.�*�
���\�)�&�&���	
�

������9�9�)�)�+�{�:��y�y�-�-�/�H���
 �;�;�=�����)�)�$�)�)�V�<��� �K�K�'�D��|�+�*�*� ��L�L��&�	'�
�	�	�%�%�k�&6�&6�u�&=�>���D�I�I�M�M�"=�v�F�G�M�M�O�5�6��M�M�O�����)�)�$�)�)�V�<�
�x��I�����R�Y�Y�y�1�1�G�H�I�J�"&���H��G�"'����{�{�+�+�-���<�'�&�&���2�:���%�%�d�+���
�x�x���.2�+�"$�(�(�9�"5���)�#�(0��|�H�$-�$4�$4�X�$>�E�$�/7�8M�#�e�k�k�!�n�:M�9M�/N����1<�1A�1A�(�1K�D�I�I�.�-2�*����.�.�t�4� �
�#�{�{�3�3�5���<�/�".�.�$�'�-�-�d�3��!� �K�K�2�2�4�8�!���K�K�0�0��1A�1A�B�"&�.�.�"2���!�\�1�".�.�$��	��z�z�6�6�8�K�G�#'�:�:�#6�#6��#�r�>�26�D�J�J�/�%�1�!*�!1�!1�(�!;�B�!�&)�"�(�(�1�+�&6��6>�u���o��
�
� 3�"&�*�*�"5�"5��%�g�s�3�!*�!1�!1�'�!:�B�!�*1�2D�C������4D�3D�*E��6=��
�
� 3��K�K�/�/�1��%�%�'�"&���D�J�.�-�-��O�O�D�)�_�f"��;�;�=�����)�)�$�)�)�V�<��	�	�%�%�k�&6�&6�x�&@�A��� �K�K�!�D��|�+�*�*� �!�&1�%5�%5�h�%?��	�	�"��'��;�;�=�����)�)�$�)�)�V�<����4�������
&���<�'�&�&������%�	
&��$�Q�K�	�!���	�2���"+�C����A��,?�,@�"A�H�Q�K�!,�!1�!1�(�!;�D�I�I������K�K�	�D��|�#�"�"���L�L���		�
	
�	�	���k�.�.�u�5�6�s
�^2d#�5E.d#c�,�d}g}t|�D�]�\}}|ddvrP|s<tj|�}|jj	|j
|��L|j
|��^|r6|j
j|jj|��dg}}|jd�r�|dk(rQtj|�}|r|dt|jd��}|j
j|���|t|�dz
k(r|jj!|�ytj"|�}|j
j$j
|���g|j'd�}|dk(r<tj(d�}|j
j$j
|����|dkDsJd��|d|}|g}���|r3|j
j|jj|��yy)	Nr	rz 	zFrom ��:zMissing header name.z3_parse_headers fed line with no : and no leading WS)�	enumerater�#FirstHeaderLineIsContinuationDefectrIrdrUr�set_raw�header_source_parse�
startswithr�r�r�r��set_unixfromrQr1�MisplacedEnvelopeHeaderDefect�defects�find�InvalidHeaderDefect)	rr<�
lastheader�	lastvalue�linenor,rfr��is	         rrzzFeedParser._parse_headers�s����
��	�%�e�,�3	�L�F�D��A�w�%��!�$�G�G��M�F��K�K�-�-�d�i�i��@��� � ��&���!��	�	�!�!�4�;�;�#B�#B�9�#M�N�(*�B�I�
����w�'��Q�;�"�)�)�$�/�B��#�$6�c�"�(�(�1�+�&6�%6�7���I�I�*�*�4�0���s�5�z�A�~�-��K�K�*�*�4�0��$�A�A�$�G�F��I�I�%�%�,�,�V�4���	�	�#��A�
�A�v��3�3�4J�K���	�	�!�!�(�(��0���Q�3�M�M�M�3��b�q��J���I�g3	�j��D�I�I���t�{�{�>�>�y�I�J�rr)rCrDrErFrrrYr\r[r%rlr`rSrzr>rrrr�s<��'�"��"�>!��
����{7�z:Krc�"��eZdZdZ�fd�Z�xZS)rz(Like FeedParser, but feed accepts bytes.c�D��t�|�|jdd��y)N�ascii�surrogateescape)�superr\�decode)rr7�	__class__s  �rr\zBytesFeedParser.feeds���
���T�[�[��*;�<�=r)rCrDrErFr\�
__classcell__)r�s@rrrs���2�>�>r)rF�__all__r��emailr�email._policybaser�collectionsr�iorr�rxr�r��NLCRE_crackrvr|�NL�objectr(rrrr>rr�<module>r�s���
�"�*�
+��	��&�����
�
�=�!���B�J�J��'�	��B�J�J�(�)�	��b�j�j��)���2�:�:�>�?����	���x��W�f�W�tIK�IK�X>�j�>r

Zerion Mini Shell 1.0