
    j                     R    d dl mZ d dlmZ  G d d          Z G d d          ZdS )    )ClientError)get_service_module_namec                   $    e Zd ZeZd Zd Zd ZdS )BaseClientExceptionsc                     || _         dS )a  Base class for exceptions object on a client

        :type code_to_exception: dict
        :param code_to_exception: Mapping of error codes (strings) to exception
            class that should be raised when encountering a particular
            error code.
        N)_code_to_exception)selfcode_to_exceptions     V/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/botocore/errorfactory.py__init__zBaseClientExceptions.__init__   s     #4    c                 B    | j                             || j                  S )aN  Retrieves the error class based on the error code

        This is helpful for identifying the exception class needing to be
        caught based on the ClientError.parsed_reponse['Error']['Code'] value

        :type error_code: string
        :param error_code: The error code associated to a ClientError exception

        :rtype: ClientError or a subclass of ClientError
        :returns: The appropriate modeled exception class for that error
            code. If the error code does not match any of the known
            modeled exceptions then return a generic ClientError.
        )r   getr   )r	   
error_codes     r   	from_codezBaseClientExceptions.from_code   s      &**:t7GHHHr   c           	          d | j                                         D             }t          |  d| dd                    |                     )Nc                     g | ]	}|j         
S  )__name__).0exception_clss     r   
<listcomp>z4BaseClientExceptions.__getattr__.<locals>.<listcomp>/   s+     
 
 
 "
 
 
r   z object has no attribute z. Valid exceptions are: z, )r   valuesAttributeErrorjoin)r	   nameexception_cls_namess      r   __getattr__z BaseClientExceptions.__getattr__.   s}    
 
!%!8!?!?!A!A
 
 
  G Gt G G&*ii0C&D&DG G
 
 	
r   N)r   
__module____qualname__r   r   r   r   r   r   r   r   r      sI        K4 4 4I I I 
 
 
 
 
r   r   c                        e Zd Zd Zd Zd ZdS )ClientExceptionsFactoryc                     i | _         d S )N)_client_exceptions_cache)r	   s    r   r   z ClientExceptionsFactory.__init__:   s    (*%%%r   c                 z    |j         }|| j        vr|                     |          }|| j        |<   | j        |         S )a  Creates a ClientExceptions object for the particular service client

        :type service_model: botocore.model.ServiceModel
        :param service_model: The service model for the client

        :rtype: object that subclasses from BaseClientExceptions
        :returns: The exceptions object of a client that can be used
            to grab the various different modeled exceptions.
        )service_namer$   _create_client_exceptions)r	   service_modelr&   client_exceptionss       r   create_client_exceptionsz0ClientExceptionsFactory.create_client_exceptions=   sI     %1t<<< $ > >} M M:KD),7,\::r   c                 2   i }i }|j         D ]K}t          |j                  }t          |t          fi           }|||<   t          |j                  }|||<   Lt          t          |          dz             }t          |t          f|          }	 |	|          S )N
Exceptions)error_shapesstrr   typer   r   r   r   )
r	   r(   	cls_propsr
   error_shapeexception_namer   codecls_nameclient_exceptions_clss
             r   r'   z1ClientExceptionsFactory._create_client_exceptionsM   s    	(5 	4 	4K !122N +DDM(5In%{-..D&3d##.}==LMM $+-y!
 !
 %$%6777r   N)r   r   r    r   r*   r'   r   r   r   r"   r"   9   sA        + + +; ; ; 8 8 8 8 8r   r"   N)botocore.exceptionsr   botocore.utilsr   r   r"   r   r   r   <module>r8      s    , + + + + + 2 2 2 2 2 2%
 %
 %
 %
 %
 %
 %
 %
P!8 !8 !8 !8 !8 !8 !8 !8 !8 !8r   