B 䊇c]-@sLddlmZddlmZGdddeZGdddeZGdddeZd S) )ShapeDocumenter) py_type_namec@sneZdZdddZddZdddZddd Zdd d Zdd d ZddZ ddZ ddZ ddZ ddZ dS)BaseParamsDocumenterNcCsg}|j|||d||ddS)a3Fills out the documentation for a section given a model shape. :param section: The section to write the documentation to. :param shape: The shape of the operation. :type include: Dictionary where keys are parameter names and values are the shapes of the parameter names. :param include: The parameter shapes to include in the documentation. :type exclude: List of the names of the parameters to exclude. :param exclude: The names of the parameters to exclude from documentation. N)sectionshapehistorynameincludeexclude)traverse_and_document_shape)selfrrr r rr o/private/var/folders/8c/hx9_v10d5x38qmnzt13b7b8j1k3n5b/T/pip-target-x6xd5gna/lib/python/botocore/docs/params.pydocument_paramssz$BaseParamsDocumenter.document_paramscKs|j||f|dS)N)_add_member_documentation)r rrkwargsr r rdocument_recursive_shape+sz-BaseParamsDocumenter.document_recursive_shapecKs|j||f|dS)N)r)r rrrr r rr r rdocument_shape_default.sz+BaseParamsDocumenter.document_shape_defaultc Ksb|j||f||j}|j|jd|jjid}|||j|||dd|d}||dS)Nr)context)rrrrzend-list)rmemberadd_new_sectionr_start_nested_paramr _end_nested_param) r rrrr r r param_shape param_sectionr r rdocument_shape_type_list3s  z-BaseParamsDocumenter.document_shape_type_listc Ks|j||f||jdd|jjid}|||||j|j|jjd|jjid}|j|||j||j|dd|d} | | | | dS)Nkeyr)r)rrrrzend-map) rrrrrvaluestyleindentr r) r rrrr r rZ key_sectionr end_sectionr r rdocument_shape_type_mapEs"     z,BaseParamsDocumenter.document_shape_type_mapc Ks||j|}|j|||dxR|D]J} |r6| |kr6q$|| } |j| d| jid} || |j| | || dq$W|d}||dS)N)rr)r)rrrrz end-structure)_add_members_to_shapemembersrrrrr r) r rrrr r rrr#paramrrr r rdocument_shape_type_structure`s      z2BaseParamsDocumenter.document_shape_type_structurecKsdS)Nr )r rrrr r rr}sz.BaseParamsDocumenter._add_member_documentationcCs(|r$|}x|D]}|||j<qW|S)N)copyr)r r#r r$r r rr"s  z*BaseParamsDocumenter._add_members_to_shapecCsD||}t|j}d}|dk r0|||n|j||dS)Nz(%s) -- )_get_special_py_type_namer type_namewriterZitalics)r type_sectionrZspecial_py_typepy_typeZ type_formatr r r"_document_non_top_level_param_types   z7BaseParamsDocumenter._document_non_top_level_param_typecCs|j|jdS)N)rrnew_line)r rr r rrs z(BaseParamsDocumenter._start_nested_paramcCs|j|jdS)N)rdedentr-)r rr r rrs z&BaseParamsDocumenter._end_nested_param)NN)NN)NN)NN)NNN)__name__ __module__ __qualname__rrrrr!r%rr"r,rrr r r rrs      rc@s&eZdZdZdZdddZddZdS) ResponseParamsDocumenterz5Generates the description for the response parameterszresponse-paramsNc Ks|d}|d|dk r,|jd||d}||||d}|jr|jt|ddr|d}d } d d d |j D} d } || | |d} | j | | |j|j dS)Nz param-namez- z%s z param-typezparam-documentationis_tagged_unionFzparam-tagged-union-docsaK.. note:: This is a Tagged Union structure. Only one of the following top level keys will be set: %s. If a client receives an unknown member it will set ``SDK_UNKNOWN_MEMBER`` as the top level key, which maps to the name or tag of the unknown member. The structure of ``SDK_UNKNOWN_MEMBER`` is as followsz, cSsg|] }d|qS)z``%s``r ).0rr r r szFResponseParamsDocumenter._add_member_documentation..z3'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}zparam-unknown-example)rr)rboldr, documentationrgetattrjoinr#keysZ codeblockinclude_doc_string new_paragraph) r rrrr name_sectionr*documentation_sectiontagged_union_docsnotetagged_union_members_strZunknown_code_exampleZexampler r rrs*           z2ResponseParamsDocumenter._add_member_documentationcKs|j|||f|dS)N)r%)r rrrrr r r document_shape_type_event_streamsz9ResponseParamsDocumenter.document_shape_type_event_stream)N)r/r0r1__doc__ EVENT_NAMErrBr r r rr2s &r2c@s8eZdZdZdZd ddZdddZd d Zd d ZdS)RequestParamsDocumenterz4Generates the description for the request parameterszrequest-paramsNc Kst|dkr&|j||f||j||j|}xft|D]Z\}} |rT| |krTq>|| } |j| d| jid} | j | |j k} |j | | || | dq>W|d}t|dkr|j |j dS)Nr)r)rrrr is_requiredz end-structure) lenrrrr"r# enumeraterrr-Zrequired_membersr r.) r rrrr r rr#ir$rrrGr r rr%s,         z5RequestParamsDocumenter.document_shape_type_structureFcKsd||}|dkrt|j}|rn|d}|d|d||d} | j|d} | d|nB|d} | d|dk r| jd||d}||||r|d } | j | jd |j rL|d } | j t |d d r4|d} d}d dd|j D}| ||| |j || ||d}|jdS)Nz param-typez:type z: zend-param-typez param-namez :param %s: z- z%s z is-requiredz [REQUIRED] zparam-documentationr3Fzparam-tagged-union-docszl.. note:: This is a Tagged Union structure. Only one of the following top level keys can be set: %s. z, cSsg|] }d|qS)z``%s``r )r4rr r rr5szERequestParamsDocumenter._add_member_documentation..z end-param)r'rr(rr)rr-r6r,rr7r8r9r#r:r; _add_special_trait_documentationr<)r rrrZis_top_level_paramrGrr+r*Zend_type_sectionr=Zis_required_sectionr>r?r@rAZend_param_sectionr r rrsF                 z1RequestParamsDocumenter._add_member_documentationcCsd|jkr||dS)NZidempotencyToken)metadata!_append_idempotency_documentation)r rrr r rrK%s z8RequestParamsDocumenter._add_special_trait_documentationcCsd}||dS)Nz,This field is autopopulated if not provided.)r))r rZ docstringr r rrM)sz9RequestParamsDocumenter._append_idempotency_documentation)NN)NFF) r/r0r1rCrDr%rrKrMr r r rrEs  1rEN)Zbotocore.docs.shaperZbotocore.docs.utilsrrr2rEr r r r s   1