ó U!¶\c@sÏdZddlmZddlmZmZmZddlmZddl m Z ddl m Z e ƒZ defd„ƒYZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZde fd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZde fd„ƒYZde fd„ƒYZde fd „ƒYZd!e fd"„ƒYZd#e fd$„ƒYZd%e fd&„ƒYZd'S((s-Abstractions to interact with service models.iÿÿÿÿ(t defaultdict(tCachedPropertytinstance_cachethyphenize_service_id(t OrderedDict(tMissingServiceIdError(tUndefinedModelAttributeErrortNoShapeFoundErrorcBseZRS((t__name__t __module__(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRstInvalidShapeErrorcBseZRS((RR (((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR stOperationNotFoundErrorcBseZRS((RR (((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR stInvalidShapeReferenceErrorcBseZRS((RR (((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR $st ServiceIdcBseZd„ZRS(cCs t|ƒS(N(R(tself((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt hyphenize)s(RR R(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR (stShapecBsÈeZdZddddddddd d d d d ddddgZdddddddddg ZeZd!d„Ze d„ƒZ e d„ƒZ e d„ƒZ d„Z d„Zed „ƒZRS("s3Object representing a shape from the service model.t locationNamet queryNamet flattenedtlocationtpayloadt streamingttimestampFormatt xmlNamespacet resultWrappert xmlAttributet eventstreamteventt eventheadert eventpayloadt jsonvaluet hostLabeltrequiredtmintmaxt sensitivetenumtidempotencyTokenterrort exceptiontendpointdiscoveryidcCsb||_|d|_|jddƒ|_||_|dkrLtƒ}n||_i|_dS(s  :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. ttypet documentationtN( tnamet type_nametgetR+t _shape_modeltNonetUnresolvableShapeMapt_shape_resolvert_cache(Rt shape_namet shape_modeltshape_resolver((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt__init__=s      cCsi|j}i}x1|jD]&}||jkr||||(t __class__RR-(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt__repr__¦s cCsdS(N(R1(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pytevent_stream_nameªsN(RR t__doc__R9R>RtMAP_TYPER1R8RR<R?R@RCREtpropertyRF(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR-s"       "!  tStructureShapecBs&eZed„ƒZed„ƒZRS(cCsM|jd}|jƒ}x-|jƒD]\}}|j|ƒ||ås(R{R/Rb(RRV((Rs2/tmp/pip-install-usGedi/botocore/botocore/model.pyt error_shapesâscCs|jjdƒS(Ntendpoint(R{R/(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR’çscCs|jƒdk S(N(tget_event_stream_inputR1(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pythas_event_stream_inputëscCs|jƒdk S(N(tget_event_stream_outputR1(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pythas_event_stream_outputïscCs|j|jƒS(N(t_get_event_streamR‡(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR“óscCs|j|jƒS(N(R—R‰(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR•öscCs.|dkrdS|j}|r*|j|SdS(sAReturns the event stream member's shape if any or None otherwise.N(R1RFRK(RRŠt event_name((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR—ùs    cCs|jƒdk S(N(tget_streaming_inputR1(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pythas_streaming_inputscCs|jƒdk S(N(tget_streaming_outputR1(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pythas_streaming_outputscCs|j|jƒS(N(t_get_streaming_bodyR‡(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR™ scCs|j|jƒS(N(RR‰(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR› scCsU|dkrdS|jjdƒ}|dk rQ|j|}|jdkrQ|SndS(s?Returns the streaming member's shape if any; or None otherwise.RtblobN(R1R<R/RKR.(RRŠRt payload_shape((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRs   cCsd|jj|jfS(Ns %s(name=%s)(RDRR-(R((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyREsN(RR R1R8RR-RIR€RR+RR„RtR‡R‰R‹RR‘R’R”R–R“R•R—RšRœR™R›RRE(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRfps2 %         RXcBsNeZdZied6ed6ed6ed6Zd„Zdd„Z d„Z RS( sResolves shape references.t structureRbtmaptstringcCs||_i|_dS(N(t _shape_mapt _shape_cache(Rt shape_map((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR8*s cCsªy|j|}Wntk r0t|ƒ‚nXy|jj|dtƒ}Wn!tk rqtd|ƒ‚nX|r”|jƒ}|j|ƒn||||ƒ}|S(NR*s(Shape is missing required key 'type': %s( R£ReRt SHAPE_CLASSESR/RR tcopytupdate(RR5R`R6t shape_clstresult((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR_.s   cCs†t|ƒdkr/d|kr/|j|dƒS|jƒ}y|jdƒ}Wn!tk rqtd|ƒ‚nX|j||ƒSdS(NiRŠs*Invalid model, missing shape reference: %s(tlenR_R§R:ReR (RRBR`R5((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRA>s  N( RR RGRJRPRQRTR¦R8R1R_RA(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRXs   R2cBs#eZdZdd„Zd„ZRS(sJA ShapeResolver that will throw ValueErrors when shapes are resolved. cCstdƒ‚dS(Ns>Attempted to lookup shape '%s', but no shape map was provided.(t ValueError(RR5R`((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR_VscCstdƒ‚dS(Ns?Attempted to resolve shape '%s', but no shape map was provided.(R¬(RRB((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyRAZsN(RR RGR1R_RA(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR2Ss tDenormalizedStructureBuildercBskeZdZd d„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z RS( sÊ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. cCs@tƒ|_tƒ|_|dkr<|jjdƒ|_ndS(NR (RRKtShapeNameGeneratort_name_generatorR1tnew_shape_nameR-(RR-((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR8ƒs   cCs ||_|S(sp :type members: dict :param members: The denormalized members. :return: self (t_members(RRK((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt with_members‰s cCshtƒ}idd6|jd6}|j|||jƒtd|ƒ}td|jd||jd|ƒS(s™Build the model based on the provided members. :rtype: botocore.model.StructureShape :return: The built StructureShape object. R R*RKR¥R5R6R7(RR±t _build_modelR-RXRJ(RRVt denormalizedtresolver((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt build_model•s   c Cs¹|ddkr)|j||ƒ||>> 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 is%sType%s(RÉt capitalize(RR.t current_index((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR°îs  (RR RGR8R°(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyR®äs N( RGt collectionsRtbotocore.utilsRRRtbotocore.compatRtbotocore.exceptionsRRtobjectRYt ExceptionRR R R tstrR RRJRPRQRTRURfRXR2R­R®(((s2/tmp/pip-install-usGedi/botocore/botocore/model.pyt s, ‚ ”¯4 …