Skip to content

Commit e6eb4f7

Browse files
committed
FIX: Fixes after rebase
1 parent 7b0a03f commit e6eb4f7

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', numpydoc.__version__)
8484
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
8585
numpydoc_xref_param_type = True
86-
numpydoc_xref_ignore = {'optional'}
86+
numpydoc_xref_ignore = {'optional', 'type_without_description', 'BadException'}
8787

8888
# The language for content autogenerated by Sphinx. Refer to documentation
8989
# for a list of supported languages.

numpydoc/docscrape_sphinx.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _str_returns(self, name='Returns'):
9292
out += self._str_indent([named_fmt % (param.name.strip(),
9393
param_type)])
9494
else:
95-
out += self._str_indent([unnamed_fmt % param_type.strip()])
95+
out += self._str_indent([unnamed_fmt % param_type.strip()])
9696
if not param.desc:
9797
out += self._str_indent(['..'], 8)
9898
else:
@@ -167,10 +167,8 @@ def _process_param(self, param, desc, fake_autosummary):
167167

168168
prefix = getattr(self, '_name', '')
169169
if prefix:
170-
autosum_prefix = '~%s.' % prefix
171170
link_prefix = '%s.' % prefix
172171
else:
173-
autosum_prefix = ''
174172
link_prefix = ''
175173

176174
# Referenced object has a docstring
@@ -230,10 +228,9 @@ def _str_param_list(self, name, fake_autosummary=False):
230228
param_type,
231229
self.xref_aliases,
232230
self.xref_ignore)
233-
(??) out += self._str_indent(['%s : %s' % (display_param,
234-
(??) param.type)])
235-
(??) else:
236-
(??) out += self._str_indent([display_param])
231+
parts.append(param_type)
232+
out += self._str_indent([' : '.join(parts)])
233+
237234
if desc and self.use_blockquotes:
238235
out += ['']
239236
elif not desc:

numpydoc/tests/test_docscrape.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,11 @@ def _strip_blank_lines(s):
383383
return s
384384

385385

386-
def line_by_line_compare(a, b):
386+
def line_by_line_compare(a, b, n_lines=None):
387387
a = textwrap.dedent(a)
388388
b = textwrap.dedent(b)
389-
a = [l.rstrip() for l in _strip_blank_lines(a).split('\n')]
390-
b = [l.rstrip() for l in _strip_blank_lines(b).split('\n')]
389+
a = [l.rstrip() for l in _strip_blank_lines(a).split('\n')][:n_lines]
390+
b = [l.rstrip() for l in _strip_blank_lines(b).split('\n')][:n_lines]
391391
assert len(a) == len(b)
392392
for ii, (aa, bb) in enumerate(zip(a, b)):
393393
assert aa == bb
@@ -519,8 +519,7 @@ def test_yield_str():
519519
The number of bananas.
520520
int
521521
The number of unknowns.
522-
523-
.. index:: """)
522+
""")
524523

525524

526525
def test_receives_str():
@@ -538,8 +537,7 @@ def test_receives_str():
538537
The number of bananas.
539538
c : int
540539
The number of oranges.
541-
542-
.. index:: """)
540+
""")
543541

544542

545543
def test_no_index_in_str():
@@ -1186,8 +1184,6 @@ def test_class_members_doc():
11861184
b
11871185
c
11881186
1189-
.. index::
1190-
11911187
""")
11921188

11931189

@@ -1371,7 +1367,7 @@ def test_autoclass():
13711367
.. rubric:: Methods
13721368
13731369
1374-
''')
1370+
''', 5)
13751371

13761372

13771373
xref_doc_txt = """

numpydoc/tests/test_numpydoc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class MockConfig():
1010
numpydoc_show_class_members = True
1111
numpydoc_show_inherited_class_members = True
1212
numpydoc_class_members_toctree = True
13+
numpydoc_xref_param_type = False
14+
numpydoc_xref_aliases = {}
15+
numpydoc_xref_ignore = set()
1316
templates_path = []
1417
numpydoc_edit_link = False
1518
numpydoc_citation_re = '[a-z0-9_.-]+'
@@ -40,7 +43,7 @@ def test_mangle_docstrings():
4043
doc = mangle_docstrings(MockApp(), 'class', 'str', str, {'members': ['upper']}, lines)
4144
assert 'rpartition' not in [x.strip() for x in lines]
4245
assert 'upper' in [x.strip() for x in lines]
43-
46+
4447
lines = s.split('\n')
4548
doc = mangle_docstrings(MockApp(), 'class', 'str', str, {'exclude-members': ALL}, lines)
4649
assert 'rpartition' not in [x.strip() for x in lines]

0 commit comments

Comments
 (0)