Your IP : 3.143.237.203


Current Path : /opt/alt/python33/lib64/python3.3/email/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/email/__pycache__/feedparser.cpython-33.pyo

�
��f�Vc@s�dZddgZddlZddlmZddlmZddlmZejd�Z	ejd	�Z
ejd
�Zejd	�Zejd�Z
dZd
Ze�ZGdd�de�ZGdd�d�ZGdd�de�ZdS(uFeedParser - 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.
u
FeedParseruBytesFeedParseriN(uerrors(umessage(ucompat32u
|
|
u(
|
|
)u
(
|
|
)\Zu(^(From |[\041-\071\073-\176]{1,}:|[\t ])uu
cBs�|EeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS(uBufferedSubFileukA 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.
    cCs(d|_g|_g|_d|_dS(NuF(u_partialu_linesu	_eofstackuFalseu_closed(uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu__init__4s			uBufferedSubFile.__init__cCs|jj|�dS(N(u	_eofstackuappend(uselfupred((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyupush_eof_matcher>su BufferedSubFile.push_eof_matchercCs
|jj�S(N(u	_eofstackupop(uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyupop_eof_matcherAsuBufferedSubFile.pop_eof_matchercCs)|jj|j�d|_d|_dS(NuT(u_linesuappendu_partialuTrueu_closed(uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyucloseDs	uBufferedSubFile.closecCsn|js|jrdStS|jj�}x>|jddd�D]&}||�r@|jj|�dSq@W|S(Nuii����(u_linesu_closeduNeedMoreDataupopu	_eofstackuappend(uselfulineuateof((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyureadlineJs		uBufferedSubFile.readlinecCs|jj|�dS(N(u_linesuappend(uselfuline((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu
unreadline\suBufferedSubFile.unreadlinecCs�|j|d}|_tj|�}|j�|_|jrw|rw|djd�rw|jd�|j�|_ng}xCtt|�d�D]+}|j||d||dd�q�W|j|�dS(u$Push some new data into this object.uiu
iNi����i����(	u_partialuNLCRE_crackusplitupopuendswithurangeulenuappendu	pushlines(uselfudataupartsulinesui((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyupushas#)uBufferedSubFile.pushcCs$|ddd�|jdd�<dS(Niii����(u_lines(uselfulines((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu	pushlinesxsuBufferedSubFile.pushlinescCs|S(N((uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu__iter__|suBufferedSubFile.__iter__cCs%|j�}|dkr!t�n|S(Nu(ureadlineu
StopIteration(uselfuline((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu__next__s	uBufferedSubFile.__next__N(u__name__u
__module__u__qualname__u__doc__u__init__upush_eof_matcherupop_eof_matcherucloseureadlineu
unreadlineupushu	pushlinesu__iter__u__next__(u
__locals__((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyuBufferedSubFile,s
uBufferedSubFilecBs�|EeZdZdZdeejdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�ZdS(u
FeedParseruA feed-style parser of email.upolicycs�|�_|�_y)|d�j��fdd��_Wn!tk
r^dd��_YnXt��_g�_�j�j�_	d�_d�_d�_dS(u_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.

        upolicycsi�jd6S(Nupolicy(upolicy((uself(u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu<lambda>�su%FeedParser.__init__.<locals>.<lambda>cSsiS(N((((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu<lambda>�sNF(u_factoryupolicyu
_factory_kwdsu	TypeErroruBufferedSubFileu_inputu	_msgstacku	_parsegenu__next__u_parseuNoneu_curu_lastuFalseu_headersonly(uselfu_factoryupolicy((uselfu5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu__init__�s		
			uFeedParser.__init__cCs
d|_dS(NT(uTrueu_headersonly(uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu_set_headersonly�suFeedParser._set_headersonlycCs|jj|�|j�dS(uPush more data into the parser.N(u_inputupushu_call_parse(uselfudata((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyufeed�suFeedParser.feedcCs'y|j�Wntk
r"YnXdS(N(u_parseu
StopIteration(uself((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu_call_parse�s
uFeedParser._call_parsecCsh|jj�|j�|j�}|j�dkrd|j�rdtj�}|jj	||�n|S(u<Parse all remaining data and return the root message object.u	multipart(
u_inputucloseu_call_parseu_pop_messageuget_content_maintypeuis_multipartuerrorsu!MultipartInvariantViolationDefectupolicyu
handle_defect(uselfurootudefect((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyuclose�s


uFeedParser.closecCs�|j|j��}|jrC|jj�dkrC|jd�n|jrc|jdj|�n|jj|�||_||_dS(Numultipart/digestumessage/rfc822ii����(	u_factoryu
_factory_kwdsu_curuget_content_typeuset_default_typeu	_msgstackuattachuappendu_last(uselfumsg((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu_new_message�s		uFeedParser._new_messagecCs8|jj�}|jr+|jd|_n	d|_|S(Nii����(u	_msgstackupopu_curuNone(uselfuretval((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu_pop_message�s
		uFeedParser._pop_messageccs"|j�g}x�|jD]�}|tkr7tVqntj|�s�tj|�s�tj�}|jj	|j
|�|jj|�nPn|j|�qW|j
|�|jr!g}xF|jj�}|tkr�tVq�n|dkr�Pn|j|�q�|j
jtj|��dS|j
j�dkrx�|jjtj�x,|j�D]}|tkrvtVqYnPqYW|j�}|jj�x*|jj�}|tkr�tVq�nPq�x*|jj�}|tkr�tVq�nPq�|dkr�Pn|jj|�q9dS|j
j�dkrgx,|j�D]}|tkrTtVq7nPq7W|j�dS|j
j�dkr�|j
j�}|dkrtj�}|jj	|j
|�g}x5|jD]*}|tkr�tVq�n|j|�q�W|j
jtj|��dS|j
jdd�j�dkrZtj�}|jj	|j
|�nd	|}tj d
tj!|�d�}	d}
g}d}d}
x�|jj�}|tkr�tVq�n|dkr�Pn|	j|�}|rI|j$d�rd}
|j$d
�}Pn|
r�|r||d}t%j&|�}|rd|dt'|j$d���|d<ntj|�|j
_(nd}
|jj|�q�nxR|jj�}|tkr�tVq�n|	j|�}|s�|jj|�Pq�q�|jj|	j�x,|j�D]}|tkr*tVq
nPq
W|j)j�dkr�|j)j*}|dkrkd|j)_*q#|dk	r#t%j&|�}|r�t'|j$d��}|d|�|j)_*q�q#nb|j)j+}t,|t-�r#t%j&|�}|r#|dt'|j$d���}||j)_+q#n|jj�|j�|j
|_)q�|j|�q�|
r�tj.�}|jj	|j
|�|j
jtj|��g}x(|jD]}|tkr�tVq�q�q�Wtj|�|j
_*dS|
stj/�}|jj	|j
|�dS|r"dg}ng}x5|jD]*}|tkrOtVq2n|j|�q2W|r�|d}t0j|�}|r�|t'|j$d��d�|d<q�ntj|�|j
_*dSg}x5|jD]*}|tkr�tVq�n|j|�q�W|j
jtj|��dS(Nuumessage/delivery-statusumessageu	multipartucontent-transfer-encodingu8bitu7bitubinaryu--u(?P<sep>u4)(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$uendulinesepii(u7bitu8bitubinaryTFi����i����(1u_new_messageu_inputuNeedMoreDatauheaderREumatchuNLCREuerrorsu MissingHeaderBodySeparatorDefectupolicyu
handle_defectu_curu
unreadlineuappendu_parse_headersu_headersonlyureadlineuset_payloaduEMPTYSTRINGujoinuget_content_typeupush_eof_matcheru	_parsegenu_pop_messageupop_eof_matcheruget_content_maintypeuget_boundaryuNoneuNoBoundaryInMultipartDefectugetuloweru-InvalidMultipartContentTransferEncodingDefectureucompileuescapeuTrueuFalseugroupu	NLCRE_eolusearchulenupreambleu_lastuepilogueu_payloadu
isinstanceustruStartBoundaryNotFoundDefectuCloseBoundaryNotFoundDefectu	NLCRE_bol(uselfuheadersulineudefectulinesuretvalumsguboundaryu	separatoru
boundaryreucapturing_preambleupreambleulinesepuclose_boundary_seenumoulastlineueolmouepilogueuendupayloadu	firstlineubolmo((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu	_parsegen�sf

	

	


'  



)uFeedParser._parsegenc	Cs�d}g}x�t|�D]u\}}|ddkry|sftj|�}|jj|j|�qn|j|�qn|r�|jj|jj|��dg}}n|j	d�rf|dkrt
j|�}|r�|dt|j
d���}n|jj|�qqf|t|�dkr>|jj|�dStj|�}|jjj|�qn|jd�}|d|�}|g}qW|r�|jj|jj|��ndS(Nuiu 	uFrom iu:(u	enumerateuerrorsu#FirstHeaderLineIsContinuationDefectupolicyu
handle_defectu_curuappenduset_rawuheader_source_parseu
startswithu	NLCRE_eolusearchulenugroupuset_unixfromu_inputu
unreadlineuMisplacedEnvelopeHeaderDefectudefectsufind(	uselfulinesu
lastheaderu	lastvalueulinenoulineudefectumoui((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu_parse_headers�s>
#
uFeedParser._parse_headersN(u__name__u
__module__u__qualname__u__doc__ucompat32umessageuMessageu__init__u_set_headersonlyufeedu_call_parseucloseu_new_messageu_pop_messageu	_parsegenu_parse_headers(u
__locals__((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu
FeedParser�s

�cs,|EeZdZdZ�fdd�Z�S(uBytesFeedParseru(Like FeedParser, but feed accepts bytes.cs t�j|jdd��dS(Nuasciiusurrogateescape(usuperufeedudecode(uselfudata(u	__class__(u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyufeedsuBytesFeedParser.feed(u__name__u
__module__u__qualname__u__doc__ufeed(u
__locals__((u	__class__u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyuBytesFeedParsers(u__doc__u__all__ureuemailuerrorsumessageuemail._policybaseucompat32ucompileuNLCREu	NLCRE_bolu	NLCRE_eoluNLCRE_crackuheaderREuEMPTYSTRINGuNLuobjectuNeedMoreDatauBufferedSubFileu
FeedParseruBytesFeedParser(((u5/opt/alt/python33/lib64/python3.3/email/feedparser.pyu<module>s"	[�z

?>