
    vKgy                        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  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)resolve_auth_type)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       N/var/www/highfloat_scraper/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)	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)Shape2   z3Object representing a shape from the service model.)locationName	queryName	flattenedlocationpayload	streamingtimestampFormatxmlNamespaceresultWrapperxmlAttributeeventstreameventeventheadereventpayload	jsonvaluer5   	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getrQ   _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/   rS   )rV   SERIALIZED_ATTRSpop)r)   modelserializationattrs       r   rc   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.

)rV   METADATA_ATTRS)r)   rb   metadatard   s       r   rh   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?   rh   rU   r(   s    r   required_membersShape.required_members   s     }}  R00r   c                 8    U R                   R                  U5      $ r'   rX   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   rS   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   )rY   rV   rX   rQ   rS   rT   r'   )r   r   r   r   __doc__r`   rg   r   MAP_TYPEr]   r
   rc   rh   rl   rs   r{   propertyr~   r   r   r   r   r-   r-   2   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)rV   rU   r   itemsrs   )r)   r   shape_membersrS   rr   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 )Nr9   )r   r   rc   rU   )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                  $ )NrG   FrF   code)rh   rU   rS   )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      $ )NrJ   Frk   r(   s    r   is_document_typeStructureShape.is_document_type   s    }}  U33r   c                 :    U R                   R                  SS5      $ )NrK   Frk   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   rs   rV   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      $ )NrD   rk   r(   s    r   rD   StringShape.enum  s    }}  ,,r   r   N)r   r   r   r   r
   rD   r   r   r   r   r   r     s    - -r   r   c                   4    \ rS rSr% \\S'   \\\4   \S'   Srg)StaticContextParameteri  rS   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  rS   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!  rS   rP   rQ   r   Nr   r   r   r   r   r   !  s    
I
Ir   r   c                   x   \ 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 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.

rh   shapesN)	_service_descriptionrU   rh   ShapeResolverrX   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'   )rX   get_shape_by_namer)   rZ   member_traitss      r   	shape_forServiceModel.shape_forM  s    ##55
 	
r   c                 :    U R                   R                  US 5      $ r'   )_error_code_cacherU   )r)   r   s     r   shape_for_error_code!ServiceModel.shape_for_error_codeR  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_cacheU  s3    ,,K))D%0T" -  r   c                 8    U R                   R                  U5      $ r'   ro   rq   s     r   rp   ServiceModel.resolve_shape_ref]  ru   r   c                 L    [        U R                  R                  S0 5      5      $ )Nr   listr   rU   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$ )NrG   F)r   r   rh   rU   append)r)   r   rZ   r   s       r   r   ServiceModel.error_shapesd  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_namerb   s      r   operation_modelServiceModel.operation_modelm  sG    	9--l;NKE e>::  	9(88	9s     6c                 :    U R                   R                  SS5      $ NrQ   rR   )r   rU   r(   s    r   rQ   ServiceModel.documentationu  s    ((,,_bAAr   c                 L    [        U R                  R                  S/ 5      5      $ r   r   r(   s    r   operation_namesServiceModel.operation_namesy  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)rh   rU   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)   	operationrb   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_discoveryrU   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 )NrM   rP   rQ   )rS   rP   rQ   )r   rU   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: )rh   r   r	   r)   rS   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   rh   rU   )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)rh   r(   s    r   is_query_compatible ServiceModel.is_query_compatible  s    #t}}44r   c                 N    U R                   R                   SU R                   S3$ )Nrx   ))rz   r   r   r(   s    r   r{   ServiceModel.__repr__  s'    ..))*!D,=,=+>a@@r   )r   r   r   rX   r   rh   r'   )!r   r   r   r   r   r]   r   r   r
   r   rp   r   r   r   r   rQ   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 = =     	
 	
 ' ' ( ( 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 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.

rS   httpN)_operation_model_service_model	_api_namerU   
_wire_namerh   r#  )r)   r   service_modelrS   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   rS   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``.

rS   r$  rU   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   rQ   OperationModel.documentation(  s    $$(("==r   c                 :    U R                   R                  SS5      $ )N
deprecatedFr.  r(   s    r   r5  OperationModel.deprecated,  s    $$((u==r   c                 :    U R                   R                  SS 5      $ )Nendpointdiscoveryr.  r(   s    r   r  !OperationModel.endpoint_discovery0  s     $$(()<dCCr   c                 :    U R                   R                  SS5      $ )NendpointoperationFr.  r(   s    r   r  .OperationModel.is_endpoint_discovery_operation6  s    $$(()<eDDr   c                 t    SU R                   ;  a  g U R                  R                  U R                   S   5      $ )Ninputr$  r%  rp   r(   s    r   input_shapeOperationModel.input_shape:  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_shapeD  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 )NrE   )r@  r   r   rh   )r)   r@  rS   shapes       r   idempotent_members!OperationModel.idempotent_membersO  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   )rS   r   )r$  rU   r   r   )r)   r  rS   propss       r   static_context_parameters(OperationModel.static_context_parameters\  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 )NrL   rS   )rS   r   )r@  r   r   rh   r   )r)   rS   rG  s      r   context_parameters!OperationModel.context_parametersd  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_compressions  s    $$(()=>>r   c                 8    U R                   R                  S5      $ )Nauthr.  r(   s    r   rW  OperationModel.authw  s    $$((00r   c                 8    U R                   R                  S5      $ )Nauthtyper.  r(   s    r   	auth_typeOperationModel.auth_type{      $$((44r   c                 f    U R                   (       a  [        U R                   5      $ U R                  $ r'   )rW  r   r[  r(   s    r   resolved_auth_type!OperationModel.resolved_auth_type  s"    99$TYY//~~r   c                 8    U R                   R                  S5      $ )NunsignedPayloadr.  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   X   >#    U H   nTR                   R                  U5      v   M"     g 7fr'   )r%  rp   ).0sr)   s     r   	<genexpr>.OperationModel.error_shapes.<locals>.<genexpr>  s%     MfD''99!<<fs   '*)r$  rU   r   )r)   r   s   ` r   r   OperationModel.error_shapes  s,    &&**8R8MfMMMr   c                 8    U R                   R                  S5      $ )Nendpointr.  r(   s    r   rn  OperationModel.endpoint  r]  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   ry  %OperationModel.get_event_stream_input  s    %%d&6&677r   c                 8    U R                  U R                  5      $ r'   )r  rD  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)   rG  
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_bodyr@  r(   s    r   r  "OperationModel.get_streaming_input  s    ''(8(899r   c                 8    U R                  U R                  5      $ r'   )r  rD  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.Nr3   blob)rc   rU   r   rT   )r)   rG  r3   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  ry   r(   s    r   r{   OperationModel.__repr__  s$    ..))*&1==r   )r&  r$  r%  r'  r#  rh   r'   )(r   r   r   r   r]   r
   rS   r   r+  r(  rQ   r5  r  r  r@  rD  rH  rM  rP  rT  rW  r[  r_  rc  r   rn  rr  rv  rz  r~  ry  r}  r  r  r  r  r  r  r{   r   r   r   r   r   r     s'   #4J " " 1 1 # # > > > > D D
 E E 
 
 
 
 

 

 
 
 
 
 ? ? 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)NrP   z&Shape is missing required key 'type': )	r  r   r   SHAPE_CLASSESrU   r-   r   copyupdate)r)   rZ   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   rG  z(Invalid model, missing shape reference: )lenr   r  ra   r   r!   )r)   rr   r   rZ   s       r   rp   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   rp   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)rW   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  rq   s     r   rp   &UnresolvableShapeMap.resolve_shape_ref  s     *9+ 6  !
 	
r   r   r'   )r   r   r   r   r   r   rp   r   r   r   r   rW   rW     s    O


r   rW   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_namerS   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  )rP   r   )r  )rZ   r[   r\   )r   r  _build_modelrS   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)NrP   r  r   r  zUnknown shape type: )_build_structure_build_list
_build_mapSCALAR_TYPES_build_scalarr   )r)   rb   r   rZ   s       r   r  )DenormalizedStructureBuilder._build_modelj  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   rG  )r   _build_initial_shaperU   r   _get_shape_namer  )r)   rb   r   r   rG  rS   member_modelmember_shape_names           r   r  -DenormalizedStructureBuilder._build_structurev  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$ )NrG  r   r  r  r  )r)   rb   r   r  rG  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   rG  r  )r)   rb   r   key_shape_namevalue_shape_namerG  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$ )NrP   rQ   )r-   rg   )r)   rb   rG  rd   s       r   r  1DenormalizedStructureBuilder._build_initial_shape  sP    E&M
 e#%*?%;E/"((D}#k ) r   c                 $    U R                  U5      $ r'   )r  r)   rb   s     r   r  *DenormalizedStructureBuilder._build_scalar  s    ((//r   c                 T    SU;   a  US   $ U R                   R                  US   5      $ )NrZ   rP   )r  r  r  s     r   r  ,DenormalizedStructureBuilder._get_shape_name  s0    5 &&''66uV}EEr   )r  r  r   rS   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)   rT   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	   botocore.utilsr
   r   r   objectr   	Exceptionr   r   r   r!   r   r$   r-   r   r   r   r   r   r   r   r   r   r   rW   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Db> b>J3E 3El
 
QF QFh'> '>r   