Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/future/backports/email/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyc
�
,�]c@`s�dZddlmZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZddlZddl
mZmZdd	lmZmZdd
lmZddlmZddlmZed
�Zeed�BZed�ZeeBZeed�Zeed�Zeed�Bed�ZeeBZ eed�BZ!e!eBZ"e"ed�Z#d�Z$de%fd��YZ&defd��YZ'de'fd��YZ(de'fd��YZ)de'fd��YZ*d e'fd!��YZ+d"e(fd#��YZ,d$e'fd%��YZ-d&e'fd'��YZ.d(e'fd)��YZ/d*e'fd+��YZ0d,e0fd-��YZ1d.e(fd/��YZ2d0e'fd1��YZ3d2e'fd3��YZ4d4e'fd5��YZ5d6e'fd7��YZ6d8e'fd9��YZ7d:e'fd;��YZ8d<e'fd=��YZ9d>e'fd?��YZ:d@e'fdA��YZ;dBe'fdC��YZ<dDe'fdE��YZ=dFe'fdG��YZ>dHe'fdI��YZ?dJe'fdK��YZ@dLe'fdM��YZAdNe*fdO��YZBdPe'fdQ��YZCdRe'fdS��YZDdTe'fdU��YZEdVe'fdW��YZFdXeFfdY��YZGdZe'fd[��YZHd\e'fd]��YZId^e'fd_��YZJd`e'fda��YZKdbe'fdc��YZLddeLfde��YZMdfeLfdg��YZNdhe'fdi��YZOdje'fdk��YZPdle'fdm��YZQdne	fdo��YZRdpeRfdq��YZSdreRfds��YZTdteSfdu��YZUeTddv�ZVeTdwdx�ZWeTdydz�ZXejYd{jZd|j[e���j\Z]ejYd}jZd|j[e�j^d~d�j^d�d����j_Z`ejYd��jaZbejYd}jZd|j[e �j^d~d�j^d�d����j_ZcejYd}jZd|j[e"�j^d~d�j^d�d����j_ZdejYd}jZd|j[e#�j^d~d�j^d�d����j_Zed��Zfd��Zgd��Zhd��Zid��Zjd��Zkd��Zld��Zmd��Znd��Zod��Zpd��Zqd��Zrd��Zsd��Ztd��Zud��Zvd��Zwd��Zxd��Zyd��Zzd��Z{d��Z|d��Z}d��Z~d��Zd��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�dS(�ulHeader value parser implementing various email-related RFC parsing rules.

The parsing methods defined in this module implement various email related
parsing rules.  Principal among them is RFC 5322, which is the followon
to RFC 2822 and primarily a clarification of the former.  It also implements
RFC 2047 encoded word decoding.

RFC 5322 goes to considerable trouble to maintain backward compatibility with
RFC 822 in the parse phase, while cleaning up the structure on the generation
phase.  This parser supports correct RFC 5322 generation by tagging white space
as folding white space only when folding is allowed in the non-obsolete rule
sets.  Actually, the parser is even more generous when accepting input than RFC
5322 mandates, following the spirit of Postel's Law, which RFC 5322 encourages.
Where possible deviations from the standard are annotated on the 'defects'
attribute of tokens that deviate.

The general structure of the parser follows RFC 5322, and uses its terminology
where there is a direct correspondence.  Where the implementation requires a
somewhat different structure than that used by the formal grammar, new terms
that mimic the closest existing terms are used.  Thus, it really helps to have
a copy of RFC 5322 handy when studying this code.

Input to the parser is a string that has already been unfolded according to
RFC 5322 rules.  According to the RFC this unfolding is the very first step, and
this parser leaves the unfolding step to a higher level message parser, which
will have already detected the line breaks that need unfolding while
determining the beginning and end of each header.

The output of the parser is a TokenList object, which is a list subclass.  A
TokenList is a recursive data structure.  The terminal nodes of the structure
are Terminal objects, which are subclasses of str.  These do not correspond
directly to terminal objects in the formal grammar, but are instead more
practical higher level combinations of true terminals.

All TokenList and Terminal objects have a 'value' attribute, which produces the
semantically meaningful value of that part of the parse subtree.  The value of
all whitespace tokens (no matter how many sub-tokens they may contain) is a
single space, as per the RFC rules.  This includes 'CFWS', which is herein
included in the general class of whitespace tokens.  There is one exception to
the rule that whitespace tokens are collapsed into single spaces in values: in
the value of a 'bare-quoted-string' (a quoted-string with no leading or
trailing whitespace), any whitespace that appeared between the quotation marks
is preserved in the returned value.  Note that in all Terminal strings quoted
pairs are turned into their unquoted values.

All TokenList and Terminal objects also have a string value, which attempts to
be a "canonical" representation of the RFC-compliant form of the substring that
produced the parsed subtree, including minimal use of quoted pair quoting.
Whitespace runs are not collapsed.

Comment tokens also have a 'content' attribute providing the string found
between the parens (including any nested comments) with whitespace preserved.

All TokenList and Terminal objects have a 'defects' attribute which is a
possibly empty list all of the defects found while creating the token.  Defects
may appear on any token in the tree, and a composite list of all defects in the
subtree is available through the 'all_defects' attribute of any node.  (For
Terminal notes x.defects == x.all_defects.)

Each object in a parse tree is called a 'token', and each has a 'token_type'
attribute that gives the name from the RFC 5322 grammar that it represents.
Not all RFC 5322 nodes are produced, and there is one non-RFC 5322 node that
may be produced: 'ptext'.  A 'ptext' is a string of printable ascii characters.
It is returned in place of lists of (ctext/quoted-pair) and
(qtext/quoted-pair).

XXX: provide complete list of token types.
i(tprint_function(tunicode_literals(tdivision(tabsolute_import(tinttrangetstrtsupertlistN(t
namedtupletOrderedDict(tunquotetunquote_to_bytes(t_encoded_words(terrors(tutilsu 	u(u
()<>@,:;.\"[]u.u."(u/?=u*'%u%cC`s*dt|�jdd�jdd�dS(Nu"u\u\\u\"(Rtreplace(tvalue((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytquote_stringdst_FoldedcB`sAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cC`sF||_||_d|_d|_t|_g|_t�|_	dS(Ni(
tmaxlentpolicytlastlentNonetstickyspacetTruet	firstlinetdoneRtcurrent(tselfRR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt__init__ms						cC`sC|jj|j�|jj|jj�|jj�d|_dS(Ni(RtextendRtappendRtlineseptclearR(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytnewlinevs
cC`s|jr|j�ndS(N(RR#(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytfinalize|s	cC`sdj|j�S(Nu(tjoinR(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt__str__�scC`s|jj|�dS(N(RR (Rtstoken((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR �scC`s�|dkrt|�}nt|�}|jdk	r+t|j�}|j|||jkr�|jj|j�|j|7_|jj|�|j|7_d|_t|_	t
S|jr|j�}|dk	r�|jt|�7_|t|�7}n|j
|�t
S|r�|d|jkr�|j|}d|koM|knr�||}|jj|j| �|j||_|}n|j�|jj|j�|jj|�|||_d|_t|_	t
S|j	s�|j�n|jj|j�|jj|�d|_t|_	t
S|j||jkrd|jj|�|j|7_t
S||jkr�|j�|jj|�||_t
StS(Nii(RRtlenRRRRR tFalseRRthas_fwstpop_leading_fwst_foldR#(RttokenR'tltstickyspace_lentwstmarginttrim((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytappend_if_fits�sf			


	

			
		
	N(	t__name__t
__module__RR#R$R&R RR3(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRks						t	TokenListcB`s�eZdZd�Zd�Zd�Zed��Zed��Z	ed��Z
d�Zd�Zd�Z
ed	��Zd
�Zed��Zd�Zd
�Zd�Zd�Zdd�Zdd�Zdd�ZRS(cO`s&tt|�j||�g|_dS(N(RR6Rtdefects(Rtargstkw((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`sdjd�|D��S(Nucs`s|]}t|�VqdS(N(R(t.0tx((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R%(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR&�scC`s%dj|jjtt|�j��S(Nu{}({})(tformatt	__class__R4RR6t__repr__(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR>�scC`sdjd�|D��S(Nucs`s!|]}|jr|jVqdS(N(R(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R%(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`std�|D�|j�S(Ncs`s|]}|jVqdS(N(tall_defects(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(tsumR7(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR?�scc`s�|j}t�}x�|D]�}|j�rh|rht|�dkrM|dn	||�V|j�qhn|j�}|j|�|r||�V|g}qqW|r�t|�dkr�|dn	||�VndS(Nii(R=Rtstartswith_fwsR(R"tpop_trailing_wsR (RtklasstthisR-tend_ws((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytparts�s		
'
cC`s|dj�S(Ni(RA(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRAscC`s.|djdkr |jd�S|dj�S(Niufws(t
token_typetpopR+(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR+s
cC`s.|djdkr |jd�S|dj�S(Ni����ucfws(RGRHRB(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRBs
cC`s"x|D]}|jrtSqWtS(N(R*RR)(Rtpart((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR*s
	cC`s|dj�S(Ni(thas_leading_comment(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRJ"scC`s+g}x|D]}|j|j�q
W|S(N(Rtcomments(RRKR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRK%s
cK`sV|d}|d=|jp#td�}t||�}|j|�|j�t|�S(Nupolicyu+inf(tmax_line_lengthtfloatRR,R$R(Rt_3to2kwargsRRtfolded((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytfold,s


cC`s�g}|j�}|r(|j|�n|djdkrJ|jd�nd}|jtjt|�|��|j|�dj|�S(Ni����ufwsu(R+R RGRHt_ewtencodeRR%(RtcharsettresR0ttrailer((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytas_encoded_word5s(
cC`s=g}x'|D]}|j|j||��q
Wdj|�S(Nu(R t
cte_encodeR%(RRSRRTRI((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRWAs
cC`s7x0|jD]%}t|�}t|�}yt|�jd�WnZtk
r�td�|jD��rqd}nd}|j||j�}t|�}nX|j	||�r�q
n|j
�}|dk	r�t|jd��|_
|j	|�r�q
q�n|jr|j|�q
n|j|�|j�q
WdS(Nuus-asciics`s!|]}t|tj�VqdS(N(t
isinstanceRtUndecodableBytesDefect(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>Nsuunknown-8bituutf-8i(RFRR(RRtUnicodeEncodeErrortanyR?RWRR3R+RRHRR*R,R R#(RRORIttstrttlenRSR0((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR,Gs0
				

ucC`s#tdj|jdd���dS(Nu
tindentu(tprintR%t_pp(RR^((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytpprintiscC`sdj|jdd��S(Nu
R^u(R%R`(RR^((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytppstrlscc`s�dj||jj|j�VxU|D]M}t|d�sN|dj|�Vq$x |j|d�D]}|VqbWq$W|jr�dj|j�}nd}dj||�VdS(Nu{}{}/{}(u_ppu*    !! invalid element in token list: {!r}u    u Defects: {}uu{}){}(R<R=R4RGthasattrR`R7(RR^R-tlinetextra((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR`os	
	
	N(R4R5RRGRR&R>tpropertyRR?RFRAR+RBR*RJRKRPRVRWR,RaRbR`(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR6�s(			+									"tWhiteSpaceTokenListcB`s&eZed��Zed��ZRS(cC`sdS(Nu ((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`s)g|D]}|jdkr|j^qS(Nucomment(RGtcontent(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRK�s(R4R5RfRRK(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRg�stUnstructuredTokenListcB`s eZdZd�Zd�ZRS(uunstructuredcC`s3td�|D��r#|j|�Sd}x|jD]�}t|�}t}yt|�jd�Wn�tk
r_td�|jD��r�d}nd}|dk	rGt	dj
|j||g��j|�}t
d�|j| D��}t|�}	t|	�}
||
|jkrG|j|3|j|	�||
|_q3qGn|j|�}t}nX|j||�r�|r3t|j�d}q3q3n|s�|r�|j|�q3n|j�}|dk	r�t|�|_|j|�r�q3q�n|jr|j|�q3n|j|�|j�d}q3WdS(	Ncs`s|]}|jdkVqdS(uencoded-wordN(RG(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�suus-asciics`s!|]}t|tj�VqdS(N(RXRRY(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�suunknown-8bituutf-8ucs`s|]}t|�VqdS(N(R((R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�si(R[t
_fold_encodedRRFRR)RRRZR?tget_unstructuredR%RRVR@R(RR RRR3t_fold_as_ewR+RR*RPR#(RROtlast_ewRIR\tis_ewRStchunkt
oldlastlentschunktlchunkR0((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR,�sX

		)


	

		


cC`s�g}d}x�|D]�}t|�}y|jd�|j|�Wqtk
r�|dkr�|j|j||��t|�}q�tdj|||g��}|j|j	��qXqWdj|�S(Nuus-asciiu(
RRRRR RZRWR(RkR%RV(RRSRRTRmRItspartttl((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRW�s


 (R4R5RGR,RW(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRi�s	8tPhrasecB`s eZdZd�Zd�ZRS(uphrasecC`s<d}x/|jD]$}t|�}t|�}t}yt|�jd�Wnztk
r�td�|jD��r}d}nd}|dk	r�|j	�r�|dj
dkr�|jr�|jd�}nd}x=t
|�D]/\}	}
|
j
dkr�t|
�||	<q�q�Wtdj|j||g��j|�}t|�}t|�}
||
|jkr�|j|3|j|�td	�|jD��|_qq�n|j|�}t|�}t}nX|j||�r'|r|jrt|j�d
}q|js|j
dkrd}qqn|j|�qWdS(Nuus-asciics`s!|]}t|tj�VqdS(N(RXRRY(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�suunknown-8bituutf-8i����ucfwsuubare-quoted-stringcs`s|]}t|�VqdS(N(R((R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>
siu
quoted-string(RRFRR(R)RRRZR[R?RJRGRKRHt	enumerateRiRkR%RRVRR R@RRR3R,(RRORmRIR\R]thas_ewRSt	remaindertiR-RoRqRr((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR,�sL
		)

	
	cC`s�g}d}t}xs|D]k}t|�}y|jd�|j|�Wntk
r[t}|dkr�|js�t|�}n|j|j	||��q\|j
�s\|djdkr�|jr�|jd�}nd}x=t
|�D]/\}	}
|
jdkr�t|
�||	<q�q�Wtdj|||g��}|j|�g||)q\nX|js{|r|jdkrd}qqWdj|�S(Nuus-asciii����ucfwsuubare-quoted-stringu
quoted-string(RR)RRRR RZRRKR(RWRJRGRHRvRiRkR%RV(RRSRRTRmRnRIRsRxRyR-Rt((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRWs4


	 
(R4R5RGR,RW(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRu�s	>tWordcB`seZdZRS(uword(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRz:stCFWSListcB`seZdZd�ZRS(ucfwscC`s
t|j�S(N(tboolRK(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRJCs(R4R5RGRJ(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR{?stAtomcB`seZdZRS(uatom(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR}GstTokencB`seZdZRS(utoken(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR~LstEncodedWordcB`s/eZdZdZdZdZed��ZRS(uencoded-wordcC`s3|jdk	r|jStjt|�|j�dS(N(tcteRRQRRRRS(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytencodedXsN(	R4R5RGRR�RStlangRfR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRQs
tQuotedStringcB`s;eZdZed��Zed��Zed��ZRS(u
quoted-stringcC`s+x$|D]}|jdkr|jSqWdS(Nubare-quoted-string(RGR(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRhds
cC`sYg}xC|D];}|jdkr8|jt|��q
|j|j�q
Wdj|�S(Nubare-quoted-stringu(RGR RRR%(RRTR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytquoted_valuejs
cC`s+x$|D]}|jdkr|jSqWdS(Nubare-quoted-string(RGR(RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytstripped_valuets
(R4R5RGRfRhR�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�`s
tBareQuotedStringcB`s&eZdZd�Zed��ZRS(ubare-quoted-stringcC`stdjd�|D���S(Nucs`s|]}t|�VqdS(N(R(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(RR%(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR&scC`sdjd�|D��S(Nucs`s|]}t|�VqdS(N(R(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R%(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s(R4R5RGR&RfR(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�{s	tCommentcB`s>eZdZd�Zd�Zed��Zed��ZRS(ucommentcC`sAdjtdgg|D]}|j|�^qdggg��S(Nuu(u)(R%R@tquote(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR&�s
		cC`sG|jdkrt|�St|�jdd�jdd�jdd�S(Nucommentu\u\\u(u\(u)u\)(RGRR(RR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s

cC`sdjd�|D��S(Nucs`s|]}t|�VqdS(N(R(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R%(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRh�scC`s
|jgS(N(Rh(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRK�s(R4R5RGR&R�RfRhRK(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s
		tAddressListcB`s;eZdZed��Zed��Zed��ZRS(uaddress-listcC`s&g|D]}|jdkr|^qS(Nuaddress(RG(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	addresses�scC`std�|D�g�S(Ncs`s'|]}|jdkr|jVqdS(uaddressN(RGt	mailboxes(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R@(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s	cC`std�|D�g�S(Ncs`s'|]}|jdkr|jVqdS(uaddressN(RGt
all_mailboxes(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>�s(R@(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s	(R4R5RGRfR�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stAddresscB`s;eZdZed��Zed��Zed��ZRS(uaddresscC`s"|djdkr|djSdS(Niugroup(RGtdisplay_name(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s@|djdkr|dgS|djdkr5gS|djS(Niumailboxuinvalid-mailbox(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s
cC`sG|djdkr|dgS|djdkr<|dgS|djS(Niumailboxuinvalid-mailbox(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s
(R4R5RGRfR�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stMailboxListcB`s,eZdZed��Zed��ZRS(umailbox-listcC`s&g|D]}|jdkr|^qS(Numailbox(RG(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s&g|D]}|jdkr|^qS(Numailboxuinvalid-mailbox(umailboxuinvalid-mailbox(RG(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s
(R4R5RGRfR�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��st	GroupListcB`s,eZdZed��Zed��ZRS(u
group-listcC`s)|s|djdkrgS|djS(Niumailbox-list(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s)|s|djdkrgS|djS(Niumailbox-list(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s(R4R5RGRfR�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stGroupcB`s;eZdZed��Zed��Zed��ZRS(ugroupcC`s"|djdkrgS|djS(Niu
group-list(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s"|djdkrgS|djS(Niu
group-list(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s|djS(Ni(R�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s(R4R5RGRfR�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stNameAddrcB`sYeZdZed��Zed��Zed��Zed��Zed��ZRS(u	name-addrcC`s!t|�dkrdS|djS(Nii(R(RR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`s|djS(Ni����(t
local_part(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`s|djS(Ni����(tdomain(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`s|djS(Ni����(troute(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`s|djS(Ni����(t	addr_spec(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s(	R4R5RGRfR�R�R�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�st	AngleAddrcB`sJeZdZed��Zed��Zed��Zed��ZRS(u
angle-addrcC`s+x$|D]}|jdkr|jSqWdS(Nu	addr-spec(RGR�(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR� s
cC`s+x$|D]}|jdkr|jSqWdS(Nu	addr-spec(RGR�(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�&s
cC`s+x$|D]}|jdkr|jSqWdS(Nu	obs-route(RGtdomains(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�,s
cC`s/x(|D]}|jdkr|jSqWdSdS(Nu	addr-specu<>(RGR�(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�2s
(R4R5RGRfR�R�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s
tObsRoutecB`seZdZed��ZRS(u	obs-routecC`s)g|D]}|jdkr|j^qS(Nudomain(RGR�(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�?s(R4R5RGRfR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�;stMailboxcB`sYeZdZed��Zed��Zed��Zed��Zed��ZRS(umailboxcC`s"|djdkr|djSdS(Niu	name-addr(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�HscC`s|djS(Ni(R�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�MscC`s|djS(Ni(R�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�QscC`s"|djdkr|djSdS(Niu	name-addr(RGR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�UscC`s|djS(Ni(R�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�Zs(	R4R5RGRfR�R�R�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�DstInvalidMailboxcB`s/eZdZed��ZeZZZZRS(uinvalid-mailboxcC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�cs(	R4R5RGRfR�R�R�R�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�_stDomaincB`seZdZed��ZRS(udomaincC`sdjtt|�jj��S(Nu(R%RR�Rtsplit(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�ns(R4R5RGRfR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�jstDotAtomcB`seZdZRS(udot-atom(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�sstDotAtomTextcB`seZdZRS(u
dot-atom-text(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�xstAddrSpeccB`sJeZdZed��Zed��Zed��Zed��ZRS(u	addr-speccC`s|djS(Ni(R�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s!t|�dkrdS|djS(Nii����(R(RR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`sJt|�dkr|djS|djj�|dj|djj�S(Niiii(R(Rtrstriptlstrip(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`sht|j�}t|�t|t�kr=t|j�}n	|j}|jdk	rd|d|jS|S(Nu@(tsetR�R(t
DOT_ATOM_ENDSRR�R(Rtnamesettlp((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s	(R4R5RGRfR�R�RR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�}s
tObsLocalPartcB`seZdZRS(uobs-local-part(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stDisplayNamecB`s,eZdZed��Zed��ZRS(udisplay-namecC`s�t|�}|djdkr/|jd�n2|ddjdkrat|dd�|d<n|djdkr�|j�n2|ddjdkr�t|dd �|d<n|jS(Niucfwsii����(R6RGRHR(RRT((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s
cC`s�t}|jrt}n)x&|D]}|jdkrt}qqW|r�d}}|djdks{|ddjdkr�d}n|djdks�|ddjdkr�d}n|t|j�|Stt|�jSdS(Nu
quoted-stringuiucfwsu i����(	R)R7RRGRR�RR�R(RR�R;tpretpost((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s		


*	*	(R4R5RGRfR�R(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��st	LocalPartcB`s,eZdZed��Zed��ZRS(u
local-partcC`s-|djdkr|djS|djSdS(Niu
quoted-string(RGR�R(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�sc	C`s
tg}t}t}x�|dtgD]�}|jdkrBq'n|r�|jdkr�|djdkr�t|d �|d<nt|t�}|r�|jdkr�|djdkr�|jt|d��n
|j|�|d}|}q'Wt|dd!�}|jS(Niucfwsudoti����i(tDOTR)RGR6RXR R(RRTtlastt
last_is_tlttoktis_tl((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s$	


(R4R5RGRfRR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��st
DomainLiteralcB`s,eZdZed��Zed��ZRS(udomain-literalcC`sdjtt|�jj��S(Nu(R%RR�RR�(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s+x$|D]}|jdkr|jSqWdS(Nuptext(RGR(RR;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytip�s
(R4R5RGRfR�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stMIMEVersioncB`seZdZdZdZRS(umime-versionN(R4R5RGRtmajortminor(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��st	ParametercB`s>eZdZeZeZdZed��Zed��Z	RS(u	parameteruus-asciicC`s|jr|djSdS(Nii(t	sectionedtnumber(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytsection_number	scC`s�x�|D]x}|jdkr#|jS|jdkrxJ|D]?}|jdkr9x'|D]}|jdkrU|jSqUWq9q9WqqWdS(Nuvalueu
quoted-stringubare-quoted-stringu(RGR�(RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytparam_values


(
R4R5RGR)R�textendedRSRfR�R�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�stInvalidParametercB`seZdZRS(uinvalid-parameter(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�st	AttributecB`seZdZed��ZRS(u	attributecC`s.x'|D]}|jjd�r|jSqWdS(Nuattrtext(RGtendswithR(RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�'s
(R4R5RGRfR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�#stSectioncB`seZdZdZRS(usectionN(R4R5RGRR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�-stValuecB`seZdZed��ZRS(uvaluecC`sF|d}|jdkr&|d}n|jjd�r?|jS|jS(Niucfwsiu
quoted-stringu	attributeuextended-attribute(u
quoted-stringu	attributeuextended-attribute(RGR�R�R(RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�7s

		(R4R5RGRfR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�3stMimeParameterscB`s&eZdZed��Zd�ZRS(umime-parameterscc`s�t�}x�|D]}}|jjd�s.qn|djdkrGqn|djj�}||krsg||<n||j|j|f�qWx^|j�D]P\}}t|�}g}|ddj	}xt
|�D]�\}\}}	||kr|	jjtj
d��n|	j}
|	jr�yt|
�}
Wn#tk
r[t|
dd�}
q�Xy|
j|d�}
Wn#tk
r�|
jd	d�}
nXtj|
�r�|	jjtj��q�n|j|
�q�Wd
j|�}
||
fVq�WdS(Nu	parameteriu	attributeiu*inconsistent multipart parameter numberingtencodingulatin-1usurrogateescapeuus-asciiu(R
RGR�RtstripR R�titemstsortedRSRvR7RtInvalidHeaderDefectR�R�RRZRtdecodetLookupErrorRt_has_surrogatesRYR%(RtparamsR-tnameRFtvalue_partsRSRyR�tparamR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�FsB	


		

cC`svg}xL|jD]A\}}|rD|jdj|t|���q|j|�qWdj|�}|rrd|SdS(Nu{}={}u; u u(R�R R<RR%(RR�R�R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR&ys"(R4R5RGRfR�R&(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�Bs3tParameterizedHeaderValuecB`s&eZed��Zed��ZRS(cC`s1x*t|�D]}|jdkr
|jSq
WiS(Numime-parameters(treversedRGR�(RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��scC`s<|r/|djdkr/t|d |d�St|�jS(Ni����umime-parameters(RGR6RF(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRF�s(R4R5RfR�RF(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stContentTypecB`seZdZdZdZRS(ucontent-typeutextuplain(R4R5RGtmaintypetsubtype(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stContentDispositioncB`seZdZdZRS(ucontent-dispositionN(R4R5RGRtcontent_disposition(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stContentTransferEncodingcB`seZdZdZRS(ucontent-transfer-encodingu7bit(R4R5RGR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stHeaderLabelcB`seZdZRS(uheader-label(R4R5RG(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stHeadercB`seZdZd�ZRS(uheadercC`s�|jt|jd���t|jd�|_|djdkrZt|jd��nd|_|jd�}|r�td��n|j	|�dS(NiucfwsuuMalformed Header token list(
R RRHR(RRRGRt
ValueErrorR,(RROtrest((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR,�s1(R4R5RGR,(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��stTerminalcB`sqeZd�Zd�Zed��Zdd�Zd�Zd�Zd�Z	ed��Z
d	�Zd
�ZRS(cC`s1tt|�j||�}||_g|_|S(N(RR�t__new__RGR7(tclsRRGR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s		cC`s%dj|jjtt|�j��S(Nu{}({})(R<R=R4RR�R>(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR>�scC`s
t|j�S(N(RR7(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR?�sucC`sOdj||jj|jtt|�j�|js9dndj|j��gS(Nu
{}{}/{}({}){}uu {}(R<R=R4RGRR�R>R7(RR^((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR`�s	cC`sFt|�}y|jd�|SWntk
rAtj||�SXdS(Nuus-ascii(RRRRZRQ(RRSRR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRW�s

cC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRB�scC`sdS(N(R(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR+�scC`sgS(N((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRK�scC`stS(N(R)(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRJ�scC`st|�|jfS(N(RRG(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt__getnewargs__�s(
R4R5R�R>RfR?R`RWRBR+RKRJR�(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s							tWhiteSpaceTerminalcB`s&eZed��Zd�ZeZRS(cC`sdS(Nu ((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`stS(N(R(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRAs(R4R5RfRRARR*(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR��s	t
ValueTerminalcB`s/eZed��Zd�ZeZd�ZRS(cC`s|S(N((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRscC`stS(N(R)(R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRAscC`stjt|�|�S(N(RQRRR(RRS((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRVs(R4R5RfRRAR)R*RV(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s	tEWWhiteSpaceTerminalcB`s5eZed��Zed��Zd�ZeZRS(cC`sdS(Nu((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRscC`s|S(N((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�scC`sdS(Nu((R((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR&s(R4R5RfRR�R&RR*(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR�s	udotu,ulist-separatoru@uroute-component-markeru([{}]+)uu[^{}]+u\u\\u]u\]u[\x00-\x20\x7F]cC`s]t|�}|r.|jjtj|��ntj|�rY|jjtjd��ndS(u@If input token contains ASCII non-printables, register a defect.u*Non-ASCII characters found in header tokenN(t_non_printable_finderR7R RtNonPrintableDefectRR�RY(txtexttnon_printables((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt_validate_xtextOsc	C`s�tt|d��}|d |dg\}}g}t}t}x�tt|��D]k}||dkr�|r�t}t}q�t}qUn|r�t}n|||kr�Pn|j||�qUW|d}dj|�dj||g|�|fS(ukScan printables/quoted-pairs until endchars and return unquoted ptext.

    This function turns a run of qcontent, ccontent-without-comments, or
    dtext-with-quoted-printables into a single string by unquoting any
    quoted printables.  It returns the string, the remaining value, and
    a flag that is True iff there were any quoted printables decoded.

    iu\u(Rt
_wsp_splitterR)RR(RR R%(	Rtendcharst	_3to2listtfragmentRxtvcharstescapethad_qptpos((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt_get_ptext_to_endcharsYs&			
c
C`s�g}g}d}x�|r�yt|d�\}}}Wn%tk
r^|dd}}}nX|jd�oz|jd�s�dj|�|||||fStj|�\}}}}	|j|�|j|	�|}qWdj|�||fS(u" Decode a run of RFC2047 encoded words.

        _decode_ew_run(value) -> (text, value, defects)

    Scans the supplied value for a run of tokens that look like they are RFC
    2047 encoded words, decodes those words into text according to RFC 2047
    rules (whitespace between encoded words is discarded), and returns the text
    and the remaining value (including any leading whitespace on the remaining
    value), as well as a list of any defects encountered while decoding.  The
    input value may not have any leading whitespace.

    uiu=?u?=(	R�R�t
startswithR�R%RQR�R R(
RRTR7tlast_wsR�R0ttextRSR�tnew_defects((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt_decode_ew_runxs
	
"


cC`s9|j�}t|t|�t|� d�}||fS(u�FWS = 1*WSP

    This isn't the RFC definition.  We're using fws to represent tokens where
    folding can be done, but when we are parsing the *un*folding has already
    been done so we don't need to watch out for CRLF.

    ufws(R�R�R((Rtnewvaluetfws((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_fws�s#cC`smt�}|jd�s3tjdj|���nt|djdd��}|d |dg\}}||dkr�tjdj|���ndj|�}|d j�r�t|jdd��}|d |dg\}}|d|}nt	|j��dkr,|j
jtjd��n||_
dj|�}y'tjd|d�\}}	}
}Wn,tk
r�tjdj|j
���nX|	|_|
|_|j
j|�x�|rb|d	tkr�t|�\}}|j|�q�ntt|d��}
|
d |
dg\}}t|d
�}t|�|j|�dj|�}q�W||fS(uE encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

    u=?u"expected encoded word but found {}iu?=iuuwhitespace inside encoded wordu!encoded word format invalid: '{}'iuvtext(RR�RtHeaderParseErrorR<RR�R%tisdigitR(R7R R�R�RQR�R�RSR�RtWSPR�R�R�R�(Rtewt
_3to2list1R�Rxtremstrt
_3to2list3R�R�RSR�R7R-t
_3to2list5tcharstvtext((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_encoded_word�sN	
	'
			


cC`s�t�}x�|r�|dtkrGt|�\}}|j|�qn|jd�r.yt|�\}}Wntjk
r�q.Xt}t	|�dkr�|dj
dkr�|jjtjd��t
}q�n|rt	|�dkr|dj
dkrt|dd�|d<qn|j|�qntt|d��}|d |dg\}}t|d	�}t|�|j|�d
j|�}qW|S(uOunstructured = (*([FWS] vchar) *WSP) / obs-unstruct
       obs-unstruct = *((*LF *CR *(obs-utext) *LF *CR)) / FWS)
       obs-utext = %d0 / obs-NO-WS-CTL / LF / CR

       obs-NO-WS-CTL is control characters except WSP/CR/LF.

    So, basically, we have printable runs, plus control characters or nulls in
    the obsolete syntax, separated by whitespace.  Since RFC 2047 uses the
    obsolete syntax in its specification, but requires whitespace on either
    side of the encoded words, I can see no reason to need to separate the
    non-printable-non-whitespace from the printable runs if they occur, so we
    parse this into xtext tokens separated by WSP tokens.

    Because an 'unstructured' value must by definition constitute the entire
    value, this 'get' routine does not return a remaining value, only the
    parsed TokenList.

    iu=?i����ufwsu&missing whitespace before encoded wordii����uencoded-worduvtextu(RiR�R�R R�RRR�RR(RGR7R�R)R�RR�R�R�R%(RtunstructuredR-thave_wst
_3to2list7R�RxR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRk�s<		




cC`s;t|d�\}}}t|d�}t|�||fS(uctext = <printable ascii except \ ( )>

    This is not the RFC ctext, since we are handling nested comments in comment
    and unquoting quoted-pairs here.  We allow anything except the '()'
    characters, but if we find any ASCII other than the RFC defined printable
    ASCII an NonPrintableDefect is added to the token's defects list.  Since
    quoted pairs are converted to their unquoted values, what is returned is
    a 'ptext' token.  In this case it is a WhiteSpaceTerminal, so it's value
    is ' '.

    u()uptext(R�R�R�(Rtptextt_((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_qp_ctexts
cC`s;t|d�\}}}t|d�}t|�||fS(uoqcontent = qtext / quoted-pair

    We allow anything except the DQUOTE character, but if we find any ASCII
    other than the RFC defined printable ASCII an NonPrintableDefect is
    added to the token's defects list.  Any quoted pairs are converted to their
    unquoted values, so what is returned is a 'ptext' token.  In this case it
    is a ValueTerminal.

    u"uptext(R�R�R�(RRR((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_qcontents

cC`slt|�}|s-tjdj|���n|j�}|t|�}t|d�}t|�||fS(u�atext = <matches _atext_matcher>

    We allow any non-ATOM_ENDS in atext, but add an InvalidATextDefect to
    the token's defects list if we find non-atext characters.
    uexpected atext but found '{}'uatext(t_non_atom_end_matcherRR�R<tgroupR(R�R�(Rtmtatext((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_atext$s
cC`s�|ddkr+tjdj|���nt�}|d}x^|r�|ddkr�|dtkr|t|�\}}nt|�\}}|j|�qAW|s�|jjtj	d��||fS||dfS(u�bare-quoted-string = DQUOTE *([FWS] qcontent) [FWS] DQUOTE

    A quoted-string without the leading or trailing white space.  Its
    value is the text between the quote marks, with whitespace
    preserved and quoted pairs decoded.
    iu"uexpected '"' but found '{}'iu"end of header inside quoted string(
RR�R<R�R�R�RR R7R�(Rtbare_quoted_stringR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_bare_quoted_string4s	


cC`s|r1|ddkr1tjdj|���nt�}|d}x�|r�|ddkr�|dtkr�t|�\}}n7|ddkr�t|�\}}nt|�\}}|j|�qGW|s�|j	jtj
d��||fS||dfS(u�comment = "(" *([FWS] ccontent) [FWS] ")"
       ccontent = ctext / quoted-pair / comment

    We handle nested comments here, and quoted-pair in our qp-ctext routine.
    iu(uexpected '(' but found '{}'iu)uend of header inside comment(RR�R<R�R�R�tget_commentRR R7R�(RtcommentR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyRLs"	


cC`stt�}x^|ri|dtkri|dtkrGt|�\}}nt|�\}}|j|�qW||fS(u,CFWS = (1*([FWS] comment) [FWS]) / FWS

    i(R{tCFWS_LEADERR�R�RR (RtcfwsR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_cfwses	cC`s�t�}|rA|dtkrAt|�\}}|j|�nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(u�quoted-string = [CFWS] <bare-quoted-string> [CFWS]

    'bare-quoted-string' is an intermediate class defined by this
    parser and not by the RFC grammar.  It is the quoted string
    without any attached CFWS.
    i(R�RRR R(Rt
quoted_stringR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_quoted_stringrs	
cC`s�t�}|rA|dtkrAt|�\}}|j|�n|rr|dtkrrtjdj|���nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(u"atom = [CFWS] 1*atext [CFWS]

    iuexpected atom but found '{}'(	R}RRR t	ATOM_ENDSRR�R<R
(RtatomR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_atom�s	
cC`s�t�}|s |dtkr;tjdj|���nxi|r�|dtkr�t|�\}}|j|�|r>|ddkr>|jt�|d}q>q>W|dtkr�tjdjd|���n||fS(u( dot-text = 1*atext *("." 1*atext)

    iu8expected atom at a start of dot-atom-text but found '{}'u.ii����u4expected atom at end of dot-atom-text but found '{}'(R�RRR�R<R
R R�(Rt
dot_atom_textR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_dot_atom_text�s	

cC`s�t�}|dtkr;t|�\}}|j|�nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(u- dot-atom = [CFWS] dot-atom-text [CFWS]

    i(R�RRR R(Rtdot_atomR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_dot_atom�s	
cC`s�|dtkr%t|�\}}nd}|ddkrPt|�\}}n=|dtkr{tjdj|���nt|�\}}|dk	r�|g|d*n||fS(u�word = atom / quoted-string

    Either atom or quoted-string may start with CFWS.  We have to peel off this
    CFWS first to determine which type of word to parse.  Afterward we splice
    the leading CFWS, if any, into the parsed sub-token.

    If neither an atom or a quoted-string is found before the next special, a
    HeaderParseError is raised.

    The token returned is either an Atom or a QuotedString, as appropriate.
    This means the 'word' level of the formal grammar is not represented in the
    parse tree; this is because having that extra layer when manipulating the
    parse tree is more confusing than it is helpful.

    iu"u1Expected 'atom' or 'quoted-string' but found '{}'N(	RRRRtSPECIALSRR�R<R(RtleaderR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_word�scC`sAt�}y#t|�\}}|j|�Wn-tjk
r[|jjtjd��nXx�|r6|dtkr6|ddkr�|jt�|jjtj	d��|d}q_yt|�\}}WnUtjk
r%|dt
krt|�\}}|jjtj	d��q&�nX|j|�q_W||fS(u� phrase = 1*word / obs-phrase
        obs-phrase = word *(word / "." / CFWS)

    This means a phrase can be a sequence of words, periods, and CFWS in any
    order as long as it starts with at least one word.  If anything other than
    words is detected, an ObsoleteHeaderDefect is added to the token's defect
    list.  We also accept a phrase that starts with CFWS followed by a dot;
    this is registered as an InvalidHeaderDefect, since it is not supported by
    even the obsolete grammar.

    uphrase does not start with wordiu.uperiod in 'phrase'iucomment found without atom(RuR R RR�R7R�tPHRASE_ENDSR�tObsoleteHeaderDefectRR(RtphraseR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_phrase�s.	



cC`s�t�}d	}|dtkr4t|�\}}n|sUtjdj|���nyt|�\}}Wnptjk
r�yt|�\}}Wq�tjk
r�|ddkr�|dt	kr��nt
�}q�XnX|d	k	r�|g|d*n|j|�|r�|ddks-|dt	kr�tt
|�|�\}}|jdkrt|jjtjd��n|jjtjd��||d<ny|jjd�Wn*tk
r�|jjtjd��nX||fS(
u= local-part = dot-atom / quoted-string / obs-local-part

    iu"expected local-part but found '{}'u\uinvalid-obs-local-partu<local-part is not dot-atom, quoted-string, or obs-local-partu,local-part is not a dot-atom (contains CFWS)uasciiu)local-part contains non-ASCII characters)N(R�RRRRR�R<RR R!R6R tget_obs_local_partRRGR7R�R"RRRRZtNonASCIILocalPartDefect(RR�RR-tobs_local_part((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_local_part�sB	 
&



c	C`sPt�}t}xu|r�|ddks8|dtkr�|ddkr�|rj|jjtjd��n|jt�t}|d}qnY|ddkr�|jt	|dd��|d}|jjtjd��t}qn|r|dj
d	kr|jjtjd
��nyt|�\}}t}Wn<tjk
ru|dt
kr`�nt|�\}}nX|j|�qW|dj
d	ks�|dj
dkr�|dj
d	kr�|jjtjd��n|dj
d	ks|dj
dkr1|d
j
d	kr1|jjtjd��n|jrFd|_
n||fS(u' obs-local-part = word *("." word)
    iu\u.uinvalid repeated '.'iumisplaced-specialu/'\' character outside of quoted-string/ccontenti����udotumissing '.' between wordsucfwsu!Invalid leading '.' in local parti����u"Invalid trailing '.' in local partuinvalid-obs-local-part(R�R)R!R7R RR�R�RR�RGR R�RR(RR'tlast_non_ws_was_dotR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyR%$sV	)









	cC`s]t|d�\}}}t|d�}|rI|jjtjd��nt|�||fS(u dtext = <printable ascii except \ [ ]> / obs-dtext
        obs-dtext = obs-NO-WS-CTL / quoted-pair

    We allow anything except the excluded characters, but if we find any
    ASCII other than the RFC defined printable ASCII an NonPrintableDefect is
    added to the token's defects list.  Quoted pairs are converted to their
    unquoted values, so what is returned is a ptext token, in this case a
    ValueTerminal.  If there were quoted-printables, an ObsoleteHeaderDefect is
    added to the returned token's defect list.

    u[]uptextu(quoted printable found in domain-literal(R�R�R7R RR"R�(RRR�((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_dtextSs

cC`s:|r
tS|jtjd��|jtdd��tS(Nu"end of input inside domain-literalu]udomain-literal-end(R)R RR�R�R(Rtdomain_literal((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt_check_for_early_dl_endgs
cC`s�t�}|dtkr;t|�\}}|j|�n|sStjd��n|ddkr~tjdj|���n|d}t||�r�||fS|jtdd��|dt	kr�t
|�\}}|j|�nt|�\}}|j|�t||�r!||fS|dt	krSt
|�\}}|j|�nt||�rl||fS|ddkr�tjdj|���n|jtdd	��|d}|r�|dtkr�t|�\}}|j|�n||fS(
uB domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]

    iuexpected domain-literalu[u6expected '[' at start of domain-literal but found '{}'iudomain-literal-startu]u4expected ']' at end of domain-literal but found '{}'udomain-literal-end(R�RRR RR�R<R,R�R�R�R*(RR+R-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_domain_literalosD	





cC`s�t�}d}|dtkr4t|�\}}n|sUtjdj|���n|ddkr�t|�\}}|dk	r�|g|d*n|j|�||fSyt	|�\}}Wn&tjk
r�t
|�\}}nX|dk	r|g|d*n|j|�|r�|ddkr�|jjtjd��|dj
dkrb|d|(nxM|r�|ddkr�|jt�t
|d�\}}|j|�qeWn||fS(	u] domain = dot-atom / domain-literal / obs-domain
        obs-domain = atom *("." atom))

    iuexpected domain but found '{}'u[u.u(domain is not a dot-atom (contains CFWS)udot-atomiN(R�RRRRR�R<R-R RRR7R"RGR�(RR�RR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_domain�s<	




cC`s�t�}t|�\}}|j|�|s?|ddkrb|jjtjd��||fS|jtdd��t|d�\}}|j|�||fS(u( addr-spec = local-part "@" domain

    iu@u"add-spec local part with no domainuaddress-at-symboli(R�R(R R7RR�R�R.(RR�R-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_addr_spec�s	



cC`st�}x�|r�|ddks2|dtkr�|dtkrdt|�\}}|j|�q|ddkr|jt�|d}qqW|s�|ddkr�tjdj|���n|jt�t	|d�\}}|j|�x�|r�|ddkr�|jt�|d}|s.Pn|dtkr`t|�\}}|j|�n|ddkr�|jt�t	|d�\}}|j|�q�q�W|s�tjd��n|ddkr�tjdj|���n|jt
dd	��||dfS(
u� obs-route = obs-domain-list ":"
        obs-domain-list = *(CFWS / ",") "@" domain *("," [CFWS] ["@" domain])

        Returns an obs-route token with the appropriate sub-tokens (that is,
        there is no obs-domain-list in the parse tree).
    iu,iu@u(expected obs-route domain but found '{}'u%end of header while parsing obs-routeu:u4expected ':' marking end of obs-route but found '{}'uend-of-obs-route-marker(R�RRR t
ListSeparatorRR�R<tRouteComponentMarkerR.R�(Rt	obs_routeR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_obs_route�sB	)





cC`s+t�}|dtkr;t|�\}}|j|�n|sR|ddkrmtjdj|���n|jtdd��|d}|ddkr�|jtdd��|jjtj	d��|d}||fSyt
|�\}}Wn�tjk
r�y/t|�\}}|jjtjd	��Wn,tjk
rftjd
j|���nX|j|�t
|�\}}nX|j|�|r�|ddkr�|d}n|jjtj	d��|jtdd��|r!|dtkr!t|�\}}|j|�n||fS(u� angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
        obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS]

    iu<u"expected angle-addr but found '{}'uangle-addr-startiu>uangle-addr-endunull addr-spec in angle-addru*obsolete route specification in angle-addru.expected addr-spec or obs-route but found '{}'u"missing trailing '>' on angle-addr(
R�RRR RR�R<R�R7R�R/R3R"(Rt
angle_addrR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_angle_addr�sJ	







cC`s@t�}t|�\}}|j|�|j|_||fS(u� display-name = phrase

    Because this is simply a name-rule, we don't return a display-name
    token containing a phrase, but rather a display-name token with
    the content of the phrase.

    (R�R$RR7(RR�R-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_display_name!s
	
cC`s>t�}d}|dtkrUt|�\}}|sUtjdj|���qUn|ddkr�|dtkr�tjdj|���nt|�\}}|s�tjdj|���n|dk	r�|g|dd*d}n|j	|�nt
|�\}}|dk	r'|g|d*n|j	|�||fS(u, name-addr = [display-name] angle-addr

    iu!expected name-addr but found '{}'u<N(R�RRRRR�R<R!R6R R5(Rt	name_addrRR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_name_addr0s0		
cC`s�t�}yt|�\}}WnYtjk
rzyt|�\}}Wq{tjk
rvtjdj|���q{XnXtd�|jD��r�d|_n|j	|�||fS(u& mailbox = name-addr / addr-spec

    uexpected mailbox but found '{}'cs`s!|]}t|tj�VqdS(N(RXRR�(R:R;((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pys	<genexpr>]suinvalid-mailbox(
R�R8RR�R/R<R[R?RGR (RtmailboxR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_mailboxNs		
cC`s�t�}xp|r{|d|kr{|dtkrY|jt|dd��|d}qt|�\}}|j|�qW||fS(u� Read everything up to one of the chars in endchars.

    This is outside the formal grammar.  The InvalidMailbox TokenList that is
    returned acts like a Mailbox, but the data attributes are None.

    iumisplaced-speciali(R�R!R R�R$(RR�tinvalid_mailboxR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_invalid_mailboxcs	

cC`sFt�}x0|r;|ddkr;y#t|�\}}|j|�WnYtjk
r�d
}|dtkrt|�\}}|s�|ddkr�|j|�|jjtj	d��q�t
|d�\}}|d
k	r�|g|d*n|j|�|jjtjd��q�|ddkrF|jjtj	d��q�t
|d�\}}|d
k	rw|g|d*n|j|�|jjtjd��nX|r|ddkr|d}d|_t
|d�\}}|j
|�|jjtjd��n|r|ddkr|jt�|d	}qqW||fS(uJ mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
        obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS])

    For this routine we go outside the formal grammar in order to improve error
    handling.  We recognize the end of the mailbox list only at the end of the
    value or at a ';' (the group terminator).  This is so that we can turn
    invalid mailboxes into InvalidMailbox tokens and continue parsing any
    remaining valid mailboxes.  We also allow all mailbox entries to be null,
    and this condition is handled appropriately at a higher level.

    iu;u,;uempty element in mailbox-listuinvalid mailbox in mailbox-listu,i����uinvalid-mailboxiN(R�R:R RR�RRRR7R"R<R�RGRR0(Rtmailbox_listR-RR9((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_mailbox_listusN	






	


cC`sft�}|s2|jjtjd��||fSd}|r�|dtkr�t|�\}}|s�|jjtjd��|j|�||fS|ddkr�|j|�||fSnt|�\}}t	|j
�dkr3|dk	r|j|�n|j|�|jjtjd��||fS|dk	rO|g|d*n|j|�||fS(ug group-list = mailbox-list / CFWS / obs-group-list
        obs-group-list = 1*([CFWS] ",") [CFWS]

    uend of header before group-listiuend of header in group-listu;ugroup-list with empty entriesN(
R�R7R RR�RRRR>R(R�RR"(Rt
group_listRR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_group_list�s8	










cC`s�t�}t|�\}}|s2|ddkrMtjdj|���n|j|�|jtdd��|d}|r�|ddkr�|jtdd��||dfSt|�\}}|j|�|s�|jjtj	d��n|ddkr tjd	j|���n|jtdd��|d}|rx|dt
krxt|�\}}|j|�n||fS(
u7 group = display-name ":" [group-list] ";" [CFWS]

    iu:u8expected ':' at end of group display name but found '{}'ugroup-display-name-terminatoriu;ugroup-terminatoruend of header in groupu)expected ';' at end of group but found {}(R�R6RR�R<R R�R@R7R�RR(RR
R-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_group�s2	




cC`s�t�}yt|�\}}WnYtjk
rzyt|�\}}Wq{tjk
rvtjdj|���q{XnX|j|�||fS(u� address = mailbox / group

    Note that counter-intuitively, an address can be either a single address or
    a list of addresses (a group).  This is why the returned Address object has
    a 'mailboxes' attribute which treats a single address as a list of length
    one.  When you need to differentiate between to two cases, extract the single
    element, which is either a mailbox or a group token.

    uexpected address but found '{}'(R�RARR�R:R<R (RtaddressR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_address�s	
cC`sGt�}x1|r<y#t|�\}}|j|�Wnmtjk
r�}d
}|dtkrt|�\}}|s�|ddkr�|j|�|jjtj	d��q�t
|d�\}}|d
k	r�|g|d*n|jt|g��|jjtjd��q�|ddkrA|jjtj	d��q�t
|d�\}}|d
k	rr|g|d*n|jt|g��|jjtjd��nX|r|ddkr|dd}d|_
t
|d�\}}|j|�|jjtjd��n|r|jtdd��|d	}qqW||fS(u� address_list = (address *("," address)) / obs-addr-list
        obs-addr-list = *([CFWS] ",") address *("," [address / CFWS])

    We depart from the formal grammar here by continuing to parse until the end
    of the input, assuming the input to be entirely composed of an
    address-list.  This is always true in email parsing, and allows us
    to skip invalid addresses to parse additional valid ones.

    iu,u"address-list entry with no contentuinvalid address in address-listuempty element in address-listi����uinvalid-mailboxulist-separatoriN(R�RCR RR�RRRR7R"R<R�R�RGRR�(Rtaddress_listR-terrRR9((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_address_list	sN
		



	

cC`s|t�}|s,|jjtjd��|S|dtkr�t|�\}}|j|�|s�|jjtjd��q�nd}xB|r�|ddkr�|dtkr�||d7}|d}q�W|j�s|jjtjdj	|���|jt
|d��n%t|�|_|jt
|d	��|ro|dtkrot|�\}}|j|�n|s�|ddkr�|jdk	r�|jjtjd
��n|r�|jt
|d��n|S|jt
dd��|d}|r,|dtkr,t|�\}}|j|�n|sa|jdk	r]|jjtjd
��n|Sd}x2|r�|dtkr�||d7}|d}qjW|j�s�|jjtjdj	|���|jt
|d��n%t|�|_|jt
|d	��|r@|dtkr@t|�\}}|j|�n|rx|jjtjd
��|jt
|d��n|S(uE mime-version = [CFWS] 1*digit [CFWS] "." [CFWS] 1*digit [CFWS]

    u%Missing MIME version number (eg: 1.0)iu0Expected MIME version number but found only CFWSuu.iu1Expected MIME major version number but found {!r}uxtextudigitsu0Incomplete MIME version; found only major numberuversion-separatoru1Expected MIME minor version number but found {!r}u'Excess non-CFWS text after MIME versionN(R�R7R RtHeaderMissingRequiredValueRRR�R�R<R�RR�RR�(Rtmime_versionR-tdigits((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytparse_mime_versionL	sv	

)



cC`s�t�}xp|r{|ddkr{|dtkrY|jt|dd��|d}qt|�\}}|j|�qW||fS(u� Read everything up to the next ';'.

    This is outside the formal grammar.  The InvalidParameter TokenList that is
    returned acts like a Parameter, but the data attributes are None.

    iu;umisplaced-speciali(R�R!R R�R$(Rtinvalid_parameterR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_invalid_parameter�	s	

cC`slt|�}|s-tjdj|���n|j�}|t|�}t|d�}t|�||fS(u8ttext = <matches _ttext_matcher>

    We allow any non-TOKEN_ENDS in ttext, but add defects to the token's
    defects list if we find non-ttext characters.  We also register defects for
    *any* non-printables even though the RFC doesn't exclude all of them,
    because we follow the spirit of RFC 5322.

    uexpected ttext but found '{}'uttext(t_non_token_end_matcherRR�R<R
R(R�R�(RRtttext((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_ttext�	s	
cC`s�t�}|rA|dtkrAt|�\}}|j|�n|rr|dtkrrtjdj|���nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(u�token = [CFWS] 1*ttext [CFWS]

    The RFC equivalent of ttext is any US-ASCII chars except space, ctls, or
    tspecials.  We also exclude tabs even though the RFC doesn't.

    The RFC implies the CFWS but is not explicit about it in the BNF.

    iuexpected token but found '{}'(	R~RRR t
TOKEN_ENDSRR�R<RO(RtmtokenR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_token�	s		
cC`slt|�}|s-tjdj|���n|j�}|t|�}t|d�}t|�||fS(uQattrtext = 1*(any non-ATTRIBUTE_ENDS character)

    We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the
    token's defects list if we find non-attrtext characters.  We also register
    defects for *any* non-printables even though the RFC doesn't exclude all of
    them, because we follow the spirit of RFC 5322.

    u expected attrtext but found {!r}uattrtext(t_non_attribute_end_matcherRR�R<R
R(R�R�(RRtattrtext((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_attrtext�	s	
cC`s�t�}|rA|dtkrAt|�\}}|j|�n|rr|dtkrrtjdj|���nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(uH [CFWS] 1*attrtext [CFWS]

    This version of the BNF makes the CFWS explicit, and as usual we use a
    value terminal for the actual run of characters.  The RFC equivalent of
    attrtext is the token characters, with the subtraction of '*', "'", and '%'.
    We include tab in the excluded set just as we do for token.

    iuexpected token but found '{}'(	R�RRR tATTRIBUTE_ENDSRR�R<RU(Rt	attributeR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_attribute�	s		
cC`slt|�}|s-tjdj|���n|j�}|t|�}t|d�}t|�||fS(u�attrtext = 1*(any non-ATTRIBUTE_ENDS character plus '%')

    This is a special parsing routine so that we get a value that
    includes % escapes as a single string (which we decode as a single
    string later).

    u)expected extended attrtext but found {!r}uextended-attrtext(t#_non_extended_attribute_end_matcherRR�R<R
R(R�R�(RRRT((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_extended_attrtext�	s
cC`s�t�}|rA|dtkrAt|�\}}|j|�n|rr|dtkrrtjdj|���nt|�\}}|j|�|r�|dtkr�t|�\}}|j|�n||fS(u� [CFWS] 1*extended_attrtext [CFWS]

    This is like the non-extended version except we allow % characters, so that
    we can pick up an encoded value as a single string.

    iuexpected token but found '{}'(	R�RRR tEXTENDED_ATTRIBUTE_ENDSRR�R<RZ(RRWR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_extended_attribute
s	
cC`s0t�}|s |ddkr;tjdj|���n|jtdd��|d}|ss|dj�r�tjdj|���nd}x2|r�|dj�r�||d7}|d}q�W|ddkr|dkr|jjtjd	��nt	|�|_
|jt|d
��||fS(u6 '*' digits

    The formal BNF is more complicated because leading 0s are not allowed.  We
    check for that and add a defect.  We also assume no CFWS is allowed between
    the '*' and the digits, though the RFC is not crystal clear on that.
    The caller should already have dealt with leading CFWS.

    iu*uExpected section but found {}usection-markeriu$Expected section number but found {}uu0u&section numberhas an invalid leading 0udigits(R�RR�R<R R�R�R7tInvalidHeaderErrorRR�(RtsectionRI((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytget_section
s$		
cC`s�t�}|s!tjd��nd}|dtkrLt|�\}}n|smtjdj|���n|ddkr�t|�\}}nt|�\}}|dk	r�|g|d*n|j	|�||fS(u  quoted-string / attribute

    u&Expected value but found end of stringiu Expected value but found only {}u"N(
R�RR�RRRR<RR\R (RtvRR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt	get_value<
s 	
cC`s�t�}t|�\}}|j|�|s?|ddkrk|jjtjdj|���||fS|ddkry,t|�\}}t|_	|j|�Wntj
k
r�nX|s�tj
d��n|ddkr|jtdd��|d}t|_qn|ddkr7tj
d	��n|jtdd
��|d}d}|r�|dtkr�t|�\}}|j|�nd}|}|jr�|r�|ddkr�t|�\}}|j}t}|jdkrC|r|ddkrt}qrt|�\}}	|	rr|	ddkrrt}qrn/yt|�\}}	WnnX|	srt}n|r�|jjtjd
��|j|�x.|D]&}
|
jdkr�g|
(|
}Pq�q�W|}q�d}|jjtjd��n|r|ddkrd}nt|�\}}|jsD|jdkr�|s[|ddkr�|j|�|dk	r�|s�t|��|}n||fS|jjtjd��n|s�|jjtjd��|j|�|dkr5||fSn:|dk	rTx!|D]}
|
jdkrPqqW|
jdk|j|
�|
j|_n|ddkrtj
dj|���n|jtdd��|d}|r|ddkrt|�\}}|j|�|j|_|s�|ddkrtj
dj|���qn|jtdd��|d}|dk	r�t�}xN|r�|dtkrxt|�\}}nt|�\}}|j|�qMW|}nt|�\}}|j|�|dk	r�|s�t|��|}n||fS(uY attribute [section] ["*"] [CFWS] "=" value

    The CFWS is implied by the RFC but not made explicit in the BNF.  This
    simplified form of the BNF from the RFC is made to conform with the RFC BNF
    through some extra checks.  We do it this way because it makes both error
    recovery and working with the resulting parse tree easier.
    iu;u)Parameter contains name ({}) but no valueu*uIncomplete parameteruextended-parameter-markeriu=uParameter not followed by '='uparameter-separatoru"u'u5Quoted string value for extended parameter is invalidubare-quoted-stringuZParameter marked as extended but appears to have a quoted string value that is non-encodeducApparent initial-extended-value but attribute was not marked as extended or was not initial sectionu(Missing required charset/lang delimitersuextended-attrtextuattrtextu=Expected RFC2231 char/lang encoding delimiter, but found {!r}uRFC2231 delimiteru;Expected RFC2231 char/lang encoding delimiter, but found {}N( R�RXR R7RR�R<R_RR�R�R�R�RRRRR�R)R�RURZRGRatAssertionErrorRRSR�R�R�R�R(RR�R-RRxtappendtotqstringtinner_valuet
semi_validR�ttR`((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt
get_parameterR
s�	


	

			


	
	
	










			
	cC`s�t�}x�|r�y#t|�\}}|j|�Wn�tjk
r.}d
}|dtkrut|�\}}n|s�|j|�|S|ddkr�|d
k	r�|j|�n|jjtj	d��q/t
|�\}}|r�|g|d*n|j|�|jjtj	dj|���nX|r�|ddkr�|d}d|_t
|�\}}|j
|�|jjtj	dj|���n|r|jtdd��|d	}qqW|S(u! parameter *( ";" parameter )

    That BNF is meant to indicate this routine should only be called after
    finding and handling the leading ';'.  There is no corresponding rule in
    the formal RFC grammar, but it is more convenient for us for the set of
    parameters to be treated as its own TokenList.

    This is 'parse' routine because it consumes the reminaing value, but it
    would never be called to parse a full header.  Instead it is called to
    parse everything after the non-parameter value of a specific MIME header.

    iu;uparameter entry with no contentuinvalid parameter {!r}i����uinvalid-parameteru)parameter with invalid trailing text {!r}uparameter-separatoriN(R�RhR RR�RRRR7R�RLR<RGRR�(Rtmime_parametersR-RERR�((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytparse_mime_parameters�
sD
		



	
cC`s�xp|rr|ddkrr|dtkrP|jt|dd��|d}qt|�\}}|j|�qW|s}dS|jtdd��|jt|d��dS(uBDo our best to find the parameters in an invalid MIME header

    iu;umisplaced-specialiNuparameter-separator(R!R R�R$Rj(t	tokenlistRR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt_find_mime_parameterss
cC`s*t�}t}|s2|jjtjd��|Syt|�\}}WnDtjk
r�|jjtjdj	|���t
||�|SX|j|�|s�|ddkr�|jjtjd��|r�t
||�n|S|jj�j
�|_|jtdd��|d}yt|�\}}WnDtjk
rz|jjtjdj	|���t
||�|SX|j|�|jj�j
�|_|s�|S|dd	kr�|jjtjd
j	|���|`|`t
||�|S|jtd	d��|jt|d��|S(u� maintype "/" subtype *( ";" parameter )

    The maintype and substype are tokens.  Theoretically they could
    be checked against the official IANA list + x-token, but we
    don't do that.
    u"Missing content type specificationu(Expected content maintype but found {!r}iu/uInvalid content typeucontent-type-separatoriu'Expected content subtype but found {!r}u;u<Only parameters are valid after content type, but found {!r}uparameter-separator(R�R)R7R RRGRRR�R�R<RlRR�tlowerR�R�R�Rj(RtctypetrecoverR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pytparse_content_type_header!sX	








cC`s,t�}|s,|jjtjd��|Syt|�\}}WnDtjk
r�tjjtjdj	|���t
||�|SX|j|�|jj�j
�|_|s�|S|ddkr�|jjtjdj	|���t
||�|S|jtdd��|jt|d��|S(u* disposition-type *( ";" parameter )

    uMissing content dispositionu+Expected content disposition but found {!r}iu;uCOnly parameters are valid after content disposition, but found {!r}uparameter-separatori(R�R7R RRGRRR�RnR�R<RlRR�RmR�R�Rj(Rtdisp_headerR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt parse_content_disposition_headerZs2	




cC`s*t�}|s,|jjtjd��|Syt|�\}}Wn6tjk
rztjjtjdj	|���n&X|j|�|j
j�j�|_
|s�|Sxy|r%|jjtjd��|dtkr|jt|dd��|d}q�t|�\}}|j|�q�W|S(u mechanism

    u!Missing content transfer encodingu1Expected content trnasfer encoding but found {!r}u*Extra text after content transfer encodingiumisplaced-speciali(R�R7R RRGRRR�RnR�R<RR�RmR�R!R�R$(Rt
cte_headerR-((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt&parse_content_transfer_encoding_headerxs.	

	

(�t__doc__t
__future__RRRRtfuture.builtinsRRRRRtretcollectionsR	R
tfuture.backports.urllib.parseRRtfuture.backports.emailR
RQRRR�R�RRRR�R!t	TSPECIALSRPt	ASPECIALSRVR[RtobjectRR6RgRiRuRzR{R}R~RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R0R1tcompileR<R%R�R�RtmatchR	tfindallR�RMRSRYR�R�R�R�RRkRRR
RRRRRRRR R$R(R%R*R,R-R.R/R3R5R6R8R:R<R>R@RARCRFRJRLRORRRURXRZR\R_RaRhRjRlRpRrRt(((sO/usr/lib/python2.7/site-packages/future/backports/email/_header_value_parser.pyt<module>Ds(


	T�N_		 '#
B3$000!	
				,	7						
						&	'	/			'	$		)	.					9	%			>	D										�	4		9	

Spamworldpro Mini