File: //opt/alt/python37/lib/python3.7/site-packages/nose/sphinx/__pycache__/pluginopts.cpython-37.pyc
B
k�6S � @ s� d Z ddlZy,ddlmZmZ ddlmZ ddlmZ W n e k
rL Y nX ddl
mZ ddlm
Z
ddlmZ dd lmZ dd
lmZ ddlmZ dd
� Zdd� ZG dd� de�ZG dd� de�Zdd� ZdS )a�
Adds a sphinx directive that can be used to automatically document a plugin.
this::
.. autoplugin :: nose.plugins.foo
:plugin: Pluggy
produces::
.. automodule :: nose.plugins.foo
Options
-------
.. cmdoption :: --foo=BAR, --fooble=BAR
Do the foo thing to the new thing.
Plugin
------
.. autoclass :: nose.plugins.foo.Pluggy
:members:
Source
------
.. include :: path/to/nose/plugins/foo.py
:literal:
� N)�nodes�utils)�ViewList)�
directives)�resolve_name)�Plugin)�BuiltinPluginManager)�Config)�TestProgram)�isclassc C s* |d } t | �}
|�dd �}|r,t|
|�}nDxBt|
�D ]6}
t|
|
�}t|�r6t|t�r6|tk r6d| |
f }P q6W t� }|�d| d� |�dd� |�dd� |�dd� |�dd� |� }t � }|�
|i � xJ|D ]B}|�|�
� d� |�d d� |�d
|j d d� |�dd� q�W |�dd� |�d
d� |�dd� |�d| d� |�dd� |�dd� |�dd� |�dd� |�d
d� |�dt�
|jd tj�|
j�dd��� d� |�dd� |�dd� t�� }|j|_|jj}|jj}g |j_d|j_|j|d|dd� ||j_||j_|jS )Nr �pluginz%s.%sz.. automodule :: %s
z <autodoc>� �Optionsz-------z
z �
r z------z.. autoclass :: %s
z
:members:
z :show-inheritance:
ZSourcez.. include :: %s
�sourcez.pycz.pyz
:literal:
� )�match_titles)r �get�getattr�dirr �
issubclassr r �append� OptBucket�options�helpr Z
relative_path�document�os�path�abspath�__file__�replacer �section�memo�title_styles�
section_level�nested_parse�children)�dirname� argumentsr �content�lineno�content_offset�
block_text�state�
state_machine�mod_name�modZ plug_name�obj�entry�rstZplug�opts�opt�node�surrounding_title_styles�surrounding_section_level� r9 �G/opt/alt/python37/lib/python3.7/site-packages/nose/sphinx/pluginopts.py�autoplugin_directive1 sd
r; c C s t tt� d�} | �t�� �}
t� }x"|
�� �d�D ]}|� |d� q2W |� dd� |� dd� |� dd� xJ|
D ]B}
|� |
�
� d� |� dd� |� d|
j d d� |� dd� qpW t�
� }|j|_|jj}|jj}g |j_d |j_|j|d |d
d� ||j_||j_|jS )zproduces rst from nose help)ZparserClassZpluginsr z <autodoc>r z-------r
z
z r r )r )r r r Z getParserr
�usager �format_help�splitr r r r r! r r"