Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/nose/sphinx/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/nose/sphinx/__pycache__/pluginopts.cpython-35.pyc



k�6S�@sdZddlZy:ddlmZmZddlmZddlmZWne	k
r`YnXddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZdd
�Zdd�ZGdd�de�ZGdd�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	Cs�|d}	t|	�}
|jdd�}|r@t|
|�}n^x[t|
�D]M}
t|
|
�}t|�rMt|t�rM|tk	rMd|	|
f}PqMWt�}|jd|	d�|jdd�|jdd�|jdd�|jdd�|�}t	�}|j
|i�x_|D]W}|j|j
�d�|jd	d�|jd
|jdd�|jdd�q$W|jdd�|jd
d�|jdd�|jd|d�|jdd�|jdd�|jdd�|jdd�|jd
d�|jdtj
|jdtjj|
jjdd���d�|jdd�|jdd�tj�}|j|_|jj}|jj}g|j_d|j_|j|d|dd�||j_||j_|jS)Nr�pluginz%s.%sz.. automodule :: %s
z	<autodoc>��Optionsz-------z   
z   �
rz------z.. autoclass :: %s
z
   :members:
z   :show-inheritance:
ZSourcez.. include :: %s
�sourcez.pycz.pyz
   :literal:
�match_titles�)r�get�getattr�dirr�
issubclassrr�append�	OptBucket�options�helprZ
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_directive1sd
'			
	
"r;c	Csxtdtdt��}	|	jtj��}
t�}x-|
j�jd�D]}|j	|d�qLW|j	dd�|j	dd�|j	dd�x_|
D]W}
|j	|
j
�d�|j	dd�|j	d	|
jdd�|j	dd�q�Wtj
�}|j|_|jj}|jj}g|j_d
|j_|j|d
|dd�||j_||j_|jS)
zproduces rst from nose helpZparserClassZpluginsrz	<autodoc>rz-------r
z   
z   rrr)r	rrZ	getParserr
�usager�format_help�splitrrrrr!rr"r#r$r%r&)r'r(rr)r*r+r,r-r.�config�parserr3�liner5r6r7r8r9r9r:�autohelp_directivets0	
rBc@sFeZdZdddd�Zdd�Zdd�Zd	d
�ZdS)rNZ	nosetestscCsg|_||_||_dS)N)r4�doc�prog)�selfrCrDr9r9r:�__init__�s		zOptBucket.__init__cCs
t|j�S)N)�iterr4)rEr9r9r:�__iter__�szOptBucket.__iter__cCs"|jjd|j�jdd�S)Nz%progz:
z::
)rCr rD)rEr9r9r:r=�szOptBucket.format_helpcOs|jjt||��dS)N)r4r�Opt)rE�arg�kwr9r9r:�
add_option�szOptBucket.add_option)�__name__�
__module__�__qualname__rFrHr=rLr9r9r9r:r�src@s4eZdZdd�Zdd�Zdd�ZdS)rIcOsa||_|jdd�|_|jdd�|_|jdd�|_|jdd�|_dS)N�action�default�metavarr)r4�poprPrQrRr)rErJrKr9r9r:rF�s
	zOpt.__init__cCsdg}xJ|jD]?}|}|jdkrB|d|j|�7}|j|�qWddj|�S)N�
store_true�store_falsez=%sz.. cmdoption :: z, )rTrU)r4rP�metar�join)rE�buf�	optstring�descr9r9r:r�szOpt.optionscCs
|jpdS)N�DEFAULT)rR)rErYr9r9r:rV�szOpt.metaN)rMrNrOrFrrVr9r9r9r:rI�s	rIcCs9|jdtdddtj�|jdtdd�dS)NZ
autopluginrrrZautohelp)rrr)rrr)Z
add_directiver;rZ	unchangedrB)Zappr9r9r:�setup�s	
r\)�__doc__rZdocutilsrrZdocutils.statemachinerZdocutils.parsers.rstr�ImportErrorZ	nose.utilrZnose.plugins.baserZnose.plugins.managerrZnose.configr	Z	nose.corer
�inspectrr;rB�objectrrIr\r9r9r9r:�<module> s$
C