Skip to content

Commit

Permalink
Merge pull request #127 from jnothman/rm-autosummary
Browse files Browse the repository at this point in the history
Remove comment autosummary from _str_param_list
  • Loading branch information
pv authored Nov 1, 2017
2 parents d601f14 + fc09bcd commit 46a0259
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
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

0 comments on commit 46a0259

Please sign in to comment.