ó
    F\ho  ã                   ó�   • S r / SQrSSKJrJr  SSKJrJr  SSKJ	r	   " S S5      r
 " S S	\
5      r " S
 S5      r " S S\5      rg)z-A parser of RFC 2822 and MIME email messages.)ÚParserÚHeaderParserÚBytesParserÚBytesHeaderParserÚ
FeedParserÚBytesFeedParseré    )ÚStringIOÚTextIOWrapper)r   r   )Úcompat32c                   ó:   • \ rS rSrS\S.S jjrS	S jrS	S jrSrg)
r   é   N©Úpolicyc                ó   • Xl         X l        g)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.

N©Ú_classr   )Úselfr   r   s      Ú#/usr/lib/python3.13/email/parser.pyÚ__init__ÚParser.__init__   s   € ð* ŒØ�ó    c                 ó  • [        U R                  U R                  S9nU(       a  UR                  5         UR	                  S5      =n(       a+  UR                  U5        UR	                  S5      =n(       a  M+  UR                  5       $ )a4  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   ÚparseÚParser.parse)   sj   € ô   §¡°D·K±KÑ@ˆ
ÞØ×'Ñ'Ô)Ø—g‘g˜d“mÐ#ˆdÕ#Ø�O‰O˜DÔ!ð —g‘g˜d“mÐ#ˆd×#à×ÑÓ!Ð!r   c                 ó4   • U R                  [        U5      US9$ )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   ÚparsestrÚParser.parsestr8   s   € ð �z‰zœ( 4›.°kˆzÐBÐBr   r   )N©F)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r!   r'   Ú__static_attributes__© r   r   r   r      s   † ð¨hö ô0"÷Cr   r   c                   ó(   • \ rS rSrSS jrSS jrSrg)r   éC   c                 ó.   • [         R                  XS5      $ ©NT)r   r!   ©r   r   r   s      r   r!   ÚHeaderParser.parseD   s   € Ü�|‰|˜D dÓ+Ð+r   c                 ó.   • [         R                  XS5      $ r3   )r   r'   r%   s      r   r'   ÚHeaderParser.parsestrG   s   € Ü�‰˜t¨4Ó0Ð0r   r/   N©T)r*   r+   r,   r-   r!   r'   r.   r/   r   r   r   r   C   s   † ô,÷1r   r   c                   ó.   • \ rS rSrS rSS jrSS jrSrg)r   éK   c                 ó$   • [        U0 UD6U l        g)ax  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   ÚBytesParser.__init__M   s   € ô  ˜dÐ) bÑ)ˆ�r   c                 óš   • [        USSS9n U R                  R                  X5      UR                  5         $ ! UR                  5         f = f)a;  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Úerrors)r
   r<   r!   Údetachr4   s      r   r!   ÚBytesParser.parse_   s=   € ô ˜2¨Ð8IÑJˆð	Ø—;‘;×$Ñ$ RÓ5à�I‰I�KøˆB�I‰I�Kús	   �8 ¸A
c                 óX   • UR                  SSS9nU R                  R                  X5      $ )a
  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.
ÚASCIIrB   )rD   )Údecoder<   r'   r%   s      r   Ú
parsebytesÚBytesParser.parsebytesn   s,   € ð �{‰{˜7Ð+<ˆ{Ð=ˆØ�{‰{×#Ñ# DÓ6Ð6r   )r<   Nr)   )r*   r+   r,   r-   r   r!   rJ   r.   r/   r   r   r   r   K   s   † ò*ô$÷	7r   r   c                   ó(   • \ rS rSrSS jrSS jrSrg)r   éz   c                 ó*   • [         R                  XSS9$ ©NTr$   )r   r!   r4   s      r   r!   ÚBytesHeaderParser.parse{   s   € Ü× Ñ  °tÐ Ð<Ð<r   c                 ó*   • [         R                  XSS9$ rO   )r   rJ   r%   s      r   rJ   ÚBytesHeaderParser.parsebytes~   s   € Ü×%Ñ% d¸dÐ%ÐCÐCr   r/   Nr8   )r*   r+   r,   r-   r!   rJ   r.   r/   r   r   r   r   z   s   † ô=÷Dr   r   N)Ú__doc__Ú__all__Úior	   r
   Úemail.feedparserr   r   Úemail._policybaser   r   r   r   r   r/   r   r   Ú<module>rX      sN   ðñ
 4ò,€÷ 'ç 8Ý &÷0Cñ 0Côf1�6ô 1÷,7ñ ,7ô^D˜õ Dr   