ok

Mini Shell

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

3


 \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�NcCsl|dk	rV|s|rtd��tj|�\}}|r:tdj||���|jrJ|jd�|j}|j}||_||_	||_
dS)Nz=addrspec specified when username and/or domain also specifiedz6Invalid addr_spec; only '{}' could be parsed from '{}'r)�	TypeError�parserZ
get_addr_spec�
ValueError�format�all_defects�
local_part�domain�
_display_name�	_username�_domain)�self�display_name�usernamer�	addr_specZa_s�rest�r�,/usr/lib64/python3.6/email/headerregistry.py�__init__s

zAddress.__init__cCs|jS)N)r)rrrrr7szAddress.display_namecCs|jS)N)r)rrrrr;szAddress.usernamecCs|jS)N)r)rrrrr?szAddress.domaincCsTt|j�}t|�t|tj�kr.tj|j�}n|j}|jrH|d|jS|sPdS|S)N�@z<>)�setr�lenr	Z
DOT_ATOM_ENDS�quote_stringr)r�namesetZlprrrrCs
zAddress.addr_speccCsdj|jj|j|j|j�S)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r�	__class__�__name__rrr)rrrr�__repr__SszAddress.__repr__cCs^t|j�}t|�t|tj�kr.tj|j�}n|j}|rX|jdkrFdn|j}dj||�S|jS)Nz<>rz{} <{}>)rrrr	�SPECIALSrrr)rr�disprrrr�__str__Xs
zAddress.__str__cCs8t|�t|�krdS|j|jko6|j|jko6|j|jkS)NF)�typerrr)r�otherrrr�__eq__cs
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�	addressesrrrrmszGroup.__init__cCs|jS)N)r)rrrrrszGroup.display_namecCs|jS)N)r-)rrrrr.�szGroup.addressescCsdj|jj|j|j�S)Nz${}(display_name={!r}, addresses={!r})rrr rr.)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{}:{};)
rrr.r0rr	r"r�joinr)rr#rZadrstrrrrr$�s
z
Group.__str__cCs,t|�t|�krdS|j|jko*|j|jkS)NF)r%rr.)rr&rrrr'�szGroup.__eq__)NN)
r r(r)rr*rr.r!r$r'rrrrr+ks
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�	_sanitizer0�__new__�init)�cls�name�value�kwdsrrrrr;�szBaseHeader.__new__cCs||_||_||_dS)N)�_name�_parse_tree�_defects)rr>�
parse_treer7rrrr<�szBaseHeader.initcCs|jS)N)rA)rrrrr>�szBaseHeader.namecCs
t|j�S)N)r,rC)rrrrr7�szBaseHeader.defectscCst|jj|jjt|�f|jfS)N)�_reconstruct_headerrr �	__bases__r0�__dict__)rrrr�
__reduce__�s
zBaseHeader.__reduce__cCstj||�S)N)r0r;)r=r?rrr�_reconstruct�szBaseHeader._reconstructcCs`tjtjtj|jd�tjdd�g�g�}|jrH|jtjtjdd�g��|j|j�|j	|d�S)Nzheader-name�:z
header-sepr4Zfws)�policy)
r	ZHeaderZHeaderLabelZ
ValueTerminalr>rB�appendZCFWSListZWhiteSpaceTerminal�fold)rrK�headerrrrrM�szBaseHeader.foldN)r r(r)r;r<r*r>r7rH�classmethodrIrMrrrrr6�s"

r6cCst||i�j|�S)N)r%rI)Zcls_name�basesr?rrrrEsrEc@s&eZdZdZeej�Zedd��Z	dS)�UnstructuredHeaderNcCs"|j|�|d<t|d�|d<dS)NrDr8)�value_parserr0)r=r?r@rrrr9szUnstructuredHeader.parse)
r r(r)�	max_count�staticmethodr	�get_unstructuredrRrOr9rrrrrQ	s
rQc@seZdZdZdS)�UniqueUnstructuredHeaderr/N)r r(r)rSrrrrrVsrVcsBeZdZdZeej�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)Nr7�datetimerr8rD)rLrZHeaderMissingRequiredValuer	Z	TokenList�
isinstancer0rZparsedate_to_datetimeZformat_datetimerR)r=r?r@rrrr9)s

zDateHeader.parsecs|jd�|_t�j||�dS)NrX)�pop�	_datetime�superr<)r�args�kw)rrrr<7szDateHeader.initcCs|jS)N)r[)rrrrrX;szDateHeader.datetime)r r(r)rSrTr	rUrRrOr9r<r*rX�
__classcell__rr)rrrWs

rWc@seZdZdZdS)�UniqueDateHeaderr/N)r r(r)rSrrrrr`@sr`csPeZdZdZedd��Zedd��Z�fdd�Ze	dd	��Z
e	d
d��Z�ZS)�
AddressHeaderNcCstj|�\}}|S)N)r	Zget_address_list)r?�address_listrrrrRIszAddressHeader.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)NrDcSs*g|]"}t|jpd|jpd|jp"d��qS)r)rrr
r)r1Zmbrrr�
<listcomp>Xsz'AddressHeader.parse.<locals>.<listcomp>�__iter__cSs&g|]}t|d�std|g�n|�qS)r.N)�hasattrr+)r1�itemrrrrcas�groupsr7z, cSsg|]}t|��qSr)r0)r1rfrrrrcgsr8)rYr0rRr.rLr+rZ
all_mailboxes�listrrer5)r=r?r@rbrgZaddrr7rrrr9Os$


zAddressHeader.parsecs(t|jd��|_d|_t�j||�dS)Nrg)r,rZ�_groupsr-r\r<)rr]r^)rrrr<kszAddressHeader.initcCs|jS)N)ri)rrrrrgpszAddressHeader.groupscCs&|jdkr tdd�|jD��|_|jS)NcSsg|]}|jD]}|�qqSr)r.)r1�group�addressrrrrcwsz+AddressHeader.addresses.<locals>.<listcomp>)r-r,ri)rrrrr.ts
zAddressHeader.addresses)
r r(r)rSrTrRrOr9r<r*rgr.r_rr)rrraEsrac@seZdZdZdS)�UniqueAddressHeaderr/N)r r(r)rSrrrrrl|srlc@seZdZedd��ZdS)�SingleAddressHeadercCs(t|j�dkrtdj|j���|jdS)Nr/z9value of single address header {} is not a single addressr)rr.r
rr>)rrrrrk�s
zSingleAddressHeader.addressN)r r(r)r*rkrrrrrm�srmc@seZdZdZdS)�UniqueSingleAddressHeaderr/N)r r(r)rSrrrrrn�srncsZeZdZdZeej�Zedd��Z	�fdd�Z
edd��Zedd	��Z
ed
d��Z�ZS)�MIMEVersionHeaderr/cCs�|j|�|d<}t|�|d<|dj|j�|jdkr<dn|j|d<|j|d<|jdk	rtdj|d|d�|d<nd|d<dS)NrDr8r7�major�minorz{}.{}�version)rRr0�extendrrqrpr)r=r?r@rDrrrr9�s

zMIMEVersionHeader.parsecs6|jd�|_|jd�|_|jd�|_t�j||�dS)Nrrrprq)rZ�_version�_major�_minorr\r<)rr]r^)rrrr<�szMIMEVersionHeader.initcCs|jS)N)ru)rrrrrp�szMIMEVersionHeader.majorcCs|jS)N)rv)rrrrrq�szMIMEVersionHeader.minorcCs|jS)N)rt)rrrrrr�szMIMEVersionHeader.version)r r(r)rSrTr	Zparse_mime_versionrRrOr9r<r*rprqrrr_rr)rrro�s
rocs8eZdZdZedd��Z�fdd�Zedd��Z�Z	S)�ParameterizedMIMEHeaderr/cCsZ|j|�|d<}t|�|d<|dj|j�|jdkrBi|d<ndd�|jD�|d<dS)NrDr8r7�paramscSs&i|]\}}tj|�tj|�j��qSr)rr:�lower)r1r>r?rrr�
<dictcomp>�sz1ParameterizedMIMEHeader.parse.<locals>.<dictcomp>)rRr0rsrrx)r=r?r@rDrrrr9�s

zParameterizedMIMEHeader.parsecs|jd�|_t�j||�dS)Nrx)rZ�_paramsr\r<)rr]r^)rrrr<�szParameterizedMIMEHeader.initcCs
t|j�S)N)rr{)rrrrrx�szParameterizedMIMEHeader.params)
r r(r)rSrOr9r<r*rxr_rr)rrrw�s
rwcsJeZdZeej�Z�fdd�Zedd��Z	edd��Z
edd��Z�ZS)	�ContentTypeHeadercs2t�j||�tj|jj�|_tj|jj�|_dS)N)	r\r<rr:rB�maintype�	_maintype�subtype�_subtype)rr]r^)rrrr<�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)rTr	Zparse_content_type_headerrRr<r*r}rr�r_rr)rrr|�s

r|cs2eZdZeej�Z�fdd�Zedd��Z	�Z
S)�ContentDispositionHeadercs2t�j||�|jj}|dkr"|ntj|�|_dS)N)r\r<rB�content_dispositionrr:�_content_disposition)rr]r^Zcd)rrrr<�szContentDispositionHeader.initcCs|jS)N)r�)rrrrr��sz,ContentDispositionHeader.content_disposition)r r(r)rTr	Z parse_content_disposition_headerrRr<r*r�r_rr)rrr��s
r�csBeZdZdZeej�Zedd��Z	�fdd�Z
edd��Z�Z
S)�ContentTransferEncodingHeaderr/cCs2|j|�|d<}t|�|d<|dj|j�dS)NrDr8r7)rRr0rsr)r=r?r@rDrrrr9�sz#ContentTransferEncodingHeader.parsecs"t�j||�tj|jj�|_dS)N)r\r<rr:rB�cte�_cte)rr]r^)rrrr<sz"ContentTransferEncodingHeader.initcCs|jS)N)r�)rrrrr�sz!ContentTransferEncodingHeader.cte)r r(r)rSrTr	Z&parse_content_transfer_encoding_headerrRrOr9r<r*r�r_rr)rrr��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�ry)rr>r=rrr�map_to_type9szHeaderRegistry.map_to_typecCs,|jj|j�|j�}td|j||jfi�S)N�_)r��getryr�r%r r�)rr>r=rrr�__getitem__?szHeaderRegistry.__getitem__cCs||||�S)Nr)rr>r?rrr�__call__Cs
zHeaderRegistry.__call__N)	r r(r)r6rQrr�r�r�rrrrr�#s
r�N)�typesrZemailrrrr	rr+r0r6rErQrVrWr`rarlrmrnrorwr|r�r�r�r�rrrr�<module>
sP[6d'7
%

Zerion Mini Shell 1.0