| Current File : //usr/lib64/python3.6/site-packages/zope/interface/__pycache__/document.cpython-36.pyc |
3
��[� � @ s6 d Z ddlZd
dd�Zddd�Zdd � Zddd�ZdS )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
�s�d||j � �|j� �pdf } |tt| �||�� q�W |d8 }|td
||�� |d7 }x`|
D ]X\}}t|d
��rJd|j � |j � f }
d||
�|j� �p�df } |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�<lambda> s z"asStructuredText.<locals>.<lambda>c S s | S )Nr )r r r r r ! s � c S s g | ]}|t jjk r|�qS r )�zopeZ interfaceZ Interface)�.0�baser r r �
<listcomp>* s z$asStructuredText.<locals>.<listcomp>zThis interface extends:zo %szAttributes:�getSignatureStringz%s -- %szno documentationzMethods:z%s%sz
)ZgetName�appendZgetDoc�_justify_and_indent�_trim_doc_string� __bases__�sorted�namesAndDescriptions�hasattrr �join)�I�munge�rstZinline_literal�rZoutp�level�bases�b�itemr �nameZdescZ_callr r r �asStructuredText sF
r c C s t | |dd�S )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 dd�jd�}|jd�g}|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 )�len�lstrip)r �liner r r r
Z s z$_trim_doc_string.<locals>.<listcomp>N)�replace�split�pop�minr r )�text�linesZnlinesZ
min_indentr"