3 eö\cã@sddlmZmZmZddlmZddlmZ[[[dZdZej de ƒƒ[Gdd„de ƒZ Gd d „d e ƒZ d!d d „ZGd d„de eƒZGdd„de ƒZGdd„deƒZGdd„de ƒZGdd„deƒZGdd„de ƒZGdd„deƒZGdd„de ƒZGdd„deƒZGdd „d eƒZdS)"é)Úabsolute_importÚprint_functionÚunicode_literalsé)Úgpgme)ÚutilNZGPG_ERR_c@sReZdZdZddd„Zedd„ƒZedd„ƒZed d „ƒZed d „ƒZ d d„Z dS)ÚGpgErrora>A GPG Error This is the base of all errors thrown by this library. If the error originated from GPGME, then additional information can be found by looking at 'code' for the error code, and 'source' for the errors origin. Suitable constants for comparison are defined in this module. 'code_str' and 'source_str' are human-readable versions of the former two properties. If 'context' is not None, then it contains a human-readable hint as to where the error originated from. If 'results' is not None, it is a tuple containing results of the operation that failed. The tuples elements are the results of the function that raised the error. Some operations return results even though they signal an error. Of course this information must be taken with a grain of salt. But often, this information is useful for diagnostic uses or to give the user feedback. Since the normal control flow is disrupted by the exception, the callee can no longer return results, hence we attach them to the exception objects. NcCs||_||_||_dS)N)ÚerrorÚcontextÚresults)Úselfr r r ©r ú/usr/lib64/python3.6/errors.pyÚ__init__=szGpgError.__init__cCs|jdkrdStj|jƒS)N)r rZgpgme_err_code)r r r rÚcodeBs z GpgError.codecCs|jdkrdStj|jƒS)N)r rÚgpgme_strerror)r r r rÚcode_strHs zGpgError.code_strcCs|jdkrdStj|jƒS)N)r rZgpgme_err_source)r r r rÚsourceNs zGpgError.sourcecCs|jdkrdStj|jƒS)N)r rZgpgme_strsource)r r r rÚ source_strTs zGpgError.source_strcCsFg}|jdk r|j|jƒ|jdk r<|j|jƒ|j|jƒdj|ƒS)Nz: )r Úappendr rrÚjoin)r Zmsgsr r rÚ__str__Zs     zGpgError.__str__)NNN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚpropertyrrrrrr r r rr#s     rc@s@eZdZdZedd„ƒZedd„ƒZdd„Zdd „Z d d „Z d S) Ú GPGMEErrorzßGeneric error This is a generic error that wraps the underlying libraries native error type. It is thrown when the low-level API is invoked and returns an error. This is the error that was used in PyME. cCs |tjƒƒS)N)rZgpgme_err_code_from_syserror)Úclsr r rÚ fromSyserrormszGPGMEError.fromSyserrorcCs|jS)N)r )r r r rÚmessageqszGPGMEError.messagecCst|ƒS)N)Ústr)r r r rÚ getstringuszGPGMEError.getstringcCs|jS)N)r)r r r rÚgetcodexszGPGMEError.getcodecCs|jS)N)r)r r r rÚ getsource{szGPGMEError.getsourceN) rrrrÚ classmethodrrr r"r#r$r r r rrds   rcCs|rt||ƒ‚dS)N)r)ZretvalZ extradatar r rÚ errorchecksr&c@s eZdZdZdd„Zdd„ZdS)Ú KeyNotFoundzÅRaised if a key was not found GPGME indicates this condition with EOF, which is not very idiomatic. We raise this error that is both a GPGMEError indicating EOF, and a KeyError. cCs||_tj|tƒdS)N)ÚkeystrrrÚEOF)r r(r r rrszKeyNotFound.__init__cCs|jS)N)r()r r r rr‘szKeyNotFound.__str__N)rrrrrrr r r rr'„sr'c@s eZdZdS)ÚEncryptionErrorN)rrrr r r rr*˜sr*c@seZdZdd„Zdd„ZdS)ÚInvalidRecipientscKstj|f|Ž||_dS)N)r*rÚ recipients)r r,Úkwargsr r rrszInvalidRecipients.__init__cCsdjdd„|jDƒƒS)Nz, css$|]}dj|jtj|jƒƒVqdS)z{}: {}N)ÚformatÚfprrrÚreason)Ú.0Úrr r rú ¢sz,InvalidRecipients.__str__..)rr,)r r r rr¡s zInvalidRecipients.__str__N)rrrrrr r r rr+œsr+c@s eZdZdS)ÚDecryptionErrorN)rrrr r r rr4¦sr4c@seZdZdd„Zdd„ZdS)ÚUnsupportedAlgorithmcKstj|f|Ž||_dS)N)r4rÚ algorithm)r r6r-r r rr«szUnsupportedAlgorithm.__init__cCs|jS)N)r6)r r r rr¯szUnsupportedAlgorithm.__str__N)rrrrrr r r rr5ªsr5c@s eZdZdS)Ú SigningErrorN)rrrr r r rr7³sr7c@seZdZdd„Zdd„ZdS)ÚInvalidSignerscKstj|f|Ž||_dS)N)r7rÚsigners)r r9r-r r rr¸szInvalidSigners.__init__cCsdjdd„|jDƒƒS)Nz, css$|]}dj|jtj|jƒƒVqdS)z{}: {}N)r.r/rrr0)r1Úsr r rr3½sz)InvalidSigners.__str__..)rr9)r r r rr¼s zInvalidSigners.__str__N)rrrrrr r r rr8·sr8c@seZdZdd„ZdS)ÚVerificationErrorcKstj|f|Ž||_dS)N)rrÚresult)r r<r-r r rrÂszVerificationError.__init__N)rrrrr r r rr;Ásr;c@seZdZdd„ZdS)Ú BadSignaturescCsdjdd„|jjDƒƒS)Nz, css.|]&}|jtkrdj|jtj|jƒƒVqdS)z{}: {}N)ZstatusÚNO_ERRORr.r/rr)r1r:r r rr3Ész(BadSignatures.__str__..)rr<Z signatures)r r r rrÈs zBadSignatures.__str__N)rrrrr r r rr=Çsr=c@seZdZdd„Zdd„ZdS)ÚMissingSignaturescKstj||f|Ž||_dS)N)r;rÚmissing)r r<r@r-r r rrÏszMissingSignatures.__init__cCsdjdd„|jDƒƒS)Nz, css|]}|jdjVqdS)rN)Zsubkeysr/)r1Úkr r rr3Ôsz,MissingSignatures.__str__..)rr@)r r r rrÓszMissingSignatures.__str__N)rrrrrr r r rr?Îsr?)N)Z __future__rrrÚrrr>r)Zprocess_constantsÚglobalsÚ Exceptionrrr&ÚKeyErrorr'r*r+r4r5r7r8r;r=r?r r r rÚs(  A