File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818import re
1919import six
2020import funcargparse
21+ import warnings
2122
2223# If extensions (or modules to document with autodoc) are in another directory,
2324# add these directories to sys.path here. If the directory is relative to the
2425# documentation root, use os.path.abspath to make it absolute, like shown here.
2526sys .path .insert (0 , os .path .abspath (osp .dirname (__file__ )))
2627
28+ warnings .filterwarnings ('ignore' , 'To exit: use' )
29+
2730# -- General configuration ------------------------------------------------
2831
2932# If your documentation needs a minimal Sphinx version, state it here.
389392
390393# Example configuration for intersphinx: refer to the Python standard library.
391394intersphinx_mapping = {
392- 'sphinx' : ('http://sphinx-doc.org/' , None ),
395+ 'sphinx' : ('http://www. sphinx-doc.org/en/stable /' , None ),
393396 'docrep' : ('http://docrep.readthedocs.org/en/latest' , None ),
394397}
395398if six .PY3 :
Original file line number Diff line number Diff line change @@ -254,7 +254,8 @@ def setup(func):
254254
255255 # create arguments
256256 args , varargs , varkw , defaults = inspect .getargspec (func )
257- full_doc = docstrings .dedents (inspect .getdoc (func ))
257+ doc = inspect .getdoc (func )
258+ full_doc = docstrings .dedents (doc ) if doc else ''
258259
259260 summary = docstrings .get_full_description (full_doc )
260261 if summary :
@@ -384,8 +385,9 @@ def setup(func):
384385 name2use = name
385386 if name2use is None :
386387 name2use = func .__name__ .replace ('_' , '-' )
388+ doc = inspect .getdoc (func )
387389 kwargs .setdefault ('help' , docstrings .get_summary (
388- docstrings .dedents (inspect . getdoc ( func )) ))
390+ docstrings .dedents (doc ) if doc else '' ))
389391 parser = self ._subparsers_action .add_parser (name2use , ** kwargs )
390392 parser .setup_args (
391393 func , setup_as = setup_as , insert_at = insert_at ,
You can’t perform that action at this time.
0 commit comments