>ac@sfddlmZddlmZdefdYZdefdYZdefdYZd S( i(tShapeDocumenter(t py_defaulttBaseExampleDocumentercBseZd d d dZdZd d dZd d dZd d dZd d dZd d dZ dZ d dZ d d Z d Z RS( c Cshg}|jj|jj|dk r<|j|n|jd|d|d|d|d|dS(s]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. tsectiontshapethistorytincludetexcludeN(tstyletnew_linetstart_codeblocktNonetwritettraverse_and_document_shape(tselfRRtprefixRRR((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_examples    cKs|jddS(Ns{'... recursive ...'}(R (RRRtkwargs((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_recursive_shape-scKs_|j|}|dkr-t|j}n|jjd|krNd}n|j|dS(Ntstreaming_shapesStreamingBody()(t_get_special_py_defaultR Rt type_namet_contexttgetR (RRRRRRRtpy_type((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_shape_default0s   c Ksd|jkrtxut|jdD]J\}}|jd||t|jddkr#|jdq#q#Wn|j|||dS(Ntenums'%s'it|(tmetadatat enumerateR tlenR( RRRRRRRtiR((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_shape_type_string:s  c Ks|j}|jd}|j|d|jddi|jd6} |jd| d|d||jd} | jd |jd } |j| d dS( Ns list-valuet[tmembertcontextRRRs ending-commat,sending-brackett](R"tadd_new_sectiont_start_nested_paramtnameR R t_end_nested_param( RRRRRRRt param_shapet list_sectiont param_sectiontending_comma_sectiontending_bracket_section((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_shape_type_listDs    c KsG|js|jddS|jd}|j|d|j|j|}xt|D]\}} |r| |krq[n|j| } | jd| || } | jddi| jd6} |jd| d| d |d | |t|d kr[| jd } | jd | j j q[q[W|j |dddS(Ns{}sstructure-valuet{s'%s': s member-valueR#RRRR(is ending-commaR$t}( tmembersR R&R't_add_members_to_shapeRR(R RRR t_end_structure(RRRRRRRt input_membersRtparamR,R*tparam_value_sectionR-((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_shape_type_structureSs.        c Ks|jd}|j|d|j}|jddi|jjd6} | jd|jddi|jd6} |jd| d|d ||jd } |j| d dS( Ns map-valueR0tkeyR#Rs 'string': tvalueRRsending-bracketR1(R&R'R:R9R(R R R)( RRRRRRRt map_sectiont value_shapet key_sectiont value_sectiontend_bracket_section((s6/usr/lib/fence-agents/bundled/botocore/docs/example.pytdocument_shape_type_mapps   cCs7|r3|j}x|D]}|||j s