; Ec@sdZdkZdkZdkZdkZdkZdkTdZdfdYZdefdYZ de fd YZ d e fd YZ d e fd YZ de fdYZ eedZdS(sTMDA Address objects.N(s*cCssg}d}d}|oI|id}|| i}||di}|iti }n|||fSdS(Nss@i( s local_partsslocalsdomainsaddresssrindexsatslowerssplitsDefaultssRECIPIENT_DELIMITER(saddresssdomains local_partssatslocal((s./TMDA/Address.pys_split%ssAddresscBsPtZddZdZedZddZdZdZdZ RS( NscCs ||_dS(N(saddresssself(sselfsaddress((s./TMDA/Address.pys__init__4scCstidtiSdS(Ns@(sDefaultssUSERNAMEsHOSTNAME(sself((s./TMDA/Address.pysbase7scCs|p |i|_|SdS(N(sbasesselfsaddress(sselfsbasesdummy((s./TMDA/Address.pyscreate:scCs tddS(Ns(No cryptographic information in address.(sBadCryptoError(sselfsdummy((s./TMDA/Address.pysverify>scCs&t|i\}}}||fSdS(N(s_splitsselfsaddresssdummyslocalsdomain(sselfsdummyslocalsdomain((s./TMDA/Address.pyssplitAscCsdSdS(Ns((sself((s./TMDA/Address.pystagEscCs |iSdS(N(sselfsaddress(sself((s./TMDA/Address.pys__str__Hs( s__name__s __module__s__init__sbasesNonescreatesverifyssplitstags__str__(((s./TMDA/Address.pysAddress3s      s TaggedAddresscBstZdZdZRS(NcCs,ti||t|\|_}}dS(N(sAddresss__init__sselfsaddresss_splits local_partssdummy(sselfsaddresssdummy((s./TMDA/Address.pys__init__MscCs|idSdS(Ni(sselfs local_parts(sself((s./TMDA/Address.pystagQs(s__name__s __module__s__init__stag(((s./TMDA/Address.pys TaggedAddressLs sConfirmAddresscBsPtZddZddZddZdZdZdZd ZRS( NscCsti||d|_dS(Nsaccept(s TaggedAddresss__init__sselfsaddressskeyword(sselfsaddress((s./TMDA/Address.pys__init__Vssacceptc Cstio ti}n| o|i}n||_tt|\}} }t i t |||}| tidi|g|_tii|i}|d||_|SdS(Nis@(sDefaultssCONFIRM_ADDRESSsbasesselfskeywords_splitsstrsdummyslocalsdomainsCookiesmake_confirm_cookiesints timestampspidscookies TAGS_CONFIRMslowers local_partssRECIPIENT_DELIMITERsjoins tagged_localsaddress( sselfsbases timestampspidskeywordsdummysdomains tagged_localscookieslocal((s./TMDA/Address.pyscreateZs   cCsxyU|idid\}}}ti|||i}||jo t dnWnt j ot dnXdS(Nis.sInvalid cryptographic tag.s!Invalid cryptographic tag format.( sselfs local_partsssplits timestampspidshmacsCookiesconfirmationmacskeywordstry_hmacsBadCryptoErrors ValueError(sselfsdummys timestampspidstry_hmacshmac((s./TMDA/Address.pysverifygs cCs |iSdS(N(sselfskeyword(sself((s./TMDA/Address.pyskeywordpscCs|ididdSdS(Nis.i(sselfs local_partsssplit(sself((s./TMDA/Address.pys timestampsscCs|ididdSdS(Nis.i(sselfs local_partsssplit(sself((s./TMDA/Address.pyspidvscCs|ididdSdS(Nis.i(sselfs local_partsssplit(sself((s./TMDA/Address.pyshmacys( s__name__s __module__s__init__screatesverifyskeywords timestampspidshmac(((s./TMDA/Address.pysConfirmAddressUs    s DatedAddresscBs>tZddZedZddZdZdZRS(NscCsti||dS(N(s TaggedAddresss__init__sselfsaddress(sselfsaddress((s./TMDA/Address.pys__init__~scCs| o|i}ntt|\}}}tit t i |}|t idi|g|_t ii|i}|d||_|SdS(Nis@(sbasesselfs_splitsstrsdummyslocalsdomainsCookiesmake_dated_cookiesintstimestimeoutscookiesDefaultss TAGS_DATEDslowers local_partssRECIPIENT_DELIMITERsjoins tagged_localsaddress(sselfsbasestimeoutsdummysdomains tagged_localscookieslocal((s./TMDA/Address.pyscreatescCsyu|idid\}}ti|}tt i t|jo t dn||jo t dnWnt j ot dnXdS(Nis.sDated address has expired.sInvalid cryptographic tag.s!Invalid cryptographic tag format.( sselfs local_partsssplits timestampshmacsCookiesdatemacstry_hmacsintstimesExpiredAddressErrorsBadCryptoErrors ValueError(sselfsdummys timestampstry_hmacshmac((s./TMDA/Address.pysverifys  cCs|ididdSdS(Nis.i(sselfs local_partsssplit(sself((s./TMDA/Address.pys timestampscCs|ididdSdS(Nis.i(sselfs local_partsssplit(sself((s./TMDA/Address.pyshmacs(s__name__s __module__s__init__sNonescreatesverifys timestampshmac(((s./TMDA/Address.pys DatedAddress}s   sKeywordAddresscBs;tZddZdZddZdZdZRS(NscCsti||dS(N(s TaggedAddresss__init__sselfsaddress(sselfsaddress((s./TMDA/Address.pys__init__scCs| o|i}ntt|\}}}ti|}|t i di |g|_t ii|i}|d||_|SdS(Nis@(sbasesselfs_splitsstrsdummyslocalsdomainsCookiesmake_keyword_cookieskeywordscookiesDefaultss TAGS_KEYWORDslowers local_partssRECIPIENT_DELIMITERsjoins tagged_localsaddress(sselfsbaseskeywordsdummysdomains tagged_localscookieslocal((s./TMDA/Address.pyscreatescCsu|idid}di|d }| o tdn|d}ti |}||jo tdndS(Nis.s!Invalid cryptographic tag format.sInvalid cryptographic tag.( sselfs local_partsssplitspartssjoinskeywordsBadCryptoErrorshmacsCookiesmake_keywordmacstry_hmac(sselfsdummyskeywordspartsstry_hmacshmac((s./TMDA/Address.pysverifys   cCs%di|ididd SdS(Ns.i(sjoinsselfs local_partsssplit(sself((s./TMDA/Address.pyskeywordscCs|ididdSdS(Nis.(sselfs local_partsssplit(sself((s./TMDA/Address.pyshmacs(s__name__s __module__s__init__screatesverifyskeywordshmac(((s./TMDA/Address.pysKeywordAddresss   s SenderAddresscBs/tZddZdZdZdZRS(NscCsti||dS(N(s TaggedAddresss__init__sselfsaddress(sselfsaddress((s./TMDA/Address.pys__init__scCs| o|i}ntt|\}}}tit|}|t i di |g|_t ii|i}|d||_|SdS(Nis@(sbasesselfs_splitsstrsdummyslocalsdomainsCookiesmake_sender_cookiessenderscookiesDefaultss TAGS_SENDERslowers local_partssRECIPIENT_DELIMITERsjoins tagged_localsaddress(sselfsbasessendersdummysdomains tagged_localscookieslocal((s./TMDA/Address.pyscreatescCst|i}|id}ti|}||jo|i dd}d}|i |}x8||jo|o#ti|i |}|d=qfW||jo tdqndS(Nis@s.isInvalid cryptographic tag.(sstrssenderslowersselfs local_partsshmacsCookiesmake_sender_cookiestry_hmacssplitsdomainsdots domain_partssjoinsBadCryptoError(sselfssendersdomainstry_hmacshmacsdots domain_parts((s./TMDA/Address.pysverifys    cCs|idSdS(Ni(sselfs local_parts(sself((s./TMDA/Address.pyshmacs(s__name__s __module__s__init__screatesverifyshmac(((s./TMDA/Address.pys SenderAddresss   cCsh|onA|o/tii|d}t|\}}}n t|Sy|p|d}|dgt dt i jot |}n|dgt dt ijot|}ns|dgt dt ijot|}n@|dgt dt ijot|}n t|}Wn%ttfj ot|}nX|SdS( s2Create an address object of the appropriate class.iisconfirmcCs |iS(N(ssslower(ss((s./TMDA/Address.pysssdatedssenderskeywordN(stagsaddresssemailsutilss parseaddrs_splits local_partssdummysAddresss cookie_typesmapsDefaultss TAGS_CONFIRMsConfirmAddresssaddr_objs TAGS_DATEDs DatedAddresss TAGS_SENDERs SenderAddresss TAGS_KEYWORDsKeywordAddresss AddressErrors IndexError(saddressstagsdummys cookie_types local_partssaddr_obj((s./TMDA/Address.pysFactorys* ####(s__doc__srestimesemailsCookiesDefaultssErrorss_splitsAddresss TaggedAddresssConfirmAddresss DatedAddresssKeywordAddresss SenderAddresssNonesFactory( s TaggedAddresssAddresss DatedAddresssFactorys SenderAddresssresCookiesKeywordAddresssDefaultsstimesemailsConfirmAddresss_split((s./TMDA/Address.pys?s       ( !&