o ]Lb@sFdZddlmZddlmZdddZddd Zd d Zdd dZdS)z Pretty-Print an Interface object as structured text (Yum) This module provides a function, asStructuredText, for rendering an interface as structured text. )absolute_import InterfaceFcCs|rdd}ndd}||g}|j}d}|r&|tt||dd|jD}|rW|td|||d7}|D]}d||} |tt| ||q>|d8}t|} |td |||d7}| D]!\} } t| d sd || | pd f} |tt| ||qk|d8}|td |||d7}| D])\} } t| d rd| | f} d || | pd f} |tt| ||qd |dS)z Output structured text format. Note, this will whack any existing 'structured' format of the text. If `rst=True`, then the output will quote all code as inline literals in accordance with 'reStructuredText' markup principles. cSs d|fS)Nz``%s``srrN/usr/lib/python3/dist-packages/mercurial/thirdparty/zope/interface/document.py!s z"asStructuredText..cSs|S)Nrrrrr r #srcSsg|]}|tur|qSrr).0baserrr ,s z$asStructuredText..zThis interface extends:zo %sz Attributes:getSignatureStringz%s -- %szno documentationzMethods:z%s%sz ) getNameappendgetDoc_justify_and_indent_trim_doc_string __bases__sortednamesAndDescriptionshasattrrjoin)Imungerstinline_literalroutplevelbasesbitemrnamedesc_callrrr asStructuredTextsP         r&cCst||ddS)zi Output reStructuredText format. Note, this will whack any existing 'structured' format of the text.T)rr)r&)rrrrr asReStructuredTextOsr'cCsZ|ddd}|dg}|r(tdd|D}|D] }|||dqd|S)zJ Trims a doc string to make it format correctly with structured text.   rcSs g|] }t|t|qSr)lenlstrip)r linerrr r \sz$_trim_doc_string..N)replacesplitpopminrr)textlinesnlines min_indentr,rrr rUs  rHcCsd|}|r1g}|}|}|D]}d||g}t||kr&|||}q||d|S||dddd|S)z9 indent and justify text, rejustify (munge) if specified  r)r()r.rr*rstripr-)r1rrwidthindentr2r,wordrrr rds     rN)rF)r)rr5) __doc__ __future__rrr&r'rrrrrr s    7