Your IP : 3.22.75.247


Current Path : /opt/alt/python39/lib64/python3.9/email/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/email/__pycache__/headerregistry.cpython-39.opt-2.pyc

a

R�f�P�@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|vs(d|vr0td��|dur�|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�9/opt/alt/python39/lib64/python3.9/email/headerregistry.py�__init__s$�
zAddress.__init__cCs|jS�N�r�rrrrr<szAddress.display_namecCs|jSr)rr rrrr@szAddress.usernamecCs|jSr)rr rrrrDszAddress.domaincCs<|j}tj�|�st�|�}|jr0|d|jS|s8dS|S)N�@�<>)rrZ
DOT_ATOM_ENDS�
isdisjoint�quote_stringr)rZlprrrrHs
zAddress.addr_speccCsd�|jj|j|j|j�S)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r�	__class__�__name__rrrr rrr�__repr__Vs�zAddress.__repr__cCsF|j}tj�|�st�|�}|r@|jdkr.dn|j}d�||�S|jS)Nr"rz{} <{}>)rr�SPECIALSr#r$rr)r�disprrrr�__str__[s
zAddress.__str__cCs2t|t�stS|j|jko0|j|jko0|j|jkSr)�
isinstancer�NotImplementedrrr�r�otherrrr�__eq__ds

�
�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�|_dSr)r�tuple�
_addresses)rr�	addressesrrrrnszGroup.__init__cCs|jSrrr rrrr�szGroup.display_namecCs|jSr)r5r rrrr6�szGroup.addressescCsd�|jj|j|j�S)Nz${}(display_name={!r}, addresses={!r})rr%r&rr6r rrrr'�s�zGroup.__repr__cCs||jdur&t|j�dkr&t|jd�S|j}|durJtj�|�sJt�|�}d�dd�|jD��}|rld|n|}d�	||�S)N�r�, css|]}t|�VqdSr��str)�.0�xrrr�	<genexpr>��z Group.__str__.<locals>.<genexpr>� z{}:{};)
r�lenr6r:rr(r#r$r
r)rr)Zadrstrrrrr*�s
z
Group.__str__cCs&t|t�stS|j|jko$|j|jkSr)r+r3r,rr6r-rrrr/�s


�zGroup.__eq__)NN)
r&r0r1rr2rr6r'r*r/rrrrr3ls



r3c@sPeZdZdd�Zdd�Zedd��Zedd��Zd	d
�Ze	dd��Z
d
d�ZdS)�
BaseHeadercCs`dgi}|�||�t�|d�r4t�|d�|d<t�||d�}|d=|j|fi|��|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)r4rNr 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&r0r1rFrGr2rIrBrS�classmethodrTrXrrrrrA�s"




rAcCst||i��|�Sr)�typerT)�cls_name�basesrJrrrrPsrPc@s&eZdZdZeej�Zedd��Z	dS)�UnstructuredHeaderNcCs"|�|�|d<t|d�|d<dS)NrOrC)�value_parserr:�rHrJrKrrrrD
szUnstructuredHeader.parse)
r&r0r1�	max_count�staticmethodr�get_unstructuredr_rZrDrrrrr^s
r^c@seZdZdZdS)�UniqueUnstructuredHeaderr7N�r&r0r1rarrrrrdsrdcsBeZdZdZeej�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	TokenListr+r:rZparsedate_to_datetimeZformat_datetimer_r`rrrrD(s

zDateHeader.parsecs"|�d�|_t�j|i|��dS)Nrg)�pop�	_datetime�superrG�r�args�kw�r%rrrG6szDateHeader.initcCs|jSr)rir rrrrg:szDateHeader.datetime)r&r0r1rarbrrcr_rZrDrGr2rg�
__classcell__rrrnrrfs


rfc@seZdZdZdS)�UniqueDateHeaderr7Nrerrrrrp?srpcsPeZdZdZedd��Zedd��Z�fdd�Ze	dd	��Z
e	d
d��Z�ZS)�
AddressHeaderNcCst�|�\}}|Sr)rZget_address_list)rJ�address_listrrrr_HszAddressHeader.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|vr�|�|d
�|d<dS)NrOcSs*g|]"}t|jpd|jpd|jp"d��qS)r)rrrr)r;Zmbrrr�
<listcomp>Ws
�
�z'AddressHeader.parse.<locals>.<listcomp>�__iter__cSs&g|]}t|d�std|g�n|�qS)r6N)�hasattrr3�r;�itemrrrrs`s��groupsrBr8cSsg|]}t|��qSrr9rvrrrrsfr>rC)r+r:r_r6rWr3rZ
all_mailboxes�listrrur
)rHrJrKrrrxZaddrrBrrrrDNs*


��
�zAddressHeader.parsecs,t|�d��|_d|_t�j|i|��dS)Nrx)r4rh�_groupsr5rjrGrkrnrrrGjszAddressHeader.initcCs|jSr)rzr rrrrxoszAddressHeader.groupscCs&|jdur tdd�|jD��|_|jS)Ncss|]}|jD]
}|VqqdSr)r6)r;�group�addressrrrr=vs
�z*AddressHeader.addresses.<locals>.<genexpr>)r5r4rzr rrrr6ss
zAddressHeader.addresses)
r&r0r1rarbr_rZrDrGr2rxr6rorrrnrrqDs


rqc@seZdZdZdS)�UniqueAddressHeaderr7Nrerrrrr}{sr}c@seZdZedd��ZdS)�SingleAddressHeadercCs(t|j�dkrtd�|j���|jdS)Nr7z9value of single address header {} is not a single addressr)r@r6rrrIr rrrr|�s
�zSingleAddressHeader.addressN)r&r0r1r2r|rrrrr~�sr~c@seZdZdZdS)�UniqueSingleAddressHeaderr7Nrerrrrr�srcsZeZdZdZeej�Zedd��Z	�fdd�Z
edd��Zedd	��Z
ed
d��Z�ZS)�MIMEVersionHeaderr7cCs�|�|�|d<}t|�|d<|d�|j�|jdur<dn|j|d<|j|d<|jdurtd�|d|d�|d<nd|d<dS)NrOrCrB�major�minorz{}.{}�version)r_r:�extendrr�r�r�rHrJrKrOrrrrD�s

zMIMEVersionHeader.parsecs:|�d�|_|�d�|_|�d�|_t�j|i|��dS)Nr�r�r�)rh�_version�_major�_minorrjrGrkrnrrrG�szMIMEVersionHeader.initcCs|jSr)r�r rrrr��szMIMEVersionHeader.majorcCs|jSr)r�r rrrr��szMIMEVersionHeader.minorcCs|jSr)r�r rrrr��szMIMEVersionHeader.version)r&r0r1rarbrZparse_mime_versionr_rZrDrGr2r�r�r�rorrrnrr��s



r�cs8eZdZdZedd��Z�fdd�Zedd��Z�Z	S)�ParameterizedMIMEHeaderr7cCsZ|�|�|d<}t|�|d<|d�|j�|jdurBi|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|i|��dS)Nr�)rh�_paramsrjrGrkrnrrrG�szParameterizedMIMEHeader.initcCs
t|j�Sr)rr�r rrrr��szParameterizedMIMEHeader.params)
r&r0r1rarZrDrGr2r�rorrrnrr��s
r�csJeZdZeej�Z�fdd�Zedd��Z	edd��Z
edd��Z�ZS)	�ContentTypeHeadercs6t�j|i|��t�|jj�|_t�|jj�|_dSr)	rjrGrrErM�maintype�	_maintype�subtype�_subtyperkrnrrrG�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&r0r1rbrZparse_content_type_headerr_rGr2r�r�r�rorrrnrr��s


r�cs2eZdZeej�Z�fdd�Zedd��Z	�Z
S)�ContentDispositionHeadercs6t�j|i|��|jj}|dur&|nt�|�|_dSr)rjrGrM�content_dispositionrrE�_content_disposition)rrlrmZcdrnrrrG�szContentDispositionHeader.initcCs|jSr)r�r rrrr��sz,ContentDispositionHeader.content_disposition)r&r0r1rbrZ parse_content_disposition_headerr_rGr2r�rorrrnrr��s
r�csBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�ContentTransferEncodingHeaderr7cCs2|�|�|d<}t|�|d<|d�|j�dS�NrOrCrB�r_r:r�rr�rrrrD�sz#ContentTransferEncodingHeader.parsecs&t�j|i|��t�|jj�|_dSr)rjrGrrErM�cte�_cterkrnrrrGsz"ContentTransferEncodingHeader.initcCs|jSr)r�r rrrr�sz!ContentTransferEncodingHeader.cte)r&r0r1rarbrZ&parse_content_transfer_encoding_headerr_rZrDrGr2r�rorrrnrr��s

r�c@s&eZdZdZeej�Zedd��Z	dS)�MessageIDHeaderr7cCs2|�|�|d<}t|�|d<|d�|j�dSr�r�r�rrrrDszMessageIDHeader.parseN)
r&r0r1rarbrZparse_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_maprrrr3s
zHeaderRegistry.__init__cCs||j|��<dSr)r�r��rrIrHrrr�map_to_typeEszHeaderRegistry.map_to_typecCs,|j�|��|j�}td|j||jfi�S)N�_)r��getr�r�r[r&r�r�rrr�__getitem__KszHeaderRegistry.__getitem__cCs||||�Srr)rrIrJrrr�__call__Os
zHeaderRegistry.__call__N)	r&r0r1rAr^rr�r�r�rrrrr�/s�
r�N)�typesrZemailrrrrrr3r:rArPr^rdrfrprqr}r~rr�r�r�r�r�r�r�r�rrrr�<module>
sV\4d'7
%�

?>