diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-01 11:23:59 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-01 11:23:59 +0900 |
commit | 4c2076b220d3c2371229cfc911bf44b1f13eeea2 (patch) | |
tree | 299bb098321879c2df6fe4260aff51a7449c0bbf | |
parent | 73f538da0ff0350b4e7b1f92e58a09f66074c833 (diff) | |
parent | 0b200d82fd48cf60a51648a9a67eec77296cb61b (diff) | |
download | sphinx-git-4c2076b220d3c2371229cfc911bf44b1f13eeea2.tar.gz |
Merge pull request #8351 from sphinx-doc/cleanup_napoleon
Cleanup napoleon
-rw-r--r-- | sphinx/ext/napoleon/docstring.py | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index 90f7ade52..ddcf3f01b 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -1193,25 +1193,6 @@ class NumpyDocstring(GoogleDocstring): items.append((name, list(rest), role)) del rest[:] - def search_inventory(inventory, name, hint=None): - roles = list(inventory.keys()) - if hint is not None: - preferred = [ - role - for role in roles - if role.split(":", 1)[-1].startswith(hint) - ] - roles = preferred + [role for role in roles if role not in preferred] - - for role in roles: - objects = inventory[role] - found = objects.get(name, None) - if found is not None: - domain, role = role.split(":", 1) - return role - - return None - def translate(func, description, role): translations = self._config.napoleon_type_aliases if role is not None or not translations: @@ -1264,14 +1245,13 @@ class NumpyDocstring(GoogleDocstring): 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] |