o e\c@sddlmZmZmZddlmZddlmZ[[[dZdZe de [Gddde Z Gd d d e Z d!d d ZGd dde eZGddde ZGdddeZGddde ZGdddeZGddde ZGdddeZGddde ZGdddeZGdd d eZdS)")absolute_importprint_functionunicode_literals)gpgme)utilNGPG_ERR_c@sReZdZdZdddZeddZeddZed d Zed d Z d dZ 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||_||_||_dSN)errorcontextresults)selfr r r r,/usr/lib/python3/dist-packages/gpg/errors.py__init__=s zGpgError.__init__cC|jdurdSt|jSr )r rgpgme_err_coderrrrcodeB  z GpgError.codecCrr )r rgpgme_strerrorrrrrcode_strHrzGpgError.code_strcCrr )r rgpgme_err_sourcerrrrsourceNrzGpgError.sourcecCrr )r rgpgme_strsourcerrrr source_strTrzGpgError.source_strcCsFg}|jdur ||j|jdur||j||jd|S)Nz: )r appendr rrjoin)rmsgsrrr__str__Zs      zGpgError.__str__)NNN) __name__ __module__ __qualname____doc__rpropertyrrrrr rrrrr #s      r c@s@eZdZdZeddZeddZddZdd Z d d Z d S) GPGMEErrorzGeneric 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 |tSr )rgpgme_err_code_from_syserror)clsrrr fromSyserrorms zGPGMEError.fromSyserrorcC|jSr )r rrrrmessageqszGPGMEError.messagecCst|Sr )strrrrr getstringuszGPGMEError.getstringcCr*r )rrrrrgetcodexzGPGMEError.getcodecCr*r )rrrrr getsource{r/zGPGMEError.getsourceN) r!r"r#r$ classmethodr)r%r+r-r.r0rrrrr&ds   r&cCs|rt||dSr )r&)retval extradatarrr errorchecks r4c@s eZdZdZddZddZdS) KeyNotFoundzRaised 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||_t|tdSr )keystrr&rEOF)rr6rrrrszKeyNotFound.__init__cCr*r )r6rrrrr r/zKeyNotFound.__str__N)r!r"r#r$rr rrrrr5s r5c@ eZdZdS)EncryptionErrorNr!r"r#rrrrr9r9c@eZdZddZddZdS)InvalidRecipientscKtj|fi|||_dSr )r9r recipients)rr?kwargsrrrr zInvalidRecipients.__init__cCddd|jDS)N, cs&|]}d|jt|jVqdSz{}: {}Nformatfprrrreason).0rrrr z,InvalidRecipients.__str__..)rr?rrrrr  zInvalidRecipients.__str__Nr!r"r#rr rrrrr= r=c@r8)DecryptionErrorNr:rrrrrQr;rQc@r<)UnsupportedAlgorithmcKr>r )rQr algorithm)rrSr@rrrrrAzUnsupportedAlgorithm.__init__cCr*r )rSrrrrr r/zUnsupportedAlgorithm.__str__NrOrrrrrRrPrRc@r8) SigningErrorNr:rrrrrTr;rTc@r<)InvalidSignerscKr>r )rTrsigners)rrVr@rrrrrAzInvalidSigners.__init__cCrB)NrCcsrDrErFrJsrrrrLrMz)InvalidSigners.__str__..)rrVrrrrr rNzInvalidSigners.__str__NrOrrrrrUrPrUc@eZdZddZdS)VerificationErrorcKr>r )r rresult)rr[r@rrrrrAzVerificationError.__init__N)r!r"r#rrrrrrZ rZc@rY) BadSignaturescCsddd|jjDS)NrCcss0|]}|jtkrd|jt|jVqdSrE)statusNO_ERRORrGrHrrrWrrrrLs z(BadSignatures.__str__..)rr[ signaturesrrrrr s zBadSignatures.__str__N)r!r"r#r rrrrr]r\r]c@r<)MissingSignaturescKstj||fi|||_dSr )rZrmissing)rr[rbr@rrrrs zMissingSignatures.__init__cCrB)NrCcss|] }|jdjVqdS)rN)subkeysrH)rJkrrrrLsz,MissingSignatures.__str__..)rrbrrrrr szMissingSignatures.__str__NrOrrrrrarPrar ) __future__rrrrrr_r7process_constantsglobals Exceptionr r&r4KeyErrorr5r9r=rQrRrTrUrZr]rarrrrs*  A