B 䊇ct"@sLddlmZddlmZGdddeZGdddeZGdddeZd S) )ShapeDocumenter) py_defaultc@steZdZdddZddZdddZddd Zdd d Zdd d ZdddZ ddZ dddZ dddZ ddZ dS) BaseExampleDocumenterNcCsBg}|j|j|dk r*|||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_lineZstart_codeblockwritetraverse_and_document_shape)selfrrprefixrr rrp/private/var/folders/8c/hx9_v10d5x38qmnzt13b7b8j1k3n5b/T/pip-target-x6xd5gna/lib/python/botocore/docs/example.pydocument_examples   z&BaseExampleDocumenter.document_examplecKs|ddS)Nz{'... recursive ...'})r )rrrkwargsrrrdocument_recursive_shape2sz.BaseExampleDocumenter.document_recursive_shapecKs>||}|dkrt|j}|jd|kr0d}||dS)NZstreaming_shapezStreamingBody())Z_get_special_py_defaultrZ type_name_contextgetr )rrrrrr rZpy_typerrrdocument_shape_default5s   z,BaseExampleDocumenter.document_shape_defaultc Kshd|jkrVxXt|jdD]6\}}|d||t|jddkr|dqWn||||dS)Nenumz'%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[memberr)context)rrrz ending-comma,zending-bracket])r!add_new_section_start_nested_paramnamer r _end_nested_param) rrrrrr r param_shapeZ list_section param_sectionending_comma_sectionZending_bracket_sectionrrrdocument_shape_type_listKs      z.BaseExampleDocumenter.document_shape_type_listcKs|js|ddS|d}||d||j|}xt|D]\}} |rX| |krXqB|| } | d| || } | jdd| jid} |j| | || d|t|d krB| d } | d | j qBW| |dd dS) Nz{}zstructure-value{z'%s': z member-valuer)r")rrrr'rz ending-commar#}) membersr r%r&_add_members_to_shaperr'r rr r _end_structure)rrrrrr r input_membersrparamr*r)param_value_sectionr+rrrdocument_shape_type_structure\s2      z3BaseExampleDocumenter.document_shape_type_structurec Ksz|d}||d|j}|jdd|jjid} | d|jdd|jid} |j| ||d|d } || d dS) Nz map-valuer-keyr)r"z 'string': value)rrrzending-bracketr.)r%r&r7r6r'r r r() rrrrrr rZ map_sectionZ value_shapeZ key_sectionZ value_sectionend_bracket_sectionrrrdocument_shape_type_maps     z-BaseExampleDocumenter.document_shape_type_mapcCs(|r$|}x|D]}|||j<qW|S)N)copyr')rr/rr3rrrr0s  z+BaseExampleDocumenter._add_members_to_shapecCs4|dk r|||j|j|jdS)N)r r indentr )rrstartrrrr&s    z)BaseExampleDocumenter._start_nested_paramcCs4|j|j|j|dk r0||dS)N)r dedentr r )rrendrrrr(s    z'BaseExampleDocumenter._end_nested_paramcCsB|js(||||||n|d}|||dS)Nzending-bracket)Zavailable_sectionsZ clear_textr r(r%)rrr<r>r8rrrr1s   z$BaseExampleDocumenter._end_structure)NNN)NN)NN)NN)NN)NN)N)N)__name__ __module__ __qualname__rrrrr,r5r9r0r&r(r1rrrrrs   #   rc@seZdZdZddZdS)ResponseExampleDocumenterzresponse-examplecKs4|d|j|||f||d}|ddS)Nz EventStream(zevent-stream-end))r r5r%)rrrrr end_sectionrrr document_shape_type_event_streams  z:ResponseExampleDocumenter.document_shape_type_event_streamN)r?r@rA EVENT_NAMErErrrrrBsrBc@seZdZdZdddZdS)RequestExampleDocumenterzrequest-exampleNcKsd}d}d} d} t|dkr,d}d} d} d }|d }||| ||j|} xt| D]\} } |rp| |krpqZ|| }||| ||| | }|jd d |jid }|j|||| d| t| dkrZ|d}|d|j qZW| || | dS)Nz'%s'z: r-r.r=(rCz%szstructure-valuez member-valuer)r")rrrr'z ending-commar#) rr%r&r0r/rr r'r r r r1)rrrrrr rZ param_formatoperatorr<r>r2rr3r*r)r4r+rrrr5s@       z6RequestExampleDocumenter.document_shape_type_structure)NN)r?r@rArFr5rrrrrGsrGN)Zbotocore.docs.shaperZbotocore.docs.utilsrrrBrGrrrr s  $