Skip to content

Remove comment autosummary from _str_param_list #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions numpydoc/docscrape_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def _str_returns(self, name='Returns'):
out += ['']
return out

def _process_param(self, param, desc, autosum):
def _process_param(self, param, desc, fake_autosummary):
"""Determine how to display a parameter

Emulates autosummary behavior if autosum is not None.
Emulates autosummary behavior if fake_autosummary

Parameters
----------
Expand All @@ -91,12 +91,9 @@ def _process_param(self, param, desc, autosum):
desc : list of str
The parameter description as given in the docstring. This is
ignored when autosummary logic applies.
autosum : list or None
If a list, autosummary-style behaviour will apply for params
fake_autosummary : bool
If True, autosummary-style behaviour will apply for params
that are attributes of the class and have a docstring.
Names for autosummary generation will be appended to this list.

If None, autosummary is disabled.

Returns
-------
Expand All @@ -119,7 +116,7 @@ def _process_param(self, param, desc, autosum):
param = param.strip()
display_param = '**%s**' % param

if autosum is None:
if not fake_autosummary:
return display_param, desc

param_obj = getattr(self._obj, param, None)
Expand All @@ -141,7 +138,6 @@ def _process_param(self, param, desc, autosum):
link_prefix = ''

# Referenced object has a docstring
autosum.append(" %s%s" % (autosum_prefix, param))
display_param = ':obj:`%s <%s%s>`' % (param,
link_prefix,
param)
Expand Down Expand Up @@ -181,15 +177,11 @@ def _str_param_list(self, name, fake_autosummary=False):
"""
out = []
if self[name]:
if fake_autosummary:
autosum = []
else:
autosum = None

out += self._str_field_list(name)
out += ['']
for param, param_type, desc in self[name]:
display_param, desc = self._process_param(param, desc, autosum)
display_param, desc = self._process_param(param, desc,
fake_autosummary)

if param_type:
out += self._str_indent(['%s : %s' % (display_param,
Expand All @@ -201,14 +193,6 @@ def _str_param_list(self, name, fake_autosummary=False):
out += self._str_indent(desc, 8)
out += ['']

if fake_autosummary and autosum:
if self.class_members_toctree:
autosum.insert(0, ' :toctree:')
autosum.insert(0, '.. autosummary::')
out += ['..', ' HACK to make autogen generate docs:']
out += self._str_indent(autosum, 4)
out += ['']

return out

@property
Expand Down
10 changes: 0 additions & 10 deletions numpydoc/tests/test_docscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,16 +1104,6 @@ def no_period(self):
:obj:`no_period <no_period>`
This does not have a period

..
HACK to make autogen generate docs:
.. autosummary::
:toctree:

an_attribute
multiline_sentence
midword_period
no_period

.. rubric:: Methods

===== ==========
Expand Down