o .&a/"@sLddlmZddlmZGdddeZGdddeZGdddeZd S) )ShapeDocumenter) py_defaultc@seZdZ  dddZddZ  dddZ ddd Z  dd d Z dd d Z dddZ ddZ dddZ dddZ ddZ dS)BaseExampleDocumenterNcCsBg}|j|j|dur|||j|||||ddS)a]Generates an example based on a shape :param section: The section to write the documentation to. :param shape: The shape of the operation. :param prefix: Anything to be included before the example :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)sectionshapehistoryincludeexclude)stylenew_linestart_codeblockwritetraverse_and_document_shape)selfrrprefixrr rr7/usr/lib/python3/dist-packages/botocore/docs/example.pydocument_examples    z&BaseExampleDocumenter.document_examplecKs|ddS)Nz{'... recursive ...'})r )rrrkwargsrrrdocument_recursive_shape-sz.BaseExampleDocumenter.document_recursive_shapecKs>||}|durt|j}|jd|krd}||dS)Nstreaming_shapezStreamingBody())_get_special_py_defaultr type_name_contextgetr )rrrrrr rpy_typerrrdocument_shape_default0s  z,BaseExampleDocumenter.document_shape_defaultc Ksfd|jvr*t|jdD]\}}|d||t|jddkr'|dq dS||||dS)Nenum'%s'|)metadata enumerater lenr) rrrrrr rirrrrdocument_shape_type_string:s  z0BaseExampleDocumenter.document_shape_type_stringc Ksn|j}|d}||d|jdd|jid} |j| ||d|d} | d|d } || d dS) Nz list-value[memberrcontextrrr ending-comma,ending-bracket])r'add_new_section_start_nested_paramnamerr _end_nested_param) rrrrrr r param_shape list_section param_sectionending_comma_sectionending_bracket_sectionrrrdocument_shape_type_listDs     z.BaseExampleDocumenter.document_shape_type_listcKs|js |ddS|d}||d||j|}t|D]E\}} |r+| |vr+q || } | d| || } | jdd| jid} |j| | || d|t|d kre| d } | d | j q | |dd dS) Nz{}structure-value{z'%s': member-valuerr(rrrr1rr+r,}) membersr r/r0_add_members_to_shaper"r1rr#r r _end_structure)rrrrrr r input_membersr$paramr5r3param_value_sectionr6rrrdocument_shape_type_structureSs6        z3BaseExampleDocumenter.document_shape_type_structurec Ksz|d}||d|j}|jdd|jjid} | d|jdd|jid} |j| ||d|d } || d dS) Nz map-valuer:keyrr(z 'string': valuer*r-r=)r/r0rFrEr1r rr2) rrrrrr r map_section value_shape key_section value_sectionend_bracket_sectionrrrdocument_shape_type_mapps      z-BaseExampleDocumenter.document_shape_type_mapcCs$|r|}|D]}|||j<q|SN)copyr1)rr>rrBrrrr?s  z+BaseExampleDocumenter._add_members_to_shapecCs4|dur |||j|j|jdSrM)r r indentr )rrstartrrrr0s    z)BaseExampleDocumenter._start_nested_paramcCs8|j|j|j|dur||dSdSrM)r dedentr r )rrendrrrr2s   z'BaseExampleDocumenter._end_nested_paramcCsD|js||||||dS|d}|||dS)Nr-)available_sections clear_textr r2r/)rrrPrRrKrrrr@s  z$BaseExampleDocumenter._end_structure)NNNNNrM)__name__ __module__ __qualname__rrrr%r8rDrLr?r0r2r@rrrrrs*          rc@seZdZdZddZdS)ResponseExampleDocumenterzresponse-examplecKs8|d|j|||fi||d}|ddS)Nz EventStream(zevent-stream-end))r rDr/)rrrrr end_sectionrrr document_shape_type_event_streams  z:ResponseExampleDocumenter.document_shape_type_event_streamN)rVrWrX EVENT_NAMEr\rrrrrYs rYc@seZdZdZ dddZdS)RequestExampleDocumenterzrequest-exampleNcKsd}d}d} d} t|dkrd}d} d} d }|d }||| ||j|} t| D]J\} } |r7| |vr7q,|| }||| ||| | }|jd d |jid }|j|||| d| t| dkrv|d}|d|j q,| || | dS)Nrz: r:r=r=(rZz%sr9r;rr(r<r+r,) r#r/r0r?r>r"r r1rr r r@)rrrrrr r param_formatoperatorrPrRrAr$rBr5r3rCr6rrrrDsD         z6RequestExampleDocumenter.document_shape_type_structurerU)rVrWrXr]rDrrrrr^sr^N)botocore.docs.shaperbotocore.docs.utilsrrrYr^rrrrs