AlkantarClanX12

Your IP : 3.15.186.56


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/email/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/email/__pycache__/_parseaddr.cpython-35.pyc



��Yf�D�@sxdZddddgZddlZddlZdZdZd	Zd
ddd
dddddddddddddddddddd gZd!d"d#d$d%d&d'gZd(dd)dd*dd+dd,d-d.d/d0d1d2d-d3d4d5d1d6d7d8d4d9d:d;d7iZ	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�ZZASTi�ZADTi,ZESTi�ZEDTZCSTiXZCDTZMSTi�ZMDTZPSTi ZPDTcCs:t|�}|sdS|ddkr0d|d<t|�S)zQConvert a date string to a time tuple.

    Accounts for military timezones.
    N�	r)�
_parsedate_tz�tuple)�data�res�r�5/opt/alt/python35/lib64/python3.5/email/_parseaddr.pyr-s
cCs�|s
dS|j�}|djd�s?|dj�tkrI|d=n;|djd�}|dkr�|d|dd�|d<t|�dkr�|djd�}t|�dkr�||dd�}t|�dkr[|d}|jd�}|dkr|jd�}|dkrN|d|�||d�g|dd�<n
|jd	�t|�d
krqdS|dd
�}|\}}}}}|j�}|tkr�||j�}}|tkr�dStj	|�d}|dkr�|d8}|ddkr|dd�}|jd�}|dkrB||}}|ddkrb|dd�}|dj
�s||}}|ddkr�|dd�}|jd�}t|�d
kr�|\}	}
d}n�t|�dkr�|\}	}
}n�t|�dkryd|dkry|djd�}t|�d
krU|\}	}
d}q}t|�dkr}|\}	}
}ndSy@t|�}t|�}t|	�}	t|
�}
t|�}Wntk
r�dSYnX|dkr|dkr�|d7}n
|d7}d}|j
�}|tkr0t|}nFyt|�}Wntk
rTYnX|dkrv|jd�rvd}|r�|dkr�d}
|}nd}
|
|dd|dd}||||	|
|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|jdkrk|j|j|j�|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�|rGtj|j�|dfg}n�|j|jdkr�||_||_|j�}tj|j�|fg}nt|j|jdkr~g}t|j�}|jd7_x7|jt|j�krz|j�|j|krg|j|jdkrg|jd7_P||j	�}qWn�|j|jdkr�|j
�}|jr�tj|�ddj|j�d	|fg}qGtj|�|fg}nP|rtj|j�|dfg}n(|j|j|jkrG|jd7_|j�|jt|j�kr�|j|jd
kr�|jd7_|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�x*|jt|j�kr<d}|j|jdkr�|rh|dj�rh|j�|jd�|jd7_d}n�|j|jdkr�|jdt|j���nQ|j|j|j	kr|r�|d	j�r�|j�Pn|j|j
��|j�}|r|r|j|�qW|jt|j�ksk|j|jdkrxtj|�S|jd�|jd7_|j�|j
�}|s�tStj|�|S)
zParse an RFC 2822 addr-spec.TrrFr:z"%s"rYr!r!)rLr?r'rD�strip�popr)r�getquoterB�getatomrJrKrZ)rFZaslistZpreserve_wsZwsZdomainrrrrU_s:


	 
.


zAddrlistClass.getaddrspeccCs7g}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|jdkr�tS|j|j|j	krPq	|j|j
��q	Wtj|�S)z-Get the complete domain name from an address.rrH�[rrY)r?r'rDr@rEr)rI�getdomainliteralrJrBr^rK)rFZsdlistrrrrZ�s"zAddrlistClass.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}x\|jt|j�kr||j|j|krSPn|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__cCsYtd�}|jdd�|_x0|jD]%}||jkr,|jj|�q,W|S)N)rfrgr))rF�other�newaddr�xrrr�__add__szAddressList.__add__cCs7x0|jD]%}||jkr
|jj|�q
W|S)N)rgr))rFrirkrrr�__iadd__
szAddressList.__iadd__cCsCtd�}x0|jD]%}||jkr|jj|�qW|S)N)rfrgr))rFrirjrkrrr�__sub__s
zAddressList.__sub__cCs7x0|jD]%}||jkr
|jj|�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	

�.