Mock only if on RTD.
And some code cleanup.
This commit is contained in:
@@ -53,8 +53,9 @@ else:
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage',
|
||||
'sphinx.ext.pngmath', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode']
|
||||
'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath',
|
||||
'sphinx.ext.mathjax', 'sphinx.ext.viewcode']
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
@@ -99,8 +100,9 @@ MOCK_MODULES = [
|
||||
'scipy.optimize',
|
||||
]
|
||||
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
if on_rtd:
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = Mock()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@@ -184,34 +186,6 @@ def process_docstring(app, what, name, obj, options, lines):
|
||||
|
||||
# Add the field's type to the docstring
|
||||
lines.append(u':type %s: %s' % (field.attname, type(field).__name__))
|
||||
# Only look at objects that inherit from Django's base FORM class
|
||||
# elif (inspect.isclass(obj) and issubclass(obj, forms.ModelForm) or issubclass(obj, forms.ModelForm) or issubclass(obj, BaseInlineFormSet)):
|
||||
# pass
|
||||
# # Grab the field list from the meta class
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# fields = obj._meta._fields()
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# for field in fields:
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# # Decode and strip any html out of the field's help text
|
||||
# help_text = strip_tags(force_unicode(field.help_text))
|
||||
|
||||
# # Decode and capitalize the verbose name, for use if there isn't
|
||||
# # any help text
|
||||
# verbose_name = force_unicode(field.verbose_name).capitalize()
|
||||
|
||||
# if help_text:
|
||||
# # Add the model field to the end of the docstring as a param
|
||||
# # using the help text as the description
|
||||
# lines.append(u':param %s: %s' % (field.attname, help_text))
|
||||
# else:
|
||||
# # Add the model field to the end of the docstring as a param
|
||||
# # using the verbose name as the description
|
||||
# lines.append(u':param %s: %s' % (field.attname, verbose_name))
|
||||
|
||||
# # Add the field's type to the docstring
|
||||
# lines.append(u':type %s: %s' % (field.attname, type(field).__name__))
|
||||
# Return the extended docstring
|
||||
return lines
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user