Skip to content

Commit 86cf7e2

Browse files
Z-FranAWhetter
authored andcommitted
Fix getting 'orig_path' for 'viewcode_follow_imported'
1 parent 38a615f commit 86cf7e2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoapi/extension.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,13 @@ def viewcode_follow_imported(app, modname, attribute):
264264
if fullname not in all_objects:
265265
return None
266266

267-
orig_path = all_objects[fullname].obj.get("original_path", "")
267+
if all_objects[fullname].obj.get("type") == 'method':
268+
fullname = fullname[:fullname.rfind('.')]
269+
attribute = attribute[:attribute.rfind('.')]
270+
while all_objects[fullname].obj.get("original_path", "") != "":
271+
fullname = all_objects[fullname].obj.get("original_path")
272+
273+
orig_path = fullname
268274
if orig_path.endswith(attribute):
269275
return orig_path[: -len(attribute) - 1]
270276

0 commit comments

Comments
 (0)