AlkantarClanX12

Your IP : 3.148.108.201


Current Path : /opt/alt/python310/lib64/python3.10/email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/email/__pycache__/_parseaddr.cpython-310.pyc

o

6��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|ddurd|d<t|�S)zQConvert a date string to a time tuple.

    Accounts for military timezones.
    N�	r)�
_parsedate_tz�tuple)�data�res�r�7/opt/alt/python310/lib64/python3.10/email/_parseaddr.pyr-src
Cs�|sdS|��}|sdS|d�d�s|d��tvr|d=n|d�d�}|dkr6|d|dd�|d<t|�dkrQ|d�d�}t|�dkrQ||dd�}t|�dkr�|d}|�d�}|d	kri|�d�}|dkr~|d|�||d�g|dd�<n|�d
�t|�dkr�dS|dd�}|\}}}}}|r�|r�|s�dS|��}|tvr�||��}}|tvr�dSt�	|�d}|dkr�|d8}|d	dkr�|dd	�}|�d
�}|dkr�||}}|d	dkr�|dd	�}|s�dS|d�
�s�||}}|d	dk�r|dd	�}|�d
�}t|�dk�r|\}	}
d}nAt|�dk�r&|\}	}
}n4t|�dk�rXd|dv�rX|d�d�}t|�dk�rI|\}	}
d}nt|�dk�rV|\}	}
}ndSdSzt|�}t|�}t|	�}	t|
�}
t|�}Wnt�y{YdSw|dk�r�|dk�r�|d7}n|d7}d}|�
�}|tv�r�t|}nzt|�}Wn
t�y�Ynw|dk�r�|�d��r�d}|�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|S)z&Convert a time string to a time tuple.Nr)r�
isinstancer�r�trrrr�s
rcCs8|ddurt�|dd�d�St�|�}||dS)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__�s
zAddrlistClass.__init__cCs�g}|jt|j�krH|j|j|jdvr.|j|jdvr&|�|j|j�|jd7_n|j|jdkr?|j�|���nn|jt|j�ks
t�|�S)z&Skip white space and extract comments.z

r�()	rBr(rGrCr*rH�
getcomment�EMPTYSTRING�join)rJZwslistrrr�gotonext�s�
	zAddrlistClass.gotonextcCsHg}|jt|j�kr"|��}|r||7}n|�d�|jt|j�ks
|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-|r,t�|j�|dfg}n�|j|jdvrI||_||_|��}t�|j�|fg}n�|j|jdkr�g}t|j�}|jd7_|jt|j�kr�|��|j|kr�|j|jdkr�|jd7_n||�	�}|jt|j�ksgnI|j|jdkr�|�
�}|jr�t�|�dd�|j�d	|fg}n't�|�|fg}n|r�t�|j�|dfg}n|j|j|jvr�|jd7_|��|jt|j�kr�|j|jd
kr�|jd7_|S)zParse the next address.rz.@rr�;�<z (r�)r)rHrPrB�
getphraselistr(rG�SPACErO�getaddrspecrQ�getrouteaddrrA)rJZoldposZoldcl�plistZ
returnlistZaddrspecZfieldlenZ	routeaddrrrrrQs^�
��
��� zAddrlistClass.getaddresscCs�|j|jdkr
dSd}|jd7_|��d}|jt|j�krx|r*|��d}nB|j|jdkr<|jd7_	|S|j|jdkrN|jd7_d}n|j|jd	kr^|jd7_n|��}|jd7_	|S|��|jt|j�ks!|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)rJZexpectrouteZadlistrrrrZGs4���zAddrlistClass.getrouteaddrcCsZg}|��|jt|j�kryd}|j|jdkr3|r$|d��s$|��|�d�|jd7_d}n1|j|jdkrG|�dt|����n|j|j|j	vr]|r\|d��s\|��n|�|�
��|��}|rq|rq|�|�|jt|j�ks|jt|j�ks�|j|jdkr�t�|�S|�d�|jd7_|��|�
�}|s�tSt�|�|S)	zParse an RFC 2822 addr-spec.TrrrFr=z"%s"r])rPrBr(rG�strip�popr*r�getquoterE�getatomrNrOr^)rJZaslistZpreserve_wsZwsZdomainrrrrYgs<

� 

zAddrlistClass.getaddrspeccCs�g}|jt|j�krt|j|j|jvr|jd7_nQ|j|jdkr,|j�|���n@|j|jdkr<|�|���n0|j|jdkrQ|jd7_|�d�n|j|jdkr[tS|j|j|j	vren|�|�
��|jt|j�ks
t�|�S)z-Get the complete domain name from an address.rrL�[rr])rBr(rGrCrHr*rM�getdomainliteralrNrErbrO)rJZsdlistrrrr^�s$�
zAddrlistClass.getdomainTcCs�|j|j|kr
dSdg}d}|jd7_|jt|j�krq|r,|�|j|j�d}n6|j|j|vr<|jd7_n5|rN|j|jdkrN|�|���q|j|jdkrYd}n	|�|j|j�|jd7_|jt|j�kst�|�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.getdelimitedcC�|�ddd�S)z1Get a quote-delimited fragment from self's field.r=z"
F�re�rJrrrra��zAddrlistClass.getquotecCrf)z7Get a parenthesis-delimited fragment from self's field.rLz)
TrgrhrrrrM�rizAddrlistClass.getcommentcCsd|�ddd�S)z!Parse an RFC 2822 domain-literal.z[%s]rcz]
Frgrhrrrrd�szAddrlistClass.getdomainliteralNcCspdg}|dur
|j}|jt|j�kr3|j|j|vrn|�|j|j�|jd7_|jt|j�kst�|�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�s�
zAddrlistClass.getatomcCs�g}|jt|j�krY|j|j|jvr|jd7_n6|j|jdkr+|�|���n&|j|jdkr<|j�|���n|j|j|jvrH	|S|�|�	|j��|jt|j�ks
|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�s��zAddrlistClass.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|��|_dSg|_dSrj)r@rKrS�addresslistrIrrrrKs
zAddressList.__init__cCs
t|j�Srj)r(rprhrrr�__len__	s
zAddressList.__len__cCs>td�}|jdd�|_|jD]
}||jvr|j�|�q|Srj�rorpr*�rJ�otherZnewaddr�xrrr�__add__s

�zAddressList.__add__cCs&|jD]
}||jvr|j�|�q|Srj)rpr*�rJrtrurrr�__iadd__�


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

�zAddressList.__sub__cCs&|jD]
}||jvr|j�|�q|Srj)rp�removerwrrr�__isub__$ryzAddressList.__isub__cCs
|j|Srj)rp)rJr,rrr�__getitem__+s
zAddressList.__getitem__N)rkrlrmrnrKrqrvrxrzr|r}rrrrros	ro)rn�__all__r9r;rXrNZ
COMMASPACEr+r&r1rr
rrrr@rorrrr�<module>s0�	}	

/