Your IP : 18.217.26.8


Current Path : /usr/lib64/python3.8/email/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/email/__pycache__/headerregistry.cpython-38.opt-2.pyc

U

e5dKQ�@svddlmZddlmZddlmZddlmZGdd�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&�ZGd'd(�d(�Ze
eeeeeeeeeeeeeeeeeeed)�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�d�td||||f��}d|ks(d|kr0td��|dk	r�|s@|rHtd��t�|�\}}|rjtd�||���|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�,/usr/lib64/python3.8/email/headerregistry.py�__init__s&�
zAddress.__init__cCs|jS�N�r�rrrrr<szAddress.display_namecCs|jSr)rr rrrr@szAddress.usernamecCs|jSr)rr rrrrDszAddress.domaincCsTt|j�}t|�t|tj�kr.t�|j�}n|j}|jrH|d|jS|sPdS|S)N�@�<>)�setr�lenrZ
DOT_ATOM_ENDS�quote_stringr)r�namesetZlprrrrHs
zAddress.addr_speccCsd�|jj|j|j|j�S)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r�	__class__�__name__rrrr rrr�__repr__Xs�zAddress.__repr__cCs^t|j�}t|�t|tj�kr.t�|j�}n|j}|rX|jdkrFdn|j}d�||�S|jS)Nr"rz{} <{}>)r#rr$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,r1rrrrrs
*



rc@sFeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dS)�GroupNcCs||_|rt|�nt�|_dSr)r�tuple�
_addresses)rr�	addressesrrrrrszGroup.__init__cCs|jSrrr rrrr�szGroup.display_namecCs|jSr)r7r rrrr8�szGroup.addressescCsd�|jj|j|j�S)Nz${}(display_name={!r}, addresses={!r})rr'r(rr8r rrrr)�s
�zGroup.__repr__cCs�|jdkr&t|j�dkr&t|jd�S|j}|dk	r\t|�}t|�t|tj�kr\t�|�}d�dd�|jD��}|r~d|n|}d�	||�S)N�r�, css|]}t|�VqdSr��str)�.0�xrrr�	<genexpr>�sz Group.__str__.<locals>.<genexpr>� z{}:{};)
rr$r8r<r#rr*r%r
r)rr+r&Zadrstrrrrr,�s
z
Group.__str__cCs,t|�t|�krdS|j|jko*|j|jkSr-)r.rr8r/rrrr1�s

�zGroup.__eq__)NN)
r(r2r3rr4rr8r)r,r1rrrrr5ps


r5c@sPeZdZdd�Zdd�Zedd��Zedd��Zd	d
�Ze	dd��Z
d
d�ZdS)�
BaseHeadercCs\dgi}|�||�t�|d�r4t�|d�|d<t�||d�}|d=|j|f|�|S)N�defects�decoded)�parserZ_has_surrogates�	_sanitizer<�__new__�init)�cls�name�value�kwdsrrrrrF�szBaseHeader.__new__cCs||_||_||_dSr)�_name�_parse_tree�_defects)rrI�
parse_treerBrrrrG�szBaseHeader.initcCs|jSr)rLr rrrrI�szBaseHeader.namecCs
t|j�Sr)r6rNr rrrrB�szBaseHeader.defectscCst|jj|jjt|�f|jfSr)�_reconstruct_headerr'r(�	__bases__r<�__dict__r rrr�
__reduce__�s��zBaseHeader.__reduce__cCst�||�Sr)r<rF)rHrJrrr�_reconstruct�szBaseHeader._reconstructc	Cs`t�t�t�|jd�t�dd�g�g�}|jrH|�t�t�dd�g��|�|j�|j	|d�S)Nzheader-name�:z
header-sepr@Zfws)�policy)
rZHeaderZHeaderLabelZ
ValueTerminalrIrM�appendZCFWSListZWhiteSpaceTerminal�fold)rrV�headerrrrrX�s
���zBaseHeader.foldN)r(r2r3rFrGr4rIrBrS�classmethodrTrXrrrrrA�s"




rAcCst||i��|�Sr)r.rT)Zcls_name�basesrJrrrrP
srPc@s&eZdZdZeej�Zedd��Z	dS)�UnstructuredHeaderNcCs"|�|�|d<t|d�|d<dS)NrOrC)�value_parserr<�rHrJrKrrrrDszUnstructuredHeader.parse)
r(r2r3�	max_count�staticmethodr�get_unstructuredr]rZrDrrrrr\s
r\c@seZdZdZdS)�UniqueUnstructuredHeaderr9N�r(r2r3r_rrrrrbsrbcsBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�
DateHeaderNcCsz|s6|d�t���d|d<d|d<t��|d<dSt|t�rJt�|�}||d<t�	|d�|d<|�
|d�|d<dS)NrB�datetimerrCrO)rWrZHeaderMissingRequiredValuerZ	TokenList�
isinstancer<rZparsedate_to_datetimeZformat_datetimer]r^rrrrD.s

zDateHeader.parsecs|�d�|_t�j||�dS)Nre)�pop�	_datetime�superrG�r�args�kw�r'rrrG<szDateHeader.initcCs|jSr)rhr rrrre@szDateHeader.datetime)r(r2r3r_r`rrar]rZrDrGr4re�
__classcell__rrrmrrds


rdc@seZdZdZdS)�UniqueDateHeaderr9NrcrrrrroEsrocsPeZdZdZedd��Zedd��Z�fdd�Ze	dd	��Z
e	d
d��Z�ZS)�
AddressHeaderNcCst�|�\}}|Sr)rZget_address_list)rJ�address_listrrrr]NszAddressHeader.value_parsercCs�t|t�rV|�|�|d<}g}|jD]"}|�t|jdd�|jD���q&t|j	�}n"t
|d�sf|g}dd�|D�}g}||d<||d<d�d	d�|D��|d
<d|kr�|�|d
�|d<dS)NrOcSs*g|]"}t|jpd|jpd|jp"d��qS)r)rrrr)r=Zmbrrr�
<listcomp>]s
�
�z'AddressHeader.parse.<locals>.<listcomp>�__iter__cSs&g|]}t|d�std|g�n|�qS)r8N)�hasattrr5�r=�itemrrrrrfs��groupsrBr:cSsg|]}t|��qSrr;rurrrrrlsrC)rfr<r]r8rWr5rZ
all_mailboxes�listrrtr
)rHrJrKrqrwZaddrrBrrrrDTs*


��
�zAddressHeader.parsecs(t|�d��|_d|_t�j||�dS)Nrw)r6rg�_groupsr7rirGrjrmrrrGpszAddressHeader.initcCs|jSr)ryr rrrrwuszAddressHeader.groupscCs&|jdkr tdd�|jD��|_|jS)Ncss|]}|jD]
}|VqqdSr)r8)r=�group�addressrrrr?|s�z*AddressHeader.addresses.<locals>.<genexpr>)r7r6ryr rrrr8ys
zAddressHeader.addresses)
r(r2r3r_r`r]rZrDrGr4rwr8rnrrrmrrpJs


rpc@seZdZdZdS)�UniqueAddressHeaderr9Nrcrrrrr|�sr|c@seZdZedd��ZdS)�SingleAddressHeadercCs(t|j�dkrtd�|j���|jdS)Nr9z9value of single address header {} is not a single addressr)r$r8rrrIr rrrr{�s
�zSingleAddressHeader.addressN)r(r2r3r4r{rrrrr}�sr}c@seZdZdZdS)�UniqueSingleAddressHeaderr9Nrcrrrrr~�sr~csZeZdZdZeej�Zedd��Z	�fdd�Z
edd��Zedd	��Z
ed
d��Z�ZS)�MIMEVersionHeaderr9cCs�|�|�|d<}t|�|d<|d�|j�|jdkr<dn|j|d<|j|d<|jdk	rtd�|d|d�|d<nd|d<dS)NrOrCrB�major�minorz{}.{}�version)r]r<�extendrr�r�r�rHrJrKrOrrrrD�s

zMIMEVersionHeader.parsecs6|�d�|_|�d�|_|�d�|_t�j||�dS)Nr�r�r�)rg�_version�_major�_minorrirGrjrmrrrG�szMIMEVersionHeader.initcCs|jSr)r�r rrrr��szMIMEVersionHeader.majorcCs|jSr)r�r rrrr��szMIMEVersionHeader.minorcCs|jSr)r�r rrrr��szMIMEVersionHeader.version)r(r2r3r_r`rZparse_mime_versionr]rZrDrGr4r�r�r�rnrrrmrr�s



rcs8eZdZdZedd��Z�fdd�Zedd��Z�Z	S)�ParameterizedMIMEHeaderr9cCsZ|�|�|d<}t|�|d<|d�|j�|jdkrBi|d<ndd�|jD�|d<dS)NrOrCrB�paramscSs&i|]\}}t�|���t�|��qSr)rrE�lower)r=rIrJrrr�
<dictcomp>�s�z1ParameterizedMIMEHeader.parse.<locals>.<dictcomp>)r]r<r�rr�r�rrrrD�s

�zParameterizedMIMEHeader.parsecs|�d�|_t�j||�dS)Nr�)rg�_paramsrirGrjrmrrrG�szParameterizedMIMEHeader.initcCs
t|j�Sr)rr�r rrrr��szParameterizedMIMEHeader.params)
r(r2r3r_rZrDrGr4r�rnrrrmrr��s
r�csJeZdZeej�Z�fdd�Zedd��Z	edd��Z
edd��Z�ZS)	�ContentTypeHeadercs2t�j||�t�|jj�|_t�|jj�|_dSr)	rirGrrErM�maintype�	_maintype�subtype�_subtyperjrmrrrG�szContentTypeHeader.initcCs|jSr)r�r rrrr��szContentTypeHeader.maintypecCs|jSr)r�r rrrr��szContentTypeHeader.subtypecCs|jd|jS)N�/)r�r�r rrr�content_type�szContentTypeHeader.content_type)
r(r2r3r`rZparse_content_type_headerr]rGr4r�r�r�rnrrrmrr��s


r�cs2eZdZeej�Z�fdd�Zedd��Z	�Z
S)�ContentDispositionHeadercs2t�j||�|jj}|dkr"|nt�|�|_dSr)rirGrM�content_dispositionrrE�_content_disposition)rrkrlZcdrmrrrG�szContentDispositionHeader.initcCs|jSr)r�r rrrr��sz,ContentDispositionHeader.content_disposition)r(r2r3r`rZ parse_content_disposition_headerr]rGr4r�rnrrrmrr��s
r�csBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�ContentTransferEncodingHeaderr9cCs2|�|�|d<}t|�|d<|d�|j�dS�NrOrCrB�r]r<r�rr�rrrrDsz#ContentTransferEncodingHeader.parsecs"t�j||�t�|jj�|_dSr)rirGrrErM�cte�_cterjrmrrrGsz"ContentTransferEncodingHeader.initcCs|jSr)r�r rrrr�sz!ContentTransferEncodingHeader.cte)r(r2r3r_r`rZ&parse_content_transfer_encoding_headerr]rZrDrGr4r�rnrrrmrr��s

r�c@s&eZdZdZeej�Zedd��Z	dS)�MessageIDHeaderr9cCs2|�|�|d<}t|�|d<|d�|j�dSr�r�r�rrrrDszMessageIDHeader.parseN)
r(r2r3r_r`rZparse_message_idr]rZrDrrrrr�s
r�)Zsubject�datezresent-datez	orig-dateZsenderz
resent-sender�toz	resent-toZccz	resent-ccZbccz
resent-bcc�fromzresent-fromzreply-tozmime-versionzcontent-typezcontent-dispositionzcontent-transfer-encodingz
message-idc@s4eZdZeedfdd�Zdd�Zdd�Zdd	�Zd
S)�HeaderRegistryTcCs&i|_||_||_|r"|j�t�dSr)�registry�
base_class�
default_class�update�_default_header_map)rr�r�Zuse_default_maprrrr9s
zHeaderRegistry.__init__cCs||j|��<dSr)r�r��rrIrHrrr�map_to_typeKszHeaderRegistry.map_to_typecCs,|j�|��|j�}td|j||jfi�S)N�_)r��getr�r�r.r(r�r�rrr�__getitem__QszHeaderRegistry.__getitem__cCs||||�Srr)rrIrJrrr�__call__Us
zHeaderRegistry.__call__N)	r(r2r3rAr\rr�r�r�rrrrr�5s�
r�N)�typesrZemailrrrrrr5r<rArPr\rbrdrorpr|r}r~rr�r�r�r�r�r�r�rrrr�<module>
sV`6d'7
%�

?>