B ݁[@sddlZddlmZddZddZddZed d d d d ddgZGdd d eZGdddeZ GdddeZ GdddeZ ddddddZ e deeje 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_namerT/Users/kashii/Desktop/Projects/Workshops/worker-safety/lambda/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 rcCsl|jd}|jdd}|dr0|dd}|drF|dd}|rh||krh|d |7}|S) zwGenerate the official name of an AWS Service :param service_model: The service model representing the service serviceFullNameserviceAbbreviationAmazonNAWSz ({0}))metadatar startswithlowerformat) service_modelZ official_nameZ short_namerrrget_official_service_name@s     r$DocumentedShapenamer documentationrmembersrequired_memberscs"eZdZdZdfdd ZZS)r%zBUse this class to inject new shapes into a model for documentationNc s@|dkr g}|dkrg}|dkr$g}tt||||||||S)N)superr%__new__)clsr&rr'rr(r)) __class__rrr+Ws  zDocumentedShape.__new__)NNN)__name__ __module__ __qualname____doc__r+ __classcell__rr)r-rr%Usc@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&r4rrr__init__eszAutoPopulatedParam.__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)r r&available_sections get_sectiondelete_sectionwritelnr4)r5 event_namesectionkwargsdescription_sectionrrrdocument_auto_populated_paramns        z0AutoPopulatedParam.document_auto_populated_param)N)r.r/r0r6r?rrrrr3ds r3c@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)r5 service_nameparameter_nameoperation_namesZparam_templateZexample_templater&rrrr6s  z HideParamFromOperations.__init__cKs@||jkr|d}n||jkr$dS|j|jkr<||jdS)Nzstructure-value)rDr8rCrAr7r9)r5r;r<r=rrr hide_params     z"HideParamFromOperations.hide_paramN)r.r/r0r1r6rIrrrrr@sr@c@s eZdZdZddZddZdS)AppendParamDocumentationz-Appends documentation to a specific parametercCs||_||_dS)N)rA _doc_string)r5rGZ doc_stringrrrr6sz!AppendParamDocumentation.__init__cKs2|j|jkr.||j}|d}||jdS)Nzparam-documentation)rAr7r8r:rK)r5r;r<r=r>rrrappend_documentations   z-AppendParamDocumentation.append_documentationN)r.r/r0r1r6rLrrrrrJsrJz\nz\rz\tz\bz\f)    |cCst|dS)Nr) _CONTROLSgroup)matchrrrsrVcCs tt|S)N)_ESCAPE_CONTROLS_REsub_CONTROLS_MATCH_HANDLER)valuerrrescape_controlssr[)re collectionsrrrr$Z_DocumentedShaper%objectr3r@rJrScompilejoinr escaperWrYr[rrrr s&   &