Your IP : 3.139.236.144


Current Path : /opt/alt/python38/lib64/python3.8/email/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/email/__pycache__/_parseaddr.cpython-38.opt-1.pyc

U

i�fE�@s�dZddddgZddlZddlZdZdZd	Zd
ddd
dddddddddddddddddddd gZd!d"d#d$d%d&d'gZddddd(d)d*d(d+d*d,d+d-d,d.�Z	d/d�Z
d0d1�Zd2d�Zd3d�Z
d4d�ZGd5d6�d6�ZGd7d8�d8e�ZdS)9zcEmail address parsing code.

Lifted directly from rfc822.py.  This should eventually be rewritten.
�	mktime_tz�	parsedate�parsedate_tz�quote�N� �z, ZjanZfebZmarZaprZmayZjunZjulZaug�sep�octZnovZdecZjanuaryZfebruaryZmarchZaprilZjuneZjulyZaugustZ	septemberZoctoberZnovemberZdecemberZmonZtueZwedZthuZfriZsatZsunip���i���i���i����iD���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/python38/lib64/python3.8/email/_parseaddr.pyr-sc
Cs�|sdS|��}|sdS|d�d�s6|d��tkr>|d=n.|d�d�}|dkrl|d|dd�|d<t|�dkr�|d�d�}t|�dkr�||dd�}t|�dk�r|d}|�d�}|d	kr�|�d�}|dkr�|d|�||d�g|dd�<n
|�d
�t|�dk�rdS|dd�}|\}}}}}|��}|tk�rb||��}}|tk�rbdSt�	|�d}|dk�r�|d8}|d	dk�r�|dd	�}|�d
�}|dk�r�||}}|d	dk�r�|dd	�}|d�
��s�||}}|d	dk�r|dd	�}|�d
�}t|�dk�r,|\}	}
d}n~t|�dk�rF|\}	}
}ndt|�dk�r�d|dk�r�|d�d�}t|�dk�r�|\}	}
d}nt|�dk�r�|\}	}
}ndSz,t|�}t|�}t|	�}	t|
�}
t|�}Wntk
�r�YdSX|dk�r|dk�r|d7}n|d7}d}|�
�}|tk�r6t|}n>zt|�}Wntk
�rXYnX|dk�rt|�d��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�<)�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"t�|dd�d�St�|�}||dSdS)zETurn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.rN�)r)�time�mktime�calendarZtimegmr5rrrr�s
cCs|�dd��dd�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|_|j�dd�|_||_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��selfrFrrr�__init__�szAddrlistClass.__init__cCs�g}|jt|j�kr�|j|j|jdkr\|j|jdkrL|�|j|j�|jd7_q|j|jdkr�|j�|���qq�qt�|�S)z&Skip white space and extract comments.z

r�()	rAr'rFrBr)rG�
getcomment�EMPTYSTRING�join)rIZwslistrrr�gotonext�szAddrlistClass.gotonextcCs:g}|jt|j�kr6|��}|r*||7}q|�d�q|S)zVParse all addresses.

        Returns a list containing all of the addresses.
        )rr)rAr'rF�
getaddressr))rI�resultZadrrr�getaddrlist�s
zAddrlistClass.getaddrlistcCs�g|_|��|j}|j}|��}|��g}|jt|j�kr\|rXt�|j�|dfg}�n\|j|jdkr�||_||_|��}t�|j�|fg}�n"|j|jdk�rg}t|j�}|jd7_|jt|j�k�r�|��|j|k�r|j|jdk�r|jd7_�q�||�	�}q�n�|j|jdk�rx|�
�}|j�rft�|�dd�|j�d	|fg}nt�|�|fg}n@|�r�t�|j�|dfg}n"|j|j|jk�r�|jd7_|��|jt|j�k�r�|j|jd
k�r�|jd7_|S)zParse the next address.rz.@rr�;�<z (r�)r)rGrOrA�
getphraselistr'rF�SPACErN�getaddrspecrP�getrouteaddrr@)rIZoldposZoldcl�plistZ
returnlistZaddrspecZfieldlenZ	routeaddrrrrrPsX

���$zAddrlistClass.getaddresscCs�|j|jdkrdSd}|jd7_|��d}|jt|j�kr�|rT|��d}n~|j|jdkrv|jd7_q�n\|j|jdkr�|jd7_d}n8|j|jd	kr�|jd7_n|��}|jd7_q�|��q2|S)
z�Parse a route address (Return-path value).

        This method just skips all the route stuff and returns the addrspec.
        rTNFrr�>�@Tr)rFrArOr'�	getdomainrX)rIZexpectrouteZadlistrrrrYAs.
zAddrlistClass.getrouteaddrcCsTg}|��|jt|j�kr�d}|j|jdkrf|rH|d��sH|��|�d�|jd7_d}nd|j|jdkr�|�dt|����n<|j|j|j	kr�|r�|d��s�|��q�n|�|�
��|��}|r|r|�|�q|jt|j�k�s
|j|jdk�rt�|�S|�d�|jd7_|��|�
�}|�sFtSt�|�|S)	zParse an RFC 2822 addr-spec.TrrrFr<z"%s"r\)rOrAr'rF�strip�popr)r�getquoterD�getatomrMrNr])rIZaslistZpreserve_wsZwsZdomainrrrrXas:
$

zAddrlistClass.getaddrspeccCs�g}|jt|j�kr�|j|j|jkr6|jd7_q|j|jdkrX|j�|���q|j|jdkrx|�|���q|j|jdkr�|jd7_|�d�q|j|jdkr�tS|j|j|j	kr�q�q|�|�
��qt�|�S)z-Get the complete domain name from an address.rrK�[rr\)rAr'rFrBrGr)rL�getdomainliteralrMrDrarN)rIZsdlistrrrr]�s"zAddrlistClass.getdomainTcCs�|j|j|krdSdg}d}|jd7_|jt|j�kr�|rX|�|j|j�d}np|j|j|krz|jd7_q�nN|r�|j|jdkr�|�|���q,n(|j|jdkr�d}n|�|j|j�|jd7_q,t�|�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.
        rFrrKr;T)rFrAr'r)rLrMrN)rIZ	begincharZendcharsZ
allowcommentsZslistrrrr�getdelimited�s(
zAddrlistClass.getdelimitedcCs|�ddd�S)z1Get a quote-delimited fragment from self's field.r<z"
F�rd�rIrrrr`�szAddrlistClass.getquotecCs|�ddd�S)z7Get a parenthesis-delimited fragment from self's field.rKz)
TrerfrrrrL�szAddrlistClass.getcommentcCsd|�ddd�S)z!Parse an RFC 2822 domain-literal.z[%s]rbz]
Frerfrrrrc�szAddrlistClass.getdomainliteralNcCsddg}|dkr|j}|jt|j�krZ|j|j|kr8qZn|�|j|j�|jd7_qt�|�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)rDrAr'rFr)rMrN)rIrDZatomlistrrrra�szAddrlistClass.getatomcCs�g}|jt|j�kr�|j|j|jkr6|jd7_q|j|jdkrV|�|���q|j|jdkrx|j�|���q|j|j|jkr�q�q|�|�	|j��q|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<rK)
rAr'rFrCr)r`rGrLrEra)rIrZrrrrV�szAddrlistClass.getphraselist)T)N)�__name__�
__module__�__qualname__�__doc__rJrOrRrPrYrXr]rdr`rLrcrarVrrrrr?�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&t�||�|r|��|_ng|_dS�N)r?rJrR�addresslistrHrrrrJ�szAddressList.__init__cCs
t|j�Srl)r'rmrfrrr�__len__szAddressList.__len__cCs>td�}|jdd�|_|jD]}||jkr|j�|�q|Srl�rkrmr)�rI�otherZnewaddr�xrrr�__add__s

zAddressList.__add__cCs&|jD]}||jkr|j�|�q|Srl)rmr)�rIrqrrrrr�__iadd__s

zAddressList.__iadd__cCs.td�}|jD]}||jkr|j�|�q|Srlrorprrr�__sub__s


zAddressList.__sub__cCs&|jD]}||jkr|j�|�q|Srl)rm�removertrrr�__isub__s

zAddressList.__isub__cCs
|j|Srl)rm)rIr+rrr�__getitem__%szAddressList.__getitem__N)rgrhrirjrJrnrsrurvrxryrrrrrk�s	rk)rj�__all__r8r:rWrMZ
COMMASPACEr*r%r0rrrrrr?rkrrrr�<module>sd���	w	

/

?>