Your IP : 3.142.255.103


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

U

i�f~C�@s�dddddddddd	d
ddd
dgZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	m
Z
ddl	mZmZmZddlmZdZdZdZdZdZe�d�Ze�d�Zdd�Zdd�ZdBd!d�Zd"d#�Zd$d%�Zd&Z d&d'�d(d�Z!d)d*�Z"d+d,�Z#d-d.�Z$d/d0�Z%dCd2d�Z&dDd3d�Z'dEd4d�Z(d5d
�Z)d&d'�d6d
�Z*d7d�Z+d8d�Z,dFd9d�Z-e�d:ej.�Z/d;d�Z0dGd>d�Z1dHd@dA�Z2dS)I�collapse_rfc2231_value�
decode_params�decode_rfc2231�encode_rfc2231�
formataddr�
formatdate�format_datetime�getaddresses�
make_msgid�	mktime_tz�	parseaddr�	parsedate�parsedate_tz�parsedate_to_datetime�unquote�N)�quote)�AddressList)r
)rr
�
_parsedate_tz)�Charsetz, �z
�'z[][\\()<>@,:;".]z[\\"]cCs*z|��WdStk
r$YdSXdS)NFT)�encode�UnicodeEncodeError)�s�r�0/opt/alt/python38/lib64/python3.8/email/utils.py�_has_surrogates4s
rcCs|�dd�}|�dd�S)N�utf-8�surrogateescape�replace)r�decode)�stringZoriginal_bytesrrr�	_sanitizeAsr"rcCs�|\}}|�d�|r�z|�d�Wn<tk
r`t|t�rFt|�}|�|�}d||fYSXd}t�|�rtd}t�	d|�}d||||fS|S)N�asciiz%s <%s>r�"z\\\g<0>z%s%s%s <%s>)
rr�
isinstance�strrZ
header_encode�
specialsre�search�	escapesre�sub)Zpair�charset�nameZaddressZencoded_nameZquotesrrrrMs 




ccs\d}d}t|�D]8\}}|r0|d|fVd}q|dkr>d}q||fVq|rX|dfVdS)NrF�\T)�	enumerate)�addr�pos�escape�chrrr�_iter_escaped_charsnsr3cCs�d|kr|Sd}d}g}t|�D]D\}}|dkr |dkr>|}q ||krX|�|||��|d}d}q |t|�kr�|�||d��d�|�S)Nr$r�r)r3�append�len�join)r/�startZopen_pos�resultr0r2rrr�_strip_quoted_realnames}s r:T)�strictcCs�|s&t�dd�|D��}t|�}|jSdd�|D�}t|�}t�|�}t|�}t|j�}d}|D]}t|�}|d|�d�7}q`t|�|kr�dgS|S)	Ncss|]}t|�VqdS)N�r&��.0�vrrr�	<genexpr>�szgetaddresses.<locals>.<genexpr>cSsg|]}t|��qSrr<r=rrr�
<listcomp>�sz getaddresses.<locals>.<listcomp>rr4�,�rr)	�
COMMASPACEr7�_AddressList�addresslist�_pre_parse_validation�_post_parse_validationr:�countr6)Zfieldvaluesr;�all�ar/r9�nr?rrrr�s 

cCsVt|�}d}t|�D]8\}}|dkr.|d7}q|dkr|d8}|dkrdSq|dkS)Nr�(r4�)F)r:r3)r/Zopensr0r2rrr�_check_parenthesis�s
rOcCs(g}|D]}t|�sd}|�|�q|S)Nz('', ''))rOr5)Zemail_header_fields�accepted_valuesr?rrrrG�srGcCs,g}|D]}d|dkrd}|�|�q|S)N�[r4rC)r5)Zparsed_email_header_tuplesrPr?rrrrH�srHcCsfddddddddg|d	|d
ddd
dddddddddg|dd|d|d|d|d|fS)Nz"%s, %02d %s %04d %02d:%02d:%02d %sZMonZTueZWedZThuZFriZSatZSun��ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecr4r���r)�	timetuple�zonerrr�_format_timetuple_and_zone�s&�
��rYFcCsR|dkrt��}|s|r,tj�|tjj�}ntj�|�}|rH|��}d}t||�S)NF)�time�datetimeZ
fromtimestamp�timezone�utcZutcfromtimestamp�
astimezoner)�timeval�	localtime�usegmt�dtrrrr�scCsV|��}|r2|jdks$|jtjjkr,td��d}n|jdkrBd}n
|�d�}t||�S)Nz%usegmt option requires a UTC datetimeZGMTz-0000z%z)rW�tzinfor[r\r]�
ValueError�strftimerY)rbra�nowrXrrrrs

cCs^tt��d�}t��}t�d�}|dkr0d}nd|}|dkrHt��}d|||||f}|S)N�d�@r�.z<%d.%d.%d%s@%s>)�intrZ�os�getpid�randomZgetrandbits�socketZgetfqdn)ZidstringZdomainr_�pidZrandintZmsgidrrrr	"s

cCsNt|��^}}|dkr(tj|dd��Stj|dd�dt�tj|d��i�S)NrRrc��seconds)rr[r\�	timedelta)�dataZdtuple�tzrrrr9s�cCsv|st|�j}|sdS|dSt|t�r0|d}t|t�s>dSt|g�d}tt|�j�}|rjt|�dkrndS|dS)NrCrr4)rErFr%�listr&rGrHr6)r/r;ZaddrsrrrrAs	


cCs`t|�dkr\|�d�r<|�d�r<|dd��dd��dd�S|�d�r\|�d�r\|dd�S|S)	Nr4r$���z\\r-z\"�<�>)r6�
startswith�endswithrr<rrrr`scCs&|�td�}t|�dkr"dd|fS|S)NrS)�split�TICKr6)r�partsrrrrls
cCsDtjj|d|pdd�}|dkr*|dkr*|S|dkr6d}d|||fS)Nrr#)Zsafe�encodingz%s'%s'%s)�urllib�parser)rr+�languagerrrrtsz&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c
Csl|dd�}g}i}|�d�\}}|�||f�|r�|�d�\}}|�d�rRd}nd}t|�}t�|�}|r�|�dd�\}}|dk	r�t|�}|�|g��|||f�q0|�|dt	|�f�q0|�rh|�
�D]�\}}g}d}	|��|D].\}}
}|�rtj
j|
dd	�}
d}	|�|
�q�t	t�|��}|	�rTt|�\}}}|�|||d|ff�q�|�|d|f�q�|S)
Nr�*TFr,�numz"%s"zlatin-1)r~)�popr5rzr�rfc2231_continuation�match�grouprj�
setdefaultr�items�sortrr��EMPTYSTRINGr7r)
ZparamsZ
new_paramsZrfc2231_paramsr,�valueZencodedZmor�Z
continuationsZextendedrr+r�rrrr�sD

r�us-asciicCsnt|t�rt|�dkrt|�S|\}}}|dkr4|}t|d�}zt|||�WStk
rht|�YSXdS)NrTzraw-unicode-escape)r%�tupler6r�bytesr&�LookupError)r��errorsZfallback_charsetr+r��textZrawbytesrrrr�s

rvc	Cs|dkrtj�tjj���S|jdk	r.|��S|��dd�|f}t�|�}t�	|�}z tj
|jd�}t�||j�}Wn�t
k
r�|tjt�|�dd��}tjo�|jdk}|r�tjntj}|tj
|d�kr�t�|tj|�}n
t�|�}YnX|j|d�S)NrvrprRr)rc)r[rfr\r]r^rcrWrZ�mktimer`rr�	tm_gmtoff�tm_zone�AttributeError�gmtime�daylight�tm_isdst�altzone�tznamer)	rbZisdstZtmrqZlocaltmZdeltartZdstZgmtoffrrrr`�s$


r`)r)NFF)F)NN)NN)rr�)Nrv)3�__all__rk�rerZrmrnr[Zurllib.parserZemail._parseaddrrrrEr
rr
rZ
email.charsetrrDr�ZUEMPTYSTRINGZCRLFr|�compiler'r)rr"rr3r:Zsupports_strict_parsingrrOrGrHrYrrr	rrrrr�ASCIIr�rrr`rrrr�<module>sz�



!,
	



�8�


?>