ó U!¶\c@skddlZddlZddlmZddlmZddlmZdefd„ƒYZ d„Z dS(iÿÿÿÿN(tparse_timestamp(tescape_controls(tsixtSharedExampleDocumentercBs€eZd„Zd„Zd„Zd„Zed„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „ZRS( cCsc|jjƒ|j|jdƒƒ|jjƒ|j||||jƒ|j|||jƒdS(s8Documents a single shared example based on its definition. :param example: The model of the example :param prefix: The prefix to use in the method example. :param section: The section to write to. :param operation_model: The model of the operation used in the example t descriptionN( tstylet new_paragraphtwritetgettnew_linetdocument_inputt input_shapetdocument_outputt output_shape(tselftexampletprefixtsectiontoperation_model((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pytdocument_shared_examples   c Csà|jdƒ}|jjƒ|dk r8|j|ƒn|jdiƒ}|jdƒ}|rq|jdƒ}n|jdƒ}|j|||g|ƒ|jdƒ} | jjƒ| jjƒ| jdƒ| jjƒdS(Ntinputtcommentst parameterss input-closesprint(response)( tadd_new_sectionRtstart_codeblocktNoneRRt_document_paramsR t end_codeblock( RRRRtshapet input_sectiontparamsRt param_sectiontclosing_section((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR (s     cCsÉ|jdƒ}|jjƒ|jdƒ|jjƒ|jjƒ|jdiƒ}idd6|d<|jdƒ}|r|jdƒ}n|j|||g|tƒ|jdƒ}|jjƒdS(NtoutputsExpected Output:s...tResponseMetadataRs output-close( RRR RRRt_document_dicttTrueR(RRRRtoutput_sectionRRR ((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR 9s    cCsÀt|tƒr+|j|||||ƒn‘t|tƒrV|j|||||ƒnft|tjƒr~|j|||ƒn>|r©|jdkr©|j |||ƒn|j |||ƒdS(s :param section: The section to add the docs to. :param value: The input / output values representing the parameters that are included in the example. :param comments: The dictionary containing all the comments to be applied to the example. :param path: A list describing where the documenter is in traversing the parameters. This is used to find the equivalent location in the comments dictionary. t timestampN( t isinstancetdictR#tlistt_document_listtnumberstNumbert_document_numbert type_namet_document_datetimet _document_str(RRtvalueRtpathR((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyt _documentJscCsY|jdƒ}|j|dƒxþ|jƒD]ð\}} |jd|ƒ|j|ƒ} | jjƒ|j||ƒ} | rš| j| ƒ| jjƒn| jd|ƒd} |rù|j dkrÛ|j j |ƒ} qù|j dkrù|j } qùn|j | | ||| ƒ|jƒq,W|jdƒ} |j| dƒ|sU| jd ƒndS( Ns dict-valuet{s.%ss'%s': t structuretmaps ending-bracet}t,(Rt_start_nested_valuetitemstappendRR t _get_commentRRR.tmembersRR1R3tpopt_end_nested_value(RRR1RR2Rt top_levelt dict_sectiontkeytvalt item_sectiont item_commentt item_shapetdict_section_end((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR#cs.  c Cs|jdƒ}|j|dƒxÑ|jƒD]Ã\}}|jd|ƒ|j|ƒ} | jjƒ|j||ƒ} | rš| j| ƒ| jjƒn| j|dƒd} |rÌ|j j |ƒ} n|j | |||| ƒ|j ƒq,W|jdƒ} |j | dƒdS(Ns param-valuest(s.%st=sending-parenthesist)(RR9R:R;RR R<RRR=RR3R>R?( RRR1RR2RRRBRCRDRERFtparam_section_end((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyRs$  c Csí|jdƒ}|j|dƒ|j}xŸt|ƒD]‘\}} |j|ƒ} | jjƒ|jd|ƒ|j||ƒ} | r£| j| ƒ| jjƒn|j | | |||ƒ|j ƒq5W|jdƒ} |j | dƒdS(Ns list-sectiont[s[%s]sending-brackets],( RR9tmembert enumerateRR R;R<RR3R>R?( RRR1RR2Rt list_sectionRFtindexRCRDREtlist_section_end((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR*•s   cCs*t|ƒ}|jdtj|ƒƒdS(Nu'%s',(RRRt text_type(RRR1R2t safe_value((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR0¦s cCs|jdt|ƒƒdS(Ns%s,(Rtstr(RRR1R2((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR-¬scCsot|ƒjƒ}t|dƒ}x5tdt|ƒƒD]}|dt||ƒ7}q8W|jd|ƒdS(Niis, s datetime(%s),(Rt timetupleRTtrangetlenR(RRR1R2tdatetime_tuplet datetime_strti((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR/¯s cCsDtjdddj|ƒƒ}|r<||kr<d||SdSdS(Ns^\.ts# (tretsubtjoin(RR2RRB((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR<¶s cCs+|j|ƒ|jjƒ|jjƒdS(N(RRtindent(RRtstart((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR9½s  cCs8|jjƒ|jjƒ|jjƒ|j|ƒdS(N(RtdedentR R(RRtend((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyR?Âs   (t__name__t __module__RR R R3tFalseR#RR*R0R-R/R<R9R?(((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyRs            c Csy|jdƒ}|jjƒ|jjdƒtƒ}x=|D]5}|jd|d|j|dƒd|d|ƒq<WdS( sDocuments the shared examples :param section: The section to write to. :param operation_model: The model of the operation. :param example_prefix: The prefix to use in the method example. :param shared_examples: The shared JSON examples from the model. sshared-examplestExamplesRRtidRRN(RRRtboldRR(RRtexample_prefixtshared_examplestcontainer_sectiont documenterR((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pytdocument_shared_examplesÉs     ( R\R+tbotocore.utilsRtbotocore.docs.utilsRtbotocore.compatRtobjectRRm(((s?/tmp/pip-install-usGedi/botocore/botocore/docs/sharedexample.pyt s  µ