
    Dhv                        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%y-).z-Abstractions to interact with service models.    )defaultdict)
NamedTupleUnion)OrderedDict)MissingServiceIdErrorUndefinedModelAttributeError)CachedPropertyhyphenize_service_idinstance_cachec                       e Zd Zy)NoShapeFoundErrorN__name__
__module____qualname__     p/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/botocore/model.pyr   r          r   r   c                       e Zd Zy)InvalidShapeErrorNr   r   r   r   r   r      r   r   r   c                       e Zd Zy)OperationNotFoundErrorNr   r   r   r   r   r   #   r   r   r   c                       e Zd Zy)InvalidShapeReferenceErrorNr   r   r   r   r   r   '   r   r   r   c                       e Zd Zd Zy)	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                   x    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y)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clientContextParamsNc                     || _         |d   | _        |j                  dd      | _        || _        |
t               }|| _        i | _        y)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getrF   _shape_modelUnresolvableShapeMap_shape_resolver_cache)r!   
shape_nameshape_modelshape_resolvers       r   __init__zShape.__init__]   sQ    ( 	$V,(___bA'! 23N-r   c                     | j                   }i }| j                  D ]  }|| j                   v s||   ||<    d|v r|j                  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%   rH   )rK   SERIALIZED_ATTRSpop)r!   modelserializationattrs       r   rW   zShape.serialization   sj    . !!)) 	2Dt(((&+Dkd#	2 ]*$1$5$5n$EM&!r   c                 r    | j                   }i }| j                  D ]  }|| j                   v s||   ||<    |S )as  Metadata about the shape.

        This requires optional information about the shape, including:

            * min
            * max
            * pattern
            * enum
            * sensitive
            * required
            * idempotencyToken
            * document
            * union

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

        )rK   METADATA_ATTRS)r!   rV   metadatarX   s       r   r[   zShape.metadata   sK    ( !!'' 	-Dt(((!&t	- r   c                 :    | j                   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[   rJ   r    s    r   required_memberszShape.required_members   s     }}  R00r   c                 8    | j                   j                  |      S r   rM   resolve_shape_refr!   	shape_refs     r   _resolve_shape_refzShape._resolve_shape_ref       ##55i@@r   c                 P    d| j                   j                   d| j                   dS )N<(z)>	__class__r   rH   r    s    r   __repr__zShape.__repr__   s&    4>>**+1TYYKr::r   c                      y r   r   r    s    r   event_stream_namezShape.event_stream_name   s    r   r   )r   r   r   __doc__rT   rZ   r   MAP_TYPErR   r	   rW   r[   r^   rd   rk   propertyrm   r   r   r   r$   r$   0   s}    =&N" H D  @  4 1 1A;  r   r$   c                   \    e Zd Zed        Zed        Zed        Zed        Zed        Zy)StructureShapec                     | j                   j                  d| j                               }| j                         }|j                         D ]  \  }}| j	                  |      ||<    |S )Nmembers)rK   rJ   ro   itemsrd   )r!   rt   shape_membersrH   rc   s        r   rt   zStructureShape.members   sc    ##''	4==?C &}} 	EOD)"&"9"9)"DM$	Er   c                     | j                   j                         D ]$  \  }}|j                  j                  d      s"|c S  y )Nr/   )rt   ru   rW   rJ   )r!   member_namemembers      r   rm   z StructureShape.event_stream_name   sB    #'<<#5#5#7 	#K##''6""	# r   c                     | j                   j                  dd      sy | j                   j                  di       }|j                  d      }|r|S | j                  S )Nr=   Fr<   code)r[   rJ   rH   )r!   error_metadatar{   s      r   
error_codezStructureShape.error_code   sQ    }}  e4**7B7!!&)Kyyr   c                 :    | j                   j                  dd      S )Nr@   Fr]   r    s    r   is_document_typezStructureShape.is_document_type   s    }}  U33r   c                 :    | j                   j                  dd      S )NrA   Fr]   r    s    r   is_tagged_unionzStructureShape.is_tagged_union   s    }}  %00r   N)	r   r   r   r	   rt   rm   r}   r   r   r   r   r   rr   rr      sd          4 4 1 1r   rr   c                       e Zd Zed        Zy)	ListShapec                 >    | j                  | j                  d         S )Nry   rd   rK   r    s    r   ry   zListShape.member   s    &&t'8'8'BCCr   N)r   r   r   r	   ry   r   r   r   r   r      s    D Dr   r   c                   ,    e Zd Zed        Zed        Zy)MapShapec                 >    | j                  | j                  d         S )Nkeyr   r    s    r   r   zMapShape.key  s    &&t'8'8'?@@r   c                 >    | j                  | j                  d         S )Nvaluer   r    s    r   r   zMapShape.value  s    &&t'8'8'ABBr   N)r   r   r   r	   r   r   r   r   r   r   r     s,    A A C Cr   r   c                       e Zd Zed        Zy)StringShapec                 :    | j                   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                   ,    e Zd ZU eed<   eeef   ed<   y)StaticContextParameterrH   r   N)r   r   r   str__annotations__r   boolr   r   r   r   r     s    
Isr   r   c                   "    e Zd ZU eed<   eed<   y)ContextParameterrH   rx   Nr   r   r   r   r   r   r   r   r   r     s    
Ir   r   c                   ,    e Zd ZU eed<   eed<   eed<   y)ClientContextParameterrH   rE   rF   Nr   r   r   r   r   r     s    
I
I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j8                  d        Zd Zy)ServiceModelzQ

    :ivar service_description: The parsed service description dictionary.

    Nc                     || _         |j                  di       | _        t        |j                  di             | _        t
        | _        || _        i | _        y)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_descriptionrJ   r[   ShapeResolverrM   NOT_SET_signature_version_service_name_instance_cache)r!   service_descriptionservice_names      r   rR   zServiceModel.__init__(  sW    * %8!+//
B?,##Hb1 
 #*)!r   c                 :    | j                   j                  ||      S r   )rM   get_shape_by_namer!   rO   member_traitss      r   	shape_forzServiceModel.shape_forG  s     ##55
 	
r   c                 :    | j                   j                  |d       S r   )_error_code_cacherJ   )r!   r}   s     r   shape_for_error_codez!ServiceModel.shape_for_error_codeL  s    %%))*d;;r   c                 N    i }| j                   D ]  }|j                  }|||<    |S r   )error_shapesr}   )r!   error_code_cacheerror_shaper{   s       r   r   zServiceModel._error_code_cacheO  s;    ,, 	1K))D%0T"	1  r   c                 8    | j                   j                  |      S r   r`   rb   s     r   ra   zServiceModel.resolve_shape_refW  re   r   c                 L    t        | j                  j                  di             S )Nr   listr   rJ   r    s    r   shape_nameszServiceModel.shape_namesZ  s     D--11(B?@@r   c                     g }| j                   D ]A  }| j                  |      }|j                  j                  dd      s1|j	                  |       C |S )Nr=   F)r   r   r[   rJ   append)r!   r   rO   r   s       r   r   zServiceModel.error_shapes^  sV    ** 	1J..4K##''U;##K0	1 r   c                 r    	 | j                   d   |   }t        || |      S # t        $ r t        |      w xY wN
operations)r   KeyErrorr   OperationModel)r!   operation_namerV   s      r   operation_modelzServiceModel.operation_modelg  sI    	9--l;NKE eT>::  	9(88	9s   ! 6c                 :    | j                   j                  dd      S NrF   rG   )r   rJ   r    s    r   rF   zServiceModel.documentationo  s    ((,,_bAAr   c                 L    t        | j                  j                  dg             S r   r   r    s    r   operation_nameszServiceModel.operation_namess  s     D--11,CDDr   c                 J    | 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_namew  s(     )%%%'''r   c                 ~    	 t        | j                  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  s@    	IT88EFF+ 	I'T5G5GHH	Is     <c                 X    | j                   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[   rJ   r   )r!   signing_names     r   r   zServiceModel.signing_name  s/     }}((7//Lr   c                 $    | j                  d      S )N
apiVersionr   r    s    r   api_versionzServiceModel.api_version  s    **<88r   c                 $    | j                  d      S )Nprotocolr   r    s    r   r   zServiceModel.protocol  s    **:66r   c                 $    | j                  d      S )NendpointPrefixr   r    s    r   r   zServiceModel.endpoint_prefix  s    **+;<<r   c                 h    | j                   D ]#  }| j                  |      }|j                  s!|c S  y r   )r   r   is_endpoint_discovery_operationr!   	operationrV   s      r   endpoint_discovery_operationz)ServiceModel.endpoint_discovery_operation  s5    -- 	I((3E44	r   c                     | j                   D ]=  }| j                  |      }|j                  !|j                  j                  d      s= y y)Nr5   TF)r   r   endpoint_discoveryrJ   r   s      r   endpoint_discovery_requiredz(ServiceModel.endpoint_discovery_required  sO    -- 	I((3E((4,,00<	 r   c           
          | j                   j                  di       }|j                         D cg c]  \  }}t        ||d   |d          c}}S c c}}w )NrC   rE   rF   )rH   rE   rF   )r   rJ   ru   r   )r!   params
param_name	param_vals       r   client_context_parametersz&ServiceModel.client_context_parameters  sa    **../DbI *0
 &
I #v&'8
 	
 
s   Ac                 ^    	 | 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!   rH   s     r   r   z#ServiceModel._get_metadata_property  sC    	==&& 	.D6EdVL 	s    ,c                     | j                   t        u r"| j                  j                  d      }|| _         | j                   S )NsignatureVersion)r   r   r[   rJ   )r!   signature_versions     r   r   zServiceModel.signature_version  s:    ""g- $ 1 12D E&7D#&&&r   c                     || _         y r   )r   )r!   r   s     r   r   zServiceModel.signature_version  s
    "'r   c                 N    | j                   j                   d| j                   dS )Nrh   ))rj   r   r   r    s    r   rk   zServiceModel.__repr__  s'    ..))*!D,=,=+>a@@r   r   )r   r   r   rn   rR   r   r   r	   r   ra   r   r   r   r   rF   r   r   r   r   r   r   r   r   r   r   r   rp   r   setterrk   r   r   r   r   r   !  s   ">

<    A A A   ; ; B B E E ( (  I I 	 	 9 9 7 7 = =     	
 	
 ' ' ( (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d Zd Zd Zed        Zed        Zd Zd Zd Z d Z!y) r   Nc                     || _         || _        || _        |j                  d      | _        |j
                  | _        |j                  di       | _        y)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.

        rH   httpN)_operation_model_service_model	_api_namerJ   
_wire_namer[   r   )r!   r   service_modelrH   s       r   rR   zOperationModel.__init__  sP    8 !0+ *--f5%..#''3	r   c                 J    | j                   | j                   S | j                  S r   )r   	wire_namer    s    r   rH   zOperationModel.name  s     >>%>>!>>!r   c                 8    | j                   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 operaiton name
        we send across the wire (e.g cloudfront).

        Any serialization code should use ``wire_name``.

        rH   r   rJ   r    s    r   r   zOperationModel.wire_name  s     $$((00r   c                     | j                   S r   )r   r    s    r   r   zOperationModel.service_model  s    """r   c                 :    | j                   j                  dd      S r   r   r    s    r   rF   zOperationModel.documentation  s    $$(("==r   c                 :    | j                   j                  dd      S )N
deprecatedFr   r    s    r   r   zOperationModel.deprecated"  s    $$((u==r   c                 :    | j                   j                  dd       S )Nendpointdiscoveryr   r    s    r   r   z!OperationModel.endpoint_discovery&  s     $$(()<dCCr   c                 :    | j                   j                  dd      S )NendpointoperationFr   r    s    r   r   z.OperationModel.is_endpoint_discovery_operation,  s    $$(()<eDDr   c                 p    d| j                   vry | j                  j                  | j                   d         S )Ninputr   r   ra   r    s    r   input_shapezOperationModel.input_shape0  s<    $/// ""44!!'*
 	
r   c                 p    d| j                   vry | j                  j                  | j                   d         S )Noutputr  r    s    r   output_shapezOperationModel.output_shape:  s<    4000 ""44!!(+
 	
r   c                     | j                   }|sg S |j                  j                         D cg c]$  \  }}d|j                  v r|j                  d   r|& c}}S c c}}w )Nr;   )r  rt   ru   r[   )r!   r  rH   shapes       r   idempotent_membersz!OperationModel.idempotent_membersE  sc    &&I "-!4!4!:!:!<
u!U^^312 
 	
 
s   )Ac           
          | j                   j                  di       }|j                         D cg c]!  \  }}t        ||j                  d            # c}}S c c}}w )NstaticContextParamsr   )rH   r   )r   rJ   ru   r   )r!   r   rH   propss       r   static_context_parametersz(OperationModel.static_context_parametersR  sW    &&**+@"E  &||~
e #EIIg4FG
 	
 
s   &Ac                    | j                   sg S | j                   j                  j                         D cg c]A  \  }}d|j                  v r.d|j                  d   v rt	        |j                  d   d   |      C c}}S c c}}w )NrB   rH   )rH   rx   )r  rt   ru   r[   r   )r!   rH   r  s      r   context_parametersz!OperationModel.context_parametersZ  s    I  $//77==?

 e/%..88 ^^N3F; 
 	
 
s   AB c                 8    | j                   j                  d      S )Nauthtyper   r    s    r   	auth_typezOperationModel.auth_typei      $$((44r   c                 d      j                   j                  dg       }t         fd|D              S )Nerrorsc              3   T   K   | ]  }j                   j                  |       ! y wr   )r   ra   ).0sr!   s     r   	<genexpr>z.OperationModel.error_shapes.<locals>.<genexpr>p  s"     MD''99!<Ms   %()r   rJ   r   )r!   r   s   ` r   r   zOperationModel.error_shapesm  s,    &&**8R8MfMMMr   c                 8    | j                   j                  d      S )Nendpointr   r    s    r   r  zOperationModel.endpointr  r  r   c                 :    | j                   j                  dd      S )NhttpChecksumRequiredFr   r    s    r   http_checksum_requiredz%OperationModel.http_checksum_requiredv  s    $$(()?GGr   c                 :    | j                   j                  di       S )NhttpChecksumr   r    s    r   http_checksumzOperationModel.http_checksumz  s    $$((<<r   c                 &    | j                         d uS r   )get_event_stream_inputr    s    r   has_event_stream_inputz%OperationModel.has_event_stream_input~  s    **,D88r   c                 &    | j                         d uS r   )get_event_stream_outputr    s    r   has_event_stream_outputz&OperationModel.has_event_stream_output  s    ++-T99r   c                 8    | j                  | j                        S r   )_get_event_streamr  r    s    r   r"  z%OperationModel.get_event_stream_input  s    %%d&6&677r   c                 8    | j                  | j                        S r   )r(  r  r    s    r   r%  z&OperationModel.get_event_stream_output  s    %%d&7&788r   c                 D    |y|j                   }|r|j                  |   S y)zAReturns the event stream member's shape if any or None otherwise.N)rm   rt   )r!   r  
event_names      r   r(  z OperationModel._get_event_stream  s*    =,,
==,,r   c                 &    | j                         d uS r   )get_streaming_inputr    s    r   has_streaming_inputz"OperationModel.has_streaming_input  s    '')55r   c                 &    | j                         d uS r   )get_streaming_outputr    s    r   has_streaming_outputz#OperationModel.has_streaming_output  s    ((*$66r   c                 8    | j                  | j                        S r   )_get_streaming_bodyr  r    s    r   r-  z"OperationModel.get_streaming_input  s    ''(8(899r   c                 8    | j                  | j                        S r   )r3  r  r    s    r   r0  z#OperationModel.get_streaming_output  s    ''(9(9::r   c                     |y|j                   j                  d      }| |j                  |   }|j                  dk(  r|S y)z?Returns the streaming member's shape if any; or None otherwise.Nr)   blob)rW   rJ   rt   rI   )r!   r  r)   payload_shapes       r   r3  z"OperationModel._get_streaming_body  sK    =%%)))4!MM'2M&&&0$$r   c                 N    | j                   j                   d| j                   dS )Nz(name=r   ri   r    s    r   rk   zOperationModel.__repr__  s$    ..))*&1==r   r   )"r   r   r   rR   r	   rH   rp   r   r   rF   r   r   r   r  r  r  r  r  r  r   r  r  r   r#  r&  r"  r%  r(  r.  r1  r-  r0  r3  rk   r   r   r   r   r     s   #4J " " 1 1 # # > > > > D D
 E E 
 
 
 
 

 

 
 
 
 
 5 5 N N 5 5 H H = = 9 9 : :89 6 6 7 7:;	>r   r   c                   2    e Zd ZdZeeeedZd Z	ddZ
d Zy)r   zResolves shape references.)	structurer   mapstringc                      || _         i | _        y r   )
_shape_map_shape_cache)r!   	shape_maps     r   rR   zShapeResolver.__init__  s    #r   Nc                 .   	 | j                   |   }	 | j                  j	                  |d   t
              }|r!|j                         }|j                  |        ||||       }|S # t        $ r t        |      w xY w# t        $ r t        d|       w xY w)NrE   z&Shape is missing required key 'type': )	r>  r   r   SHAPE_CLASSESrJ   r$   r   copyupdate)r!   rO   r   rP   	shape_clsresults         r   r   zShapeResolver.get_shape_by_name  s    	0//*5K	**..{6/BEJI
 %**,K}-:{D9  	0#J//	0  	#8F 	s   A$ #A< $A9<Bc                     t        |      dk(  rd|v r| j                  |d         S |j                         }	 |j                  d      }| j                  ||      S # t        $ r t        d|       w xY w)N   r  z(Invalid model, missing shape reference: )lenr   rC  rU   r   r   )r!   rc   r   rO   s       r   ra   zShapeResolver.resolve_shape_ref  s     y>Q7i#7 )))G*<==%NN,M*..w7

 ))*mDD	  0>ykJ s   A A3r   )r   r   r   rn   rr   r   r   r   rB  rR   r   ra   r   r   r   r   r     s*    $ $	M"Er   r   c                       e Zd ZdZddZd Zy)rL   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    )*5VW
 	
r   c                      t        d| d      )NzAttempted to resolve shape 'rL  rM  rb   s     r   ra   z&UnresolvableShapeMap.resolve_shape_ref  s     *9+ 6  !
 	
r   r   )r   r   r   rn   r   ra   r   r   r   rL   rL     s    O


r   rL   c                   R    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y)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.

    )	r<  integerbooleanr6  float	timestamplongdoublecharNc                     t               | _        t               | _        |!| j                  j	                  d      | _        y y )Nr:  )r   rt   ShapeNameGenerator_name_generatornew_shape_namerH   r   s     r   rR   z%DenormalizedStructureBuilder.__init__(  s8    "}13<,,;;KHDI r   c                     || _         | S )zp

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

        :return: self

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

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

        r:  )rE   rt   )r@  )rO   rP   rQ   )r   r^  _build_modelrH   r   rr   )r!   r   denormalizedresolvers       r   build_modelz(DenormalizedStructureBuilder.build_model:  sa     }}
 	,		: 62yytyy)#
 	
r   c                 $   |d   dk(  r| j                  ||      ||<   y |d   dk(  r| j                  ||      ||<   y |d   dk(  r| j                  ||      ||<   y |d   | j                  v r| j	                  |      ||<   y t        d|d          )NrE   r:  r   r;  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r!   rV   r   rO   s       r   ra  z)DenormalizedStructureBuilder._build_modelN  s    =K'!%!6!6uf!EF:6]f$!%!1!1%!@F:6]e#!%!?F:6]d///!%!3!3E!:F:#&:5=/$JKKr   c                     t               }| j                  |      }||d<   |j                  dt                     j                         D ]0  \  }}| j	                  |      }d|i||<   | j                  |||       2 |S )Nrt   r  )r   _build_initial_shaperJ   ru   _get_shape_namera  )r!   rV   r   rt   r  rH   member_modelmember_shape_names           r   rf  z-DenormalizedStructureBuilder._build_structureZ  s    -))%0"i"'))I{}"E"K"K"M 	GD, $ 4 4\ B$&78GDMlF4EF	G r   c                     | j                  |      }| j                  |      }d|i|d<   | j                  |d   ||       |S )Nr  ry   rm  rl  ra  )r!   rV   r   ro  r  s        r   rg  z(DenormalizedStructureBuilder._build_liste  sN     007))%0"$56h%/63DEr   c                     | j                  |d         }| j                  |d         }| j                  |      }d|i|d<   d|i|d<   | j                  |d   ||       | j                  |d   ||       |S )Nr   r   r  rq  )r!   rV   r   key_shape_namevalue_shape_namer  s         r   rh  z'DenormalizedStructureBuilder._build_mapl  s    --eEl;//g?))%00e!#34g%,?%.&2BCr   c                 p    d|d   i}d|v r|d   |d<   t         j                  D ]  }||v s||   ||<    |S )NrE   rF   )r$   rZ   )r!   rV   r  rX   s       r   rl  z1DenormalizedStructureBuilder._build_initial_shapev  s[    E&M
 e#%*?%;E/"(( 	*Du}#Dkd	* r   c                 $    | j                  |      S r   )rl  r!   rV   s     r   rj  z*DenormalizedStructureBuilder._build_scalar  s    ((//r   c                 P    d|v r|d   S | j                   j                  |d         S )NrO   rE   )r[  r\  rw  s     r   rm  z,DenormalizedStructureBuilder._get_shape_name  s0    5 &&''66uV}EEr   r   )r   r   r   rn   ri  rR   r_  rd  ra  rf  rg  rh  rl  rj  rm  r   r   r   rQ  rQ    sD    "H
LI

(
L		0Fr   rQ  c                       e Zd ZdZd Zd Zy)rZ  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                 ,    t        t              | _        y r   )r   int_name_cacher    s    r   rR   zShapeNameGenerator.__init__  s    &s+r   c                 x    | j                   |xx   dz  cc<   | j                   |   }|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

        rH  Type)r|  
capitalize)r!   rI   current_indexs      r   r\  z!ShapeNameGenerator.new_shape_name  sE    4 	#q(#((3&&()m_==r   N)r   r   r   rn   rR   r\  r   r   r   rZ  rZ    s    ,>r   rZ  N)&rn   collectionsr   typingr   r   botocore.compatr   botocore.exceptionsr   r   botocore.utilsr	   r
   r   objectr   	Exceptionr   r   r   r   r   r   r$   rr   r   r   r   r   r   r   r   r   r   rL   rQ  rZ  r   r   r   <module>r     s   4 # $ ' P O
(		 			 		Y 		 	* *
^ ^B'1U '1TD DCu C-% -Z 
z 
Z {A {A|P> P>f3E 3El
 
QF QFh'> '>r   