napoleon: simplify seealso transformation

This commit is contained in:
Takeshi KOMIYA 2020-10-30 00:53:59 +09:00
parent 078aaf5f13
commit 0b200d82fd

View File

@ -1240,14 +1240,13 @@ class NumpyDocstring(GoogleDocstring):
for func, description, role in items for func, description, role in items
] ]
func_role = 'obj'
lines = [] # type: List[str] lines = [] # type: List[str]
last_had_desc = True last_had_desc = True
for func, desc, role in items: for name, desc, role in items:
if role: if role:
link = ':%s:`%s`' % (role, func) link = ':%s:`%s`' % (role, name)
else: else:
link = ':%s:`%s`' % (func_role, func) link = ':obj:`%s`' % name
if desc or last_had_desc: if desc or last_had_desc:
lines += [''] lines += ['']
lines += [link] lines += [link]