From 0b200d82fd48cf60a51648a9a67eec77296cb61b Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 30 Oct 2020 00:53:59 +0900 Subject: [PATCH] napoleon: simplify seealso transformation --- sphinx/ext/napoleon/docstring.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 20d9e1b9e1d..bcd2d242646 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -1240,14 +1240,13 @@ def translate(func, description, role): for func, description, role in items ] - func_role = 'obj' lines = [] # type: List[str] last_had_desc = True - for func, desc, role in items: + for name, desc, role in items: if role: - link = ':%s:`%s`' % (role, func) + link = ':%s:`%s`' % (role, name) else: - link = ':%s:`%s`' % (func_role, func) + link = ':obj:`%s`' % name if desc or last_had_desc: lines += [''] lines += [link]