AlkantarClanX12

Your IP : 18.222.121.24


Current Path : /opt/alt/python36/lib64/python3.6/email/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/email/__pycache__/_parseaddr.cpython-36.pyc

3

� fE�@s�dZddddgZddlZddlZdZdZd	Zd
ddd
dddddddddddddddddddd gZd!d"d#d$d%d&d'gZddddd9d:d;d<d=d>d?d@dAdBd.�Z	d/d�Z
d0d1�Zd2d�Zd3d�Z
d4d�ZGd5d6�d6�ZGd7d8�d8e�ZdS)CzcEmail address parsing code.

Lifted directly from rfc822.py.  This should eventually be rewritten.
�	mktime_tz�	parsedate�parsedate_tz�quote�N� �z, ZjanZfebZmarZaprZmayZjunZjulZaug�sep�octZnovZdecZjanuaryZfebruaryZmarchZaprilZjuneZjulyZaugustZ	septemberZoctoberZnovemberZdecemberZmonZtueZwedZthuZfriZsatZsuni�i,i�iXi�i )ZUTZUTCZGMT�ZZASTZADTZESTZEDTZCSTZCDTZMSTZMDTZPSTZPDTcCs,t|�}|sdS|ddkr$d|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/python36/lib64/python3.6/email/_parseaddr.pyr-scCs�|sdS|j�}|sdS|djd�s6|dj�tkr>|d=n.|djd�}|dkrl|d|dd�|d<t|�dkr�|djd�}t|�dkr�||dd�}t|�dk�r
|d}|jd�}|dkr�|jd�}|dk�r|d|�||d�g|dd�<n
|jd	�t|�d
k�rdS|dd
�}|\}}}}}|j�}|tk�rd||j�}}|tk�rddStj	|�d}|dk�r�|d8}|ddk�r�|dd�}|jd�}|dk�r�||}}|ddk�r�|dd�}|dj
��s�||}}|ddk�r|dd�}|jd�}t|�d
k�r.|\}	}
d}n~t|�dk�rH|\}	}
}ndt|�dk�r�d|dk�r�|djd�}t|�d
k�r�|\}	}
d}nt|�dk�r�|\}	}
}ndSy,t|�}t|�}t|	�}	t|
�}
t|�}Wntk
�r�dSX|dk�r|dk�r|d7}n|d7}d}|j
�}|tk�r6t|}n>yt|�}Wntk
�rXYnX|dk�rt|jd��rtd}|�r�|dk�r�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cCs&t|�}t|t�r|dd�S|SdS)z&Convert a time string to a time tuple.Nr)r�
isinstancer
)r�trrrr�s
cCs<|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�s
cCs|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.
    cCsZd|_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__�szAddrlistClass.__init__cCs�g}x�|jt|j�kr�|j|j|jdkr^|j|jdkrN|j|j|j�|jd7_q|j|jdkr�|jj|j��qPqWtj|�S)z&Skip white space and extract comments.z

r�()	r?r'rDr@r)rE�
getcomment�EMPTYSTRING�join)rFZwslistrrr�gotonext�szAddrlistClass.gotonextcCs>g}x4|jt|j�kr8|j�}|r,||7}q|jd�qW|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\|rXtj|j�|dfg}�n\|j|jdkr�||_||_|j�}tj|j�|fg}�n"|j|jdk�rg}t|j�}|jd7_x�|jt|j�k�r|j�|j|ko�|j|jdk�r|jd7_P||j	�}q�Wn�|j|jdk�rx|j
�}|j�rftj|�ddj|j�d	|fg}ntj|�|fg}n@|�r�tj|j�|dfg}n"|j|j|jk�r�|jd7_|j�|jt|j�k�r�|j|jd
k�r�|jd7_|S)zParse the next address.rz.@rr�;�<z (r�)r)rErLr?�
getphraselistr'rD�SPACErK�getaddrspecrM�getrouteaddrr>)rFZoldposZoldcl�plistZ
returnlistZaddrspecZfieldlenZ	routeaddrrrrrMsL
&$zAddrlistClass.getaddresscCs�|j|jdkrdSd}|jd7_|j�d}x�|jt|j�kr�|rV|j�d}n~|j|jdkrx|jd7_Pn\|j|jdkr�|jd7_d}n8|j|jd	kr�|jd7_n|j�}|jd7_P|j�q4W|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)rFZexpectrouteZadlistrrrrVAs.zAddrlistClass.getrouteaddrcCs\g}|j�x�|jt|j�kr�d}|j|jdkrj|rL|dj�rL|j�|jd�|jd7_d}nf|j|jdkr�|jdt|j���n>|j|j|j	kr�|r�|d	j�r�|j�Pn|j|j
��|j�}|r|r|j|�qW|jt|j�k�s|j|jdk�rtj|�S|jd�|jd7_|j�|j
�}|�sNtStj|�|S)
zParse an RFC 2822 addr-spec.TrrFr:z"%s"rYr!r!)rLr?r'rD�strip�popr)r�getquoterB�getatomrJrKrZ)rFZaslistZpreserve_wsZwsZdomainrrrrUas:
$

zAddrlistClass.getaddrspeccCs�g}x�|jt|j�kr�|j|j|jkr8|jd7_q|j|jdkrZ|jj|j��q|j|jdkrz|j|j��q|j|jdkr�|jd7_|jd�q|j|jdkr�tS|j|j|j	kr�Pq|j|j
��qWtj|�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�|rZ|j|j|j�d}np|j|j|kr||jd7_PnN|r�|j|jdkr�|j|j��q.n(|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.getdomainliteralNcCshdg}|dkr|j}xH|jt|j�kr\|j|j|kr:Pn|j|j|j�|jd7_qWtj|�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^�szAddrlistClass.getatomcCs�g}x�|jt|j�kr�|j|j|jkr8|jd7_q|j|jdkrX|j|j��q|j|jdkrz|jj|j��q|j|j|jkr�Pq|j|j	|j��qW|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)T)N)�__name__�
__module__�__qualname__�__doc__rGrLrOrMrVrUrZrar]rIr`r^rSrrrrr=�s; &
%
r=c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�AddressListz@An AddressList encapsulates a list of parsed RFC 2822 addresses.cCs&tj||�|r|j�|_ng|_dS)N)r=rGrO�addresslist)rFrDrrrrG�szAddressList.__init__cCs
t|j�S)N)r'rg)rFrrr�__len__szAddressList.__len__cCsBtd�}|jdd�|_x$|jD]}||jkr |jj|�q W|S)N)rfrgr))rF�other�newaddr�xrrr�__add__s
zAddressList.__add__cCs*x$|jD]}||jkr|jj|�qW|S)N)rgr))rFrirkrrr�__iadd__s
zAddressList.__iadd__cCs2td�}x$|jD]}||jkr|jj|�qW|S)N)rfrgr))rFrirjrkrrr�__sub__s

zAddressList.__sub__cCs*x$|jD]}||jkr|jj|�qW|S)N)rg�remove)rFrirkrrr�__isub__s
zAddressList.__isub__cCs
|j|S)N)rg)rFr+rrr�__getitem__%szAddressList.__getitem__N)rbrcrdrerGrhrlrmrnrprqrrrrrf�s	rfip���i���i���ip���i����i���iD���i����i��iD���)re�__all__r7r8rTrJZ
COMMASPACEr*r%r0rrrrrr=rfrrrr�<module>s8

w	

/