
    w                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	J
r
  SSK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)OrderedDict)MissingServiceIdErrorUndefinedModelAttributeError)CachedPropertyhyphenize_service_idinstance_cachec                       \ rS rSrSrg)NoShapeFoundError    N__name__
__module____qualname____firstlineno____static_attributes__r       !lib/third_party/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)	ServiceId+   c                     [        U 5      $ N)r
   selfs    r   	hyphenizeServiceId.hyphenize,   s    #D))r   r   N)r   r   r   r   r)   r   r   r   r   r#   r#   +   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)Shape0   z3Object representing a shape from the service model.)locationName	queryName	flattenedlocationpayload	streamingtimestampFormatxmlNamespaceresultWrapperxmlAttributeeventstreameventeventheadereventpayload	jsonvaluer4   	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getrP   _shape_modelUnresolvableShapeMap_shape_resolver_cache)r(   
shape_nameshape_modelshape_resolvers       r   __init__Shape.__init__^   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.

r.   rR   )rU   SERIALIZED_ATTRSpop)r(   modelserializationattrs       r   rb   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.

)rU   METADATA_ATTRS)r(   ra   metadatarc   s       r   rg   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.

r>   rg   rT   r'   s    r   required_membersShape.required_members   s     }}  R00r   c                 8    U R                   R                  U5      $ r&   rW   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   rR   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   )rX   rU   rW   rP   rR   rS   r&   )r   r   r   r   __doc__r_   rf   r   MAP_TYPEr\   r	   rb   rg   rk   rr   rz   propertyr}   r   r   r   r   r,   r,   0   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)rU   rT   r   itemsrr   )r(   r   shape_membersrR   rq   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 )Nr8   )r   r   rb   rT   )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                  $ )NrF   FrE   code)rg   rT   rR   )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      $ )NrI   Frj   r'   s    r   is_document_typeStructureShape.is_document_type   s    }}  U33r   c                 :    U R                   R                  SS5      $ )NrJ   Frj   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)	ListShape   c                 >    U R                  U R                  S   5      $ )Nr   rr   rU   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      $ )NrC   rj   r'   s    r   rC   StringShape.enum  s    }}  ,,r   r   N)r   r   r   r   r	   rC   r   r   r   r   r   r     s    - -r   r   c                   4    \ rS rSr% \\S'   \\\4   \S'   Srg)StaticContextParameteri  rR   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  rR   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  rR   rO   rP   r   Nr   r   r   r   r   r     s    
I
Ir   r   c                   h   \ 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 r\S 5       r\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.

rg   shapesN)	_service_descriptionrT   rg   ShapeResolverrW   NOT_SET_signature_version_service_name_instance_cache)r(   service_descriptionservice_names      r   r\   ServiceModel.__init__,  sS    * %8!+//
B?,##Hb1 
 #*)!r   c                 8    U R                   R                  X5      $ r&   )rW   get_shape_by_namer(   rY   member_traitss      r   	shape_forServiceModel.shape_forK  s    ##55
 	
r   c                 :    U R                   R                  US 5      $ r&   )_error_code_cacherT   )r(   r   s     r   shape_for_error_code!ServiceModel.shape_for_error_codeP  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_cacheS  s3    ,,K))D%0T" -  r   c                 8    U R                   R                  U5      $ r&   rn   rp   s     r   ro   ServiceModel.resolve_shape_ref[  rt   r   c                 L    [        U R                  R                  S0 5      5      $ )Nr   listr   rT   r'   s    r   shape_namesServiceModel.shape_names^  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$ )NrF   F)r   r   rg   rT   append)r(   r   rY   r   s       r   r   ServiceModel.error_shapesb  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_namera   s      r   operation_modelServiceModel.operation_modelk  sG    	9--l;NKE e>::  	9(88	9s     6c                 :    U R                   R                  SS5      $ NrP   rQ   )r   rT   r'   s    r   rP   ServiceModel.documentations  s    ((,,_bAAr   c                 L    [        U R                  R                  S/ 5      5      $ r   r   r'   s    r   operation_namesServiceModel.operation_namesw  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)rg   rT   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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(   	operationra   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)Nr>   TF)r   r   endpoint_discoveryrT   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 )NrL   rO   rP   )rR   rO   rP   )r   rT   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: )rg   r   r   r(   rR   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   rg   rT   )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                 N    U R                   R                   SU R                   S3$ )Nrw   ))ry   r   r   r'   s    r   rz   ServiceModel.__repr__  s'    ..))*!D,=,=+>a@@r   )r   r   r   rW   r   rg   r&   ) r   r   r   r   r   r\   r   r   r	   r   ro   r   r   r   r   rP   r   r   r   r   r   r   r   r  r  r  r   r   r  setterrz   r   r   r   r   r   r   %  s   ">

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

rR   httpN)_operation_model_service_model	_api_namerT   
_wire_namerg   r  )r(   r   service_modelrR   s       r   r\   OperationModel.__init__  sJ    8 !0+ *--f5%..#''3	r   c                 L    U R                   b  U R                   $ U R                  $ r&   )r"  	wire_namer'   s    r   rR   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``.

rR   r   rT   r'   s    r   r'  OperationModel.wire_name  s     $$((00r   c                     U R                   $ r&   )r!  r'   s    r   r$  OperationModel.service_model  s    """r   c                 :    U R                   R                  SS5      $ r   r*  r'   s    r   rP   OperationModel.documentation"  s    $$(("==r   c                 :    U R                   R                  SS5      $ )N
deprecatedFr*  r'   s    r   r1  OperationModel.deprecated&  s    $$((u==r   c                 :    U R                   R                  SS 5      $ )Nendpointdiscoveryr*  r'   s    r   r  !OperationModel.endpoint_discovery*  s     $$(()<dCCr   c                 :    U R                   R                  SS5      $ )NendpointoperationFr*  r'   s    r   r  .OperationModel.is_endpoint_discovery_operation0  s    $$(()<eDDr   c                 t    SU R                   ;  a  g U R                  R                  U R                   S   5      $ )Ninputr   r!  ro   r'   s    r   input_shapeOperationModel.input_shape4  s<    $/// ""44!!'*
 	
r   c                 t    SU R                   ;  a  g U R                  R                  U R                   S   5      $ )Noutputr;  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 )NrD   )r<  r   r   rg   )r(   r<  rR   shapes       r   idempotent_members!OperationModel.idempotent_membersI  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   )rR   r   )r   rT   r   r   )r(   r  rR   propss       r   static_context_parameters(OperationModel.static_context_parametersV  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 )NrK   rR   )rR   r   )r<  r   r   rg   r   )r(   rR   rC  s      r   context_parameters!OperationModel.context_parameters^  s    I  $//77==?

  @/ %..88^^N3F;   @
 	
 
s   BB*Bc                 8    U R                   R                  S5      $ )Nrequestcompressionr*  r'   s    r   request_compression"OperationModel.request_compressionm  s    $$(()=>>r   c                 8    U R                   R                  S5      $ )Nauthtyper*  r'   s    r   	auth_typeOperationModel.auth_typeq      $$((44r   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&   )r!  ro   ).0sr(   s     r   	<genexpr>.OperationModel.error_shapes.<locals>.<genexpr>x  s%     MfD''99!<<fs   (+)r   rT   r   )r(   r   s   ` r   r   OperationModel.error_shapesu  s,    &&**8R8MfMMMr   c                 8    U R                   R                  S5      $ )Nendpointr*  r'   s    r   r`  OperationModel.endpointz  rV  r   c                 :    U R                   R                  SS5      $ )NhttpChecksumRequiredFr*  r'   s    r   http_checksum_required%OperationModel.http_checksum_required~  s    $$(()?GGr   c                 :    U R                   R                  S0 5      $ )NhttpChecksumr*  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_streamr<  r'   s    r   rk  %OperationModel.get_event_stream_input  s    %%d&6&677r   c                 8    U R                  U R                  5      $ r&   )rs  r@  r'   s    r   ro  &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(   rC  
event_names      r   rs   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_bodyr<  r'   s    r   r{  "OperationModel.get_streaming_input  s    ''(8(899r   c                 8    U R                  U R                  5      $ r&   )r  r@  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.Nr2   blob)rb   rT   r   rS   )r(   rC  r2   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  rx   r'   s    r   rz   OperationModel.__repr__  s$    ..))*&1==r   )r"  r   r!  r#  r  rg   r&   )%r   r   r   r   r\   r	   rR   r   r'  r$  rP   r1  r  r  r<  r@  rD  rI  rL  rP  rT  r   r`  rd  rh  rl  rp  rk  ro  rs  r|  r  r{  r  r  rz   r   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                   <    \ 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)NrO   z&Shape is missing required key 'type': )	r  r   r   SHAPE_CLASSESrT   r,   r   copyupdate)r(   rY   r   rZ   	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   rC  z(Invalid model, missing shape reference: )lenr   r  r`   r   r    )r(   rq   r   rY   s       r   ro   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   ro   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)rV   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  rp   s     r   ro   &UnresolvableShapeMap.resolve_shape_ref  s     *9+ 6  !
 	
r   r   r&   )r   r   r   r   r   r   ro   r   r   r   r   rV   rV     s    O


r   rV   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)DenormalizedStructureBuilderi  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_namerR   r  s     r   r\   %DenormalizedStructureBuilder.__init__0  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_members6  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  )rO   r   )r  )rY   rZ   r[   )r   r  _build_modelrR   r   r   )r(   r   denormalizedresolvers       r   build_model(DenormalizedStructureBuilder.build_modelB  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)NrO   r  r   r  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r(   ra   r   rY   s       r   r  )DenormalizedStructureBuilder._build_modelV  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   rC  )r   _build_initial_shaperT   r   _get_shape_namer  )r(   ra   r   r   rC  rR   member_modelmember_shape_names           r   r  -DenormalizedStructureBuilder._build_structureb  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$ )NrC  r   r  r  r  )r(   ra   r   r  rC  s        r   r  (DenormalizedStructureBuilder._build_listm  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   rC  r  )r(   ra   r   key_shape_namevalue_shape_namerC  s         r   r  'DenormalizedStructureBuilder._build_mapt  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$ )NrO   rP   )r,   rf   )r(   ra   rC  rc   s       r   r  1DenormalizedStructureBuilder._build_initial_shape~  sP    E&M
 e#%*?%;E/"((D}#k ) r   c                 $    U R                  U5      $ r&   )r  r(   ra   s     r   r  *DenormalizedStructureBuilder._build_scalar  s    ((//r   c                 T    SU;   a  US   $ U R                   R                  US   5      $ )NrY   rO   )r  r  r  s     r   r  ,DenormalizedStructureBuilder._get_shape_name  s0    5 &&''66uV}EEr   )r  r  r   rR   r&   )r   r   r   r   r   r  r\   r  r  r  r  r  r  r  r  r  r   r   r   r   r  r    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(   rS   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.compatr   botocore.exceptionsr   r   botocore.utilsr	   r
   r   objectr   	Exceptionr   r   r   r    r   r#   r,   r   r   r   r   r   r   r   r   r   r   rV   r  r  r   r   r   <module>r     s   4 # $ ' P O
(		 			 		Y 		 	* *
b bJ'1U '1TD DCu C-% -Z 
z 
Z {A {A|T> T>n3E 3El
 
QF QFh'> '>r   