<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

]Y                 @   s  d  d g Z  d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 e j d	  Z e j d
  Z e j d  Z e j d
  Z e j d  Z d Z d Z e   Z Gd d   d e  Z Gd d    d   Z Gd d   d e  Z d S)
FeedParserBytesFeedParser    N)errors)message)compat32)deque)StringIOz
||
z(
||
)z
(
||
)\Zz%^(From |[\041-\071\073-\176]*:|[\t ]) 
c               @   s   e  Z d  Z d d   Z d d   Z d d   Z d d   Z d	 d
   Z d d   Z d d   Z	 d d   Z
 d d   Z d d   Z d S)BufferedSubFilec             C   s4   t  d d  |  _ t   |  _ g  |  _ d |  _ d  S)Nnewliner	   F)r   _partialr   _lines	_eofstack_closed)self r   //opt/alt/python35/lib64/python3.5/feedparser.py__init__6   s    	zBufferedSubFile.__init__c             C   s   |  j  j |  d  S)N)r   append)r   Zpredr   r   r   push_eof_matcherA   s    z BufferedSubFile.push_eof_matcherc             C   s   |  j  j   S)N)r   pop)r   r   r   r   pop_eof_matcherD   s    zBufferedSubFile.pop_eof_matcherc             C   sP   |  j  j d  |  j |  j  j    |  j  j d  |  j  j   d |  _ d  S)Nr   T)r   seek	pushlines	readlinestruncater   )r   r   r   r   closeG   s
    zBufferedSubFile.closec             C   sg   |  j  s |  j r d St S|  j  j   } x7 t |  j  D]& } | |  r9 |  j  j |  d Sq9 W| S)Nr	   )r   r   NeedMoreDatapopleftreversedr   
appendleft)r   lineZateofr   r   r   readlineO   s    		zBufferedSubFile.readlinec             C   s   |  j  j |  d  S)N)r   r!   )r   r"   r   r   r   
unreadlinea   s    zBufferedSubFile.unreadlinec             C   s   |  j  j |  d | k r, d | k r, d  S|  j  j d  |  j  j   } |  j  j d  |  j  j   | d j d  s |  j  j | j    |  j |  d  S)Nr
   r      )r   writer   r   r   endswithr   r   )r   datapartsr   r   r   pushf   s    zBufferedSubFile.pushc             C   s   |  j  j |  d  S)N)r   extend)r   linesr   r   r   r   {   s    zBufferedSubFile.pushlinesc             C   s   |  S)Nr   )r   r   r   r   __iter__~   s    zBufferedSubFile.__iter__c             C   s"   |  j    } | d k r t  | S)Nr	   )r#   StopIteration)r   r"   r   r   r   __next__   s    zBufferedSubFile.__next__N)__name__
__module____qualname__r   r   r   r   r#   r$   r,   r   r/   r1   r   r   r   r   r   .   s   r   c               @   s   e  Z d  Z d d e d d Z d d   Z d d   Z d	 d
   Z d d   Z d d   Z	 d d   Z
 d d   Z d d   Z d S)r   Npolicyc            C   s   | |  _  d |  _ | d  k rK |  j  t k r< t j |  _ q t j |  _ n; | |  _ y | d |  j   Wn t k
 r d |  _ Yn Xt   |  _	 g  |  _
 |  j   j |  _ d  |  _ d  |  _ d |  _ d  S)NFr5   T)r5   _old_style_factoryr   r   ZMessage_factoryZEmailMessage	TypeErrorr   _input	_msgstack	_parsegenr1   _parse_cur_last_headersonly)r   r7   r5   r   r   r   r      s"    						zFeedParser.__init__c             C   s   d |  _  d  S)NT)r?   )r   r   r   r   _set_headersonly   s    zFeedParser._set_headersonlyc             C   s   |  j  j |  |  j   d  S)N)r9   r,   _call_parse)r   r*   r   r   r   feed   s    zFeedParser.feedc             C   s'   y |  j    Wn t k
 r" Yn Xd  S)N)r<   r0   )r   r   r   r   rA      s    zFeedParser._call_parsec             C   se   |  j  j   |  j   |  j   } | j   d k ra | j   ra t j   } |  j j	 | |  | S)N	multipart)
r9   r   rA   _pop_messageget_content_maintypeZis_multipartr   Z!MultipartInvariantViolationDefectr5   handle_defect)r   rootdefectr   r   r   r      s    
zFeedParser.closec             C   s   |  j  r |  j   } n |  j d |  j  } |  j rX |  j j   d k rX | j d  |  j ru |  j d j |  |  j j |  | |  _ | |  _	 d  S)Nr5   zmultipart/digestzmessage/rfc822r&   r'   )
r6   r7   r5   r=   get_content_typeZset_default_typer:   Zattachr   r>   )r   msgr   r   r   _new_message   s    			zFeedParser._new_messagec             C   s8   |  j  j   } |  j  r+ |  j  d |  _ n	 d  |  _ | S)Nr&   r'   )r:   r   r=   )r   retvalr   r   r   rD      s
    		zFeedParser._pop_messagec             c   s  |  j    g  } x |  j D]x } | t k r4 t Vq t j |  s t j |  s t j   } |  j j	 |  j
 |  |  j j |  P| j |  q W|  j |  |  j rg  } xA |  j j   } | t k r t Vq | d k r P| j |  q W|  j
 j t j |   d  S|  j
 j   d k rx |  j j t j  x) |  j   D] } | t k ret VqKPqKW|  j   } |  j j   x( |  j j   } | t k rt VqPqWx( |  j j   } | t k rt VqPqW| d k rP|  j j |  q+Wd  S|  j
 j   d k rMx) |  j   D] } | t k r:t Vq Pq W|  j   d  S|  j
 j   d k rv|  j
 j   } | d  k rt j   } |  j j	 |  j
 |  g  } x2 |  j D]' } | t k rt Vq| j |  qW|  j
 j t j |   d  S|  j
 j d d  j   d k r:t j   } |  j j	 |  j
 |  d	 | } t j d
 t j  |  d  }	 d }
 g  } d } d } x|  j j   } | t k rt Vq| d k rP|	 j |  } | r| j! d  rd } | j! d  } P|
 rf| rM| d } t" j# |  } | r8| d  t$ | j! d    | d <t j |  |  j
 _% d }
 |  j j |  qxM |  j j   } | t k rt Vqi|	 j |  } | si|  j j |  PqiW|  j j |	 j  x) |  j   D] } | t k rt VqPqW|  j& j   d k r|  j& j' } | d k r1d  |  j& _' q| d  k	 rt" j# |  } | rt$ | j! d   } | d  |  |  j& _' n\ |  j& j( } t) | t*  rt" j# |  } | r| d  t$ | j! d    } | |  j& _( |  j j   |  j   |  j
 |  _& q| j |  qW|
 rt j+   } |  j j	 |  j
 |  |  j
 j t j |   g  } x% |  j D] } | t k ret VqeqeWt j |  |  j
 _' d  S| st j,   } |  j j	 |  j
 |  d  S| rd g } n g  } x2 |  j D]' } | t k rt Vq| j |  qW| r]| d } t- j |  } | r]| t$ | j! d   d   | d <t j |  |  j
 _' d  Sg  } x2 |  j D]' } | t k rt Vq| j |  qW|  j
 j t j |   d  S)Nr	   zmessage/delivery-statusr   rC   zcontent-transfer-encoding8bit7bitbinaryz--z(?P<sep>z4)(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$TFendlinesepr&   r   )rN   rM   rO   r'   r'   ).rK   r9   r   headerREmatchNLCREr   Z MissingHeaderBodySeparatorDefectr5   rF   r=   r$   r   _parse_headersr?   r#   Zset_payloadEMPTYSTRINGjoinrI   r   r;   rD   r   rE   Zget_boundaryZNoBoundaryInMultipartDefectgetlowerZ-InvalidMultipartContentTransferEncodingDefectrecompileescapegroup	NLCRE_eolsearchlenpreambler>   epilogueZ_payload
isinstancestrZStartBoundaryNotFoundDefectZCloseBoundaryNotFoundDefect	NLCRE_bol)r   Zheadersr"   rH   r.   rL   rJ   boundaryZ	separatorZ
boundaryreZcapturing_preamblera   rQ   Zclose_boundary_seenmoZlastlineZeolmorb   rP   Zpayload	firstlineZbolmor   r   r   r;      sf   
	
	


$ 

#zFeedParser._parsegenc       	      C   s  d } g  } xt  |  D]\ } } | d d k rs | sc t j |  } |  j j |  j |  q | j |  q | r |  j j |  j j |    d g  } } | j	 d  rW| d k rt
 j |  } | r | d  t | j d    } |  j j |  q nO | t |  d k r2|  j j |  d  St j |  } |  j j j |  q | j d  } | d k rt j d  } |  j j j |  q | d  |  } | g } q W| r|  j j |  j j |    d  S)Nr	   r   z 	zFrom r&   :zMissing header name.)	enumerater   Z#FirstHeaderLineIsContinuationDefectr5   rF   r=   r   Zset_rawZheader_source_parse
startswithr^   r_   r`   r]   Zset_unixfromr9   r$   ZMisplacedEnvelopeHeaderDefectZdefectsfindZInvalidHeaderDefect)	r   r.   Z
lastheaderZ	lastvaluelinenor"   rH   rg   ir   r   r   rU     sF     zFeedParser._parse_headers)r2   r3   r4   r   r   r@   rB   rA   r   rK   rD   r;   rU   r   r   r   r   r      s   !c                   s"   e  Z d  Z   f d d   Z   S)r   c                s    t    j | j d d   d  S)Nasciisurrogateescape)superrB   decode)r   r*   )	__class__r   r   rB     s    zBytesFeedParser.feed)r2   r3   r4   rB   r   r   )rs   r   r     s   )__all__rZ   Zemailr   r   Zemail._policybaser   collectionsr   ior   r[   rT   re   r^   ZNLCRE_crackrR   rV   NLobjectr   r   r   r   r   r   r   r   <module>   s$   	[ 