Your IP : 3.137.200.56


Current Path : /opt/alt/python310/lib64/python3.10/email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/email/__pycache__/headerregistry.cpython-310.opt-2.pyc

o

6��fMQ�@s�	ddlmZddlmZddlmZddlmZGdd�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(�Zid)e
�d*e�d+e�d,e�d-e�d.e�d/e�d0e�d1e�d2e�d3e�d4e�d5e�d6e�d7e�d8e�d9e�eeed:��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|vsd|vrtd��|durD|s!|r%td��t�|�\}}|r6td�||���|jr>|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�;/opt/alt/python310/lib64/python3.10/email/headerregistry.py�__init__s*��

zAddress.__init__cC�|jS�N�r�rrrrr8�zAddress.display_namecCrr)rr!rrrr<r"zAddress.usernamecCrr)rr!rrrr@r"zAddress.domaincCs>	|j}tj�|�st�|�}|jr|d|jS|sdS|S)N�@�<>)rrZ
DOT_ATOM_ENDS�
isdisjoint�quote_stringr)rZlprrrrDs
zAddress.addr_speccCsd�|jj|j|j|j�S)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r�	__class__�__name__rrrr!rrr�__repr__Rs�zAddress.__repr__cCsF|j}tj�|�st�|�}|r |jdkrdn|j}d�||�S|jS)Nr$rz{} <{}>)rr�SPECIALSr%r&rr)r�disprrrr�__str__Ws
zAddress.__str__cCs2t|t�stS|j|jko|j|jko|j|jkSr)�
isinstancer�NotImplementedrrr�r�otherrrr�__eq__`s

�
�zAddress.__eq__)rrrN)r(�
__module__�__qualname__r�propertyrrrrr)r,r1rrrrrs
*




	rc@sFeZdZddd�Zedd��Zedd��Zdd	�Zd
d�Zdd
�Z	dS)�GroupNcCs&	||_|r
t|�|_dSt�|_dSr)r�tuple�
_addresses)rr�	addressesrrrrjszGroup.__init__cCrrr r!rrrr|r"zGroup.display_namecCrr)r7r!rrrr8�r"zGroup.addressescCsd�|jj|j|j�S)Nz${}(display_name={!r}, addresses={!r})rr'r(rr8r!rrrr)�s�zGroup.__repr__cCs||jdurt|j�dkrt|jd�S|j}|dur%tj�|�s%t�|�}d�dd�|jD��}|r6d|n|}d�	||�S)N�r�, css�|]}t|�VqdSr��str)�.0�xrrr�	<genexpr>�s�z Group.__str__.<locals>.<genexpr>� z{}:{};)
r�lenr8r<rr*r%r&r
r)rr+Zadrstrrrrr,�s
z
Group.__str__cCs&t|t�stS|j|jko|j|jkSr)r-r5r.rr8r/rrrr1�s


�zGroup.__eq__)NN)
r(r2r3rr4rr8r)r,r1rrrrr5hs



r5c@sReZdZ	dd�Zdd�Zedd��Zedd��Zd	d
�Ze	dd��Z
d
d�ZdS)�
BaseHeadercCs`dgi}|�||�t�|d�rt�|d�|d<t�||d�}|d=|j|fi|��|S)N�defects�decoded)�parserZ_has_surrogates�	_sanitizer<�__new__�init)�cls�name�value�kwdsrrrrrG�szBaseHeader.__new__cCs||_||_||_dSr)�_name�_parse_tree�_defects)rrJ�
parse_treerCrrrrH�s
zBaseHeader.initcCrr)rMr!rrrrJ�r"zBaseHeader.namecC�
t|j�Sr)r6rOr!rrrrC��
zBaseHeader.defectscCst|jj|jjt|�f|jfSr)�_reconstruct_headerr'r(�	__bases__r<�__dict__r!rrr�
__reduce__�s��zBaseHeader.__reduce__cCst�||�Sr)r<rG)rIrKrrr�_reconstruct�szBaseHeader._reconstructc	Csb	t�t�t�|jd�t�dd�g�g�}|jr%|�t�t�dd�g��|�|j�|j	|d�S)Nzheader-name�:z
header-sepr@Zfws)�policy)
rZHeaderZHeaderLabelZ
ValueTerminalrJrN�appendZCFWSListZWhiteSpaceTerminal�fold)rrY�headerrrrr[�s
���zBaseHeader.foldN)r(r2r3rGrHr4rJrCrV�classmethodrWr[rrrrrB�s 




rBcCst||i��|�Sr)�typerW)�cls_name�basesrKrrrrSsrSc@s&eZdZdZeej�Zedd��Z	dS)�UnstructuredHeaderNcCs"|�|�|d<t|d�|d<dS)NrPrD)�value_parserr<�rIrKrLrrrrE	szUnstructuredHeader.parse)
r(r2r3�	max_count�staticmethodr�get_unstructuredrbr]rErrrrra�

rac@�eZdZdZdS)�UniqueUnstructuredHeaderr9N�r(r2r3rdrrrrri�ricsDeZdZ	dZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�
DateHeaderNcCs�|s|d�t���d|d<d|d<t��|d<dSt|t�rJ||d<zt�|�}Wnt	yI|d�t�
d��d|d<t��|d<YdSw||d<t�|d�|d<|�|d�|d<dS)NrC�datetimerrDrPzInvalid date value or format)
rZrZHeaderMissingRequiredValuerZ	TokenListr-r<rZparsedate_to_datetimerZInvalidDateDefectZformat_datetimerbrcrrrrE$s&
�zDateHeader.parsec�"|�d�|_t�j|i|��dS)Nrm)�pop�	_datetime�superrH�r�args�kw�r'rrrH9�zDateHeader.initcCrr)rpr!rrrrm=r"zDateHeader.datetime)r(r2r3rdrerrfrbr]rErHr4rm�
__classcell__rrrurrls	

rlc@rh)�UniqueDateHeaderr9NrjrrrrrxBrkrxcsPeZdZdZedd��Zedd��Z�fdd�Ze	dd	��Z
e	d
d��Z�ZS)�
AddressHeaderNcCst�|�\}}|Sr)rZget_address_list)rK�address_listrrrrbKszAddressHeader.value_parsercCs�t|t�r+|�|�|d<}g}|jD]}|�t|jdd�|jD���qt|j	�}nt
|d�s3|g}dd�|D�}g}||d<||d<d�d	d�|D��|d
<d|vr_|�|d
�|d<dSdS)NrPcSs*g|]}t|jp	d|jp
d|jpd��qS)r)rrrr)r=Zmbrrr�
<listcomp>Zs
��z'AddressHeader.parse.<locals>.<listcomp>�__iter__cSs&g|]}t|d�std|g�n|�qS)r8N)�hasattrr5�r=�itemrrrr{cs
���groupsrCr:cSsg|]}t|��qSrr;r~rrrr{isrD)r-r<rbr8rZr5rZ
all_mailboxes�listrr}r
)rIrKrLrzr�ZaddrrCrrrrEQs,


��
��zAddressHeader.parsecs,t|�d��|_d|_t�j|i|��dS)Nr�)r6ro�_groupsr7rqrHrrrurrrHmszAddressHeader.initcCrr)r�r!rrrr�rr"zAddressHeader.groupscCs&|jdurtdd�|jD��|_|jS)Ncss �|]}|jD]}|VqqdSr)r8)r=�group�addressrrrr?ys���z*AddressHeader.addresses.<locals>.<genexpr>)r7r6r�r!rrrr8vs
zAddressHeader.addresses)
r(r2r3rdrerbr]rErHr4r�r8rwrrrurryGs


ryc@rh)�UniqueAddressHeaderr9Nrjrrrrr�~rkr�c@seZdZedd��ZdS)�SingleAddressHeadercCs(t|j�dkrtd�|j���|jdS)Nr9z9value of single address header {} is not a single addressr)rAr8rrrJr!rrrr��s
�
zSingleAddressHeader.addressN)r(r2r3r4r�rrrrr��sr�c@rh)�UniqueSingleAddressHeaderr9Nrjrrrrr��rkr�csZeZdZdZeej�Zedd��Z	�fdd�Z
edd��Zedd	��Z
ed
d��Z�ZS)�MIMEVersionHeaderr9cCs�|�|�|d<}t|�|d<|d�|j�|jdurdn|j|d<|j|d<|jdur;d�|d|d�|d<dSd|d<dS)NrPrDrC�major�minorz{}.{}�version)rbr<�extendrr�r�r�rIrKrLrPrrrrE�s

zMIMEVersionHeader.parsecs:|�d�|_|�d�|_|�d�|_t�j|i|��dS)Nr�r�r�)ro�_version�_major�_minorrqrHrrrurrrH�szMIMEVersionHeader.initcCrr)r�r!rrrr��r"zMIMEVersionHeader.majorcCrr)r�r!rrrr��r"zMIMEVersionHeader.minorcCrr)r�r!rrrr��r"zMIMEVersionHeader.version)r(r2r3rdrerZparse_mime_versionrbr]rErHr4r�r�r�rwrrrurr��s



r�cs8eZdZdZedd��Z�fdd�Zedd��Z�Z	S)�ParameterizedMIMEHeaderr9cCs\|�|�|d<}t|�|d<|d�|j�|jdur"i|d<dSdd�|jD�|d<dS)NrPrDrC�paramscSs&i|]\}}t�|���t�|��qSr)rrF�lower)r=rJrKrrr�
<dictcomp>�s
��z1ParameterizedMIMEHeader.parse.<locals>.<dictcomp>)rbr<r�rr�r�rrrrE�s
�zParameterizedMIMEHeader.parsecrn)Nr�)ro�_paramsrqrHrrrurrrH�rvzParameterizedMIMEHeader.initcCrQr)rr�r!rrrr��rRzParameterizedMIMEHeader.params)
r(r2r3rdr]rErHr4r�rwrrrurr��s
r�csJeZdZeej�Z�fdd�Zedd��Z	edd��Z
edd��Z�ZS)	�ContentTypeHeadercs6t�j|i|��t�|jj�|_t�|jj�|_dSr)	rqrHrrFrN�maintype�	_maintype�subtype�_subtyperrrurrrH�szContentTypeHeader.initcCrr)r�r!rrrr��r"zContentTypeHeader.maintypecCrr)r�r!rrrr��r"zContentTypeHeader.subtypecCs|jd|jS)N�/)r�r�r!rrr�content_type�szContentTypeHeader.content_type)
r(r2r3rerZparse_content_type_headerrbrHr4r�r�r�rwrrrurr��s


r�cs2eZdZeej�Z�fdd�Zedd��Z	�Z
S)�ContentDispositionHeadercs<t�j|i|��|jj}|dur||_dSt�|�|_dSr)rqrHrN�content_dispositionrrF�_content_disposition)rrsrtZcdrurrrH�s"zContentDispositionHeader.initcCrr)r�r!rrrr��r"z,ContentDispositionHeader.content_disposition)r(r2r3rerZ parse_content_disposition_headerrbrHr4r�rwrrrurr��s

r�csBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�ContentTransferEncodingHeaderr9cC�2|�|�|d<}t|�|d<|d�|j�dS�NrPrDrC�rbr<r�rr�rrrrE��z#ContentTransferEncodingHeader.parsecs&t�j|i|��t�|jj�|_dSr)rqrHrrFrN�cte�_cterrrurrrHsz"ContentTransferEncodingHeader.initcCrr)r�r!rrrr�r"z!ContentTransferEncodingHeader.cte)r(r2r3rdrerZ&parse_content_transfer_encoding_headerrbr]rErHr4r�rwrrrurr��s

r�c@s&eZdZdZeej�Zedd��Z	dS)�MessageIDHeaderr9cCr�r�r�r�rrrrEr�zMessageIDHeader.parseN)
r(r2r3rdrerZparse_message_idrbr]rErrrrr�
rgr��subject�datezresent-datez	orig-dateZsenderz
resent-sender�toz	resent-toZccz	resent-ccZbccz
resent-bcc�fromzresent-fromzreply-tozmime-versionzcontent-type)zcontent-dispositionzcontent-transfer-encodingz
message-idc@s6eZdZ	eedfdd�Zdd�Zdd�Zdd	�Zd
S)�HeaderRegistryTcCs,	i|_||_||_|r|j�t�dSdSr)�registry�
base_class�
default_class�update�_default_header_map)rr�r�Zuse_default_maprrrr6s
�zHeaderRegistry.__init__cCs	||j|��<dSr)r�r��rrJrIrrr�map_to_typeHszHeaderRegistry.map_to_typecCs,|j�|��|j�}td|j||jfi�S)N�_)r��getr�r�r^r(r�r�rrr�__getitem__NszHeaderRegistry.__getitem__cCs	||||�Srr)rrJrKrrr�__call__Rs	zHeaderRegistry.__call__N)	r(r2r3rBrarr�r�r�rrrrr�2s
�r�N)�typesrZemailrrrrrr5r<rBrSrarirlrxryr�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s~\4d.7
%��������	�
���
������

?>