Your IP : 52.15.92.58


Current Path : /lib64/python3.6/email/__pycache__/
Upload File :
Current File : //lib64/python3.6/email/__pycache__/utils.cpython-36.opt-2.pyc

3

�Qg�J�@s�dddddddddd	d
ddd
dgZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	m
Z
ddl	mZmZmZddlmZdZdZdZdZdZejd�Zejd�ZdZdadd�Zdd �Zd!d"�Zd#d$�Z dHd&d�Z!d'd(�Z"d)d*�Z#d+Z$dd,�d-d�Z%d.d/�Z&d0d1�Z'd2d3�Z(ejd4ej)ej*B�Z+d5d6�Z,dId8d�Z-dJd9d�Z.dKd:d�Z/d;d
�Z0dd,�d<d
�Z1d=d�Z2d>d�Z3dLd?d�Z4ejd@ej5�Z6dAd�Z7dMdDd�Z8dOdFdG�Z9dS)P�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[\\"]z/etc/python/email.cfgcCstdkrt�atS)N)�_cached_strict_addr_parsing�_use_strict_email_parsing_impl�rr�#/usr/lib64/python3.6/email/utils.py�_use_strict_email_parsing7srcCs�ttjjd��}|rdSytt�}Wntk
r8YnBX|�6ddl}|jdd	d�}|j	|�|j
dddd�}WdQRX|r�dSdS)
NZ(PYTHON_EMAIL_DISABLE_STRICT_ADDR_PARSINGFr�#)Z
interpolationZcomment_prefixesZemail_addr_parsing)ZfallbackT)r)�bool�os�environ�get�open�_EMAIL_CONFIG_FILE�FileNotFoundError�configparserZConfigParserZ	read_fileZ
getboolean)Zdisabled�filer$�configrrrr?s"
rcCs&y|j�dStk
r dSXdS)NFT)�encode�UnicodeEncodeError)�srrr�_has_surrogates\s
r*cCs|jdd�}|jdd�S)Nzutf-8�surrogateescape�replace)r'�decode)�stringZoriginal_bytesrrr�	_sanitizeisr/�utf-8c
Cs�|\}}|jd�|r�y|jd�Wn8tk
r\t|t�rFt|�}|j|�}d||fSXd}tj|�rpd}tj	d|�}d||||fS|S)N�asciiz%s <%s>r�"z\\\g<0>z%s%s%s <%s>)
r'r(�
isinstance�strrZ
header_encode�
specialsre�search�	escapesre�sub)Zpair�charset�nameZaddressZencoded_nameZquotesrrrrus 




ccs`d}d}xDt|�D]8\}}|r2|d|fVd}q|dkr@d}q||fVqW|r\|dfVdS)NrF�\T)�	enumerate)�addr�pos�escape�chrrr�_iter_escaped_chars�srAcCs�d|kr|Sd}d}g}xPt|�D]D\}}|dkr"|dkr@|}q"||krZ|j|||��|d}d}q"W|t|�kr�|j||d��dj|�S)Nr2r�r)rA�append�len�join)r=�startZopen_pos�resultr>r@rrr�_strip_quoted_realnames�s rHT)�strictcCs�|dkrt�}|s4tjdd�|D��}t|�}|jSdd�|D�}t|�}tj|�}t|�}t|j�}d}x&|D]}t|�}|d|jd�7}qpWt	|�|kr�d	gS|S)
Ncss|]}t|�VqdS)N)r4)�.0�vrrr�	<genexpr>�szgetaddresses.<locals>.<genexpr>cSsg|]}t|��qSr)r4)rJrKrrr�
<listcomp>�sz getaddresses.<locals>.<listcomp>rrB�,r)rr)
r�
COMMASPACErE�_AddressList�addresslist�_pre_parse_validation�_post_parse_validationrH�countrD)ZfieldvaluesrI�all�ar=rG�nrKrrrr�s$


cCsXt|�}d}xBt|�D]6\}}|dkr0|d7}q|dkr|d8}|dkrdSqW|dkS)Nr�(rB�)F)rHrA)r=Zopensr>r@rrr�_check_parenthesis�s
rZcCs,g}x"|D]}t|�sd}|j|�q
W|S)Nz('', ''))rZrC)Zemail_header_fields�accepted_valuesrKrrrrRs
rRcCs0g}x&|D]}d|dkrd}|j|�q
W|S)N�[rBr)rr)rC)Zparsed_email_header_tuplesr[rKrrrrS
s
rSa_
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qb])    # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<atom>.*?)         # non-greedy up to the next ?= is the atom
  \?=                   # literal ?=
  cCsfddddddddg|d	|d
ddd
dddddddddg|dd|d|d|d|d|fS)Nz"%s, %02d %s %04d %02d:%02d:%02d %sZMonZTueZWedZThuZFriZSatZSun��ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecrBr���r)�	timetuple�zonerrr�_format_timetuple_and_zone"srdFcCsR|dkrtj�}|s|r,tjj|tjj�}ntjj|�}|rH|j�}d}t||�S)NF)�time�datetimeZ
fromtimestamp�timezone�utcZutcfromtimestamp�
astimezoner)�timeval�	localtime�usegmt�dtrrrr+scCsV|j�}|r2|jdks$|jtjjkr,td��d}n|jdkrBd}n
|jd�}t||�S)Nz%usegmt option requires a UTC datetimeZGMTz-0000z%z)rb�tzinforfrgrh�
ValueErrorZstrftimerd)rmrl�nowrcrrrrHs

cCs^ttj�d�}tj�}tjd�}|dkr0d}nd|}|dkrHtj�}d|||||f}|S)N�d�@r�.z<%d.%d.%d%s@%s>)�intrer�getpid�randomZgetrandbits�socketZgetfqdn)ZidstringZdomainrj�pidZrandintZmsgidrrrr	[s

cCsNt|��^}}|dkr(tj|dd��Stj|dd�dtjtj|d��i�S)Nr]rn)�seconds)rrfrg�	timedelta)�dataZdtuple�tzrrrrrs
cCs�|dkrt�}|s,t|�j}|s$dS|dSt|t�r>|d}t|t�sLdSt|g�d}tt|�j�}|szt|�dkr~dS|dS)NrrrB)rr)rr)rr)	rrPrQr3�listr4rRrSrD)r=rIZaddrsrrrrzs 


cCs`t|�dkr\|jd�r<|jd�r<|dd�jdd�jdd�S|jd�r\|jd�r\|dd	�S|S)
NrBr2z\\r;z\"�<�>���r�)rD�
startswith�endswithr,)r4rrrr�scCs&|jtd�}t|�dkr"dd|fS|S)Nr^)�split�TICKrD)r)�partsrrrr�s
cCsDtjj|d|pdd�}|dkr*|dkr*|S|dkr6d}d|||fS)Nrr1)Zsafe�encodingz%s'%s'%s)�urllib�parser)r)r9�languagerrrr�sz&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c
Csx|dd�}g}i}|jd�\}}|j||f�x�|r�|jd�\}}|jd�rTd}nd}t|�}tj|�}|r�|jdd�\}}|dk	r�t|�}|j|g�j|||f�q2|j|dt	|�f�q2W|�rtx�|j
�D]�\}}g}d}	|j�x6|D].\}}
}|�rtj
j|
dd	�}
d}	|j|
�q�Wt	tj|��}|	�r^t|�\}}}|j|||d|ff�q�|j|d|f�q�W|S)
Nr�*TFr:�numz"%s"zlatin-1)r�)�poprCr�r�rfc2231_continuation�match�grouprt�
setdefaultr�items�sortr�r��EMPTYSTRINGrEr)
ZparamsZ
new_paramsZrfc2231_paramsr:�valueZencodedZmor�Z
continuationsZextendedr)r9r�rrrr�sD

r,�us-asciicCsjt|t�st|�dkr t|�S|\}}}|dkr6|}t|d�}yt|||�Stk
rdt|�SXdS)Nr_zraw-unicode-escape)r3�tuplerDr�bytesr4�LookupError)r��errorsZfallback_charsetr9r��textZrawbytesrrrr�s

rBc	Cs|dkrtjjtjj�j�S|jdk	r.|j�S|j�dd�|f}tj|�}tj	|�}y tj
|jd�}tj||j�}Wn�t
k
r�|tjtj|�dd��}tjo�|jdk}|r�tjntj}|tj
|d�kr�tj|tj|�}n
tj|�}YnX|j|d�S)NrB)ryr]r)rnr�)rfrprgrhrirnrbreZmktimerkrzZ	tm_gmtoffZtm_zone�AttributeErrorZgmtimeZdaylightZtm_isdstZaltzoneZtznamer,)	rmZisdstZtmryZlocaltmZdeltar|�dstZgmtoffrrrrks$


rk)r0)NFF)F)NN)NN)r,r�r�)Nr�):�__all__r�rerervrwrfZurllib.parser�Zemail._parseaddrrrrPr
rr
rZ
email.charsetrrOr�ZUEMPTYSTRINGZCRLFr��compiler5r7r"rrrr*r/rrArHZsupports_strict_parsingrrZrRrS�VERBOSE�
IGNORECASEZecrerdrrr	rrrrr�ASCIIr�rrrkrrrr�<module>s�



!1

	


$
8


?>