U é üeã@sÒdZddlZz,ddlmZmZddlmZddlmZWne k rLYnXddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZd 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| ƒ} | dd¡} | r,t| | ƒ} nBt| ƒD]8} t| | ƒ} t| ƒr4t| tƒr4| tk r4d| | f} qnq4tƒ}| d| d¡| dd¡| dd¡| dd¡| dd¡| ƒ}t ƒ}|  |i¡|D]B}| |  ¡d¡| d d¡| d |j d d¡| d d¡qÐ| d d¡| d d¡| dd¡| d| d¡| dd¡| dd¡| dd¡| dd¡| d d¡| dt   |jdtj | 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 ú ÚÚOptionsú-------ú ú Ú rz------z.. autoclass :: %s z :members: z :show-inheritance: ZSourcez.. include :: %s Úsourcez.pycz.pyz :literal: é©Z match_titles)rÚgetÚgetattrÚdirr Ú issubclassrrÚappendÚ OptBucketÚoptionsÚhelprÚ 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©r>úD/opt/hc_python/lib/python3.8/site-packages/nose/sphinx/pluginopts.pyÚautoplugin_directive1sh                   þü  r@c Cstttƒd} |  t ¡¡} tƒ} |  ¡ d¡D]} |   | d¡q0|   dd¡|   dd¡|   dd¡| D]B} |   |   ¡d¡|   dd¡|   d| j dd¡|   dd¡qjt   ¡}|j|_|jj}|jj}g|j_d |j_|j| d |d d ||j_||j_|jS) zproduces rst from nose help)Z parserClassÚpluginsrr rrrrrrrr)r rrZ getParserr ÚusagerÚ format_helpÚsplitrrrrr&r r'r(r)r*r+)r,r-rr.r/r0r1r2r3ÚconfigÚparserr8Úliner:r;r<r=r>r>r?Úautohelp_directivets2ÿ    rHc@s.eZdZd dd„Zdd„Zdd„Zd d „ZdS) rNÚ nosetestscCsg|_||_||_dS©N)r9ÚdocÚprog)ÚselfrKrLr>r>r?Ú__init__”szOptBucket.__init__cCs t|jƒSrJ)Úiterr9©rMr>r>r?Ú__iter__™szOptBucket.__iter__cCs|j d|j¡ dd¡S)Nz%progz: z:: )rKr%rLrPr>r>r?rCœszOptBucket.format_helpcOs|j t||Ž¡dSrJ)r9rÚOpt©rMÚargÚkwr>r>r?Ú add_optionŸszOptBucket.add_option)NrI)Ú__name__Ú __module__Ú __qualname__rNrQrCrVr>r>r>r?r“s rc@s$eZdZdd„Zdd„Zdd„ZdS)rRcOsB||_| dd¡|_| dd¡|_| dd¡|_| dd¡|_dS)NÚactionÚdefaultÚmetavarr)r9ÚpoprZr[r\rrSr>r>r?rN¤s z Opt.__init__cCsHg}|jD].}|}|jdkr.|d| |¡7}| |¡q dd |¡S)N)Ú store_trueÚ store_falsez=%sz.. cmdoption :: z, )r9rZÚmetarÚjoin)rMÚbufÚ optstringÚdescr>r>r?r«s   z Opt.optionscCs |jpdS)NÚDEFAULT)r\)rMrcr>r>r?r`´szOpt.metaN)rWrXrYrNrr`r>r>r>r?rR£s rRcCs*|jdtddtjd| dtdd¡dS)NZ autopluginr)rrr)r Zautohelpr)rrr)Z add_directiver@rZ unchangedrH)Zappr>r>r?Úsetup¹sþrf)Ú__doc__r!ZdocutilsrrZdocutils.statemachinerZdocutils.parsers.rstrÚ ImportErrorZ nose.utilrZnose.plugins.baserZnose.plugins.managerrZ nose.configr Z nose.corer Úinspectr r@rHÚobjectrrRrfr>r>r>r?Ús$        C