Ë
    	š„j¾  ã                   óÌ   — d Z ddlmZ ddlmZ ddlmZ g d¢ZddlZddlmZm	Z	 ddl
mZmZ dd	lmZ dd
lmZ  G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy)z-A parser of RFC 2822 and MIME email messages.é    )Úunicode_literals)Údivision)Úabsolute_import)ÚParserÚHeaderParserÚBytesParserÚBytesHeaderParserN)ÚStringIOÚTextIOWrapper)Ú
FeedParserÚBytesFeedParser)ÚMessage)Úcompat32c                   ó&   — e Zd Zefd„Zdd„Zdd„Zy)r   c                 óF   — d|v r	|d   }|d= nt         }|| _        || _        y)a…  Parser of RFC 2822 and MIME email messages.

        Creates an in-memory object tree representing the email message, which
        can then be manipulated and turned over to a Generator to return the
        textual representation of the message.

        The string must be formatted as a block of RFC 2822 headers and header
        continuation lines, optionally preceded by a `Unix-from' header.  The
        header block is terminated either by the end of the string or by a
        blank line.

        _class is the class to instantiate for new message objects when they
        must be created.  This class must have a constructor that can take
        zero arguments.  Default is Message.Message.

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

        ÚpolicyN)r   Ú_classr   )Úselfr   Ú_3to2kwargsr   s       úT/var/www/html/GAP/venv/lib/python3.12/site-packages/future/backports/email/parser.pyÚ__init__zParser.__init__   s0   € ð* �{Ñ"¨[¸Ñ-B FÈÐT\ÑH]ÜˆfØˆŒØˆ�ó    c                 óÖ   — t        | j                  | j                  ¬«      }|r|j                  «        	 |j	                  d«      }|s	 |j                  «       S |j                  |«       Œ6)a\  Create a message structure from the data in a file.

        Reads all the data from the file and returns the root of the message
        structure.  Optional headersonly is a flag specifying whether to stop
        parsing after reading the headers or not.  The default is False,
        meaning it parses the entire contents of the file.
        )r   i    )r   r   r   Ú_set_headersonlyÚreadÚfeedÚclose)r   ÚfpÚheadersonlyÚ
feedparserÚdatas        r   ÚparsezParser.parse/   s_   € ô   §¡°D·K±KÔ@ˆ
ÙØ×'Ñ'Ô)ØØ—7‘7˜4“=ˆDÙØà×ÑÓ!Ð!ð �O‰O˜DÔ!ð	 r   c                 ó:   — | j                  t        |«      |¬«      S )a-  Create a message structure from a string.

        Returns the root of the message structure.  Optional headersonly is a
        flag specifying whether to stop parsing after reading the headers or
        not.  The default is False, meaning it parses the entire contents of
        the file.
        ©r   )r"   r
   ©r   Útextr   s      r   ÚparsestrzParser.parsestrA   s   € ð �z‰zœ( 4›.°kˆzÓBÐBr   N©F)Ú__name__Ú
__module__Ú__qualname__r   r   r"   r'   © r   r   r   r      s   „ Ø%ó ó4"ô$Cr   r   c                   ó   — e Zd Zdd„Zdd„Zy)r   c                 ó0   — t         j                  | |d«      S ©NT)r   r"   ©r   r   r   s      r   r"   zHeaderParser.parseN   s   € Ü�|‰|˜D " dÓ+Ð+r   c                 ó0   — t         j                  | |d«      S r/   )r   r'   r%   s      r   r'   zHeaderParser.parsestrQ   s   € Ü�‰˜t T¨4Ó0Ð0r   N©T)r)   r*   r+   r"   r'   r,   r   r   r   r   M   s   „ ó,ô1r   r   c                   ó"   — e Zd Zd„ Zdd„Zdd„Zy)r   c                 ó$   — t        |i |¤Ž| _        y)aÐ  Parser of binary RFC 2822 and MIME email messages.

        Creates an in-memory object tree representing the email message, which
        can then be manipulated and turned over to a Generator to return the
        textual representation of the message.

        The input must be formatted as a block of RFC 2822 headers and header
        continuation lines, optionally preceded by a `Unix-from' header.  The
        header block is terminated either by the end of the input or by a
        blank line.

        _class is the class to instantiate for new message objects when they
        must be created.  This class must have a constructor that can take
        zero arguments.  Default is Message.Message.
        N)r   Úparser)r   ÚargsÚkws      r   r   zBytesParser.__init__W   s   € ô  ˜dÐ) bÑ)ˆ�r   c                 ó†   — t        |dd¬«      }|5  | j                  j                  ||«      cddd«       S # 1 sw Y   yxY w)ac  Create a message structure from the data in a binary file.

        Reads all the data from the file and returns the root of the message
        structure.  Optional headersonly is a flag specifying whether to stop
        parsing after reading the headers or not.  The default is False,
        meaning it parses the entire contents of the file.
        ÚasciiÚsurrogateescape)ÚencodingÚerrorsN)r   r5   r"   r0   s      r   r"   zBytesParser.parsei   s?   € ô ˜2¨Ð8IÔJˆØñ 	6Ø—;‘;×$Ñ$ R¨Ó5÷	6÷ 	6ò 	6ús	   ‘7·A c                 ó`   — |j                  dd¬«      }| j                  j                  ||«      S )a2  Create a message structure from a byte string.

        Returns the root of the message structure.  Optional headersonly is a
        flag specifying whether to stop parsing after reading the headers or
        not.  The default is False, meaning it parses the entire contents of
        the file.
        ÚASCIIr:   )r<   )Údecoder5   r'   r%   s      r   Ú
parsebyteszBytesParser.parsebytesv   s.   € ð �{‰{˜7Ð+<ˆ{Ó=ˆØ�{‰{×#Ñ# D¨+Ó6Ð6r   Nr(   )r)   r*   r+   r   r"   r@   r,   r   r   r   r   U   s   „ ò*ó$
6ô	7r   r   c                   ó   — e Zd Zdd„Zdd„Zy)r	   c                 ó2   — t         j                  | |d¬«      S ©NTr$   )r   r"   r0   s      r   r"   zBytesHeaderParser.parseƒ   s   € Ü× Ñ   r°tÐ Ó<Ð<r   c                 ó2   — t         j                  | |d¬«      S rC   )r   r@   r%   s      r   r@   zBytesHeaderParser.parsebytes†   s   € Ü×%Ñ% d¨D¸dÐ%ÓCÐCr   Nr2   )r)   r*   r+   r"   r@   r,   r   r   r	   r	   ‚   s   „ ó=ôDr   r	   )Ú__doc__Ú
__future__r   r   r   Ú__all__ÚwarningsÚior
   r   Ú!future.backports.email.feedparserr   r   Úfuture.backports.email.messager   Ú"future.backports.email._policybaser   Úobjectr   r   r   r	   r,   r   r   ú<module>rN      s]   ðñ
 4Ý 'Ý Ý &â
H€ã ß &ç IÝ 2Ý 7ô5CˆVô 5Côr1�6ô 1ô*7�&ô *7ôZD˜õ Dr   