Your IP : 18.217.242.39


Current Path : /opt/alt/python39/lib64/python3.9/email/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/email/__pycache__/_parseaddr.cpython-39.opt-1.pyc

a

R�f:E�@s�dZgd�ZddlZddlZdZdZdZgd�Zgd�Zddddd	d
dd	ddd
ddd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZGdd�d�ZGdd�de�ZdS)zcEmail address parsing code.

Lifted directly from rfc822.py.  This should eventually be rewritten.
)�	mktime_tz�	parsedate�parsedate_tz�quote�N� �z, )ZjanZfebZmarZapr�mayZjunZjulZaug�sep�octZnovZdecZjanuaryZfebruaryZmarchZaprilrZjuneZjulyZaugustZ	septemberZoctoberZnovemberZdecember)ZmonZtueZwedZthuZfriZsatZsunip���i���i���i����iD���i��)ZUTZUTCZGMT�ZZASTZADTZESTZEDTZCSTZCDTZMSTZMDTZPSTZPDTcCs,t|�}|sdS|ddur$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/python39/lib64/python3.9/email/_parseaddr.pyr-src
Cs�|sdS|��}|sdS|d�d�s6|d��tvr>|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�}|\}}}}}|��}|tv�rb||��}}|tv�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|\}	}
}njt|�dk�r�d|dv�r�|d�d�}t|�dk�r�|\}	}
d}nt|�dk�r�|\}	}
}ndSndSz,t|�}t|�}t|	�}	t|
�}
t|�}Wnt�y�YdS0|dk�r|dk�r|d7}n|d7}d}|�
�}|tv�r:t|}n<zt|�}Wnt�yZYn0|dk�rv|�d��rvd}|�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
rcCs<|ddur"t�|dd�d�St�|�}||dSdS)zETurn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.rN�)r)�time�mktime�calendarZtimegmr6rrrr�s
rcCs|�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�src@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��selfrGrrr�__init__�szAddrlistClass.__init__cCs�g}|jt|j�kr�|j|j|jdvr\|j|jdvrL|�|j|j�|jd7_q|j|jdkr�|j�|���qq�qt�|�S)z&Skip white space and extract comments.z

r�()	rBr(rGrCr*rH�
getcomment�EMPTYSTRING�join)rJZwslistrrr�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)rBr(rG�
getaddressr*)rJ�resultZadrrr�getaddrlist�s
zAddrlistClass.getaddrlistcCs�g|_|��|j}|j}|��}|��g}|jt|j�kr\|rXt�|j�|dfg}�n\|j|jdvr�||_||_|��}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|jv�r�|jd7_|��|jt|j�k�r�|j|jd
k�r�|jd7_|S)zParse the next address.rz.@rr�;�<z (r�)r)rHrPrB�
getphraselistr(rG�SPACErO�getaddrspecrQ�getrouteaddrrA)rJZoldposZoldcl�plistZ
returnlistZaddrspecZfieldlenZ	routeaddrrrrrQsX

���$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.
        rUNFrr�>�@Tr)rGrBrPr(�	getdomainrY)rJZexpectrouteZadlistrrrrZCs.
zAddrlistClass.getrouteaddrcCsTg}|��|jt|j�kr�d}|j|jdkrf|rH|d��sH|��|�d�|jd7_d}nd|j|jdkr�|�dt|����n<|j|j|j	vr�|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])rPrBr(rG�strip�popr*r�getquoterE�getatomrNrOr^)rJZaslistZpreserve_wsZwsZdomainrrrrYcs:
$

zAddrlistClass.getaddrspeccCs�g}|jt|j�kr�|j|j|jvr6|jd7_q|j|jdkrX|j�|���q|j|jdkrx|�|���q|j|jdkr�|jd7_|�d�q|j|jdkr�tS|j|j|j	vr�q�q|�|�
��qt�|�S)z-Get the complete domain name from an address.rrL�[rr])rBr(rGrCrHr*rM�getdomainliteralrNrErbrO)rJZsdlistrrrr^�s"zAddrlistClass.getdomainTcCs�|j|j|krdSdg}d}|jd7_|jt|j�kr�|rX|�|j|j�d}np|j|j|vrz|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.
        rFrrLr<T)rGrBr(r*rMrNrO)rJZ	begincharZendcharsZ
allowcommentsZslistrrrr�getdelimited�s(
zAddrlistClass.getdelimitedcCs|�ddd�S)z1Get a quote-delimited fragment from self's field.r=z"
F�re�rJrrrra�szAddrlistClass.getquotecCs|�ddd�S)z7Get a parenthesis-delimited fragment from self's field.rLz)
TrfrgrrrrM�szAddrlistClass.getcommentcCsd|�ddd�S)z!Parse an RFC 2822 domain-literal.z[%s]rcz]
Frfrgrrrrd�szAddrlistClass.getdomainliteralNcCsddg}|dur|j}|jt|j�krZ|j|j|vr8qZn|�|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)rErBr(rGr*rNrO)rJrEZatomlistrrrrb�szAddrlistClass.getatomcCs�g}|jt|j�kr�|j|j|jvr6|jd7_q|j|jdkrV|�|���q|j|jdkrx|j�|���q|j|j|jvr�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=rL)
rBr(rGrDr*rarHrMrFrb)rJr[rrrrW�szAddrlistClass.getphraselist)T)N)�__name__�
__module__�__qualname__�__doc__rKrPrSrQrZrYr^rerarMrdrbrWrrrrr@�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@rKrS�addresslistrIrrrrK�szAddressList.__init__cCs
t|j�Srm)r(rnrgrrr�__len__szAddressList.__len__cCs>td�}|jdd�|_|jD]}||jvr|j�|�q|Srm�rlrnr*�rJ�otherZnewaddr�xrrr�__add__s

zAddressList.__add__cCs&|jD]}||jvr|j�|�q|Srm)rnr*�rJrrrsrrr�__iadd__s

zAddressList.__iadd__cCs.td�}|jD]}||jvr|j�|�q|Srmrprqrrr�__sub__s


zAddressList.__sub__cCs&|jD]}||jvr|j�|�q|Srm)rn�removerurrr�__isub__ s

zAddressList.__isub__cCs
|j|Srm)rn)rJr,rrr�__getitem__'szAddressList.__getitem__N)rhrirjrkrKrortrvrwryrzrrrrrl�s	rl)rk�__all__r9r;rXrNZ
COMMASPACEr+r&r1rr
rrrr@rlrrrr�<module>s.�	y	

/

?>