
    !i[~                     
   S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
JrJrJr  SSKJrJrJrJr  \" 5       r " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r! " S S\5      r" " S  S!\5      r# " S" S#5      r$ " S$ S%5      r% " S& S'5      r& " S( S)5      r' " S* S+5      r( " S, S-5      r)g.)/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                       \ rS rSrSrg)NoShapeFoundError#    N__name__
__module____qualname____firstlineno____static_attributes__r       M/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/botocore/model.pyr   r   #       r   r   c                       \ rS rSrSrg)InvalidShapeError'   r   Nr   r   r   r   r   r   '   r   r   r   c                       \ rS rSrSrg)OperationNotFoundError+   r   Nr   r   r   r   r    r    +   r   r   r    c                       \ rS rSrSrg)InvalidShapeReferenceError/   r   Nr   r   r   r   r#   r#   /   r   r   r#   c                       \ rS rSrS rSrg)	ServiceId3   c                     [        U 5      $ N)r   selfs    r   	hyphenizeServiceId.hyphenize4   s    #D))r   r   N)r   r   r   r   r,   r   r   r   r   r&   r&   3   s    *r   r&   c                       \ rS rSrSr/ SQr/ SQr\rSS jr	\
S 5       r\
S 5       r\
S	 5       rS
 rS r\S 5       rSrg)Shape8   z3Object representing a shape from the service model.)locationName	queryName	flattenedlocationpayload	streamingtimestampFormatxmlNamespaceresultWrapperxmlAttributeeventstreameventeventheadereventpayload	jsonvaluer7   	hostLabel)requiredminmaxpattern	sensitiveenumidempotencyTokenerror	exceptionendpointdiscoveryid	retryabledocumentunioncontextParamclientContextParamsrequiresLengthNc                     Xl         US   U l        UR                  SS5      U l        X l        Uc
  [        5       nX0l        0 U l        g)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getrS   _shape_modelUnresolvableShapeMap_shape_resolver_cache)r+   
shape_nameshape_modelshape_resolvers       r   __init__Shape.__init__f   sK    ( 	$V,(___bA'! 23N-r   c                     U R                   n0 nU R                   H  nX0R                   ;   d  M  X   X#'   M     SU;   a  UR                  S5      US'   U$ )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.

r1   rU   )rX   SERIALIZED_ATTRSpop)r+   modelserializationattrs       r   re   Shape.serialization   s_    . !!))D(((&+k# * ]*$1$5$5n$EM&!r   c                 v    U R                   n0 nU R                   H  nX0R                   ;   d  M  X   X#'   M     U$ )aM  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.

)rX   METADATA_ATTRS)r+   rd   metadatarf   s       r   rj   Shape.metadata   s@    . !!''D(((!& ( r   c                 :    U R                   R                  S/ 5      $ )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.

rA   rj   rW   r*   s    r   required_membersShape.required_members   s     }}  R00r   c                 8    U R                   R                  U5      $ r)   rZ   resolve_shape_refr+   	shape_refs     r   _resolve_shape_refShape._resolve_shape_ref       ##55i@@r   c                 P    SU R                   R                   SU R                   S3$ )N<(z)>	__class__r   rU   r*   s    r   __repr__Shape.__repr__   s&    4>>**+1TYYKr::r   c                     g r)   r   r*   s    r   event_stream_nameShape.event_stream_name   s    r   )r[   rX   rZ   rS   rU   rV   r)   )r   r   r   r   __doc__rb   ri   r   MAP_TYPEr_   r   re   rj   rn   ru   r}   propertyr   r   r   r   r   r/   r/   8   s}    =&N$ H D  @  : 1 1A;  r   r/   c                   d    \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	StructureShape   c                     U R                   R                  SU R                  5       5      nU R                  5       nUR                  5        H  u  p4U R	                  U5      X#'   M     U$ )Nmembers)rX   rW   r   itemsru   )r+   r   shape_membersrU   rt   s        r   r   StructureShape.members   sX    ##''	4==?C &}}OD"&"9"9)"DM  /r   c                     U R                   R                  5        H)  u  pUR                  R                  S5      (       d  M'  Us  $    g )Nr;   )r   r   re   rW   )r+   member_namemembers      r   r    StructureShape.event_stream_name   s>    #'<<#5#5#7K##''66"" $8 r   c                     U R                   R                  SS5      (       d  g U R                   R                  S0 5      nUR                  S5      nU(       a  U$ U R                  $ )NrI   FrH   code)rj   rW   rU   )r+   error_metadatar   s      r   
error_codeStructureShape.error_code   sT    }}  e44**7B7!!&)Kyyr   c                 :    U R                   R                  SS5      $ )NrL   Frm   r*   s    r   is_document_typeStructureShape.is_document_type   s    }}  U33r   c                 :    U R                   R                  SS5      $ )NrM   Frm   r*   s    r   is_tagged_unionStructureShape.is_tagged_union  s    }}  %00r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      sd          4 4 1 1r   r   c                   $    \ rS rSr\S 5       rSrg)	ListShapei  c                 >    U R                  U R                  S   5      $ )Nr   ru   rX   r*   s    r   r   ListShape.member  s    &&t'8'8'BCCr   r   N)r   r   r   r   r   r   r   r   r   r   r   r     s    D Dr   r   c                   4    \ rS rSr\S 5       r\S 5       rSrg)MapShapei  c                 >    U R                  U R                  S   5      $ )Nkeyr   r*   s    r   r   MapShape.key  s    &&t'8'8'?@@r   c                 >    U R                  U R                  S   5      $ )Nvaluer   r*   s    r   r   MapShape.value  s    &&t'8'8'ABBr   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r     s,    A A C Cr   r   c                   $    \ rS rSr\S 5       rSrg)StringShapei  c                 :    U R                   R                  S/ 5      $ )NrF   rm   r*   s    r   rF   StringShape.enum  s    }}  ,,r   r   N)r   r   r   r   r   rF   r   r   r   r   r   r     s    - -r   r   c                   4    \ rS rSr% \\S'   \\\4   \S'   Srg)StaticContextParameteri  rU   r   r   N)	r   r   r   r   str__annotations__r   boolr   r   r   r   r   r     s    
Isr   r   c                   *    \ rS rSr% \\S'   \\S'   Srg)ContextParameteri"  rU   r   r   Nr   r   r   r   r   r   r   r   r   r   r   r   "  s    
Ir   r   c                   4    \ rS rSr% \\S'   \\S'   \\S'   Srg)ClientContextParameteri'  rU   rR   rS   r   Nr   r   r   r   r   r   '  s    
I
Ir   r   c                      \ rS rSrSrSS jrSS jrS r\S 5       r	S r
\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rS r\S 5       r\R>                  S 5       r\S 5       r S r!Sr"g) ServiceModeli-  zI

:ivar service_description: The parsed service description dictionary.

Nc                     Xl         UR                  S0 5      U l        [        UR                  S0 5      5      U l        [
        U l        X l        0 U l        g)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.

rj   shapesN)	_service_descriptionrW   rj   ShapeResolverrZ   NOT_SET_signature_version_service_name_instance_cache)r+   service_descriptionservice_names      r   r_   ServiceModel.__init__4  sS    * %8!+//
B?,##Hb1 
 #*)!r   c                 8    U R                   R                  X5      $ r)   )rZ   get_shape_by_namer+   r\   member_traitss      r   	shape_forServiceModel.shape_forS  s    ##55
 	
r   c                 :    U R                   R                  US 5      $ r)   )_error_code_cacherW   )r+   r   s     r   shape_for_error_code!ServiceModel.shape_for_error_codeX  s    %%))*d;;r   c                 P    0 nU R                    H  nUR                  nX!U'   M     U$ r)   )error_shapesr   )r+   error_code_cacheerror_shaper   s       r   r   ServiceModel._error_code_cache[  s3    ,,K))D%0T" -  r   c                 8    U R                   R                  U5      $ r)   rq   rs   s     r   rr   ServiceModel.resolve_shape_refc  rw   r   c                 L    [        U R                  R                  S0 5      5      $ )Nr   listr   rW   r*   s    r   shape_namesServiceModel.shape_namesf  s     D--11(B?@@r   c                     / nU R                    HH  nU R                  U5      nUR                  R                  SS5      (       d  M7  UR	                  U5        MJ     U$ )NrI   F)r   r   rj   rW   append)r+   r   r\   r   s       r   r   ServiceModel.error_shapesj  sT    **J..4K##''U;;##K0 + r   c                 r     U R                   S   U   n[        X U5      $ ! [         a    [        U5      ef = fN
operations)r   KeyErrorr    OperationModel)r+   operation_namerd   s      r   operation_modelServiceModel.operation_models  sG    	9--l;NKE e>::  	9(88	9s     6c                 :    U R                   R                  SS5      $ NrS   rT   )r   rW   r*   s    r   rS   ServiceModel.documentation{  s    ((,,_bAAr   c                 L    [        U R                  R                  S/ 5      5      $ r   r   r*   s    r   operation_namesServiceModel.operation_names  s     D--11,CDDr   c                 L    U R                   b  U R                   $ U R                  $ )as  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   ServiceModel.service_name  s(     )%%%'''r   c                 z     [        U R                  S5      5      $ ! [         a    [        U R                  S9ef = f)N	serviceId)r   )r&   _get_metadata_propertyr	   r   r   r*   s    r   
service_idServiceModel.service_id  s@    	IT88EFF+ 	I'T5G5GHH	Is    :c                 Z    U R                   R                  S5      nUc  U R                  nU$ )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)rj   rW   r   )r+   signing_names     r   r   ServiceModel.signing_name  s/     }}((7//Lr   c                 $    U R                  S5      $ )N
apiVersionr   r*   s    r   api_versionServiceModel.api_version  s    **<88r   c                 $    U R                  S5      $ )Nprotocolr   r*   s    r   r   ServiceModel.protocol  s    **:66r   c                 $    U R                  S5      $ )N	protocolsr   r*   s    r   r   ServiceModel.protocols  s    **;77r   c                     U R                   R                  S5      (       aC  [         H  nXR                  ;   d  M  Us  $    [	        [        U R                  U R
                  S9eU R                  $ )Nr   )botocore_supported_protocolsservice_supported_protocolsservice)rj   rW   r   r   r
   r   r   )r+   r   s     r   resolved_protocolServiceModel.resolved_protocol  sa    
 ==[))@~~-#O A 3-Q,0NN))  }}r   c                 $    U R                  S5      $ )NendpointPrefixr   r*   s    r   r   ServiceModel.endpoint_prefix  s    **+;<<r   c                 v    U R                    H)  nU R                  U5      nUR                  (       d  M'  Us  $    g r)   )r   r   is_endpoint_discovery_operationr+   	operationrd   s      r   endpoint_discovery_operation)ServiceModel.endpoint_discovery_operation  s3    --I((3E444 .r   c                     U R                    HE  nU R                  U5      nUR                  c  M#  UR                  R                  S5      (       d  ME    g   g)NrA   TF)r   r   endpoint_discoveryrW   r  s      r   endpoint_discovery_required(ServiceModel.endpoint_discovery_required  sM    --I((3E((4,,00<< . r   c           
          U R                   R                  S0 5      nUR                  5        VVs/ s H  u  p#[        UUS   US   S9PM     snn$ s  snnf )NrO   rR   rS   )rU   rR   rS   )r   rW   r   r   )r+   params
param_name	param_vals       r   client_context_parameters&ServiceModel.client_context_parameters  sg    **../DbI *0
 *8%
 #v&'8
 *8
 	
 
s   Ac                 `     U R                   U   $ ! [         a    [        SU SU  35      ef = f)N"z," not defined in the metadata of the model: )rj   r   r	   r+   rU   s     r   r   #ServiceModel._get_metadata_property  sC    	==&& 	.D6EdVL 	s    -c                     U R                   [        L a!  U R                  R                  S5      nXl         U R                   $ )NsignatureVersion)r   r   rj   rW   )r+   signature_versions     r   r!  ServiceModel.signature_version  s8    ""g- $ 1 12D E&7#&&&r   c                     Xl         g r)   )r   )r+   r   s     r   r!  r"    s    "'r   c                      SU R                   ;   $ )NawsQueryCompatible)rj   r*   s    r   is_query_compatible ServiceModel.is_query_compatible  s    #t}}44r   c                 N    U R                   R                   SU R                   S3$ )Nrz   ))r|   r   r   r*   s    r   r}   ServiceModel.__repr__  s'    ..))*!D,=,=+>a@@r   )r   r   r   rZ   r   rj   r)   )#r   r   r   r   r   r_   r   r   r   r   rr   r   r   r   r   rS   r   r   r   r   r   r   r   r  r   r  r  r  r   r   r!  setterr&  r}   r   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                      \ rS rSrS&S jr\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rS rS r S r!\S 5       r"\S  5       r#S! r$S" r%S# r&S$ r'S%r(g)'r   i  Nc                     Xl         X l        X0l        UR                  S5      U l        UR
                  U l        UR                  S0 5      U l        g)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.

rU   httpN)_operation_model_service_model	_api_namerW   
_wire_namerj   r.  )r+   r   service_modelrU   s       r   r_   OperationModel.__init__  sJ    8 !0+ *--f5%..#''3	r   c                 L    U R                   b  U R                   $ U R                  $ r)   )r1  	wire_namer*   s    r   rU   OperationModel.name+  s     >>%>>!>>!r   c                 8    U R                   R                  S5      $ )a"  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``.

rU   r/  rW   r*   s    r   r6  OperationModel.wire_name2  s     $$((00r   c                     U R                   $ r)   )r0  r*   s    r   r3  OperationModel.service_model@  s    """r   c                 :    U R                   R                  SS5      $ r   r9  r*   s    r   rS   OperationModel.documentationD  s    $$(("==r   c                 :    U R                   R                  SS5      $ )N
deprecatedFr9  r*   s    r   r@  OperationModel.deprecatedH  s    $$((u==r   c                 :    U R                   R                  SS 5      $ )Nendpointdiscoveryr9  r*   s    r   r  !OperationModel.endpoint_discoveryL  s     $$(()<dCCr   c                 :    U R                   R                  SS5      $ )NendpointoperationFr9  r*   s    r   r  .OperationModel.is_endpoint_discovery_operationR  s    $$(()<eDDr   c                 t    SU R                   ;  a  g U R                  R                  U R                   S   5      $ )Ninputr/  r0  rr   r*   s    r   input_shapeOperationModel.input_shapeV  s<    $/// ""44!!'*
 	
r   c                 t    SU R                   ;  a  g U R                  R                  U R                   S   5      $ )NoutputrJ  r*   s    r   output_shapeOperationModel.output_shape`  s<    4000 ""44!!(+
 	
r   c                     U R                   nU(       d  / $ UR                  R                  5        VVs/ s H/  u  p#SUR                  ;   d  M  UR                  S   (       d  M-  UPM1     snn$ s  snnf )NrG   )rK  r   r   rj   )r+   rK  rU   shapes       r   idempotent_members!OperationModel.idempotent_membersk  sm    &&I "-!4!4!:!:!<
!<!U^^3  12 !<
 	
 
s   A-A-#A-c           
          U R                   R                  S0 5      nUR                  5        VVs/ s H  u  p#[        X#R                  S5      S9PM     snn$ s  snnf )NstaticContextParamsr   )rU   r   )r/  rW   r   r   )r+   r  rU   propss       r   static_context_parameters(OperationModel.static_context_parametersx  sX    &&**+@"E  &||~
- #IIg4FG-
 	
 
s   $Ac           	      $   U R                   (       d  / $ U R                   R                  R                  5        VVs/ s HF  u  pSUR                  ;   d  M  SUR                  S   ;   d  M,  [	        UR                  S   S   US9PMH     snn$ s  snnf )NrN   rU   )rU   r   )rK  r   r   rj   r   )r+   rU   rR  s      r   context_parameters!OperationModel.context_parameters  s    I  $//77==?

  @/ %..88^^N3F;   @
 	
 
s   BB*Bc                 :    U R                   R                  S/ 5      $ )NoperationContextParamsr9  r*   s    r   operation_context_parameters+OperationModel.operation_context_parameters  s    $$(()A2FFr   c                 8    U R                   R                  S5      $ )Nrequestcompressionr9  r*   s    r   request_compression"OperationModel.request_compression  s    $$(()=>>r   c                 8    U R                   R                  S5      $ )Nauthr9  r*   s    r   rf  OperationModel.auth  s    $$((00r   c                 8    U R                   R                  S5      $ )Nauthtyper9  r*   s    r   	auth_typeOperationModel.auth_type      $$((44r   c                 f    U R                   (       a  [        U R                   5      $ U R                  $ r)   )rf  r   rj  r*   s    r   resolved_auth_type!OperationModel.resolved_auth_type  s"    99$TYY//~~r   c                 8    U R                   R                  S5      $ )NunsignedPayloadr9  r*   s    r   unsigned_payloadOperationModel.unsigned_payload  s    $$(():;;r   c                 f   ^  T R                   R                  S/ 5      n[        U 4S jU 5       5      $ )Nerrorsc              3   Z   >#    U  H   nTR                   R                  U5      v   M"     g 7fr)   )r0  rr   ).0sr+   s     r   	<genexpr>.OperationModel.error_shapes.<locals>.<genexpr>  s%     MfD''99!<<fs   (+)r/  rW   r   )r+   r   s   ` r   r   OperationModel.error_shapes  s,    &&**8R8MfMMMr   c                 8    U R                   R                  S5      $ )Nendpointr9  r*   s    r   r}  OperationModel.endpoint  rl  r   c                 :    U R                   R                  SS5      $ )NhttpChecksumRequiredFr9  r*   s    r   http_checksum_required%OperationModel.http_checksum_required  s    $$(()?GGr   c                 :    U R                   R                  S0 5      $ )NhttpChecksumr9  r*   s    r   http_checksumOperationModel.http_checksum  s    $$((<<r   c                 &    U R                  5       S L$ r)   )get_event_stream_inputr*   s    r   has_event_stream_input%OperationModel.has_event_stream_input  s    **,D88r   c                 &    U R                  5       S L$ r)   )get_event_stream_outputr*   s    r   has_event_stream_output&OperationModel.has_event_stream_output  s    ++-T99r   c                 8    U R                  U R                  5      $ r)   )_get_event_streamrK  r*   s    r   r  %OperationModel.get_event_stream_input  s    %%d&6&677r   c                 8    U R                  U R                  5      $ r)   )r  rO  r*   s    r   r  &OperationModel.get_event_stream_output  s    %%d&7&788r   c                 P    Uc  gUR                   nU(       a  UR                  U   $ g)zAReturns the event stream member's shape if any or None otherwise.N)r   r   )r+   rR  
event_names      r   r   OperationModel._get_event_stream  s*    =,,
==,,r   c                 &    U R                  5       S L$ r)   )get_streaming_inputr*   s    r   has_streaming_input"OperationModel.has_streaming_input  s    '')55r   c                 &    U R                  5       S L$ r)   )get_streaming_outputr*   s    r   has_streaming_output#OperationModel.has_streaming_output  s    ((*$66r   c                 8    U R                  U R                  5      $ r)   )_get_streaming_bodyrK  r*   s    r   r  "OperationModel.get_streaming_input  s    ''(8(899r   c                 8    U R                  U R                  5      $ r)   )r  rO  r*   s    r   r  #OperationModel.get_streaming_output  s    ''(9(9::r   c                     Uc  gUR                   R                  S5      nUb!  UR                  U   nUR                  S:X  a  U$ g)z?Returns the streaming member's shape if any; or None otherwise.Nr5   blob)re   rW   r   rV   )r+   rR  r5   payload_shapes       r   r  "OperationModel._get_streaming_body  sK    =%%)))4!MM'2M&&&0$$r   c                 N    U R                   R                   SU R                   S3$ )Nz(name=r)  r{   r*   s    r   r}   OperationModel.__repr__  s$    ..))*&1==r   )r1  r/  r0  r2  r.  rj   r)   ))r   r   r   r   r_   r   rU   r   r6  r3  rS   r@  r  r  rK  rO  rS  rX  r[  r_  rc  rf  rj  rn  rr  r   r}  r  r  r  r  r  r  r  r  r  r  r  r  r}   r   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                   <    \ rS rSrSr\\\\S.r	S r
S	S jrS rSrg)
r   i  zResolves shape references.)	structurer   mapstringc                     Xl         0 U l        g r)   )
_shape_map_shape_cache)r+   	shape_maps     r   r_   ShapeResolver.__init__  s    #r   Nc                 :    U R                   U   n U R                  R	                  US   [
        5      nU(       a!  UR                  5       nUR                  U5        U" XU 5      nU$ ! [         a    [        U5      ef = f! [         a    [        SU 35      ef = f)NrR   z&Shape is missing required key 'type': )	r  r   r   SHAPE_CLASSESrW   r/   r   copyupdate)r+   r\   r   r]   	shape_clsresults         r   r   ShapeResolver.get_shape_by_name  s    	0//*5K	**..{6/BEJI
 %**,K}-:D9  	0#J//	0  	#8F 	s   A( #B (A>Bc                     [        U5      S:X  a  SU;   a  U R                  US   5      $ UR                  5       n UR                  S5      nU R                  X25      $ ! [         a    [        SU 35      ef = f)N   rR  z(Invalid model, missing shape reference: )lenr   r  rc   r   r#   )r+   rt   r   r\   s       r   rr   ShapeResolver.resolve_shape_ref  s     y>Q7i#7 )))G*<==%NN,M*..w7

 ))*DD	  0>ykJ s   A A6)r  r  r)   )r   r   r   r   r   r   r   r   r   r  r_   r   rr   r   r   r   r   r   r     s*    $ $	M"Er   r   c                   (    \ rS rSrSrSS jrS rSrg)rY   i$  zEA ShapeResolver that will throw ValueErrors when shapes are resolved.Nc                      [        SU S35      e)NzAttempted to lookup shape '!', but no shape map was provided.
ValueErrorr   s      r   r   &UnresolvableShapeMap.get_shape_by_name'  s    )*5VW
 	
r   c                      [        SU S35      e)NzAttempted to resolve shape 'r  r  rs   s     r   rr   &UnresolvableShapeMap.resolve_shape_ref,  s     *9+ 6  !
 	
r   r   r)   )r   r   r   r   r   r   rr   r   r   r   r   rY   rY   $  s    O


r   rY   c                   \    \ rS rSrSrSrSS jrS rS rS r	S	 r
S
 rS rS rS rS rSrg)DenormalizedStructureBuilderi3  aZ  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booleanr  float	timestamplongdoublecharNc                     [        5       U l        [        5       U l        Uc!  U R                  R	                  S5      U l        g g )Nr  )r   r   ShapeNameGenerator_name_generatornew_shape_namerU   r  s     r   r_   %DenormalizedStructureBuilder.__init__d  s8    "}13<,,;;KHDI r   c                     Xl         U $ )zP

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

:return: self

)_members)r+   r   s     r   with_members)DenormalizedStructureBuilder.with_membersj  s      r   c                     [        5       nSU R                  S.nU R                  X!U R                  5        [	        US9n[        U R                  XR                     US9$ )zBuild the model based on the provided members.

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

r  )rR   r   )r  )r\   r]   r^   )r   r  _build_modelrU   r   r   )r+   r   denormalizedresolvers       r   build_model(DenormalizedStructureBuilder.build_modelv  s]     }}
 	,		: 62yyyy)#
 	
r   c                     US   S:X  a  U R                  X5      X#'   g US   S:X  a  U R                  X5      X#'   g US   S:X  a  U R                  X5      X#'   g US   U R                  ;   a  U R	                  U5      X#'   g [        SUS    35      e)NrR   r  r   r  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r+   rd   r   r\   s       r   r  )DenormalizedStructureBuilder._build_model  s    =K'!%!6!6u!EF6]f$!%!1!1%!@F6]e#!%!?F6]d///!%!3!3E!:F#&:5=/$JKKr   c                     [        5       nU R                  U5      nX4S'   UR                  S[        5       5      R                  5        H.  u  pVU R	                  U5      nSU0X5'   U R                  XbU5        M0     U$ )Nr   rR  )r   _build_initial_shaperW   r   _get_shape_namer  )r+   rd   r   r   rR  rU   member_modelmember_shape_names           r   r  -DenormalizedStructureBuilder._build_structure  s{    -))%0"i"'))I{}"E"K"K"MD $ 4 4\ B$&78GMl4EF #N r   c                     U R                  U5      nU R                  U5      nSU0US'   U R                  US   X#5        U$ )NrR  r   r  r  r  )r+   rd   r   r  rR  s        r   r  (DenormalizedStructureBuilder._build_list  sK     007))%0"$56h%/6Er   c                     U R                  US   5      nU R                  US   5      nU R                  U5      nSU0US'   SU0US'   U R                  US   X#5        U R                  US   X$5        U$ )Nr   r   rR  r  )r+   rd   r   key_shape_namevalue_shape_namerR  s         r   r  'DenormalizedStructureBuilder._build_map  s    --eEl;//g?))%00e!#34g%,?%.&Cr   c                 x    SUS   0nSU;   a  US   US'   [         R                   H  nX1;   d  M
  X   X#'   M     U$ )NrR   rS   )r/   ri   )r+   rd   rR  rf   s       r   r  1DenormalizedStructureBuilder._build_initial_shape  sP    E&M
 e#%*?%;E/"((D}#k ) r   c                 $    U R                  U5      $ r)   )r  r+   rd   s     r   r  *DenormalizedStructureBuilder._build_scalar  s    ((//r   c                 T    SU;   a  US   $ U R                   R                  US   5      $ )Nr\   rR   )r  r  r  s     r   r  ,DenormalizedStructureBuilder._get_shape_name  s0    5 &&''66uV}EEr   )r  r  r   rU   r)   )r   r   r   r   r   r  r_   r  r  r  r  r  r  r  r  r  r   r   r   r   r  r  3  sD    "H
LI

(
L		0Fr   r  c                   $    \ rS rSrSrS rS rSrg)r  i  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                 ,    [        [        5      U l        g r)   )r   int_name_cacher*   s    r   r_   ShapeNameGenerator.__init__  s    &s+r   c                 x    U R                   U==   S-  ss'   U R                   U   nUR                  5        SU 3$ )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

r  Type)r  
capitalize)r+   rV   current_indexs      r   r  !ShapeNameGenerator.new_shape_name  sE    4 	#q(#((3&&()m_==r   )r  N)r   r   r   r   r   r_   r  r   r   r   r   r  r    s    ,>r   r  N)*r   collectionsr   typingr   r   botocore.authr   botocore.compatr   botocore.exceptionsr   r	   r
   botocore.utilsr   r   r   r   objectr   	Exceptionr   r   r    r#   r   r&   r/   r   r   r   r   r   r   r   r   r   r   rY   r  r  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   