o
    gHdã  ã                   @   s>   d Z ddlZddgZddd„Zddd„Zdd	„ Zddd„ZdS )zž Pretty-Print an Interface object as structured text (Yum)

This module provides a function, asStructuredText, for rendering an
interface as structured text.
é    NÚasReStructuredTextÚasStructuredTextFc                 C   s   |rdd„ }ndd„ }||   ¡ ƒg}|j}d}|  ¡ r&|tt|  ¡ ƒ|ƒƒ dd„ | jD ƒ}|rW|td||ƒƒ |d7 }|D ]}d||  ¡ ƒ }	|tt|	ƒ||ƒƒ q>|d8 }t|  ¡ ƒ}
|td	||ƒƒ |d7 }|
D ]!\}}t|d
ƒsŒd 	||  ¡ ƒ| ¡ p€d¡}	|tt|	ƒ||ƒƒ qk|d8 }|td||ƒƒ |d7 }|
D ])\}}t|d
ƒrÈd 	|  ¡ | 
¡ ¡}d 	||ƒ| ¡ p¼d¡}	|tt|	ƒ||ƒƒ 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  | ¡S )Nz``{}``)Úformat©Ús© r   ú^/var/www/html/facialservice/flask-venv/lib/python3.10/site-packages/zope/interface/document.pyÚ<lambda>#   s   
 z"asStructuredText.<locals>.<lambda>c                 S   s   | S )Nr   r   r   r   r   r	   %   s    é   c                 S   s   g | ]
}|t jjur|‘qS r   )ÚzopeÚ	interfaceÚ	Interface)Ú.0Úbaser   r   r   Ú
<listcomp>.   s    

þz$asStructuredText.<locals>.<listcomp>zThis interface extends:zo %szAttributes:ÚgetSignatureStringz{} -- {}zno documentationzMethods:z{}{}z

)ÚgetNameÚappendÚgetDocÚ_justify_and_indentÚ_trim_doc_stringÚ	__bases__ÚsortedÚnamesAndDescriptionsÚhasattrr   r   Újoin)ÚIÚmungeÚrstÚinline_literalÚrÚoutpÚlevelÚbasesÚbÚitemr   ÚnameÚdescÚ_callr   r   r   r      sP   
ÿ

ÿ€


ÿ€c                 C   s   t | |dd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   r   Q   s   c                 C   sZ   |   dd¡ d¡}| d¡g}|r(tdd„ |D ƒƒ}|D ]}| ||d… ¡ qd |¡S )zJ Trims a doc string to make it format
    correctly with structured text. ú
Ú
r   c                 S   s    g | ]}t |ƒt | ¡ ƒ ‘qS r   )ÚlenÚlstrip)r   Úliner   r   r   r   ^   s    ÿz$_trim_doc_string.<locals>.<listcomp>N)ÚreplaceÚsplitÚpopÚminr   r   )ÚtextÚlinesÚnlinesÚ
min_indentr-   r   r   r   r   W   s   ÿ
r   éH   c                 C   s‚   d| }|r1g }|}|   ¡ } | D ]}d ||g¡}t|ƒ|kr&| |¡ |}q| |¡ d |¡S ||  ¡  dd¡ dd| ¡ S )z9 indent and justify text, rejustify (munge) if specified ú r*   r)   )r/   r   r+   r   Ústripr.   )r2   r"   r   ÚwidthÚindentr3   r-   Úwordr   r   r   r   f   s    
€

ÿr   )r   F)r   )r   r6   )Ú__doc__Úzope.interfacer   Ú__all__r   r   r   r   r   r   r   r   Ú<module>   s   þ

7