B 䊇c|@sddlZddlmZddZddZddZed d d d d ddgZGdd d eZGdddZGdddZ GdddZ ddddddZ e d eeje ZddZd d!ZdS)"N) namedtuplecCsdddddddd||S)zGet the Python type name for a given model type. >>> py_type_name('list') 'list' >>> py_type_name('structure') 'dict' :rtype: string bytesstringfloatintegerdictdatetime)blob characterdoublelongmap structure timestamp)get) type_namern/private/var/folders/8c/hx9_v10d5x38qmnzt13b7b8j1k3n5b/T/pip-target-x6xd5gna/lib/python/botocore/docs/utils.py py_type_names rc Cs"ddddddddddd |d S) zGet the Python default value for a given model type. >>> py_default('string') ''string'' >>> py_default('list') '[...]' >>> py_default('unknown') '...' :rtype: string z123.0Z123z'string'zb'bytes'z True|Falsez[...]z{...}zdatetime(2015, 1, 1)) r r rrr booleanlistr rrz...)r)rrrr py_default&s rcCsn|jd}|jdd}|dr0|dd}|drF|dd}|rj||krj|d |d 7}|S) zwGenerate the official name of an AWS Service :param service_model: The service model representing the service ZserviceFullNameZserviceAbbreviationZAmazonNZAWSz ())metadatar startswithlower)Z service_modelZ official_nameZ short_namerrrget_official_service_name@s     rDocumentedShapenamer documentationrmembersrequired_memberscs"eZdZdZdfdd ZZS)r zBUse this class to inject new shapes into a model for documentationNc s<|dkr g}|dkrg}|dkr$g}t|||||||S)N)super__new__)clsr!rr"rr#r$) __class__rrr&`s zDocumentedShape.__new__)NNN)__name__ __module__ __qualname____doc__r& __classcell__rr)r(rr ]sc@seZdZdddZddZdS)AutoPopulatedParamNcCs||_||_|dkrd|_dS)Nz{Please note that this parameter is automatically populated if it is not provided. Including this parameter is not required )r!param_description)selfr!r/rrr__init__{szAutoPopulatedParam.__init__cKs~|drN|j|jkrz||j}d|jkr6|d|d}||jn,|drz|d}|j|jkrz||jdS)zDocuments auto populated parameters It will remove any required marks for the parameter, remove the parameter from the example, and add a snippet about the parameter being autopopulated in the description. zdocs.request-paramsz is-requiredzparam-documentationzdocs.request-examplezstructure-valueN)rr!available_sections get_sectiondelete_sectionwritelnr/)r0 event_namesectionkwargsdescription_sectionrrrdocument_auto_populated_params        z0AutoPopulatedParam.document_auto_populated_param)N)r)r*r+r1r:rrrrr.zs r.c@s eZdZdZddZddZdS)HideParamFromOperationsa>Hides a single parameter from multiple operations. This method will remove a parameter from documentation and from examples. This method is typically used for things that are automatically populated because a user would be unable to provide a value (e.g., a checksum of a serialized XML request body).cCsX||_t|_t|_d}d}x4|D],}|j|||f|j|||fq$WdS)a( :type service_name: str :param service_name: Name of the service to modify. :type parameter_name: str :param parameter_name: Name of the parameter to modify. :type operation_names: list :param operation_names: Operation names to modify. z*docs.request-params.%s.%s.complete-sectionz+docs.request-example.%s.%s.complete-sectionN)_parameter_nameset_params_events_example_eventsadd)r0 service_nameparameter_nameZoperation_namesZparam_templateZexample_templater!rrrr1s  z HideParamFromOperations.__init__cKs@||jkr|d}n||jkr$dS|j|jkr<||jdS)Nzstructure-value)r?r3r>r<r2r4)r0r6r7r8rrr hide_params     z"HideParamFromOperations.hide_paramN)r)r*r+r,r1rCrrrrr;sr;c@s eZdZdZddZddZdS)AppendParamDocumentationz-Appends documentation to a specific parametercCs||_||_dS)N)r< _doc_string)r0rBZ doc_stringrrrr1sz!AppendParamDocumentation.__init__cKs2|j|jkr.||j}|d}||jdS)Nzparam-documentation)r<r2r3r5rE)r0r6r7r8r9rrrappend_documentations   z-AppendParamDocumentation.append_documentationN)r)r*r+r,r1rFrrrrrDsrDz\nz\rz\tz\bz\f)    |cCst|dS)Nr) _CONTROLSgroup)matchrrrrPcCs tt|S)N)_ESCAPE_CONTROLS_REsub_CONTROLS_MATCH_HANDLER)valuerrrescape_controlssrV)re collectionsrrrrZ_DocumentedShaper r.r;rDrMcompilejoinr escaperRrTrVrrrr s0 !'