Your IP : 3.14.249.191


Current Path : /opt/alt/python34/lib64/python3.4/email/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/email/__pycache__/_parseaddr.cpython-34.pyc

�
e f/C�@s�dZddddgZddlZddlZdZdZd	Zd
ddd
dddddddddddddddddddd gZd!d"d#d$d%d&d'gZidd(6dd)6dd*6dd+6d,d-6d.d/6d0d16d,d26d3d46d0d56d6d76d3d86d9d:6d6d;6Z	d<d�Z
d=d>�Zd?d�Zd@d�Z
dAd�ZGdBdC�dC�ZGdDdE�dEe�ZdS)FzcEmail address parsing code.

Lifted directly from rfc822.py.  This should eventually be rewritten.
�	mktime_tz�	parsedate�parsedate_tz�quote�N� �z, ZjanZfebZmarZaprZmayZjunZjulZaug�sep�octZnovZdecZjanuaryZfebruaryZmarchZaprilZjuneZjulyZaugustZ	septemberZoctoberZnovemberZdecemberZmonZtueZwedZthuZfriZsatZsunZUTZUTCZGMT�Zi�ZASTi,ZADTi�ZESTZEDTiXZCSTZCDTi�ZMSTZMDTi ZPSTZPDTcCs=t|�}|sdS|ddkr3d|d<nt|�S)zQConvert a date string to a time tuple.

    Accounts for military timezones.
    N�	r)�
_parsedate_tz�tuple)�data�res�r�5/opt/alt/python34/lib64/python3.4/email/_parseaddr.pyr-s
cCs|s
dS|j�}|djd�s?|dj�tkrI|d=n>|djd�}|dkr�|d|dd�|d<nt|�dkr�|djd�}t|�dkr�||dd�}q�nt|�dkrj|d}|jd�}|dkr!|jd�}n|dkrZ|d|�||d�g|dd�<qj|jd	�nt|�d
kr�dS|dd
�}|\}}}}}|j�}|tkr�||j�}}|tkr�dSntj	|�d}|dkr|d8}n|ddkr2|dd�}n|jd�}|dkr]||}}n|ddkr�|dd�}n|dj
�s�||}}n|ddkr�|dd�}n|jd�}t|�d
kr�|\}	}
d}n�t|�dkr|\}	}
}n�t|�dkr�d|dkr�|djd�}t|�d
kry|\}	}
d}q�t|�dkr�|\}	}
}q�ndSy@t|�}t|�}t|	�}	t|
�}
t|�}Wntk
r�dSYnX|dkr/|dkr"|d7}q/|d7}nd}|j
�}|tkrZt|}nIyt|�}Wntk
r~YnX|dkr�|jd�r�d}n|r�|dkr�d}
|}nd}
|
|dd|dd}n||||	|
|ddd|g
S)a�Convert date to extended time tuple.

    The last (additional) element is the time zone offset in seconds, except if
    the timezone was specified as -0000.  In that case the last element is
    None.  This indicates a UTC timestamp that explicitly declaims knowledge of
    the source timezone, as opposed to a +0000 timestamp that indicates the
    source timezone really was UTC.

    Nr�,���-��+r���:��0�.�d�Dili�i�<���r!r!r!r!r!r!r!r!)�split�endswith�lower�	_daynames�rfind�len�find�append�_monthnames�index�isdigit�int�
ValueError�upper�
_timezones�
startswith)r�iZstuff�sZddZmmZyyZtmZtzZthhZtmmZtssZtzoffsetZtzsignrrrr9s�
)

-
	"	
	



	
!rcCs1t|�}t|t�r)|dd�S|SdS)z&Convert a time string to a time tuple.Nr)r�
isinstancer
)r�trrrr�scCsJ|ddkr+tj|dd�d�Stj|�}||dSdS)zETurn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.rN�rr!)r!)�timeZmktime�calendarZtimegm)rr5rrrr�scCs|jdd�jdd�S)z�Prepare string to be used in a quoted string.

    Turns backslash and double quote characters into quoted pairs.  These
    are the only characters that need to be quoted inside a quoted string.
    Does not add the surrounding double quotes.
    �\z\\�"z\")�replace)�strrrrr�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zddd�Zdd�ZdS)�
AddrlistClassaAddress parser class by Ben Escoto.

    To understand what this class does, it helps to have a copy of RFC 2822 in
    front of you.

    Note: this class interface is deprecated and may be removed in the future.
    Use email.utils.AddressList instead.
    cCsd|_d|_d|_d|_|j|j|_|j|j|j|_|jjdd�|_||_g|_	dS)z�Initialize a new instance.

        `field' is an unparsed address header field, containing
        one or more addresses.
        z()<>@,:;."[]rz 	z
rrN)
�specials�pos�LWSZCR�FWS�atomendsr;�
phraseends�field�commentlist)�selfrDrrr�__init__�s					zAddrlistClass.__init__cCs�g}x�|jt|j�kr�|j|j|jdkr�|j|jdkrn|j|j|j�n|jd7_q	|j|jdkr�|jj|j��q	Pq	Wtj|�S)z&Skip white space and extract comments.z

r�()	r?r'rDr@r)rE�
getcomment�EMPTYSTRING�join)rFZwslistrrr�gotonext�szAddrlistClass.gotonextcCsUg}xH|jt|j�krP|j�}|r@||7}q	|jd�q	W|S)zVParse all addresses.

        Returns a list containing all of the addresses.
        r)rr)r?r'rD�
getaddressr))rF�resultZadrrr�getaddrlist�s
zAddrlistClass.getaddrlistcCs�g|_|j�|j}|j}|j�}|j�g}|jt|j�kr�|rPtj|j�|dfg}qPn�|j|jdkr�||_||_|j�}tj|j�|fg}nz|j|jdkr�g}t|j�}|jd7_x=|jt|j�kr�|j�|j|krm|j|jdkrm|jd7_Pn||j	�}qWn�|j|jdkr�|j
�}|jr�tj|�ddj|j�d	|fg}qPtj|�|fg}nS|r%tj|j�|dfg}n+|j|j|jkrP|jd7_n|j�|jt|j�kr�|j|jd
kr�|jd7_n|S)zParse the next address.rz.@rr�;�<z (r�)r)rErLr?�
getphraselistr'rD�SPACErK�getaddrspecrM�getrouteaddrr>)rFZoldposZoldcl�plistZ
returnlistZaddrspecZfieldlenZ	routeaddrrrrrMsL	
		
%		
%	3"
.zAddrlistClass.getaddresscCs |j|jdkrdSd}|jd7_|j�d}x�|jt|j�kr|rs|j�d}n�|j|jdkr�|jd7_Pnr|j|jdkr�|jd7_d}nD|j|jd	kr�|jd7_n|j�}|jd7_P|j�qBW|S)
z�Parse a route address (Return-path value).

        This method just skips all the route stuff and returns the addrspec.
        rQNFrr�>�@Tr)rDr?rLr'�	getdomainrU)rFZexpectrouteZadlistrrrrV?s.

		zAddrlistClass.getrouteaddrcCs�g}|j�x3|jt|j�krEd}|j|jdkr�|rk|dj�rk|j�n|jd�|jd7_d}n�|j|jdkr�|jdt|j���nT|j|j|j	kr|r|d	j�r|j�nPn|j|j
��|j�}|r|r|j|�qqW|jt|j�kst|j|jdkr�tj|�S|jd�|jd7_|j�tj|�|j
�S)
zParse an RFC 2822 addr-spec.TrrFr:z"%s"rYr!r!)rLr?r'rD�strip�popr)r�getquoterB�getatomrJrKrZ)rFZaslistZpreserve_wsZwsrrrrU_s4


	 
.


zAddrlistClass.getaddrspeccCsg}x|jt|j�kr|j|j|jkrL|jd7_q	|j|jdkr{|jj|j��q	|j|jdkr�|j|j��q	|j|jdkr�|jd7_|jd�q	|j|j|jkr�Pq	|j|j	��q	Wt
j|�S)z-Get the complete domain name from an address.rrH�[r)r?r'rDr@rEr)rI�getdomainliteralrBr^rJrK)rFZsdlistrrrrZ�szAddrlistClass.getdomainTcCs-|j|j|krdSdg}d}|jd7_x�|jt|j�kr|ry|j|j|j�d}n�|j|j|kr�|jd7_Pnk|r�|j|jdkr�|j|j��q;n6|j|jdkr�d}n|j|j|j�|jd7_q;Wtj|�S)a�Parse a header fragment delimited by special characters.

        `beginchar' is the start character for the fragment.
        If self is not looking at an instance of `beginchar' then
        getdelimited returns the empty string.

        `endchars' is a sequence of allowable end-delimiting characters.
        Parsing stops when one of these is encountered.

        If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed
        within the parsed fragment.
        rFrrHr9T)rDr?r'r)rIrJrK)rFZ	begincharZendcharsZ
allowcommentsZslistrrrr�getdelimited�s(
			zAddrlistClass.getdelimitedcCs|jddd�S)z1Get a quote-delimited fragment from self's field.r:z"
F)ra)rFrrrr]�szAddrlistClass.getquotecCs|jddd�S)z7Get a parenthesis-delimited fragment from self's field.rHz)
T)ra)rFrrrrI�szAddrlistClass.getcommentcCsd|jddd�S)z!Parse an RFC 2822 domain-literal.z[%s]r_z]
F)ra)rFrrrr`�szAddrlistClass.getdomainliteralNcCs�dg}|dkr!|j}nx\|jt|j�kr|j|j|krVPn|j|j|j�|jd7_q$Wtj|�S)aParse an RFC 2822 atom.

        Optional atomends specifies a different set of end token delimiters
        (the default is to use self.atomends).  This is used e.g. in
        getphraselist() since phrase endings must not include the `.' (which
        is legal in phrases).rNr)rBr?r'rDr)rJrK)rFrBZatomlistrrrr^�s	zAddrlistClass.getatomcCs�g}x�|jt|j�kr�|j|j|jkrL|jd7_q	|j|jdkrx|j|j��q	|j|jdkr�|jj|j��q	|j|j|jkr�Pq	|j|j	|j��q	W|S)z�Parse a sequence of RFC 2822 phrases.

        A phrase is a sequence of words, which are in turn either RFC 2822
        atoms or quoted-strings.  Phrases are canonicalized by squeezing all
        runs of continuous whitespace into one space.
        rr:rH)
r?r'rDrAr)r]rErIrCr^)rFrWrrrrS�szAddrlistClass.getphraselist)�__name__�
__module__�__qualname__�__doc__rGrLrOrMrVrUrZrar]rIr`r^rSrrrrr=�s; !%r=c@sjeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�AddressListz@An AddressList encapsulates a list of parsed RFC 2822 addresses.cCs5tj||�|r(|j�|_n	g|_dS)N)r=rGrO�addresslist)rFrDrrrrG�szAddressList.__init__cCs
t|j�S)N)r'rg)rFrrr�__len__�szAddressList.__len__cCs\td�}|jdd�|_x3|jD](}||jkr,|jj|�q,q,W|S)N)rfrgr))rF�other�newaddr�xrrr�__add__�szAddressList.__add__cCs:x3|jD](}||jkr
|jj|�q
q
W|S)N)rgr))rFrirkrrr�__iadd__szAddressList.__iadd__cCsFtd�}x3|jD](}||jkr|jj|�qqW|S)N)rfrgr))rFrirjrkrrr�__sub__s
zAddressList.__sub__cCs:x3|jD](}||jkr
|jj|�q
q
W|S)N)rg�remove)rFrirkrrr�__isub__szAddressList.__isub__cCs|j|S)N)rg)rFr+rrr�__getitem__szAddressList.__getitem__N)rbrcrdrerGrhrlrmrnrprqrrrrrf�s	rf)re�__all__r7r8rTrJZ
COMMASPACEr*r%r0rrrrrr=rfrrrr�<module>s6	u	

�%

?>