+
    iPY  c                   sx   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                   s`   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                sb    \        R R7      V n        \        4       V n        . V n        RV n        R# )r   )ZnewlineFN)r   _partialr   _lines	_eofstack_closedself   &)/usr/lib64/python3.14/email/feedparser.py__init__ZBufferedSubFile.__init__6   s'     !,g    c                <    V P                   P                  V4       R # N)r   append)r   Zpred   &&r   push_eof_matcherZ BufferedSubFile.push_eof_matcherA   s    d#r   c                s6    V P                   P                  4       # r   )r   popr   r   r   pop_eof_matcherZBufferedSubFile.pop_eof_matcherD   s    ~~!!##r   c                s   V P                   P                  ^ 4       V P                  V P                   P                  4       4       V P                   P                  ^ 4       V P                   P	                  4        RV n        R# )i    TN)r	   seek	pushlines	readlinestruncater   r   r   r   closeZBufferedSubFile.closeG   sV    1t}}..011 r   c                s"   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   NeedMoreDataZpopleftZreversedr   
appendleft)r   lineZateof   &  r   readlineZBufferedSubFile.readlineO   sk    {{{||| {{""$ dnn-ET{{&&t,	 .
 r   c                r   r   )r
   r!   r   r"   r   r   
unreadlineZBufferedSubFile.unreadlinea   s     	t$r   c                s   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   ZN)r	   Zwriter   r   r   Zendswithr   r   )r   dataZpartss   && r   pushZBufferedSubFile.pushf   s    D!tD 0 	1'')1  Ry!!$''MM		,ur   c                r   r   )r
   Zextend)r   linesr   r   r   ZBufferedSubFile.pushlines{   s    5!r   c                s    V # r    r   r   r   __iter__ZBufferedSubFile.__iter__~   s    r   c                s@    V P                  4       pVR 8X  d   \        hV# r   )r$   StopIterationr%      & r   __next__ZBufferedSubFile.__next__   s    }}2:r   )r   r   r
   r	   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r$   r&   r)   r   r,   r/   __static_attributes____classdictcell____classdict__   @r   r   r   .   sA     	$$$%
*" r   r   c                   sf   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               sz   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r:   T)r:   _old_style_factoryZmessage_factoryZemail.messager;   _factoryZ	TypeErrorr   _input	_msgstack	_parsegenr/   _parse_cur_last_headersonly)r   r>   r:   r;   s   &&$ r   r   ZFeedParser.__init__   s     "'%%-1 ' & 6 6$M/, &'nn&//	
!  /*.'/s   B% %B:9B:c                s    R V n         R# )TN)rE   r   r   r   _set_headersonlyZFeedParser._set_headersonly   s
     r   c                s\    V P                   P                  V4       V P                  4        R# )zPush more data into the parser.N)r?   r)   _call_parse)r   r(   r   r   feedZFeedParser.feed   s     r   c                sL     V P                  4        R #   \         d     R # i ; ir   )rB   r-   r   r   r   rG   ZFeedParser._call_parse   s"    	KKM 		s    ##c                sT   V P                   P                  4        V P                  4        V P                  4       p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   rG   _pop_messageget_content_maintypeZis_multipartrE   r   Z!MultipartInvariantViolationDefectr:   handle_defect)r   Zrootdefectr#   r   r   ZFeedParser.close   s~      " $$&+5((**43D3D3D==?FKK%%d3r   c                s   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# )r<   zmultipart/digestzmessage/rfc822Nr'   )
r=   r>   r:   rC   get_content_typeZset_default_typer@   Zattachr   rD   )r   Zmsgr.   r   _new_messageZFeedParser._new_message   s    """--/C--t{{-3C9993359KK  !12>>>NN2%%c*c"	
r   c                s    V P                   P                  4       pV P                   '       d   V P                   R,          V n        V# RV n        V# )i   Nr'   )r@   r   rC   )r   retvalr.   r   rJ   ZFeedParser._pop_message   sB    ##%>>>r*DI  DIr   c              #  sd  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d)   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	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-statusZmessagerI   zcontent-transfer-encoding8bitz--c                 st   < V P                  S4      '       g   R # \        P                  V \        S4      4      # r   )
startswithboundaryendREmatchlen)r"   	separators   &r   boundarymatchZ+FeedParser._parsegen.<locals>.boundarymatchL  s,    y11$**4Y@@r   Fendlinesep)Z7bitrQ   Zbinaryr'   )+rO   r?   r    headerRErT   NLCREr   Z MissingHeaderBodySeparatorDefectr:   rL   rC   r&   r   _parse_headersrE   r$   Zset_payloadEMPTYSTRINGZjoinrN   r   rA   rJ   r   rK   Zget_boundaryZNoBoundaryInMultipartDefectZstrZgetZlowerZ-InvalidMultipartContentTransferEncodingDefectgroup	NLCRE_eolsearchrU   preamblerD   epilogueZ_payloadZ
isinstanceZStartBoundaryNotFoundDefectZCloseBoundaryNotFoundDefect	NLCRE_bol)r   Zheadersr"   rM   r*   rP   ZboundaryrW   Zcapturing_preamblera   rY   Zclose_boundary_seenmoZlastlineZeolmorb   rX   ZpayloadZ	firstlineZbolmorV   s   &                   @r   rA   ZFeedParser._parsegen   sz     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6sp   Af0f0/Bf0?N4f04f0f0(f00Cf0<Cf0A8f0Bf0Bf09f0Af0Af0%f0 B0f0c                s   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	                  V P
                  V4       EK  VP%                  R4      pV^ 8X  d@   \        P&                  ! R4      pV P                  P	                  V P
                  V4       EK  VRV pV.pEK  	  V'       d6   V P
                  P                  ! V P                  P                  V4      !   R# R# )r   z 	zFrom NZ:zMissing header name.)Z	enumerater   Z#FirstHeaderLineIsContinuationDefectr:   rL   rC   r   Zset_rawZheader_source_parserR   r_   r`   rU   r^   Zset_unixfromr?   r&   ZMisplacedEnvelopeHeaderDefectZfindZInvalidHeaderDefect)	r   r*   Z
lastheaderZ	lastvalueZlinenor"   rM   rd   Zis	   &&       r   r\   Z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KK--dii@ 		#A
 Av334JK))$))V< bqJIe -h IIt{{>>yIJ r   )	rC   r>   rE   r?   rD   r@   r=   rB   r:   r   )r0   r1   r2   r3   r4   r   r   rF   rH   rG   r   rO   rJ   rA   r\   r5   r6   r7   r9   r   r    r       sE     '" ">!
|7|9K 9Kr   c                   s6   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                sF   < \         SV `  VP                  R R4      4       R# )ZasciiZsurrogateescapeN)ZsuperrH   Zdecode)r   r(   	__class__s   &&r   rH   ZBytesFeedParser.feed  s    T[[*;<=r   r+   )	r0   r1   r2   r3   r4   rH   r5   r6   Z__classcell__)re   r8   s   @@r   r   r     s     2> >r   )r4   Z__all__ZreZemailr   Zemail._policybaser   Zcollectionsr   Zior   Zcompiler[   rc   r_   ZNLCRE_crackrZ   r]   ZNLrS   Zobjectr    r   r    r   r+   r   r   <module>rf      s   
" *
+ 	  &  


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

:< xWf WtIK IKX>j >r   