U
    nª/ec  ã                `   @   s¾  d Z ddlZddlZeedejƒZeedejƒZeedejƒZeedejƒZ	eedej
ƒZeeee eej¡e eej¡e eej¡eee ee¡e eej¡ee eej¡e ee¡eee eej¡e eej¡e eej¡e ee¡e ee	¡ee eej¡e eej¡e eej¡e eej¡e eej¡e eej¡e eej¡ee eej¡e eej¡ee eej¡e eej¡e eej¡ee eej¡e eej¡e eej¡e eej¡e eej¡e ee¡e eej¡e eej¡e eej¡e ee¡e ee¡e ee¡e eej¡e eej¡e eej¡e eej¡e eej¡e eej¡e eej¡eeeeeee eej¡ee eej¡e ee¡e eej¡e ee¡e eej¡e eej¡eee eej¡ee eej¡e eej¡e ee¡e eej¡e eej¡e eej¡e eej¡e eej¡e ee¡e ee¡e eej¡eee eej¡e eej¡e eej¡e eej¡e ee	¡e eej¡e eej¡dœ]Zdd
d„ZdS )z‰S3 error codes adapted into more natural Python ones.

Adapted from: https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
é    NÚENAMETOOLONGÚ	ENOTEMPTYÚEMSGSIZEÚ	EREMOTEIOÚEREMCHG)]ZAccessDeniedZAccountProblemZAllAccessDisabledZAmbiguousGrantByEmailAddressZAuthorizationHeaderMalformedZ	BadDigestZBucketAlreadyExistsZBucketAlreadyOwnedByYouZBucketNotEmptyZCredentialsNotSupportedZCrossLocationLoggingProhibitedZEntityTooSmallZEntityTooLargeZExpiredTokenZ"IllegalLocationConstraintExceptionZ'IllegalVersioningConfigurationExceptionZIncompleteBodyZ#IncorrectNumberOfFilesInPostRequestZInlineDataTooLargeZInternalErrorZInvalidAccessKeyIdZInvalidAddressingHeaderZInvalidArgumentZInvalidBucketNameZInvalidBucketStateZInvalidDigestZInvalidEncryptionAlgorithmErrorZInvalidLocationConstraintZInvalidObjectStateZInvalidPartZInvalidPartOrderZInvalidPayerZInvalidPolicyDocumentZInvalidRangeZInvalidRequestZInvalidSecurityZInvalidSOAPRequestZInvalidStorageClassZInvalidTargetBucketForLoggingZInvalidTokenZ
InvalidURIZKeyTooLongErrorZMalformedACLErrorZMalformedPOSTRequestZMalformedXMLZMaxMessageLengthExceededZ!MaxPostPreDataLengthExceededErrorZMetadataTooLargeZMethodNotAllowedZMissingAttachmentZMissingContentLengthZMissingRequestBodyErrorZMissingSecurityElementZMissingSecurityHeaderZNoLoggingStatusForKeyZNoSuchBucketZNoSuchBucketPolicyZ	NoSuchKeyZNoSuchLifecycleConfigurationZNoSuchUploadZNoSuchVersionÚNotImplementedZNotSignedUpZOperationAbortedZPermanentRedirectZPreconditionFailedZRedirectZRestoreAlreadyInProgressZRequestIsNotMultiPartContentZRequestTimeoutZRequestTimeTooSkewedZRequestTorrentOfBucketErrorZSignatureDoesNotMatchZServiceUnavailableZSlowDownZTemporaryRedirectZTokenRefreshRequiredZTooManyBucketsZUnexpectedContentZUnresolvableGrantByEmailAddressZUserKeyMustBeSpecifiedZ301Z307Z400Z403Z404Z405Z409Z412Z416Ú500Z501Z503Tc           	      O   s†   t | ddƒ}|dkr| S |d  d¡}t |¡}|r^|sL|d  dt| ƒ¡}||f|ž|Ž}nttj|pnt| ƒf|žŽ }|r‚| |_|S )a7  Convert a ClientError exception into a Python one.

    Parameters
    ----------

    error : botocore.exceptions.ClientError
        The exception returned by the boto API.
    message : str
        An error message to use for the returned exception. If not given, the
        error message returned by the server is used instead.
    set_cause : bool
        Whether to set the __cause__ attribute to the previous exception if the
        exception is translated.
    *args, **kwargs :
        Additional arguments to pass to the exception constructor, after the
        error message. Useful for passing the filename arguments to ``IOError``.

    Returns
    -------

    An instantiated exception ready to be thrown. If the error code isn't
    recognized, an IOError with the original error message is returned.
    ÚresponseNÚErrorZCodeÚMessage)ÚgetattrÚgetÚERROR_CODE_TO_EXCEPTIONÚstrÚIOErrorÚerrnoÚEIOÚ	__cause__)	ÚerrorÚmessageZ	set_causeÚargsÚkwargsZerror_responseÚcodeÚconstructorZ
custom_exc© r   ú//tmp/pip-unpacked-wheel-zv_a3qq1/s3fs/errors.pyÚtranslate_boto_errors   s    
r   )NT)Ú__doc__r   Ú	functoolsr   ÚEINVALr   r   r   r   r   ÚENOENTr   ÚPermissionErrorÚpartialr   ÚFileExistsErrorÚEPERMÚFileNotFoundErrorZENOSYSZEBUSYÚTimeoutErrorr   r   r   r   r   r   Ú<module>   sÌ   













£a