>ac@s{ddlZddlmZddlmZddlmZejdZde fdYZ de fd YZ dS( iN(t OrderedDict(tDocStringParser(t ReSTStyletbcdocst ReSTDocumentcBsweZddZdZdZdZdZdZdZdZ d Z d Z d Z d Z RS( tmancCsat||_||_t||_t|_t|_i|_ i|_ g|_ d|_ dS(N(RtstylettargetRtparsertTruet keep_datatFalsetdo_translationttranslation_mapthrefst_writestNonet_last_doc_string(tselfR((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt__init__s      cCs,|jr(|dk r(|jj|ndS(N(R RRtappend(Rts((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt_write#scCs|j|dS(s2 Write content into the document. N(R(Rtcontent((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytwrite'scCs$|jd|jj|fdS(s- Write content on a newline. s%s%s N(RRtspaces(RR((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytwriteln-scCs |jdS(sn Returns the last content written to the document without removing it from the stack. i(R(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt peek_write3scCs |jjS(sL Removes and returns the last content written to the stack. (Rtpop(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt pop_write:scCs|jj|dS(s2 Places new content on the stack. N(RR(RR((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt push_write@scCse|jrL|jjx3|jjD]\}}|jj||q&Wndj|jjdS(sJ Returns the current content of the document as a string. tsutf-8(RRt new_paragraphtitemstlink_target_definitiontjoinRtencode(Rtrefnametlink((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytgetvalueFs   cCs&g|D]}|jj||^qS(N(R tget(Rtwordstw((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyttranslate_wordsPscCs#|r|jr|j|ndS(N(R R(Rtdata((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt handle_dataSscCs|ryNt|j}|jj||jjt|j}||f|_Wqtk rtjddt tj|qXndS(NsError parsing doc stringtexc_info( tlenRRtfeedtcloseRt ExceptiontLOGtdebugR (Rt doc_stringtstarttend((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytinclude_doc_stringWs  cCs2|jdk r.|j\}}|j||5ndS(N(RRR(RR6R7((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytremove_last_doc_stringcs(t__name__t __module__RRRRRRRR'R+R-R8R9(((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRs         tDocumentStructurecBseZddddZedZedZejdZedZedZ dZ ddZ d Z d Z d Zd Zd ZdZRS(RcCs~tt|jd|||_t|_|jg|_i|_|dk r^||_n|dk rz|j |ndS(s5Provides a Hierarichial structure to a ReSTDocument You can write to it similiar to as you can to a ReSTDocument but has an innate structure for more orginaztion and abstraction. :param name: The name of the document :param section_names: A list of sections to be included in the document. :param target: The target documentation of the Document structure :param context: A dictionary of data to store with the strucuture. These are only stored per section not the entire structure. RN( tsuperR<Rt_nameRt _structuret_patht_contextRt_generate_structure(Rtnamet section_namesRtcontext((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRks       cCs|jS(s"The name of the document structure(R>(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRCscCs|jS(sv A list of where to find a particular document structure in the overlying document structure. (R@(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytpathscCs ||_dS(N(R@(Rtvalue((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRFscCs t|jS(N(tlistR?(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytavailable_sectionsscCs|jS(N(RA(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyREscCs"x|D]}|j|qWdS(N(tadd_new_section(RRDt section_name((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRBs cCso|jd|d|jd|}|j|g|_|jj|j_|j|_|j|_||j|<|S(sAdds a new section to the current document structure This document structure will be considered a section to the current document structure but will in itself be an entirely new document structure that can be written to and have sections as well :param name: The name of the section. :param context: A dictionary of data to store with the strucuture. These are only stored per section not the entire structure. :rtype: DocumentStructure :returns: A new document structure to add to but lives as a section to the document structure it was instantiated from. RCRRE(t __class__RRFRt indentationR RR?(RRCREtsection((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRJs    cCs |j|S(sRetrieve a section(R?(RRC((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt get_sectionscCs|j|=dS(sDelete a sectionN(R?(RRC((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytdelete_sectionscCst|jdkrd|jrd|jjx3|jjD]\}}|jj||q;Wqdn|j}x-|jjD]\}}||j 7}qW|S(sFlushes a doc structure to a ReSTructed string The document is flushed out in a DFS style where sections and their subsections' values are added to the string as they are visited. i( R/RFRRR R!R"R'R?tflush_structure(RR%R&RGRCRN((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyRQs   cCsdj|jjdS(NRsutf-8(R#RR$(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyR'scCst|_dS(N(RR?(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pytremove_all_sectionsscCs g|_dS(N(R(R((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt clear_textsN(R:R;RRtpropertyRCRFtsetterRIRERBRJRORPRQR'RRRS(((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyR<js       ( tloggingtbotocore.compatRt#botocore.docs.bcdoc.docstringparserRtbotocore.docs.bcdoc.styleRt getLoggerR3tobjectRR<(((s</usr/lib/fence-agents/bundled/botocore/docs/bcdoc/restdoc.pyt s T