File: //lib/python3/dist-packages/zope/interface/__pycache__/document.cpython-38.pyc
U
ؒ�]� � @ 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� }|| � � �g}|j}d}| �� rL|tt| �� �|�� dd� | jD �}|r�|td||�� |d7 }|D ](}d||� � � } |tt| �||�� q||d8 }t| �� �}
|td ||�� |d7 }|
D ]D\}}t|d
�s�d||� � �|�� �p df } |tt| �||�� q�|d8 }|td
||�� |d7 }|
D ]X\}}t|d
��r@d|� � |� � f }
d||
�|�� �p|df } |tt| �||�� �q@d�
|�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 �9/usr/lib/python3/dist-packages/zope/interface/document.py�<lambda> � z"asStructuredText.<locals>.<lambda>c S s | S )Nr r r r r r ! r � 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 sL
�
��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 sZ | � dd��d�}|�d�g}|rPtdd� |D ��}|D ]}|�||d� � q8d�|�S )zJ Trims a doc string to make it format
correctly with structured text. �
�
r c S s g | ]}t |�t |�� � �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% r r r r S s �r �H c C s� d| }|rbg }|}| � � } | D ],}d�||g�}t|�|kr |�|� |}q |�|� d�|�S || �� �dd��dd| � S dS )z9 indent and justify text, rejustify (munge) if specified � r"