
     h[~                     
   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZ ddlmZ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)resolve_auth_type)OrderedDict)MissingServiceIdErrorUndefinedModelAttributeError UnsupportedServiceProtocolsError)$PRIORITY_ORDERED_SUPPORTED_PROTOCOLSCachedPropertyhyphenize_service_idinstance_cachec                       e Zd Zy)NoShapeFoundErrorN__name__
__module____qualname__     j/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/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.hyphenize4   s    #D))r   N)r   r   r   r%   r   r   r   r    r    3   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clientContextParamsrequiresLengthNc                     || _         |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getrJ   _shape_modelUnresolvableShapeMap_shape_resolver_cache)r$   
shape_nameshape_modelshape_resolvers       r   __init__zShape.__init__f   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(   rL   )rO   SERIALIZED_ATTRSpop)r$   modelserializationattrs       r   r[   zShape.serialization   sj    . !!)) 	2Dt(((&+Dkd#	2 ]*$1$5$5n$EM&!r   c                 r    | j                   }i }| j                  D ]  }|| j                   v s||   ||<    |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.

        )rO   METADATA_ATTRS)r$   rZ   metadatar\   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.

        r8   r_   rN   r#   s    r   required_memberszShape.required_members   s     }}  R00r   c                 8    | j                   j                  |      S r"   rQ   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   rL   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__rX   r^   r   MAP_TYPErV   r   r[   r_   rb   rh   ro   propertyrq   r   r   r   r'   r'   8   s}    =&N$ H D  @  : 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)rO   rN   rs   itemsrh   )r$   rx   shape_membersrL   rg   s        r   rx   zStructureShape.members   sc    ##''	4==?C &}} 	EOD)"&"9"9)"DM$	Er   c                     | j                   j                         D ]$  \  }}|j                  j                  d      s"|c S  y )Nr2   )rx   ry   r[   rN   )r$   member_namemembers      r   rq   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_   rN   rL   )r$   error_metadatar   s      r   
error_codezStructureShape.error_code   sQ    }}  e4**7B7!!&)Kyyr   c                 :    | j                   j                  dd      S )NrC   Fra   r#   s    r   is_document_typezStructureShape.is_document_type   s    }}  U33r   c                 :    | j                   j                  dd      S )NrD   Fra   r#   s    r   is_tagged_unionzStructureShape.is_tagged_union  s    }}  %00r   N)	r   r   r   r   rx   rq   r   r   r   r   r   r   rv   rv      sd          4 4 1 1r   rv   c                       e Zd Zed        Zy)	ListShapec                 >    | j                  | j                  d         S )Nr}   rh   rO   r#   s    r   r}   zListShape.member  s    &&t'8'8'BCCr   N)r   r   r   r   r}   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=   ra   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)StaticContextParameterrL   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)ContextParameterrL   r|   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)ClientContextParameterrL   rI   rJ   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ed        Zed        Zd Zed        Zej<                  d        Ze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_descriptionrN   r_   ShapeResolverrQ   NOT_SET_signature_version_service_name_instance_cache)r$   service_descriptionservice_names      r   rV   zServiceModel.__init__4  sW    * %8!+//
B?,##Hb1 
 #*)!r   c                 :    | j                   j                  ||      S r"   )rQ   get_shape_by_namer$   rS   member_traitss      r   	shape_forzServiceModel.shape_forS  s     ##55
 	
r   c                 :    | j                   j                  |d       S r"   )_error_code_cacherN   )r$   r   s     r   shape_for_error_codez!ServiceModel.shape_for_error_codeX  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_cache[  s;    ,, 	1K))D%0T"	1  r   c                 8    | j                   j                  |      S r"   rd   rf   s     r   re   zServiceModel.resolve_shape_refc  ri   r   c                 L    t        | j                  j                  di             S )Nr   listr   rN   r#   s    r   shape_nameszServiceModel.shape_namesf  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_   rN   append)r$   r   rS   r   s       r   r   zServiceModel.error_shapesj  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_namerZ   s      r   operation_modelzServiceModel.operation_models  sI    	9--l;NKE eT>::  	9(88	9s   ! 6c                 :    | j                   j                  dd      S NrJ   rK   )r   rN   r#   s    r   rJ   zServiceModel.documentation{  s    ((,,_bAAr   c                 L    t        | j                  j                  dg             S r   r   r#   s    r   operation_nameszServiceModel.operation_names  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_name  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_   rN   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	protocolsr   r#   s    r   r   zServiceModel.protocols  s    **;77r   c                     | j                   j                  d      rCt        D ]  }|| j                  v s|c S  t	        t        | j                  | j
                        | j                  S )Nr   )botocore_supported_protocolsservice_supported_protocolsservice)r_   rN   r   r   r
   r   r   )r$   r   s     r   resolved_protocolzServiceModel.resolved_protocol  sd    
 ==[)@ $t~~-#O$ 3-Q,0NN))  }}r   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$   	operationrZ   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)Nr8   TF)r   r   endpoint_discoveryrN   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 )NrF   rI   rJ   )rL   rI   rJ   )r   rN   ry   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$   rL   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_   rN   )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                     d| j                   v S )NawsQueryCompatible)r_   r#   s    r   is_query_compatiblez ServiceModel.is_query_compatible  s    #t}}44r   c                 N    | j                   j                   d| j                   dS )Nrl   ))rn   r   r   r#   s    r   ro   zServiceModel.__repr__  s'    ..))*!D,=,=+>a@@r   r"   )!r   r   r   rr   rV   r   r   r   r   re   r   r   r   r   rJ   r   r   r   r   r   r   r   r   r   r   r   r   r   rt   r   setterr   ro   r   r   r   r   r   -  s   ">

<    A A A   ; ; B B E E ( (  I I 	 	 9 9 7 7 8 8  " = =     	
 	
 ' ' ( ( 5 5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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.

        rL   httpN)_operation_model_service_model	_api_namerN   
_wire_namer_   r   )r$   r   service_modelrL   s       r   rV   zOperationModel.__init__  sP    8 !0+ *--f5%..#''3	r   c                 J    | j                   | j                   S | j                  S r"   )r   	wire_namer#   s    r   rL   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 operation name
        we send across the wire (e.g cloudfront).

        Any serialization code should use ``wire_name``.

        rL   r   rN   r#   s    r   r  zOperationModel.wire_name2  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   rJ   zOperationModel.documentationD  s    $$(("==r   c                 :    | j                   j                  dd      S )N
deprecatedFr  r#   s    r   r  zOperationModel.deprecatedH  s    $$((u==r   c                 :    | j                   j                  dd       S )Nendpointdiscoveryr  r#   s    r   r   z!OperationModel.endpoint_discoveryL  s     $$(()<dCCr   c                 :    | j                   j                  dd      S )NendpointoperationFr  r#   s    r   r   z.OperationModel.is_endpoint_discovery_operationR  s    $$(()<eDDr   c                 p    d| j                   vry | j                  j                  | j                   d         S )Ninputr   r   re   r#   s    r   input_shapezOperationModel.input_shapeV  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  rx   ry   r_   )r$   r  rL   shapes       r   idempotent_membersz!OperationModel.idempotent_membersk  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   )rL   r   )r   rN   ry   r   )r$   r   rL   propss       r   static_context_parametersz(OperationModel.static_context_parametersx  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 )NrE   rL   )rL   r|   )r  rx   ry   r_   r   )r$   rL   r  s      r   context_parametersz!OperationModel.context_parameters  s    I  $//77==?

 e/%..88 ^^N3F; 
 	
 
s   AB c                 :    | j                   j                  dg       S )NoperationContextParamsr  r#   s    r   operation_context_parametersz+OperationModel.operation_context_parameters  s    $$(()A2FFr   c                 8    | j                   j                  d      S )Nrequestcompressionr  r#   s    r   request_compressionz"OperationModel.request_compression  s    $$(()=>>r   c                 8    | j                   j                  d      S )Nauthr  r#   s    r   r$  zOperationModel.auth  s    $$((00r   c                 8    | j                   j                  d      S )Nauthtyper  r#   s    r   	auth_typezOperationModel.auth_type      $$((44r   c                 \    | j                   rt        | j                         S | j                  S r"   )r$  r   r'  r#   s    r   resolved_auth_typez!OperationModel.resolved_auth_type  s"    99$TYY//~~r   c                 8    | j                   j                  d      S )NunsignedPayloadr  r#   s    r   unsigned_payloadzOperationModel.unsigned_payload  s    $$(():;;r   c                 d      j                   j                  dg       }t         fd|D              S )Nerrorsc              3   T   K   | ]  }j                   j                  |       ! y wr"   )r   re   ).0sr$   s     r   	<genexpr>z.OperationModel.error_shapes.<locals>.<genexpr>  s"     MD''99!<Ms   %()r   rN   r   )r$   r   s   ` r   r   zOperationModel.error_shapes  s,    &&**8R8MfMMMr   c                 8    | j                   j                  d      S )Nendpointr  r#   s    r   r5  zOperationModel.endpoint  r(  r   c                 :    | j                   j                  dd      S )NhttpChecksumRequiredFr  r#   s    r   http_checksum_requiredz%OperationModel.http_checksum_required  s    $$(()?GGr   c                 :    | j                   j                  di       S )NhttpChecksumr  r#   s    r   http_checksumzOperationModel.http_checksum  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"   )rC  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)rq   rx   )r$   r  
event_names      r   rC  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   rH  z"OperationModel.get_streaming_input  s    ''(8(899r   c                 8    | j                  | j                        S r"   )rN  r  r#   s    r   rK  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)r[   rN   rx   rM   )r$   r  r,   payload_shapes       r   rN  z"OperationModel._get_streaming_body  sK    =%%)))4!MM'2M&&&0$$r   c                 N    | j                   j                   d| j                   dS )Nz(name=r   rm   r#   s    r   ro   zOperationModel.__repr__  s$    ..))*&1==r   r"   )'r   r   r   rV   r   rL   rt   r  r   rJ   r  r   r   r  r  r  r  r  r  r"  r$  r'  r*  r-  r   r5  r8  r;  r>  rA  r=  r@  rC  rI  rL  rH  rK  rN  ro   r   r   r   r   r     s=   #4J " " 1 1 # # > > > > D D
 E E 
 
 
 
 

 

 
 
 
 
 G G ? ? 1 1 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   rV   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)NrI   z&Shape is missing required key 'type': )	rY  r   r   SHAPE_CLASSESrN   r'   r   copyupdate)r$   rS   r   rT   	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   r^  rY   r   r   )r$   rg   r   rS   s       r   re   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   rr   rv   r   r   r   r]  rV   r   re   r   r   r   r   r     s*    $ $	M"Er   r   c                       e Zd ZdZddZd Zy)rP   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 'rg  rh  rf   s     r   re   z&UnresolvableShapeMap.resolve_shape_ref,  s     *9+ 6  !
 	
r   r"   )r   r   r   rr   r   re   r   r   r   rP   rP   $  s    O


r   rP   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.

    )	rW  integerbooleanrQ  float	timestamplongdoublecharNc                     t               | _        t               | _        |!| j                  j	                  d      | _        y y )NrU  )r   rx   ShapeNameGenerator_name_generatornew_shape_namerL   r   s     r   rV   z%DenormalizedStructureBuilder.__init__d  s8    "}13<,,;;KHDI r   c                     || _         | S )zp

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

        :return: self

        )_members)r$   rx   s     r   with_membersz)DenormalizedStructureBuilder.with_membersj  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.

        rU  )rI   rx   )r[  )rS   rT   rU   )r   ry  _build_modelrL   r   rv   )r$   r   denormalizedresolvers       r   build_modelz(DenormalizedStructureBuilder.build_modelv  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          )NrI   rU  r   rV  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r$   rZ   r   rS   s       r   r|  z)DenormalizedStructureBuilder._build_model  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 )Nrx   r  )r   _build_initial_shaperN   ry   _get_shape_namer|  )r$   rZ   r   rx   r  rL   member_modelmember_shape_names           r   r  z-DenormalizedStructureBuilder._build_structure  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  r}   r  r  r|  )r$   rZ   r   r  r  s        r   r  z(DenormalizedStructureBuilder._build_list  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  r  )r$   rZ   r   key_shape_namevalue_shape_namer  s         r   r  z'DenormalizedStructureBuilder._build_map  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 )NrI   rJ   )r'   r^   )r$   rZ   r  r\   s       r   r  z1DenormalizedStructureBuilder._build_initial_shape  s[    E&M
 e#%*?%;E/"(( 	*Du}#Dkd	* r   c                 $    | j                  |      S r"   )r  r$   rZ   s     r   r  z*DenormalizedStructureBuilder._build_scalar  s    ((//r   c                 P    d|v r|d   S | j                   j                  |d         S )NrS   rI   )rv  rw  r  s     r   r  z,DenormalizedStructureBuilder._get_shape_name  s0    5 &&''66uV}EEr   r"   )r   r   r   rr   r  rV   rz  r  r|  r  r  r  r  r  r  r   r   r   rl  rl  3  sD    "H
LI

(
L		0Fr   rl  c                       e Zd ZdZd Zd Zy)ru  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   rV   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

        rc  Type)r  
capitalize)r$   rM   current_indexs      r   rw  z!ShapeNameGenerator.new_shape_name  sE    4 	#q(#((3&&()m_==r   N)r   r   r   rr   rV   rw  r   r   r   ru  ru    s    ,>r   ru  N)*rr   collectionsr   typingr   r   botocore.authr   botocore.compatr   botocore.exceptionsr   r	   r
   botocore.utilsr   r   r   r   objectr   	Exceptionr   r   r   r   r   r    r'   rv   r   r   r   r   r   r   r   r   r   rP   rl  ru  r   r   r   <module>r     s!   4 # $ + ' 
  (		 			 		Y 		 	* *
b bJ'1U '1TD DCu C-% -Z 
z 
Z UA UApf> f>R3E 3El
 
QF QFh'> '>r   