3
[ @ s6 d Z ddlZd
ddZdddZdd ZdddZdS )z Pretty-Print an Interface object as structured text (Yum)
This module provides a function, asStructuredText, for rendering an
interface as structured text.
NFc C s |rdd }ndd }|| j g}|j}d}| j rL|tt| j | dd | jD }|r|td|| |d7 }x0|D ](}d||j } |tt| || q~W |d8 }t| j }
|td || |d7 }xL|
D ]D\}}t|d
sd||j |j pdf } |tt| || qW |d8 }|td
|| |d7 }x`|
D ]X\}}t|d
rJd|j |j f }
d||
|j pdf } |tt| || qJW dj
|d S )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.
c S s
d| f S )Nz``%s`` )sr r /usr/lib64/python3.6/document.py s z"asStructuredText..c S s | S )Nr )r r r r r ! s c S s g | ]}|t jjk r|qS r )zopeZ interfaceZ Interface).0baser r r
* s z$asStructuredText..zThis interface extends:zo %szAttributes:getSignatureStringz%s -- %szno documentationzMethods:z%s%sz
)ZgetNameappendZgetDoc_justify_and_indent_trim_doc_string __bases__sortednamesAndDescriptionshasattrr join)ImungerstZinline_literalrZoutplevelbasesbitemr nameZdescZ_callr r r asStructuredText sF
r c C s t | |ddS )zi Output reStructuredText format. Note, this will whack any existing
'structured' format of the text.T)r r )r )r r r r r asReStructuredTextM s r c C s^ | j ddjd}|jdg}|rTtdd |D }x|D ]}|j||d q:W dj|S )zJ Trims a doc string to make it format
correctly with structured text. z
r c S s g | ]}t |t |j qS r )lenlstrip)r liner r r r
Z s z$_trim_doc_string..N)replacesplitpopminr r )textlinesZnlinesZ
min_indentr" r r r r S s
r H c C s d| }|rfg }|}| j } x>| D ],}dj||g}t||kr"|j| |}q"W |j| dj|S || j jddjdd| S dS )z9 indent and justify text, rejustify (munge) if specified r z
N)r$ r r r stripr# )r' r r widthindentr( r" Zwordr r r r
b s
r
)r F)r )r r) )__doc__Zzope.interfacer r r r r
r r r r s
7