AlkantarClanX12

Your IP : 52.15.68.97


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

3

��2a�O�@sfddlmZddlmZddlmZddlmZGdd�d�ZGdd�d�ZGd	d
�d
e	�Z
dd�ZGd
d�d�ZGdd�de�Z
Gdd�d�ZGdd�de�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�d�ZGdd �d �ZGd!d"�d"e�ZGd#d$�d$e�ZGd%d&�d&�Ze
eeeeeeeeeeeeeeeeeed'�ZGd(d)�d)�Zd*S)+�)�MappingProxyType)�utils)�errors)�_header_value_parserc@s^eZdZddd�Zedd��Zedd��Zed	d
��Zedd��Zd
d�Z	dd�Z
dd�ZdS)�Address�NcCs�djtd||||f��}d|ks(d|kr0td��|dk	r�|s@|rHtd��tj|�\}}|rjtdj||���|jrz|jd�|j}|j	}||_
||_||_dS)Nr�
�
z8invalid arguments; address parts cannot contain CR or LFz=addrspec specified when username and/or domain also specifiedz6Invalid addr_spec; only '{}' could be parsed from '{}'r)
�join�filter�
ValueError�	TypeError�parserZ
get_addr_spec�format�all_defects�
local_part�domain�
_display_name�	_username�_domain)�self�display_name�usernamer�	addr_specZinputsZa_s�rest�r�3/opt/alt/python36/lib64/python3.6/headerregistry.py�__init__s"

zAddress.__init__cCs|jS)N)r)rrrrr<szAddress.display_namecCs|jS)N)r)rrrrr@szAddress.usernamecCs|jS)N)r)rrrrrDszAddress.domaincCsTt|j�}t|�t|tj�kr.tj|j�}n|j}|jrH|d|jS|sPdS|S)N�@z<>)�setr�lenrZ
DOT_ATOM_ENDS�quote_stringr)r�namesetZlprrrrHs
zAddress.addr_speccCsdj|jj|j|j|j�S)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r�	__class__�__name__rrr)rrrr�__repr__XszAddress.__repr__cCs^t|j�}t|�t|tj�kr.tj|j�}n|j}|rX|jdkrFdn|j}dj||�S|jS)Nz<>rz{} <{}>)rrr r�SPECIALSr!rr)rr"�disprrrr�__str__]s
zAddress.__str__cCs8t|�t|�krdS|j|jko6|j|jko6|j|jkS)NF)�typerrr)r�otherrrr�__eq__hs
zAddress.__eq__)rrrN)r$�
__module__�__qualname__r�propertyrrrrr%r(r+rrrrrs
*rc@sFeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dS)�GroupNcCs||_|rt|�nt�|_dS)N)r�tuple�
_addresses)rr�	addressesrrrrrszGroup.__init__cCs|jS)N)r)rrrrr�szGroup.display_namecCs|jS)N)r1)rrrrr2�szGroup.addressescCsdj|jj|j|j�S)Nz${}(display_name={!r}, addresses={!r})rr#r$rr2)rrrrr%�szGroup.__repr__cCs�|jdkr&t|j�dkr&t|jd�S|j}|dk	r\t|�}t|�t|tj�kr\tj|�}djdd�|jD��}|r~d|n|}dj	||�S)N�rz, css|]}t|�VqdS)N)�str)�.0�xrrr�	<genexpr>�sz Group.__str__.<locals>.<genexpr>� z{}:{};)
rr r2r4rrr&r!r
r)rr'r"Zadrstrrrrr(�s
z
Group.__str__cCs,t|�t|�krdS|j|jko*|j|jkS)NF)r)rr2)rr*rrrr+�szGroup.__eq__)NN)
r$r,r-rr.rr2r%r(r+rrrrr/ps
r/c@sPeZdZdd�Zdd�Zedd��Zedd��Zd	d
�Ze	dd��Z
d
d�ZdS)�
BaseHeadercCs\dgi}|j||�tj|d�r4tj|d�|d<tj||d�}|d=|j|f|�|S)N�defects�decoded)�parserZ_has_surrogates�	_sanitizer4�__new__�init)�cls�name�value�kwdsrrrrr>�szBaseHeader.__new__cCs||_||_||_dS)N)�_name�_parse_tree�_defects)rrA�
parse_treer:rrrr?�szBaseHeader.initcCs|jS)N)rD)rrrrrA�szBaseHeader.namecCs
t|j�S)N)r0rF)rrrrr:�szBaseHeader.defectscCst|jj|jjt|�f|jfS)N)�_reconstruct_headerr#r$�	__bases__r4�__dict__)rrrr�
__reduce__�s
zBaseHeader.__reduce__cCstj||�S)N)r4r>)r@rBrrr�_reconstruct�szBaseHeader._reconstructcCs`tjtjtj|jd�tjdd�g�g�}|jrH|jtjtjdd�g��|j|j�|j	|d�S)Nzheader-name�:z
header-sepr8Zfws)�policy)
rZHeaderZHeaderLabelZ
ValueTerminalrArE�appendZCFWSListZWhiteSpaceTerminal�fold)rrN�headerrrrrP�szBaseHeader.foldN)r$r,r-r>r?r.rAr:rK�classmethodrLrPrrrrr9�s"

r9cCst||i�j|�S)N)r)rL)Zcls_name�basesrBrrrrH
srHc@s&eZdZdZeej�Zedd��Z	dS)�UnstructuredHeaderNcCs"|j|�|d<t|d�|d<dS)NrGr;)�value_parserr4)r@rBrCrrrr<szUnstructuredHeader.parse)
r$r,r-�	max_count�staticmethodr�get_unstructuredrUrRr<rrrrrTs
rTc@seZdZdZdS)�UniqueUnstructuredHeaderr3N)r$r,r-rVrrrrrYsrYcsBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�
DateHeaderNcCsz|s6|djtj��d|d<d|d<tj�|d<dSt|t�rJtj|�}||d<tj	|d�|d<|j
|d�|d<dS)Nr:�datetimerr;rG)rOrZHeaderMissingRequiredValuerZ	TokenList�
isinstancer4rZparsedate_to_datetimeZformat_datetimerU)r@rBrCrrrr<.s

zDateHeader.parsecs|jd�|_t�j||�dS)Nr[)�pop�	_datetime�superr?)r�args�kw)r#rrr?<szDateHeader.initcCs|jS)N)r^)rrrrr[@szDateHeader.datetime)r$r,r-rVrWrrXrUrRr<r?r.r[�
__classcell__rr)r#rrZs

rZc@seZdZdZdS)�UniqueDateHeaderr3N)r$r,r-rVrrrrrcEsrccsPeZdZdZedd��Zedd��Z�fdd�Ze	dd	��Z
e	d
d��Z�ZS)�
AddressHeaderNcCstj|�\}}|S)N)rZget_address_list)rB�address_listrrrrUNszAddressHeader.value_parsercCs�t|t�rZ|j|�|d<}g}x,|jD]"}|jt|jdd�|jD���q(Wt|j	�}n"t
|d�sj|g}dd�|D�}g}||d<||d<djd	d�|D��|d
<d|kr�|j|d
�|d<dS)NrGcSs*g|]"}t|jpd|jpd|jp"d��qS)r)rrrr)r5Zmbrrr�
<listcomp>]sz'AddressHeader.parse.<locals>.<listcomp>�__iter__cSs&g|]}t|d�std|g�n|�qS)r2N)�hasattrr/)r5�itemrrrrffs�groupsr:z, cSsg|]}t|��qSr)r4)r5rirrrrflsr;)r\r4rUr2rOr/rZ
all_mailboxes�listrrhr
)r@rBrCrerjZaddrr:rrrr<Ts$


zAddressHeader.parsecs(t|jd��|_d|_t�j||�dS)Nrj)r0r]�_groupsr1r_r?)rr`ra)r#rrr?pszAddressHeader.initcCs|jS)N)rl)rrrrrjuszAddressHeader.groupscCs&|jdkr tdd�|jD��|_|jS)NcSsg|]}|jD]}|�qqSr)r2)r5�group�addressrrrrf|sz+AddressHeader.addresses.<locals>.<listcomp>)r1r0rl)rrrrr2ys
zAddressHeader.addresses)
r$r,r-rVrWrUrRr<r?r.rjr2rbrr)r#rrdJsrdc@seZdZdZdS)�UniqueAddressHeaderr3N)r$r,r-rVrrrrro�sroc@seZdZedd��ZdS)�SingleAddressHeadercCs(t|j�dkrtdj|j���|jdS)Nr3z9value of single address header {} is not a single addressr)r r2rrrA)rrrrrn�s
zSingleAddressHeader.addressN)r$r,r-r.rnrrrrrp�srpc@seZdZdZdS)�UniqueSingleAddressHeaderr3N)r$r,r-rVrrrrrq�srqcsZeZdZdZeej�Zedd��Z	�fdd�Z
edd��Zedd	��Z
ed
d��Z�ZS)�MIMEVersionHeaderr3cCs�|j|�|d<}t|�|d<|dj|j�|jdkr<dn|j|d<|j|d<|jdk	rtdj|d|d�|d<nd|d<dS)NrGr;r:�major�minorz{}.{}�version)rUr4�extendrrtrsr)r@rBrCrGrrrr<�s

zMIMEVersionHeader.parsecs6|jd�|_|jd�|_|jd�|_t�j||�dS)Nrursrt)r]�_version�_major�_minorr_r?)rr`ra)r#rrr?�szMIMEVersionHeader.initcCs|jS)N)rx)rrrrrs�szMIMEVersionHeader.majorcCs|jS)N)ry)rrrrrt�szMIMEVersionHeader.minorcCs|jS)N)rw)rrrrru�szMIMEVersionHeader.version)r$r,r-rVrWrZparse_mime_versionrUrRr<r?r.rsrtrurbrr)r#rrr�s
rrcs8eZdZdZedd��Z�fdd�Zedd��Z�Z	S)�ParameterizedMIMEHeaderr3cCsZ|j|�|d<}t|�|d<|dj|j�|jdkrBi|d<ndd�|jD�|d<dS)NrGr;r:�paramscSs&i|]\}}tj|�tj|�j��qSr)rr=�lower)r5rArBrrr�
<dictcomp>�sz1ParameterizedMIMEHeader.parse.<locals>.<dictcomp>)rUr4rvrr{)r@rBrCrGrrrr<�s

zParameterizedMIMEHeader.parsecs|jd�|_t�j||�dS)Nr{)r]�_paramsr_r?)rr`ra)r#rrr?�szParameterizedMIMEHeader.initcCs
t|j�S)N)rr~)rrrrr{�szParameterizedMIMEHeader.params)
r$r,r-rVrRr<r?r.r{rbrr)r#rrz�s
rzcsJeZdZeej�Z�fdd�Zedd��Z	edd��Z
edd��Z�ZS)	�ContentTypeHeadercs2t�j||�tj|jj�|_tj|jj�|_dS)N)	r_r?rr=rE�maintype�	_maintype�subtype�_subtype)rr`ra)r#rrr?�szContentTypeHeader.initcCs|jS)N)r�)rrrrr��szContentTypeHeader.maintypecCs|jS)N)r�)rrrrr��szContentTypeHeader.subtypecCs|jd|jS)N�/)r�r�)rrrr�content_type�szContentTypeHeader.content_type)
r$r,r-rWrZparse_content_type_headerrUr?r.r�r�r�rbrr)r#rr�s

rcs2eZdZeej�Z�fdd�Zedd��Z	�Z
S)�ContentDispositionHeadercs2t�j||�|jj}|dkr"|ntj|�|_dS)N)r_r?rE�content_dispositionrr=�_content_disposition)rr`raZcd)r#rrr?�szContentDispositionHeader.initcCs|jS)N)r�)rrrrr��sz,ContentDispositionHeader.content_disposition)r$r,r-rWrZ parse_content_disposition_headerrUr?r.r�rbrr)r#rr��s
r�csBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�ContentTransferEncodingHeaderr3cCs2|j|�|d<}t|�|d<|dj|j�dS)NrGr;r:)rUr4rvr)r@rBrCrGrrrr<sz#ContentTransferEncodingHeader.parsecs"t�j||�tj|jj�|_dS)N)r_r?rr=rE�cte�_cte)rr`ra)r#rrr?sz"ContentTransferEncodingHeader.initcCs|jS)N)r�)rrrrr�sz!ContentTransferEncodingHeader.cte)r$r,r-rVrWrZ&parse_content_transfer_encoding_headerrUrRr<r?r.r�rbrr)r#rr��s

r�)ZsubjectZdatezresent-datez	orig-dateZsenderz
resent-senderZtoz	resent-toZccz	resent-ccZbccz
resent-bcc�fromzresent-fromzreply-tozmime-versionzcontent-typezcontent-dispositionzcontent-transfer-encodingc@s4eZdZeedfdd�Zdd�Zdd�Zdd	�Zd
S)�HeaderRegistryTcCs&i|_||_||_|r"|jjt�dS)N)�registry�
base_class�
default_class�update�_default_header_map)rr�r�Zuse_default_maprrrr,s
zHeaderRegistry.__init__cCs||j|j�<dS)N)r�r|)rrAr@rrr�map_to_type>szHeaderRegistry.map_to_typecCs,|jj|j�|j�}td|j||jfi�S)N�_)r��getr|r�r)r$r�)rrAr@rrr�__getitem__DszHeaderRegistry.__getitem__cCs||||�S)Nr)rrArBrrr�__call__Hs
zHeaderRegistry.__call__N)	r$r,r-r9rTrr�r�r�rrrrr�(s
r�N)�typesrZemailrrrrrr/r4r9rHrTrYrZrcrdrorprqrrrzrr�r�r�r�rrrr�<module>
sP`6d'7
%