Edit File: feedparser.cpython-311.opt-1.pyc
� �����fY�����������������������X����d�Z�ddgZddlZddlmZ�ddlmZ�ddlmZ�ddl m Z ��ej��������d ������������Z�ej��������d ������������Z �ej��������d������������Z�ej��������d ������������Z�ej��������d������������Zd ZdZ�e��������������Z�G�d��de������������Z�G�d��d������������Z�G�d��de������������ZdS�)a��FeedParser - 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��������������������N�����e�Zd�ZdZd��Zd��Zd��Zd��Zd��Zd��Z d��Z d ��Zd ��Zd��Z dS�) �BufferedSubFileak��A 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������������������r�����t����������d�������������|�_��������t������������������������|�_��������g�|�_��������d|�_��������d�S�)Nr ���)�newlineF)r����_partialr����_lines� _eofstack�_closed��selfs��� �7/opt/alt/python311/lib64/python3.11/email/feedparser.py�__init__zBufferedSubFile.__init__4���s3�������!��,�,�,�� ��g�g���������������c������������������:�����|�j������������������������������|�������������d�S��N)r����append)r����preds��� r����push_eof_matcherz BufferedSubFile.push_eof_matcher?���s����������d�#�#�#�#�#r���c������������������4�����|�j��������������������������������������������S�r���)r����popr���s��� r����pop_eof_matcherzBufferedSubFile.pop_eof_matcherB���s�������~�!�!�#�#�#r���c����������������������|�j������������������������������d�������������|����������������������|�j���������������������������������������������������������|�j������������������������������d�������������|�j���������������������������������������������d|�_��������d�S�)Nr���T)r����seek� pushlines� readlines�truncater���r���s��� r����closezBufferedSubFile.closeE���sm������� ���1�������t�}�.�.�0�0�1�1�1�� ���1����� ��� � � �����r���c������������������������|�j���������s|�j��������rdS�t����������S�|�j��������������������������������������������}t ����������|�j��������������������D�]*}�||������������r|�j������������������������������|��������������dS��+|S��Nr ���)r���r����NeedMoreData�popleft�reversedr���� appendleft)r����line�ateofs��� r����readlinezBufferedSubFile.readlineM���s��������{�� ��|�� ��r�����{�"�"�$�$����d�n�-�-�� �� �E��u�T�{�{�� ���&�&�t�,�,�,��r�r� ���r���c������������������:�����|�j������������������������������|�������������d�S�r���)r���r+����r���r,���s��� r���� unreadlinezBufferedSubFile.unreadline_���s ������� ����t�$�$�$�$�$r���c�����������������������|�j������������������������������|�������������d|vrd|vrdS�|�j������������������������������d�������������|�j��������������������������������������������}|�j������������������������������d�������������|�j���������������������������������������������|d������������������������������d������������s,|�j������������������������������|������������������������������������������������|����������������������|�������������dS�)z$Push some new data into this object.r ���� Nr������)r����writer!���r#���r$����endswithr���r"���)r����data�partss��� r����pushzBufferedSubFile.pushd���s�������� ���D�!�!�!��t����D� 0� 0��F�� � ���1����� �'�'�)�)��� ���1����� ��� � � ���R�y�!�!�$�'�'�� -��M���� � ���,�,�,����u�����r���c������������������:�����|�j������������������������������|�������������d�S�r���)r����extend)r����liness��� r���r"���zBufferedSubFile.pushlinesy���s����������5�!�!�!�!�!r���c�����������������������|�S�r�����r���s��� r����__iter__zBufferedSubFile.__iter__|���s�������r���c������������������H�����|�������������������������������������}|dk����rt�����������|S�r'���)r.���� StopIterationr0���s��� r����__next__zBufferedSubFile.__next__���s#�������}�}�����2�:�:����r���N)�__name__� __module__�__qualname__�__doc__r���r���r���r%���r.���r1���r9���r"���r?���rB���r>���r���r���r���r���,���s������������������ �� �� �$��$��$�$��$��$�����������$%��%��%� �����*"��"��"��������������r���r���c��������������������P�����e�Zd�ZdZd ed�d�Zd��Zd��Zd��Zd��Z d ��Z d ��Zd��Zd��Z dS�)r���zA feed-style parser of email.N��policyc�����������������f����||�_���������d|�_��������|�"|j���������ddlm}�||�_��������n>|j��������|�_��������n1||�_�������� ��||�j�����������������������n#�t����������$�r �d|�_��������Y�nw�xY�wt������������������������|�_��������g�|�_ ��������|�� ����������������������������������j��������|�_��������d|�_ ��������d|�_��������d|�_��������dS�)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���)�MessagerH���T)rI����_old_style_factory�message_factory� email.messagerK����_factory� TypeErrorr����_input� _msgstack� _parsegenrB����_parse�_cur�_last�_headersonly)r���rO���rI���rK���s��� r���r���zFeedParser.__init__����s�����������"'������%�-�1�1�1�1�1�1� '�� � � &� 6�� � �$�D�M� /�����,�,�,�,�,���� /�� /�� /�*.��'�'�'� /�����&�'�'�������n�n�&�&�/����� ��� �!����s����A �� A!� A!c�����������������������d|�_���������d�S�)NT)rW���r���s��� r����_set_headersonlyzFeedParser._set_headersonly����s������ ����r���c������������������b�����|�j������������������������������|�������������|�������������������������������������dS�)zPush more data into the parser.N)rQ���r9����_call_parse)r���r7���s��� r����feedzFeedParser.feed����s0���������������������r���c������������������R����� �|��������������������������������������d�S�#�t����������$�r�Y�d�S�w�xY�wr���)rT���rA���r���s��� r���r[���zFeedParser._call_parse����s:������ ��K�K�M�M�M�M�M���� �� �� ��D�D� ���s������ &�&c������������������J����|�j���������������������������������������������|�������������������������������������|������������������������������������}|�����������������������������������dk����rI|�����������������������������������s5|�j��������s.t����������j����������������������}|�j ��������� ��������������������||�������������|S�)z<Parse all remaining data and return the root message object.� multipart)rQ���r%���r[����_pop_message�get_content_maintype�is_multipartrW���r����!MultipartInvariantViolationDefectrI���� handle_defect)r����root�defects��� r���r%���zFeedParser.close����s��������������������� � �"�"����$�$�&�&�+�5�5��(�(�*�*��6�37�3D��6��=�?�?�F��K�%�%�d�F�3�3�3��r���c����������������������|�j���������r|������������������������������������}n|����������������������|�j���������������������}|�j��������r2|�j�������������������������������������������dk����r|���������������������d�������������|�j��������r |�j��������d������������������������������|�������������|�j�����������������������������|�������������||�_��������||�_ ��������d�S�)NrH���zmultipart/digestzmessage/rfc822r4���) rL���rO���rI���rU����get_content_type�set_default_typerR����attachr���rV���)r����msgs��� r����_new_messagezFeedParser._new_message����s��������"�� 4��-�-�/�/�C�C��-�-�t�{�-�3�3�C��9�� 3���3�3�5�5�9K�K�K�� � �!1�2�2�2��>�� +��N�2��%�%�c�*�*�*�����c�"�"�"��� ��� � � r���c������������������z�����|�j��������������������������������������������}|�j���������r|�j���������d���������|�_��������nd�|�_��������|S�)Nr4���)rR���r���rU���)r����retvals��� r���r`���zFeedParser._pop_message����s;��������#�#�%�%���>�� ���r�*�D�I�I��D�I�� r���c��������������#�������K����|��������������������������������������g�}|�j��������D�]�}|t����������u�r t����������V����t�������������������������������|������������sit �������������������������������|������������sMt ����������j����������������������}|�j��������� ��������������������|�j ��������|�������������|�j�����������������������������|��������������n|���������������������|���������������|�� ��������������������|�������������|�j��������r�g�} �|�j�������������������������������������������}|t����������u�r t����������V����-|dk����rn|���������������������|��������������I|�j �����������������������������t"�������������������������������|�������������������������d�S�|�j �������������������������������������������dk����r� �|�j�����������������������������t ����������j���������������������|������������������������������������D�]}|t����������u�r t����������V�����|������������������������������������}|�j�������������������������������������������� �|�j�������������������������������������������}|t����������u�r t����������V����- � �|�j�������������������������������������������}|t����������u�r t����������V����- �|dk����rn|�j�����������������������������|���������������d�S�|�j �������������������������������������������dk����r@|������������������������������������D�]}|t����������u�r t����������V�����|�������������������������������������d�S�|�j �������������������������������������������dk�����r|�j �������������������������������������������}|��t ����������j����������������������}|�j��������� ��������������������|�j ��������|�������������g�}|�j��������D�]*}|t����������u�r t����������V����|���������������������|��������������+|�j �����������������������������t"�������������������������������|�������������������������d�S�t7����������|�j �����������������������������dd�����������������������������������������������������������dvr3t ����������j����������������������}|�j��������� ��������������������|�j ��������|�������������d |z���}t?����������j ��������d t?����������j!��������|������������z���dz���������������} d} g�}d}d} �|�j�������������������������������������������}|t����������u�r t����������V����-|dk����r�n�| ���������������������|������������}|�r�|�"��������������������d ������������rd} |�"��������������������d������������}�n�| r�|rv|d���������}tF�����������$��������������������|������������}|r.|d�tK����������|�"��������������������d�����������������������������������|d<���t"�������������������������������|������������|�j ��������_&��������d} |�j�����������������������������|��������������� �|�j�������������������������������������������}|t����������u�r t����������V����-| ���������������������|������������}|s|�j�����������������������������|�������������n�_|�j�����������������������������| j���������������������|������������������������������������D�]}|t����������u�r t����������V�����|�j'�������������������������������������������dk����ru|�j'��������j(��������}|dk����r d�|�j'��������_(��������n�|�StF�����������$��������������������|������������}|r7tK����������|�"��������������������d������������������������}|d�|�����������|�j'��������_(��������nt|�j'��������j)��������}tU����������|t6����������������������rStF�����������$��������������������|������������}|r7|d�tK����������|�"��������������������d�����������������������������������}||�j'��������_)��������|�j��������������������������������������������|�������������������������������������|�j ��������|�_'��������n|���������������������|���������������| r�t ����������j+����������������������}|�j��������� ��������������������|�j ��������|�������������|�j �����������������������������t"�������������������������������|�������������������������g�}|�j��������D�]}|t����������u�r t����������V�����t"�������������������������������|������������|�j ��������_(��������d�S�| s5t ����������j,����������������������}|�j��������� ��������������������|�j ��������|�������������d�S�|rdg}ng�}|�j��������D�]*}|t����������u�r t����������V����|���������������������|��������������+|rQ|d���������}tZ�������������������������������|������������}|r-|tK����������|�"��������������������d������������������������d�����������|d<���t"�������������������������������|������������|�j ��������_(��������d�S�g�}|�j��������D�]*}|t����������u�r t����������V����|���������������������|��������������+|�j �����������������������������t"�������������������������������|�������������������������d�S�)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�linesepr4���r���).rl���rQ���r(����headerRE�match�NLCREr���� MissingHeaderBodySeparatorDefectrI���rd���rU���r1���r����_parse_headersrW���r.����set_payload�EMPTYSTRING�joinrh���r���rS���r`���r���ra����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,���rf���r<���rn���rk����boundary� separator� boundaryre�capturing_preambler����ru����close_boundary_seen�mo�lastline�eolmor����rt����payload� firstline�bolmos��� r���rS���zFeedParser._parsegen����s� �������������������K�� !�� !�D��|�#�#�"�"�"�"���>�>�$�'�'�� ���{�{�4�(�(��1�#�D�F�F�F��K�-�-�d�i��@�@�@��K�*�*�4�0�0�0����N�N�4� � � � �� ���G�$�$�$����� ��E� #��{�+�+�-�-���<�'�'�&�&�&�&���2�:�:�����T�"�"�"� #�� �I�!�!�+�"2�"2�5�"9�"9�:�:�:��F��9�%�%�'�'�+D�D�D� -���,�,�U�[�9�9�9�"�n�n�.�.�����F���-�-�*�*�*�*� ���'�'�)�)�����+�+�-�-�-� ��;�/�/�1�1�D��|�+�+�*�*�*�*� ����;�/�/�1�1�D��|�+�+�*�*�*�*� ���2�:�:����&�&�t�,�,�,�? -�@� �F��9�)�)�+�+�y�8�8���.�.�*�*�� �� ���\�)�)�&�&�&�&����������F��9�)�)�+�+�{�:�:��y�-�-�/�/�H��� � �;�=�=����)�)�$�)�V�<�<�<��� �K��'��'�D��|�+�+�*�*�*�*� ��L�L��&�&�&�&�� �%�%�k�&6�&6�u�&=�&=�>�>�>����D�I�M�M�"=�v�F�F�G�G�M�M�O�O�5�6��6��M�O�O����)�)�$�)�V�<�<�<� ��x��I����R�Y�y�1�1�1�G�H�I��I�J��"&���H��G�"'��O *��{�+�+�-�-���<�'�'�&�&�&�&���2�:�:���%�%�d�+�+����G*� ��x�x������.2�+�"$�(�(�9�"5�"5���)��!�#��L��(0��|�H�$-�$4�$4�X�$>�$>�E�$��O�/7�8M�#�e�k�k�!�n�n�:M�:M�9M�8M�/N����1<�1A�1A�(�1K�1K�D�I�.�-2�*���.�.�t�4�4�4� � "�#�{�3�3�5�5���<�/�/�".�.�.�.�$�'�-�-�d�3�3��!��"� �K�2�2�4�8�8�8�!�"���K�0�0��1A�B�B�B�"&�.�.�"2�"2������!�\�1�1�".�.�.�.�$�� ��z�6�6�8�8�K�G�G�#'�:�#6��#�r�>�>�26�D�J�/�/�%�1�!*�!1�!1�(�!;�!;�B�!��F�&)�"�(�(�1�+�+�&6�&6��6>�u���u�o�� � 3��"&�*�"5��%�g�s�3�3��>�!*�!1�!1�'�!:�!:�B�!��>�*1�2D�C�������4D�4D�3D�2D�*E��6=�� � 3��K�/�/�1�1�1��%�%�'�'�'��"&��D�J�J���O�O�D�)�)�)�_O *�f�"�� ��;�=�=����)�)�$�)�V�<�<�<�� �%�%�k�&6�&6�x�&@�&@�A�A�A��� �K��!��!�D��|�+�+�*�*�*�*� ��,��&1�%5�%5�h�%?�%?�� �"����'�� ��;�=�=����)�)�$�)�V�<�<�<������ ��4�������� &�� &���<�'�'�&�&�&�&������%�%�%�%���� B�$�Q�K� �!��� �2�2����B�"+�C����A���,?�,?�,@�,@�"A�H�Q�K�!,�!1�!1�(�!;�!;�D�I���F�����K�� �� �D��|�#�#�"�"�"�"���L�L������� ���k�.�.�u�5�5�6�6�6�6�6r���c������������������ ����d}g�}t����������|������������D��]�\��}}|d���������dv�rM|s5t����������j��������|������������}|�j�����������������������������|�j��������|��������������G|���������������������|��������������]|r+�|�j��������j��������|�j�����������������������������|���������������dg�}}|� ��������������������d������������r�|dk����rct�������������������������������|������������}|r+|d�t����������|� ��������������������d�����������������������������������}|�j�����������������������������|���������������|t����������|������������dz ��k����r|�j�����������������������������|��������������d�S�t����������j��������|������������}|�j��������j�����������������������������|���������������p|���������������������d������������}|dk����r5t����������j��������d������������}|�j��������j�����������������������������|����������������|d�|����������}|g}���|r)�|�j��������j��������|�j�����������������������������|���������������d�S�d�S�)Nr ���r���z zFrom �����:zMissing header name.)� enumerater����#FirstHeaderLineIsContinuationDefectrI���rd���rU���r����set_raw�header_source_parse� startswithr����r����r����r�����set_unixfromrQ���r1����MisplacedEnvelopeHeaderDefect�defects�find�InvalidHeaderDefect) r���r<���� lastheader� lastvalue�linenor,���rf���r�����is ��� r���rz���zFeedParser._parse_headers���s-������ �� �%�e�,�,��3 ��3 �L�F�D��A�w�%���!����$�G��M�M�F��K�-�-�d�i��@�@�@��� � ��&�&�&���� /�!�� �!�4�;�#B�#B�9�#M�#M�N�N�(*�B�I� ����w�'�'�� ��Q�;�;�"�)�)�$�/�/�B���8�#�$6�c�"�(�(�1�+�+�&6�&6�%6�$6�7���I�*�*�4�0�0�0���s�5�z�z�A�~�-�-���K�*�*�4�0�0�0��F�F��$�A�$�G�G�F��I�%�,�,�V�4�4�4���� � �#���A� ��A�v�v��3�4J�K�K��� �!�(�(��0�0�0����b�q�b��J���I�I��� K��D�I��t�{�>�>�y�I�I�J�J�J�J� K�� Kr���r���)rC���rD���rE���rF���r���r���rY���r\���r[���r%���rl���r`���rS���rz���r>���r���r���r���r�������s���������������'�'�"���"��"��"��"��"�>!��!��!������ ��������������������{7��{7��{7�z:K��:K��:K��:K��:Kr���c��������������������"�������e�Zd�ZdZ��fd�Z��xZS�)r���z(Like FeedParser, but feed accepts bytes.c������������������r������t���������������������������������������������|���������������������dd�������������������������d�S�)N�ascii�surrogateescape)�superr\����decode)r���r7���� __class__s��� �r���r\���zBytesFeedParser.feed��s.������� �����T�[�[��*;�<�<�=�=�=�=�=r���)rC���rD���rE���rF���r\���� __classcell__)r����s���@r���r���r�����s>���������������2�2�>��>��>��>��>��>��>��>��>r���)rF����__all__r�����emailr����email._policybaser����collectionsr����ior���r����rx���r����r�����NLCRE_crackrv���r|����NL�objectr(���r���r���r���r>���r���r����<module>r�������s{���� ���"��*� +��� � � � ��������������&��&��&��&��&��&��������������������������� �=�!�!���B�J��'�'� ��B�J�(�)�)� ��b�j��)�)����2�:�>�?�?���� ���v�x�x��W��W��W��W��W�f��W��W��W�tIK��IK��IK��IK��IK��IK��IK��IK�X>��>��>��>��>�j��>��>��>��>��>r���