+
    CrhmY                     x   R t RR.t^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ]P                  ! R4      t]P                  ! R	4      t]P                  ! R
4      t]P                  ! R	4      t]P                  ! R4      tRtRt]P                  ! R4      t]! 4       t ! R R]4      t ! R R4      t ! R R]4      tR# )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BytesFeedParserN)errors)compat32)deque)StringIOz
\r\n|\r|\nz(\r\n|\r|\n)z(\r\n|\r|\n)\zz%^(From |[\041-\071\073-\176]*:|[\t ]) 
z3(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$c                   `   a  ] tR t^.t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tRtV tR# )BufferedSubFileaW  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                b    \        R R7      V n        \        4       V n        . V n        RV n        R# )r   )newlineFN)r   _partialr   _lines	_eofstack_closedselfs   &-/usr/local/lib/python3.14/email/feedparser.py__init__BufferedSubFile.__init__6   s'     !,g    c                <    V P                   P                  V4       R # N)r   append)r   preds   &&r   push_eof_matcher BufferedSubFile.push_eof_matcherA   s    d#r   c                6    V P                   P                  4       # r   )r   popr   s   &r   pop_eof_matcherBufferedSubFile.pop_eof_matcherD   s    ~~!!##r   c                   V P                   P                  ^ 4       V P                  V P                   P                  4       4       V P                   P                  ^ 4       V P                   P	                  4        RV n        R# )    TN)r   seek	pushlines	readlinestruncater   r   s   &r   closeBufferedSubFile.closeG   sV    1t}}..011 r   c                "   V P                   '       g   V P                  '       d   R # \        # V P                   P                  4       p\	        V P
                  4       F/  pV! V4      '       g   K  V P                   P                  V4        R # 	  V# r   )r   r   NeedMoreDatapopleftreversedr   
appendleft)r   lineateofs   &  r   readlineBufferedSubFile.readlineO   sk    {{{||| {{""$ dnn-ET{{&&t,	 .
 r   c                T    V\         Jg   Q hV P                  P                  V4       R # r   )r,   r   r/   r   r0   s   &&r   
unreadlineBufferedSubFile.unreadlinea   s"    <'''t$r   c                   V P                   P                  V4       RV9  d
   RV9  d   R# V P                   P                  ^ 4       V P                   P                  4       pV P                   P                  ^ 4       V P                   P	                  4        VR,          P                  R4      '       g*   V P                   P                  VP                  4       4       V P                  V4       R# )z$Push some new data into this object.r	   N)r   writer$   r&   r'   endswithr   r%   )r   datapartss   && r   pushBufferedSubFile.pushf   s    D!tD 0 	1'')1  Ry!!$''MM		,ur   c                <    V P                   P                  V4       R # r   )r   extend)r   liness   &&r   r%   BufferedSubFile.pushlines{   s    5!r   c                    V # r    r   s   &r   __iter__BufferedSubFile.__iter__~   s    r   c                @    V P                  4       pVR 8X  d   \        hV# r+   )r2   StopIterationr5   s   & r   __next__BufferedSubFile.__next__   s    }}2:r   )r   r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r   r    r(   r2   r6   r?   r%   rG   rK   __static_attributes____classdictcell____classdict__s   @r   r   r   .   sA     	$$$%
*" r   r   c                   f   a  ] tR t^t o RtRR]/R lltR tR tR t	R t
R	 tR
 tR tR tRtV tR# )r   zA feed-style parser of email.Npolicyc               z   W n         RV n        Vf.   VP                  f   ^ RIHp W0n        M,VP                  V n        MWn         V! V P                   R7       \        4       V n        . V n	        V P                  4       P                  V n        RV n        RV n        RV n        R#   \         d    RT n         L`i ; i)z_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.

FN)MessagerW   T)rW   _old_style_factorymessage_factoryemail.messagerY   _factory	TypeErrorr   _input	_msgstack	_parsegenrK   _parse_cur_last_headersonly)r   r^   rW   rY   s   &&$ r   r   FeedParser.__init__   s     "'%%-1 ' & 6 6$M/, &'nn&//	
!  /*.'/s   B% %B:9B:c                    R V n         R# )TN)rf   r   s   &r   _set_headersonlyFeedParser._set_headersonly   s
     r   c                \    V P                   P                  V4       V P                  4        R# )zPush more data into the parser.N)r`   r?   _call_parse)r   r=   s   &&r   feedFeedParser.feed   s     r   c                L     V P                  4        R #   \         d     R # i ; ir   )rc   rJ   r   s   &r   rl   FeedParser._call_parse   s"    	KKM 		s    ##c                |   V P                   P                  4        V P                  4        V P                  4       pV P                  '       d   Q hVP                  4       R8X  dY   VP                  4       '       gC   V P                  '       g1   \        P                  ! 4       pV P                  P                  W4       V# )z<Parse all remaining data and return the root message object.	multipart)r`   r(   rl   _pop_messagera   get_content_maintypeis_multipartrf   r   !MultipartInvariantViolationDefectrW   handle_defect)r   rootdefects   &  r   r(   FeedParser.close   s      ">>>!!$$&+5((**43D3D3D==?FKK%%d3r   c                   V P                   '       d   V P                  4       pMV P                  V P                  R 7      pV P                  '       d1   V P                  P	                  4       R8X  d   VP                  R4       V P                  '       d#   V P                  R,          P                  V4       V P                  P                  V4       Wn        Wn	        R# )rZ   zmultipart/digestzmessage/rfc822Nr:   )
r[   r^   rW   rd   get_content_typeset_default_typera   attachr   re   )r   msgs   & r   _new_messageFeedParser._new_message   s    """--/C--t{{-3C9993359KK  !12>>>NN2%%c*c"	
r   c                    V P                   P                  4       pV P                   '       d   V P                   R,          V n        V# RV n        V# )   Nr:   )ra   r   rd   )r   retvals   & r   rs   FeedParser._pop_message   sB    ##%>>>r*DI  DIr   c              #  x  a"   V P                  4        . pV P                   F  pV\        J d   \        x  K  \        P	                  V4      '       gt   \
        P	                  V4      '       gW   \        P                  ! 4       pV P                  P                  V P                  V4       V P                  P                  V4        MVP                  V4       K  	  V P                  V4       V P                  '       d}   . p V P                  P                  4       pV\        J d   \        x  K/  VR8X  d   MVP                  V4       KJ  V P                  P!                  \"        P%                  V4      4       R# V P                  P'                  4       R8X  Ed    V P                  P)                  \
        P                  4       V P+                  4        F  pV\        J d   \        x  K   M	  V P-                  4        V P                  P/                  4         V P                  P                  4       pV\        J d   \        x  K/    T P                  P                  4       pT\        J d   \        x  K/   TR8X  d    R# T P                  P                  T4       EK  V P                  P1                  4       R8X  d>   V P+                  4        F  pV\        J d   \        x  K   M	  V P-                  4        R# V P                  P1                  4       R8X  Ed3   V P                  P3                  4       pVf   \        P4                  ! 4       pV P                  P                  V P                  V4       . pV P                   F(  pV\        J d   \        x  K  VP                  V4       K*  	  V P                  P!                  \"        P%                  V4      4       R# \7        V P                  P9                  RR4      4      P;                  4       R9  d<   \        P<                  ! 4       pV P                  P                  V P                  V4       RV,           oV3R	 lpR p. p	R
p
R
p V P                  P                  4       pV\        J d   \        x  K/  VR8X  d   EMV! V4      pV'       Ed   VP?                  R4      '       d   R pVP?                  R4      p
EMV'       d   V	'       dl   V	R,          p\@        PC                  V4      pV'       d"   VR\E        VP?                  ^ 4      4      )  V	R&   \"        P%                  V	4      V P                  n#        R
pV P                  P                  V4       EK   V P                  P                  4       pV\        J d   \        x  K/  V! V4      pV'       d   KA  V P                  P                  V4        T P                  P)                  T4       T P+                  4        F  pT\        J d   \        x  K   M	  T PH                  P1                  4       R8X  d   T PH                  PJ                  pTR8X  d   RT PH                  n%        MTeM   \@        PC                  T4      pT'       d0   \E        TP?                  ^ 4      4      pTRT)  T PH                  n%        MxT PH                  PL                  p\O        T\6        4      '       dM   \@        PC                  T4      pT'       d0   TR\E        TP?                  ^ 4      4      )  pTT PH                  n&        T P                  P/                  4        T P-                  4        T P                  T n$        EK  V'       g   Q hV	P                  V4       EK&  V'       d   \        PP                  ! 4       pV P                  P                  V P                  V4       V P                  P!                  \"        P%                  V	4      4       . pV P                   F  pV\        J g   K  \        x  K  	  \"        P%                  V4      V P                  n%        R# V'       g>   \        PR                  ! 4       pV P                  P                  V P                  V4       R# V
'       d   R.pM. pV P                   F(  pV\        J d   \        x  K  VP                  V4       K*  	  V'       dG   V^ ,          p\T        P	                  V4      pV'       d!   V\E        VP?                  ^ 4      4      R V^ &   \"        P%                  V4      V P                  n%        R# . pV P                   F(  pV\        J d   \        x  K  VP                  V4       K*  	  V P                  P!                  \"        P%                  V4      4       R# 5i)Tr   Nzmessage/delivery-statusmessagerr   zcontent-transfer-encoding8bitz--c                 t   < V P                  S4      '       g   R # \        P                  V \        S4      4      # r   )
startswithboundaryendREmatchlen)r0   	separators   &r   boundarymatch+FeedParser._parsegen.<locals>.boundarymatchL  s,    y11$**4Y@@r   Fendlinesep)7bitr   binaryr:   )+r   r`   r,   headerREr   NLCREr    MissingHeaderBodySeparatorDefectrW   rw   rd   r6   r   _parse_headersrf   r2   set_payloadEMPTYSTRINGjoinr|   r   rb   rs   r    rt   get_boundaryNoBoundaryInMultipartDefectstrgetlower-InvalidMultipartContentTransferEncodingDefectgroup	NLCRE_eolsearchr   preamblere   epilogue_payload
isinstanceStartBoundaryNotFoundDefectCloseBoundaryNotFoundDefect	NLCRE_bol)r   headersr0   ry   rC   r   boundaryr   capturing_preambler   r   close_boundary_seenmolastlineeolmor   r   payload	firstlinebolmor   s   &                   @r   rb   FeedParser._parsegen   s     KKD|#"">>$'' {{4((#DDFFKK--dii@KK**40NN4     	G$ E{{++-<'&&2:T"II!!+"2"25"9:99%%'+DD ,,U[[9"nn.F-** 	 /
 !!# ++-
 ;;//1D|+** ;;//1D|+** 2:  &&t,99))+y8 ..*\)&&	 +
 99))+{:yy--/H
  ;;=))$))V< KKD|+** LL&	 (
 		%%k&6&6u&=>DIIMM"=vFGMMO56MMO))$))V<
 xIA "&HG"'{{++-<'&&2:"4(2
 xx.2+"$((9"5)# (0|H$-$4$4X$>E$/78M#ekk!n:M9M/N1<1A1A(1KDII.-2*..t4 
 #{{335</"..$*40!r KK2248! KK00?"&.."2!\1"..$	 #3 zz668KG#'::#6#6#r>26DJJ/%1!*!1!1(!;B!&)"((1+&66>uo

 3"&**"5"5%gs33!*!1!1'!:B!*12DC4D3D*E6=

 3KK//1%%' "&DJ .--OOD) ";;=))$))V<		%%k&6&6x&@A KKD|+**  ( &1%5%5h%?		" ';;=))$))V< 4<'&&%	 $ $QK	!	2"+CA,?,@"AHQK!,!1!1(!;DII KKD|#""LL	  
 			k..u56sv   Af:f:/Bf:?N4f:4f:f:(f:0Cf:<Cf:A8f:A4f:;f:Bf:9f:Af:Af:$%f:
B0f:c                   R p. p\        V4       EF  w  rEV^ ,          R9   dZ   V'       g?   \        P                  ! V4      pV P                  P	                  V P
                  V4       KZ  VP                  V4       Km  V'       d7   V P
                  P                  ! V P                  P                  V4      !   R . r2VP                  R4      '       d   V^ 8X  dZ   \        P                  V4      pV'       d   VR\        VP                  ^ 4      4      )  pV P
                  P                  V4       EK"  V\        V4      ^,
          8X  d   V P                  P!                  V4        R# \        P"                  ! V4      pV P
                  P$                  P                  V4       EK  VP'                  R4      pV^ 8X  d?   \        P(                  ! R4      pV P
                  P$                  P                  V4       EK  V^ 8  g   Q R4       hVRV pV.pEK  	  V'       d6   V P
                  P                  ! V P                  P                  V4      !   R# R# )r   z 	zFrom N:zMissing header name.z3_parse_headers fed line with no : and no leading WS)	enumerater   #FirstHeaderLineIsContinuationDefectrW   rw   rd   r   set_rawheader_source_parser   r   r   r   r   set_unixfromr`   r6   MisplacedEnvelopeHeaderDefectdefectsfindInvalidHeaderDefect)	r   rC   
lastheader	lastvaluelinenor0   ry   r   is	   &&       r   r   FeedParser._parse_headers  s   
	%e,LFAw%! $GGMFKK--dii@  &		!!4;;#B#B9#MN(*BIw''Q;"))$/B#$6c"((1+&6%67II**40s5zA~- KK**40 $AA$GFII%%,,V4 		#A
 Av334JK		!!((0Q3MMM3bqJIg -j IIt{{>>yIJ r   )	rd   r^   rf   r`   re   ra   r[   rc   rW   r   )rM   rN   rO   rP   rQ   r   r   ri   rm   rl   r(   r   rs   rb   r   rR   rS   rT   s   @r   r   r      sE     '" ">!
|7|:K :Kr   c                   6   a a ] tR tRt oRtV 3R ltRtVtV ;t# )r   i  z(Like FeedParser, but feed accepts bytes.c                F   < \         SV `  VP                  R R4      4       R# )asciisurrogateescapeN)superrm   decode)r   r=   	__class__s   &&r   rm   BytesFeedParser.feed  s    T[[*;<=r   rF   )	rM   rN   rO   rP   rQ   rm   rR   rS   __classcell__)r   rU   s   @@r   r   r     s     2> >r   )rQ   __all__reemailr   email._policybaser   collectionsr   ior   compiler   r   r   NLCRE_crackr   r   NLr   objectr,   r   r   r   rF   r   r   <module>r      s   
" *
+ 	  &  


=!JJ'	JJ()	jj) ::>?	

:< xWf WtJK JKZ>j >r   