Skip to content

Commit 46a0259

Browse files
authored
Merge pull request #127 from jnothman/rm-autosummary
Remove comment autosummary from _str_param_list
2 parents d601f14 + fc09bcd commit 46a0259

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

numpydoc/docscrape_sphinx.py

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ def _str_returns(self, name='Returns'):
7979
out += ['']
8080
return out
8181

82-
def _process_param(self, param, desc, autosum):
82+
def _process_param(self, param, desc, fake_autosummary):
8383
"""Determine how to display a parameter
8484
85-
Emulates autosummary behavior if autosum is not None.
85+
Emulates autosummary behavior if fake_autosummary
8686
8787
Parameters
8888
----------
@@ -91,12 +91,9 @@ def _process_param(self, param, desc, autosum):
9191
desc : list of str
9292
The parameter description as given in the docstring. This is
9393
ignored when autosummary logic applies.
94-
autosum : list or None
95-
If a list, autosummary-style behaviour will apply for params
94+
fake_autosummary : bool
95+
If True, autosummary-style behaviour will apply for params
9696
that are attributes of the class and have a docstring.
97-
Names for autosummary generation will be appended to this list.
98-
99-
If None, autosummary is disabled.
10097
10198
Returns
10299
-------
@@ -119,7 +116,7 @@ def _process_param(self, param, desc, autosum):
119116
param = param.strip()
120117
display_param = '**%s**' % param
121118

122-
if autosum is None:
119+
if not fake_autosummary:
123120
return display_param, desc
124121

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

143140
# Referenced object has a docstring
144-
autosum.append(" %s%s" % (autosum_prefix, param))
145141
display_param = ':obj:`%s <%s%s>`' % (param,
146142
link_prefix,
147143
param)
@@ -181,15 +177,11 @@ def _str_param_list(self, name, fake_autosummary=False):
181177
"""
182178
out = []
183179
if self[name]:
184-
if fake_autosummary:
185-
autosum = []
186-
else:
187-
autosum = None
188-
189180
out += self._str_field_list(name)
190181
out += ['']
191182
for param, param_type, desc in self[name]:
192-
display_param, desc = self._process_param(param, desc, autosum)
183+
display_param, desc = self._process_param(param, desc,
184+
fake_autosummary)
193185

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

204-
if fake_autosummary and autosum:
205-
if self.class_members_toctree:
206-
autosum.insert(0, ' :toctree:')
207-
autosum.insert(0, '.. autosummary::')
208-
out += ['..', ' HACK to make autogen generate docs:']
209-
out += self._str_indent(autosum, 4)
210-
out += ['']
211-
212196
return out
213197

214198
@property

numpydoc/tests/test_docscrape.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,16 +1104,6 @@ def no_period(self):
11041104
:obj:`no_period <no_period>`
11051105
This does not have a period
11061106
1107-
..
1108-
HACK to make autogen generate docs:
1109-
.. autosummary::
1110-
:toctree:
1111-
1112-
an_attribute
1113-
multiline_sentence
1114-
midword_period
1115-
no_period
1116-
11171107
.. rubric:: Methods
11181108
11191109
===== ==========

0 commit comments

Comments
 (0)