U
    N8c                     @   sR   d Z ddlZddlmZ ddlmZ eeZG dd deZ	G dd deZ
dS )	zSpecial cased retries.

These are additional retry cases we still have to handle from the legacy
retry handler.  They don't make sense as part of the standard mode retry
module.  Ideally we should be able to remove this module.

    N)crc32)BaseRetryableCheckerc                   @   s   e Zd ZdZdd ZdS )RetryIDPCommunicationErrorstsc                 C   s(   |j jj}|| jkrdS | }|dkS )NFZIDPCommunicationError)operation_modelservice_modelservice_name_SERVICE_NAMEZget_error_code)selfcontextr   Z
error_code r   </tmp/pip-unpacked-wheel-ozje0y8b/botocore/retries/special.pyis_retryable   s
    

z'RetryIDPCommunicationError.is_retryableN)__name__
__module____qualname__r	   r   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdZdd ZdS )RetryDDBChecksumErrorzx-amz-crc32Zdynamodbc                 C   st   |j jj}|| jkrdS |jd kr&dS |jj| j}|d krBdS t|jj	d@ }|t
|krptd|| dS d S )NFl    z@DynamoDB crc32 checksum does not match, expected: %s, actual: %sT)r   r   r   r	   http_responseheadersget_CHECKSUM_HEADERr   contentintloggerdebug)r
   r   r   ZchecksumZactual_crc32r   r   r   r   #   s     


z"RetryDDBChecksumError.is_retryableN)r   r   r   r   r	   r   r   r   r   r   r      s   r   )__doc__loggingbinasciir   Zbotocore.retries.baser   	getLoggerr   r   r   r   r   r   r   r   <module>   s   
