Fix getting 'orig_path' for 'viewcode_follow_imported'

pull/394/head
Z-Fran 1 year ago committed by Ashley Whetter
parent 38a615ff74
commit 86cf7e2b87

@ -264,7 +264,13 @@ def viewcode_follow_imported(app, modname, attribute):
if fullname not in all_objects:
return None
orig_path = all_objects[fullname].obj.get("original_path", "")
if all_objects[fullname].obj.get("type") == 'method':
fullname = fullname[:fullname.rfind('.')]
attribute = attribute[:attribute.rfind('.')]
while all_objects[fullname].obj.get("original_path", "") != "":
fullname = all_objects[fullname].obj.get("original_path")
orig_path = fullname
if orig_path.endswith(attribute):
return orig_path[: -len(attribute) - 1]

Loading…
Cancel
Save