
    /Jfw                     p   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZmZmZ  e            Z G d de          Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d d          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"          Z  G d# d$          Z! G d% d&          Z" G d' d(          Z# G d) d*          Z$ G d+ d,          Z%d-S ).z-Abstractions to interact with service models.    )defaultdict)
NamedTupleUnion)OrderedDict)MissingServiceIdErrorUndefinedModelAttributeError)CachedPropertyhyphenize_service_idinstance_cachec                       e Zd ZdS )NoShapeFoundErrorN__name__
__module____qualname__     Q/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/botocore/model.pyr   r              Dr   r   c                       e Zd ZdS )InvalidShapeErrorNr   r   r   r   r   r      r   r   r   c                       e Zd ZdS )OperationNotFoundErrorNr   r   r   r   r   r   #   r   r   r   c                       e Zd ZdS )InvalidShapeReferenceErrorNr   r   r   r   r   r   '   r   r   r   c                       e Zd Zd ZdS )	ServiceIdc                      t          |           S N)r
   selfs    r   	hyphenizezServiceId.hyphenize,   s    #D)))r   N)r   r   r   r"   r   r   r   r   r   +   s#        * * * * *r   r   c                       e Zd ZdZg dZg dZeZddZe	d             Z
e	d             Ze	d             Zd	 Zd
 Zed             ZdS )Shapez3Object representing a shape from the service model.)locationName	queryName	flattenedlocationpayload	streamingtimestampFormatxmlNamespaceresultWrapperxmlAttributeeventstreameventeventheadereventpayload	jsonvaluer+   	hostLabel)requiredminmaxpattern	sensitiveenumidempotencyTokenerror	exceptionendpointdiscoveryid	retryabledocumentunioncontextParamclientContextParamsrequiresLengthNc                     || _         |d         | _        |                    dd          | _        || _        |t                      }|| _        i | _        dS )a  

        :type shape_name: string
        :param shape_name: The name of the shape.

        :type shape_model: dict
        :param shape_model: The shape model.  This would be the value
            associated with the key in the "shapes" dict of the
            service model (i.e ``model['shapes'][shape_name]``)

        :type shape_resolver: botocore.model.ShapeResolver
        :param shape_resolver: A shape resolver object.  This is used to
            resolve references to other shapes.  For scalar shape types
            (string, integer, boolean, etc.), this argument is not
            required.  If a shape_resolver is not provided for a complex
            type, then a ``ValueError`` will be raised when an attempt
            to resolve a shape is made.

        typedocumentation N)name	type_namegetrG   _shape_modelUnresolvableShapeMap_shape_resolver_cache)r!   
shape_nameshape_modelshape_resolvers       r   __init__zShape.__init__^   s[    ( 	$V,(___bAA'! 233N-r   c                     | j         }i }| j        D ]}|| j         v r||         ||<   d|v r|                    d          |d<   |S )a  Serialization information about the shape.

        This contains information that may be needed for input serialization
        or response parsing.  This can include:

            * name
            * queryName
            * flattened
            * location
            * payload
            * streaming
            * xmlNamespace
            * resultWrapper
            * xmlAttribute
            * jsonvalue
            * timestampFormat

        :rtype: dict
        :return: Serialization information about the shape.

        r%   rI   )rL   SERIALIZED_ATTRSpop)r!   modelserializationattrs       r   rX   zShape.serialization   si    . !) 	2 	2Dt(((&+Dkd#]**$1$5$5n$E$EM&!r   c                 T    | j         }i }| j        D ]}|| j         v r||         ||<   |S )a  Metadata about the shape.

        This requires optional information about the shape, including:

            * min
            * max
            * pattern
            * enum
            * sensitive
            * required
            * idempotencyToken
            * document
            * union
            * contextParam
            * clientContextParams
            * requiresLength

        :rtype: dict
        :return: Metadata about the shape.

        )rL   METADATA_ATTRS)r!   rW   metadatarY   s       r   r\   zShape.metadata   sD    . !' 	- 	-Dt(((!&tr   c                 8    | j                             dg           S )zA list of members that are required.

        A structure shape can define members that are required.
        This value will return a list of required members.  If there
        are no required members an empty list is returned.

        r5   r\   rK   r    s    r   required_memberszShape.required_members   s     }  R000r   c                 6    | j                             |          S r   rN   resolve_shape_refr!   	shape_refs     r   _resolve_shape_refzShape._resolve_shape_ref       #55i@@@r   c                 2    d| j         j         d| j         dS )N<(z)>	__class__r   rI   r    s    r   __repr__zShape.__repr__   s"    :4>*::TY::::r   c                     d S r   r   r    s    r   event_stream_namezShape.event_stream_name   s    tr   r   )r   r   r   __doc__rU   r[   r   MAP_TYPErS   r	   rX   r\   r_   re   rl   propertyrn   r   r   r   r$   r$   0   s        ==  &  N$ H       D   ^@   ^: 1 1 ^1A A A; ; ;   X  r   r$   c                   |    e Zd Zed             Zed             Zed             Zed             Zed             ZdS )StructureShapec                     | j                             d|                                           }|                                 }|                                D ]\  }}|                     |          ||<   |S )Nmembers)rL   rK   rp   itemsre   )r!   ru   shape_membersrI   rd   s        r   ru   zStructureShape.members   so    #''	4==??CC &}} 	E 	EOD)"&"9"9)"D"DM$r   c                     | j                                         D ]#\  }}|j                            d          r|c S $d S )Nr/   )ru   rv   rX   rK   )r!   member_namemembers      r   rn   z StructureShape.event_stream_name   sS    #'<#5#5#7#7 	# 	#K#''66 #""""#tr   c                     | j                             dd          sd S | j                             di           }|                    d          }|r|S | j        S )Nr=   Fr<   code)r\   rK   rI   )r!   error_metadatar|   s      r   
error_codezStructureShape.error_code   s`    }  e44 	4**7B77!!&)) 	Kyr   c                 8    | j                             dd          S )Nr@   Fr^   r    s    r   is_document_typezStructureShape.is_document_type   s    }  U333r   c                 8    | j                             dd          S )NrA   Fr^   r    s    r   is_tagged_unionzStructureShape.is_tagged_union   s    }  %000r   N)	r   r   r   r	   ru   rn   r~   r   r   r   r   r   rs   rs      s          ^   ^   ^ 4 4 ^4 1 1 ^1 1 1r   rs   c                   $    e Zd Zed             ZdS )	ListShapec                 B    |                      | j        d                   S )Nrz   re   rL   r    s    r   rz   zListShape.member   s    &&t'8'BCCCr   N)r   r   r   r	   rz   r   r   r   r   r      s2        D D ^D D Dr   r   c                   :    e Zd Zed             Zed             ZdS )MapShapec                 B    |                      | j        d                   S )Nkeyr   r    s    r   r   zMapShape.key  s    &&t'8'?@@@r   c                 B    |                      | j        d                   S )Nvaluer   r    s    r   r   zMapShape.value
  s    &&t'8'ABBBr   N)r   r   r   r	   r   r   r   r   r   r   r     sP        A A ^A C C ^C C Cr   r   c                   $    e Zd Zed             ZdS )StringShapec                 8    | j                             dg           S )Nr:   r^   r    s    r   r:   zStringShape.enum  s    }  ,,,r   N)r   r   r   r	   r:   r   r   r   r   r     s-        - - ^- - -r   r   c                   4    e Zd ZU eed<   eeef         ed<   dS )StaticContextParameterrI   r   N)r   r   r   str__annotations__r   boolr   r   r   r   r     s0         
IIIsr   r   c                   $    e Zd ZU eed<   eed<   dS )ContextParameterrI   ry   Nr   r   r   r   r   r   r   r   r   r     s'         
IIIr   r   c                   .    e Zd ZU eed<   eed<   eed<   dS )ClientContextParameterrI   rF   rG   Nr   r   r   r   r   r     s0         
III
IIIr   r   c                      e Zd ZdZddZddZd Zed             Zd Z	ed             Z
ed	             Zed
             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zd Zed             Zej        d             Zd ZdS )ServiceModelzQ

    :ivar service_description: The parsed service description dictionary.

    Nc                     || _         |                    di           | _        t          |                    di                     | _        t
          | _        || _        i | _        dS )a  

        :type service_description: dict
        :param service_description: The service description model.  This value
            is obtained from a botocore.loader.Loader, or from directly loading
            the file yourself::

                service_description = json.load(
                    open('/path/to/service-description-model.json'))
                model = ServiceModel(service_description)

        :type service_name: str
        :param service_name: The name of the service.  Normally this is
            the endpoint prefix defined in the service_description.  However,
            you can override this value to provide a more convenient name.
            This is done in a few places in botocore (ses instead of email,
            emr instead of elasticmapreduce).  If this value is not provided,
            it will default to the endpointPrefix defined in the model.

        r\   shapesN)	_service_descriptionrK   r\   ShapeResolverrN   NOT_SET_signature_version_service_name_instance_cache)r!   service_descriptionservice_names      r   rS   zServiceModel.__init__,  sh    * %8!+//
B??,##Hb11 
  
 #*)!r   c                 8    | j                             ||          S r   )rN   get_shape_by_namer!   rP   member_traitss      r   	shape_forzServiceModel.shape_forK  s"    #55
 
 	
r   c                 8    | j                             |d           S r   )_error_code_cacherK   )r!   r~   s     r   shape_for_error_codez!ServiceModel.shape_for_error_codeP  s    %))*d;;;r   c                 6    i }| j         D ]}|j        }|||<   |S r   )error_shapesr~   )r!   error_code_cacheerror_shaper|   s       r   r   zServiceModel._error_code_cacheS  s6    , 	1 	1K)D%0T""r   c                 6    | j                             |          S r   ra   rc   s     r   rb   zServiceModel.resolve_shape_ref[  rf   r   c                 R    t          | j                            di                     S )Nr   listr   rK   r    s    r   shape_nameszServiceModel.shape_names^  s#    D-11(B??@@@r   c                     g }| j         D ]G}|                     |          }|j                            dd          r|                    |           H|S )Nr=   F)r   r   r\   rK   append)r!   r   rP   r   s       r   r   zServiceModel.error_shapesb  s`    * 	1 	1J..44K#''U;; 1##K000r   c                     	 | j         d         |         }n# t          $ r t          |          w xY wt          || |          S N
operations)r   KeyErrorr   OperationModel)r!   operation_namerW   s      r   operation_modelzServiceModel.operation_modelk  sV    	9-l;NKEE 	9 	9 	9(888	9eT>:::s    0c                 8    | j                             dd          S NrG   rH   )r   rK   r    s    r   rG   zServiceModel.documentations  s    (,,_bAAAr   c                 R    t          | j                            dg                     S r   r   r    s    r   operation_nameszServiceModel.operation_namesw  s#    D-11,CCDDDr   c                 ,    | j         | j         S | j        S )a  The name of the service.

        This defaults to the endpointPrefix defined in the service model.
        However, this value can be overriden when a ``ServiceModel`` is
        created.  If a service_name was not provided when the ``ServiceModel``
        was created and if there is no endpointPrefix defined in the
        service model, then an ``UndefinedModelAttributeError`` exception
        will be raised.

        )r   endpoint_prefixr    s    r   r   zServiceModel.service_name{  s     )%%''r   c                     	 t          |                     d                    S # t          $ r t          | j                  w xY w)N	serviceId)r   )r   _get_metadata_propertyr   r   r   r    s    r   
service_idzServiceModel.service_id  sW    	IT88EEFFF+ 	I 	I 	I'T5GHHHH	Is	   !$  Ac                 L    | j                             d          }|| j        }|S )zThe name to use when computing signatures.

        If the model does not define a signing name, this
        value will be the endpoint prefix defined in the model.
        signingName)r\   rK   r   )r!   signing_names     r   r   zServiceModel.signing_name  s-     }((77/Lr   c                 ,    |                      d          S )N
apiVersionr   r    s    r   api_versionzServiceModel.api_version  s    **<888r   c                 ,    |                      d          S )Nprotocolr   r    s    r   r   zServiceModel.protocol  s    **:666r   c                 ,    |                      d          S )NendpointPrefixr   r    s    r   r   zServiceModel.endpoint_prefix  s    **+;<<<r   c                 Z    | j         D ]"}|                     |          }|j        r|c S #d S r   )r   r   is_endpoint_discovery_operationr!   	operationrW   s      r   endpoint_discovery_operationz)ServiceModel.endpoint_discovery_operation  sJ    - 	 	I((33E4 	 	r   c                     | j         D ];}|                     |          }|j        |j                            d          r dS <dS )Nr5   TF)r   r   endpoint_discoveryrK   r   s      r   endpoint_discovery_requiredz(ServiceModel.endpoint_discovery_required  sX    - 	 	I((33E(4,00<< 5 ttur   c                 t    | j                             di           }d |                                D             S )NrC   c                 P    g | ]#\  }}t          ||d          |d                   $S )rF   rG   )rI   rF   rG   )r   ).0
param_name	param_vals      r   
<listcomp>z:ServiceModel.client_context_parameters.<locals>.<listcomp>  sP     
 
 
 &
I #v&'8  
 
 
r   )r   rK   rv   r!   paramss     r   client_context_parametersz&ServiceModel.client_context_parameters  sF    *../DbII
 
 *0
 
 
 	
r   c                 d    	 | j         |         S # t          $ r t          d| d|            w xY w)N"z," not defined in the metadata of the model: )r\   r   r   r!   rI   s     r   r   z#ServiceModel._get_metadata_property  sT    	=&& 	 	 	.LDLLdLL  	s     /c                 n    | j         t          u r!| j                            d          }|| _         | j         S )NsignatureVersion)r   r   r\   rK   )r!   signature_versions     r   r   zServiceModel.signature_version  s8    "g-- $ 1 12D E E&7D#&&r   c                     || _         d S r   )r   )r!   r   s     r   r   zServiceModel.signature_version  s    "'r   c                 0    | j         j         d| j         dS )Nri   ))rk   r   r   r    s    r   rl   zServiceModel.__repr__  s!    .)@@D,=@@@@r   r   )r   r   r   ro   rS   r   r   r	   r   rb   r   r   r   r   rG   r   r   r   r   r   r   r   r   r   r   r   rq   r   setterrl   r   r   r   r   r   %  se        " " " ">
 
 
 

< < <     ^ A A A A A ^A   ^ ; ; ^; B B ^B E E ^E ( ( ^(  I I ^I 	 	 ^	 9 9 ^9 7 7 ^7 = = ^=   ^   ^ 	
 	
 ^	
   ' ' X' ( ( (A A A A Ar   r   c                   $   e Zd Zd dZed             Zed             Zed             Zed             Z	ed             Z
ed             Zed	             Zed
             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zd Zd Zd Zed             Zed             Zd Zd Z d Z!d Z"dS )!r   Nc                     || _         || _        || _        |                    d          | _        |j        | _        |                    di           | _        dS )a  

        :type operation_model: dict
        :param operation_model: The operation model.  This comes from the
            service model, and is the value associated with the operation
            name in the service model (i.e ``model['operations'][op_name]``).

        :type service_model: botocore.model.ServiceModel
        :param service_model: The service model associated with the operation.

        :type name: string
        :param name: The operation name.  This is the operation name exposed to
            the users of this model.  This can potentially be different from
            the "wire_name", which is the operation name that *must* by
            provided over the wire.  For example, given::

               "CreateCloudFrontOriginAccessIdentity":{
                 "name":"CreateCloudFrontOriginAccessIdentity2014_11_06",
                  ...
              }

           The ``name`` would be ``CreateCloudFrontOriginAccessIdentity``,
           but the ``self.wire_name`` would be
           ``CreateCloudFrontOriginAccessIdentity2014_11_06``, which is the
           value we must send in the corresponding HTTP request.

        rI   httpN)_operation_model_service_model	_api_namerK   
_wire_namer\   r   )r!   r   service_modelrI   s       r   rS   zOperationModel.__init__  sW    8 !0+ *--f55%.#''33			r   c                 ,    | j         | j         S | j        S r   )r   	wire_namer    s    r   rI   zOperationModel.name	  s    >%>!>!r   c                 6    | j                             d          S )aR  The wire name of the operation.

        In many situations this is the same value as the
        ``name``, value, but in some services, the operation name
        exposed to the user is different from the operation name
        we send across the wire (e.g cloudfront).

        Any serialization code should use ``wire_name``.

        rI   r   rK   r    s    r   r   zOperationModel.wire_name  s     $((000r   c                     | j         S r   )r   r    s    r   r   zOperationModel.service_model  s    ""r   c                 8    | j                             dd          S r   r   r    s    r   rG   zOperationModel.documentation"  s    $(("===r   c                 8    | j                             dd          S )N
deprecatedFr   r    s    r   r   zOperationModel.deprecated&  s    $((u===r   c                 8    | j                             dd           S )Nendpointdiscoveryr   r    s    r   r   z!OperationModel.endpoint_discovery*  s     $(()<dCCCr   c                 8    | j                             dd          S )NendpointoperationFr   r    s    r   r   z.OperationModel.is_endpoint_discovery_operation0  s    $(()<eDDDr   c                 b    d| j         vrd S | j                            | j         d                   S )Ninputr   r   rb   r    s    r   input_shapezOperationModel.input_shape4  s=    $/// 4"44!'*
 
 	
r   c                 b    d| j         vrd S | j                            | j         d                   S )Noutputr  r    s    r   output_shapezOperationModel.output_shape>  s=    4000 4"44!(+
 
 	
r   c                 ^    | j         }|sg S d |j                                        D             S )Nc                 D    g | ]\  }}d |j         v |j         d          |S )r;   )r\   r   rI   shapes      r   r   z5OperationModel.idempotent_members.<locals>.<listcomp>O  sC     
 
 
u!U^3312 4 333r   r  ru   rv   )r!   r  s     r   idempotent_membersz!OperationModel.idempotent_membersI  sG    & 	I
 
!,!4!:!:!<!<
 
 
 	
r   c                 t    | j                             di           }d |                                D             S )NstaticContextParamsc                 \    g | ])\  }}t          ||                    d                     *S )r   )rI   r   )r   rK   )r   rI   propss      r   r   z<OperationModel.static_context_parameters.<locals>.<listcomp>Y  sE     
 
 
e #EIIg4F4FGGG
 
 
r   )r   rK   rv   r   s     r   static_context_parametersz(OperationModel.static_context_parametersV  sD    &**+@"EE
 
%||~~
 
 
 	
r   c                 d    | j         sg S d | j         j                                        D             S )Nc                     g | ]?\  }}d |j         v r1d|j         d          v t          |j         d          d         |          @S )rB   rI   )rI   ry   )r\   r   r  s      r   r   z5OperationModel.context_parameters.<locals>.<listcomp>c  sj     
 
 

 e//%.888 ^N3F;    988r   r  r    s    r   context_parametersz!OperationModel.context_parameters^  sG     	I
 

  $/7==??
 
 
 	
r   c                 6    | j                             d          S )Nrequestcompressionr   r    s    r   request_compressionz"OperationModel.request_compressionm  s    $(()=>>>r   c                 6    | j                             d          S )Nauthtyper   r    s    r   	auth_typezOperationModel.auth_typeq      $((444r   c                 p      j                             dg           }t           fd|D                       S )Nerrorsc              3   L   K   | ]}j                             |          V  d S r   )r   rb   )r   sr!   s     r   	<genexpr>z.OperationModel.error_shapes.<locals>.<genexpr>x  s4      MMD'99!<<MMMMMMr   )r   rK   r   )r!   r   s   ` r   r   zOperationModel.error_shapesu  s>    &**8R88MMMMfMMMMMMr   c                 6    | j                             d          S )Nendpointr   r    s    r   r&  zOperationModel.endpointz  r  r   c                 8    | j                             dd          S )NhttpChecksumRequiredFr   r    s    r   http_checksum_requiredz%OperationModel.http_checksum_required~  s    $(()?GGGr   c                 8    | j                             di           S )NhttpChecksumr   r    s    r   http_checksumzOperationModel.http_checksum  s    $((<<<r   c                 .    |                                  d uS r   )get_event_stream_inputr    s    r   has_event_stream_inputz%OperationModel.has_event_stream_input  s    **,,D88r   c                 .    |                                  d uS r   )get_event_stream_outputr    s    r   has_event_stream_outputz&OperationModel.has_event_stream_output  s    ++--T99r   c                 6    |                      | j                  S r   )_get_event_streamr  r    s    r   r.  z%OperationModel.get_event_stream_input  s    %%d&6777r   c                 6    |                      | j                  S r   )r4  r
  r    s    r   r1  z&OperationModel.get_event_stream_output  s    %%d&7888r   c                 :    |dS |j         }|r|j        |         S dS )zAReturns the event stream member's shape if any or None otherwise.N)rn   ru   )r!   r  
event_names      r   r4  z OperationModel._get_event_stream  s.    =4,
 	-=,,tr   c                 .    |                                  d uS r   )get_streaming_inputr    s    r   has_streaming_inputz"OperationModel.has_streaming_input  s    ''))55r   c                 .    |                                  d uS r   )get_streaming_outputr    s    r   has_streaming_outputz#OperationModel.has_streaming_output  s    ((**$66r   c                 6    |                      | j                  S r   )_get_streaming_bodyr  r    s    r   r9  z"OperationModel.get_streaming_input  s    ''(8999r   c                 6    |                      | j                  S r   )r?  r
  r    s    r   r<  z#OperationModel.get_streaming_output  s    ''(9:::r   c                 z    |dS |j                             d          }||j        |         }|j        dk    r|S dS )z?Returns the streaming member's shape if any; or None otherwise.Nr)   blob)rX   rK   ru   rJ   )r!   r  r)   payload_shapes       r   r?  z"OperationModel._get_streaming_body  sM    =4%)))44!M'2M&&00$$tr   c                 0    | j         j         d| j         dS )Nz(name=r   rj   r    s    r   rl   zOperationModel.__repr__  s     .)======r   r   )#r   r   r   rS   r	   rI   rq   r   r   rG   r   r   r   r  r
  r  r  r  r  r  r   r&  r)  r,  r/  r2  r.  r1  r4  r:  r=  r9  r<  r?  rl   r   r   r   r   r     s       #4 #4 #4 #4J " " ^" 1 1 X1 # # X# > > ^> > > ^> D D ^D
 E E ^E 
 
 ^
 
 
 ^
 

 

 ^

 
 
 ^
 
 
 ^
 ? ? ^? 5 5 ^5 N N ^N 5 5 ^5 H H ^H = = ^= 9 9 ^9 : : ^:8 8 89 9 9   6 6 ^6 7 7 ^7: : :; ; ;	 	 	> > > > >r   r   c                   4    e Zd ZdZeeeedZd Z	ddZ
d ZdS )r   zResolves shape references.)	structurer   mapstringc                 "    || _         i | _        d S r   )
_shape_map_shape_cache)r!   	shape_maps     r   rS   zShapeResolver.__init__  s    #r   Nc                 ^   	 | j         |         }n# t          $ r t          |          w xY w	 | j                            |d         t
                    }n # t          $ r t          d|           w xY w|r)|                                }|                    |            ||||           }|S )NrF   z&Shape is missing required key 'type': )	rJ  r   r   SHAPE_CLASSESrK   r$   r   copyupdate)r!   rP   r   rQ   	shape_clsresults         r   r   zShapeResolver.get_shape_by_name  s    	0/*5KK 	0 	0 	0#J///	0	*..{6/BEJJII 	 	 	#FFF  	  	.%**,,K}---:{D99s    *&A A2c                 (   t          |          dk    rd|v r|                     |d                   S |                                }	 |                    d          }n # t          $ r t          d|           w xY w|                     ||          S )N   r  z(Invalid model, missing shape reference: )lenr   rO  rV   r   r   )r!   rd   r   rP   s       r   rb   zShapeResolver.resolve_shape_ref  s     y>>Q7i#7#7 )))G*<===%NN,,M*..w77

   0JyJJ   ))*mDDDs   A A;r   )r   r   r   ro   rs   r   r   r   rN  rS   r   rb   r   r   r   r   r     sk        $$ $	 M     "E E E E Er   r   c                        e Zd ZdZddZd ZdS )rM   zEA ShapeResolver that will throw ValueErrors when shapes are resolved.Nc                 (    t          d| d          )NzAttempted to lookup shape '!', but no shape map was provided.
ValueErrorr   s      r   r   z&UnresolvableShapeMap.get_shape_by_name  s"    W*WWW
 
 	
r   c                 (    t          d| d          )NzAttempted to resolve shape 'rX  rY  rc   s     r   rb   z&UnresolvableShapeMap.resolve_shape_ref  s*    !9 ! ! !
 
 	
r   r   )r   r   r   ro   r   rb   r   r   r   rM   rM     s=        OO
 
 
 


 
 
 
 
r   rM   c                   T    e Zd ZdZdZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd ZdS )DenormalizedStructureBuildera  Build a StructureShape from a denormalized model.

    This is a convenience builder class that makes it easy to construct
    ``StructureShape``s based on a denormalized model.

    It will handle the details of creating unique shape names and creating
    the appropriate shape map needed by the ``StructureShape`` class.

    Example usage::

        builder = DenormalizedStructureBuilder()
        shape = builder.with_members({
            'A': {
                'type': 'structure',
                'members': {
                    'B': {
                        'type': 'structure',
                        'members': {
                            'C': {
                                'type': 'string',
                            }
                        }
                    }
                }
            }
        }).build_model()
        # ``shape`` is now an instance of botocore.model.StructureShape

    :type dict_type: class
    :param dict_type: The dictionary type to use, allowing you to opt-in
                      to using OrderedDict or another dict type. This can
                      be particularly useful for testing when order
                      matters, such as for documentation.

    )	rH  integerbooleanrB  float	timestamplongdoublecharNc                     t                      | _        t                      | _        |!| j                            d          | _        d S d S )NrF  )r   ru   ShapeNameGenerator_name_generatornew_shape_namerI   r   s     r   rS   z%DenormalizedStructureBuilder.__init__0  sC    "}}133<,;;KHHDIII <r   c                     || _         | S )zp

        :type members: dict
        :param members: The denormalized members.

        :return: self

        )_members)r!   ru   s     r   with_membersz)DenormalizedStructureBuilder.with_members6  s      r   c                     t                      }d| j        d}|                     ||| j                   t	          |          }t          | j        || j                 |          S )zBuild the model based on the provided members.

        :rtype: botocore.model.StructureShape
        :return: The built StructureShape object.

        rF  )rF   ru   )rL  )rP   rQ   rR   )r   rj  _build_modelrI   r   rs   )r!   r   denormalizedresolvers       r   build_modelz(DenormalizedStructureBuilder.build_modelB  sv     }
 
 	,	::: 6222yty)#
 
 
 	
r   c                 n   |d         dk    r|                      ||          ||<   d S |d         dk    r|                     ||          ||<   d S |d         dk    r|                     ||          ||<   d S |d         | j        v r|                     |          ||<   d S t          d|d                    )NrF   rF  r   rG  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r!   rW   r   rP   s       r   rm  z)DenormalizedStructureBuilder._build_modelV  s    =K''!%!6!6uf!E!EF:6]f$$!%!1!1%!@!@F:6]e##!%!?!?F:6]d///!%!3!3E!:!:F:#$J5=$J$JKKKr   c                 0   t                      }|                     |          }||d<   |                    dt                                                                D ]8\  }}|                     |          }d|i||<   |                     |||           9|S )Nru   r  )r   _build_initial_shaperK   rv   _get_shape_namerm  )r!   rW   r   ru   r  rI   member_modelmember_shape_names           r   rr  z-DenormalizedStructureBuilder._build_structureb  s    --))%00"i"'))I{}}"E"E"K"K"M"M 	G 	GD, $ 4 4\ B B$&78GDMlF4EFFFFr   c                     |                      |          }|                     |          }d|i|d<   |                     |d         ||           |S )Nr  rz   ry  rx  rm  )r!   rW   r   r{  r  s        r   rs  z(DenormalizedStructureBuilder._build_listm  sZ     0077))%00"$56h%/63DEEEr   c                 ,   |                      |d                   }|                      |d                   }|                     |          }d|i|d<   d|i|d<   |                     |d         ||           |                     |d         ||           |S )Nr   r   r  r}  )r!   rW   r   key_shape_namevalue_shape_namer  s         r   rt  z'DenormalizedStructureBuilder._build_mapt  s    --eEl;;//g??))%000e!#34g%,???%.&2BCCCr   c                 t    d|d         i}d|v r|d         |d<   t           j        D ]}||v r||         ||<   |S )NrF   rG   )r$   r[   )r!   rW   r  rY   s       r   rx  z1DenormalizedStructureBuilder._build_initial_shape~  s\    E&M
 e##%*?%;E/"( 	* 	*Du}}#Dkdr   c                 ,    |                      |          S r   )rx  r!   rW   s     r   rv  z*DenormalizedStructureBuilder._build_scalar  s    ((///r   c                 Z    d|v r|d         S | j                             |d                   S )NrP   rF   )rg  rh  r  s     r   ry  z,DenormalizedStructureBuilder._get_shape_name  s3    5  &&'66uV}EEEr   r   )r   r   r   ro   ru  rS   rk  rp  rm  rr  rs  rt  rx  rv  ry  r   r   r   r]  r]    s        " "H
LI I I I
 
 

 
 
(
L 
L 
L	 	 	    	 	 	0 0 0F F F F Fr   r]  c                       e Zd ZdZd Zd ZdS )rf  zGenerate unique shape names for a type.

    This class can be used in conjunction with the DenormalizedStructureBuilder
    to generate unique shape names for a given type.

    c                 8    t          t                    | _        d S r   )r   int_name_cacher    s    r   rS   zShapeNameGenerator.__init__  s    &s++r   c                 x    | j         |xx         dz  cc<   | j         |         }|                                 d| S )a  Generate a unique shape name.

        This method will guarantee a unique shape name each time it is
        called with the same type.

        ::

            >>> s = ShapeNameGenerator()
            >>> s.new_shape_name('structure')
            'StructureType1'
            >>> s.new_shape_name('structure')
            'StructureType2'
            >>> s.new_shape_name('list')
            'ListType1'
            >>> s.new_shape_name('list')
            'ListType2'


        :type type_name: string
        :param type_name: The type name (structure, list, map, string, etc.)

        :rtype: string
        :return: A unique shape name for the given type

        rT  Type)r  
capitalize)r!   rJ   current_indexs      r   rh  z!ShapeNameGenerator.new_shape_name  sP    4 	###q(###(3&&((==m===r   N)r   r   r   ro   rS   rh  r   r   r   rf  rf    s<         , , ,> > > > >r   rf  N)&ro   collectionsr   typingr   r   botocore.compatr   botocore.exceptionsr   r   botocore.utilsr	   r
   r   objectr   	Exceptionr   r   r   r   r   r   r$   rs   r   r   r   r   r   r   r   r   r   rM   r]  rf  r   r   r   <module>r     s   4 3 # # # # # # $ $ $ $ $ $ $ $ ' ' ' ' ' '        P O O O O O O O O O
&((	 	 	 	 		 	 	 		 	 	 	 		 	 	 		 	 	 	 	Y 	 	 		 	 	 	 	 	 	 	* * * * * * * *
b b b b b b b bJ'1 '1 '1 '1 '1U '1 '1 '1TD D D D D D D DC C C C Cu C C C- - - - -% - - -    Z   
    z   
    Z   {A {A {A {A {A {A {A {A|T> T> T> T> T> T> T> T>n3E 3E 3E 3E 3E 3E 3E 3El
 
 
 
 
 
 
 
QF QF QF QF QF QF QF QFh'> '> '> '> '> '> '> '> '> '>r   