• File: headerregistry.cpython-37.opt-2.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/email/__pycache__/headerregistry.cpython-37.opt-2.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 15.25 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

YI~dO@sfddlmZddlmZddlmZddlmZGdddZGdddZGd	d
d
e	Z
ddZGd
ddZGdddeZ
GdddZGdddeZGdddZGdddeZGdddeZGdddeZGdddZGdd d ZGd!d"d"eZGd#d$d$eZGd%d&d&Ze
eeeeeeeeeeeeeeeeeed'ZGd(d)d)Zd*S)+)MappingProxyType)utils)errors)_header_value_parserc@s^eZdZdddZeddZeddZed	d
ZeddZd
dZ	ddZ
ddZdS)AddressNcCsdtd||||f}d|ks(d|kr0td|dk	r|s@|rHtdt|\}}|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)
joinfilter
ValueError	TypeErrorparserZ
get_addr_specformatall_defects
local_partdomain
_display_name	_username_domain)selfdisplay_nameusernamer	addr_specZinputsZa_srestr9/opt/alt/python37/lib64/python3.7/email/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|tjkr.t|j}n|j}|jrH|d|jS|sPdS|S)N@z<>)setrlenrZ
DOT_ATOM_ENDSquote_stringr)rnamesetZlprrrrHs
zAddress.addr_speccCsd|jj|j|j|jS)Nz1{}(display_name={!r}, username={!r}, domain={!r}))r	__class____name__rrr)rrrr__repr__XszAddress.__repr__cCs^t|j}t|t|tjkr.t|j}n|j}|rX|jdkrFdn|j}d||S|jS)Nz<>rz{} <{}>)rrr rSPECIALSr!rr)rr"disprrrr__str__]s
zAddress.__str__cCs8t|t|krdS|j|jko6|j|jko6|j|jkS)NF)typerrr)rotherrrr__eq__hs
zAddress.__eq__)rrrN)r$
__module____qualname__rpropertyrrrrr%r(r+rrrrrs
*rc@sFeZdZdddZeddZeddZdd	Zd
dZdd
Z	dS)GroupNcCs||_|rt|nt|_dS)N)rtuple
_addresses)rr	addressesrrrrrszGroup.__init__cCs|jS)N)r)rrrrrszGroup.display_namecCs|jS)N)r1)rrrrr2szGroup.addressescCsd|jj|j|jS)Nz${}(display_name={!r}, addresses={!r})rr#r$rr2)rrrrr%szGroup.__repr__cCs|jdkr&t|jdkr&t|jdS|j}|dk	r\t|}t|t|tjkr\t|}ddd|jD}|r~d|n|}d	||S)Nrz, css|]}t|VqdS)N)str).0xrrr	<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@sPeZdZddZddZeddZeddZd	d
Ze	ddZ
d
dZdS)
BaseHeadercCs\dgi}|||t|dr4t|d|d<t||d}|d=|j|f||S)Ndefectsdecoded)parserZ_has_surrogates	_sanitizer4__new__init)clsnamevaluekwdsrrrrr>szBaseHeader.__new__cCs||_||_||_dS)N)_name_parse_tree_defects)rrA
parse_treer:rrrr?szBaseHeader.initcCs|jS)N)rD)rrrrrAszBaseHeader.namecCs
t|jS)N)r0rF)rrrrr:szBaseHeader.defectscCst|jj|jjt|f|jfS)N)_reconstruct_headerr#r$	__bases__r4__dict__)rrrr
__reduce__s
zBaseHeader.__reduce__cCst||S)N)r4r>)r@rBrrr_reconstructszBaseHeader._reconstructc	Cs`ttt|jdtddgg}|jrH|ttddg||j|j	|dS)Nzheader-name:z
header-sepr8Zfws)policy)
rZHeaderZHeaderLabelZ
ValueTerminalrArEappendZCFWSListZWhiteSpaceTerminalfold)rrNheaderrrrrPszBaseHeader.foldN)r$r,r-r>r?r.rAr:rKclassmethodrLrPrrrrr9s"

r9cCst||i|S)N)r)rL)Zcls_namebasesrBrrrrH
srHc@s&eZdZdZeejZeddZ	dS)UnstructuredHeaderNcCs"|||d<t|d|d<dS)NrGr;)value_parserr4)r@rBrCrrrr<szUnstructuredHeader.parse)
r$r,r-	max_countstaticmethodrget_unstructuredrUrRr<rrrrrTs
rTc@seZdZdZdS)UniqueUnstructuredHeaderr3N)r$r,r-rVrrrrrYsrYcsBeZdZdZeejZeddZ	fddZ
eddZZ
S)
DateHeaderNcCsz|s6|dtd|d<d|d<t|d<dSt|trJt|}||d<t	|d|d<|
|d|d<dS)Nr:datetimerr;rG)rOrZHeaderMissingRequiredValuerZ	TokenList
isinstancer4rZparsedate_to_datetimeZformat_datetimerU)r@rBrCrrrr<.s

zDateHeader.parsecs|d|_tj||dS)Nr[)pop	_datetimesuperr?)rargskw)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-rVrrrrrcEsrccsPeZdZdZeddZeddZfddZe	dd	Z
e	d
dZZS)
AddressHeaderNcCst|\}}|S)N)rZget_address_list)rBaddress_listrrrrUNszAddressHeader.value_parsercCst|trZ|||d<}g}x,|jD]"}|t|jdd|jDq(Wt|j	}n"t
|dsj|g}dd|D}g}||d<||d<dd	d|D|d
<d|kr||d
|d<dS)NrGcSs*g|]"}t|jpd|jpd|jp"dqS)r)rrrr)r5Zmbrrr
<listcomp>]sz'AddressHeader.parse.<locals>.<listcomp>__iter__cSs&g|]}t|dstd|gn|qS)r2N)hasattrr/)r5itemrrrrffsgroupsr:z, cSsg|]}t|qSr)r4)r5rirrrrflsr;)r\r4rUr2rOr/rZ
all_mailboxeslistrrhr
)r@rBrCrerjZaddrr:rrrr<Ts$


zAddressHeader.parsecs(t|d|_d|_tj||dS)Nrj)r0r]_groupsr1r_r?)rr`ra)r#rrr?pszAddressHeader.initcCs|jS)N)rl)rrrrrjuszAddressHeader.groupscCs&|jdkr tdd|jD|_|jS)Ncss|]}|jD]
}|VqqdS)N)r2)r5groupaddressrrrr7|sz*AddressHeader.addresses.<locals>.<genexpr>)r1r0rl)rrrrr2ys
zAddressHeader.addresses)
r$r,r-rVrWrUrRr<r?r.rjr2rbrr)r#rrdJsrdc@seZdZdZdS)UniqueAddressHeaderr3N)r$r,r-rVrrrrrosroc@seZdZeddZdS)SingleAddressHeadercCs(t|jdkrtd|j|jdS)Nr3z9value of single address header {} is not a single addressr)r r2rrrA)rrrrrns
zSingleAddressHeader.addressN)r$r,r-r.rnrrrrrpsrpc@seZdZdZdS)UniqueSingleAddressHeaderr3N)r$r,r-rVrrrrrqsrqcsZeZdZdZeejZeddZ	fddZ
eddZedd	Z
ed
dZZS)MIMEVersionHeaderr3cCs|||d<}t||d<|d|j|jdkr<dn|j|d<|j|d<|jdk	rtd|d|d|d<nd|d<dS)NrGr;r:majorminorz{}.{}version)rUr4extendrrtrsr)r@rBrCrGrrrr<s

zMIMEVersionHeader.parsecs6|d|_|d|_|d|_tj||dS)Nrursrt)r]_version_major_minorr_r?)rr`ra)r#rrr?szMIMEVersionHeader.initcCs|jS)N)rx)rrrrrsszMIMEVersionHeader.majorcCs|jS)N)ry)rrrrrtszMIMEVersionHeader.minorcCs|jS)N)rw)rrrrruszMIMEVersionHeader.version)r$r,r-rVrWrZparse_mime_versionrUrRr<r?r.rsrtrurbrr)r#rrrs
rrcs8eZdZdZeddZfddZeddZZ	S)ParameterizedMIMEHeaderr3cCsZ|||d<}t||d<|d|j|jdkrBi|d<ndd|jD|d<dS)NrGr;r:paramscSs&i|]\}}t|t|qSr)rr=lower)r5rArBrrr
<dictcomp>sz1ParameterizedMIMEHeader.parse.<locals>.<dictcomp>)rUr4rvrr{)r@rBrCrGrrrr<s

zParameterizedMIMEHeader.parsecs|d|_tj||dS)Nr{)r]_paramsr_r?)rr`ra)r#rrr?szParameterizedMIMEHeader.initcCs
t|jS)N)rr~)rrrrr{szParameterizedMIMEHeader.params)
r$r,r-rVrRr<r?r.r{rbrr)r#rrzs
rzcsJeZdZeejZfddZeddZ	eddZ
eddZZS)	ContentTypeHeadercs2tj||t|jj|_t|jj|_dS)N)	r_r?rr=rEmaintype	_maintypesubtype_subtype)rr`ra)r#rrr?szContentTypeHeader.initcCs|jS)N)r)rrrrrszContentTypeHeader.maintypecCs|jS)N)r)rrrrrszContentTypeHeader.subtypecCs|jd|jS)N/)rr)rrrrcontent_typeszContentTypeHeader.content_type)
r$r,r-rWrZparse_content_type_headerrUr?r.rrrrbrr)r#rrs

rcs2eZdZeejZfddZeddZ	Z
S)ContentDispositionHeadercs2tj|||jj}|dkr"|nt||_dS)N)r_r?rEcontent_dispositionrr=_content_disposition)rr`raZcd)r#rrr?szContentDispositionHeader.initcCs|jS)N)r)rrrrrsz,ContentDispositionHeader.content_disposition)r$r,r-rWrZ parse_content_disposition_headerrUr?r.rrbrr)r#rrs
rcsBeZdZdZeejZeddZ	fddZ
eddZZ
S)ContentTransferEncodingHeaderr3cCs2|||d<}t||d<|d|jdS)NrGr;r:)rUr4rvr)r@rBrCrGrrrr<sz#ContentTransferEncodingHeader.parsecs"tj||t|jj|_dS)N)r_r?rr=rEcte_cte)rr`ra)r#rrr?sz"ContentTransferEncodingHeader.initcCs|jS)N)r)rrrrrsz!ContentTransferEncodingHeader.cte)r$r,r-rVrWrZ&parse_content_transfer_encoding_headerrUrRr<r?r.rrbrr)r#rrs

r)ZsubjectZdatezresent-datez	orig-dateZsenderz
resent-sendertoz	resent-toZccz	resent-ccZbccz
resent-bccfromzresent-fromzreply-tozmime-versionzcontent-typezcontent-dispositionzcontent-transfer-encodingc@s4eZdZeedfddZddZddZdd	Zd
S)HeaderRegistryTcCs&i|_||_||_|r"|jtdS)N)registry
base_class
default_classupdate_default_header_map)rrrZuse_default_maprrrr,s
zHeaderRegistry.__init__cCs||j|<dS)N)rr|)rrAr@rrrmap_to_type>szHeaderRegistry.map_to_typecCs,|j||j}td|j||jfiS)N_)rgetr|rr)r$r)rrAr@rrr__getitem__DszHeaderRegistry.__getitem__cCs||||S)Nr)rrArBrrr__call__Hs
zHeaderRegistry.__call__N)	r$r,r-r9rTrrrrrrrrr(s
rN)typesrZemailrrrrrr/r4r9rHrTrYrZrcrdrorprqrrrzrrrrrrrrr<module>
sP`6d'7
%