
    Cad                         d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ  e
j                  e      Zd	 Zd
 ZddZ G d dej*                        Zd Zy)    N)nodes)rst)
directives)ViewList)logging)nested_parse_with_titles)	extensionc                 4    t        j                  |       xs dS )N )inspectgetdoc)plugins    5/usr/lib/python3/dist-packages/stevedore/sphinxext.py_get_docstringr      s    >>&!'R'    c              #     K   t        | j                               D ]a  }| |   }t        |j                        xs d}|j	                         d   j                         }d|j                  d||j                  f c y w)N
r   z* z -- )sortednamesr   r   
splitlinesstripnamemodule_name)mgrr   extdocsummarys        r   _simple_listr      ss     syy{# $iSZZ(0D.."1%++-!hh0oo 		s   A?Bc              #   x  K   t        | j                               D ]  }| |   }|r&|t        |j                        z  |j                  f |r)|j                  j                         |j                  f n|j                  |j                  f |r&|t        |j                        z  |j                  f d|j                  f t        |j                        }|r||j                  f n4dj                  |j                  |j                        |j                  f d|j                  f  y w)Nr   z0.. warning:: No documentation found for {} in {})
r   r   lenr   r   titler   r   formatentry_point_target)r   overunder	titlecaser   r   r   s          r   _detailed_listr'   (   s
    syy{# &$i#chh-'9988>>#S__5588S__--3sxx=(#//::S__%%SZZ((( CIIHHc44 	  S__%%+&s   D8D:c                       e Zd ZdZej
                  ej                  ej                  ej                  ej                  dZdZ	d Z
y)ListPluginsDirectivez4Present a simple list of the plugins in a namespace.)classdetailedr&   overline-styleunderline-styleTc                    dj                  | j                        j                         }t        j	                  d|z         | j
                  j                  dd      }| j
                  j                  dd      }d }t        j                  ||      }t               }d	| j
                  v }d
| j
                  v rt        ||||      }nt        |      }|D ],  \  }	}
|	j                         D ]  }|j                  ||
        . t        j                         }| j                   j"                  |_        t%        | j                   ||       |j&                  S )N zdocumenting plugins from %rr,   r   r-   =c                 N    t         j                  d|j                  d|       y )NzFailed to load z: )LOGwarningmodule)r   eperrs      r   report_load_failurez5ListPluginsDirective.run.<locals>.report_load_failureT   s    KKBIIsCDr   )on_load_failure_callbackr&   r+   )r$   r%   r&   )joincontentr   r2   infooptionsgetr	   ExtensionManagerr   r'   r   r   appendr   sectionstatedocumentr   children)self	namespaceoverline_styleunderline_styler7   r   resultr&   datatextsourcelinenodes                r   runzListPluginsDirective.runN   s-   HHT\\*002	.:;))*:B?,,**+<cB	E ((%8

 4<</	%!.#%D  $D  	,LD&) ,dF+,	,
 }}

++ VT:}}r   N)__name__
__module____qualname____doc__r   class_optionflagsingle_char_or_unicodeoption_spechas_contentrN    r   r   r)   r)   A   sC    > ((OO__$;;%<<K K!r   r)   c                 b    t         j                  d       | j                  dt               dddS )Nzloading stevedore.sphinxextzlist-pluginsT)parallel_read_safeparallel_write_safe)r2   r;   add_directiver)   )apps    r   setupr^   r   s0    HH*+n&:;"# r   )r   -F)r   docutilsr   docutils.parsersr   docutils.parsers.rstr   docutils.statemachiner   sphinx.utilr   sphinx.util.nodesr   	stevedorer	   	getLoggerrO   r2   r   r   r'   	Directiver)   r^   rX   r   r   <module>ri      sV        + *  6 g!(&2.3== .br   