Your IP : 216.73.216.213
k�6S � @ s d Z d d l Z y: d d l m Z m Z d d l m Z d d l m Z Wn e k
r` Yn Xd 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
� Z d d � Z Gd d � d e � Z Gd d � d e � Z d d � Z d S)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 | � }
| j d d � } | r@ t |
| � } n^ x[ t |
� D]M }
t |
|
� } t | � rM t | t � rM | t k rM d | |
f } PqM Wt � } | j d | d � | j d d � | j d d � | j d d � | j d d � | � } t � } | j
| i � x_ | D]W } | j | j
� d � | j d d � | j d
| j d d � | j d d � q$W| j d d � | j d
d � | j d d � | j d | d � | j d d � | j d d � | j d d � | j d d � | j d
d � | j d t j
| j d t j j |
j j d d � � � d � | j d d � | j d d � t j � } | j | _ | j j } | j j } g | j _ d | j _ | j | d | d d �| | j _ | | j _ | j S)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/python35/lib/python3.5/site-packages/nose/sphinx/pluginopts.py�autoplugin_directive1 sd
'
"r; c C sx t d t d t � � } | j t j � � }
t � } x- |
j � j d � D] } | j | d � qL W| j d d � | j d d � | j d d � x_ |
D]W }
| j |
j
� d � | j d d � | j d |
j d d � | j d d � q� Wt j
� } | j | _ | j j } | j j } g | j _ d
| j _ | j | d
| d d �| | j _ | | j _ | j S)
zproduces rst from nose helpZparserClassZpluginsr 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"