Skip to content

Commit 5595abd

Browse files
authored
Fix source code links in documentation (#219)
1 parent dceb1fb commit 5595abd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None:
200200
pyobject = module
201201
for elt in info["fullname"].split("."):
202202
pyobject = getattr(pyobject, elt)
203+
pyobject = inspect.unwrap(pyobject)
203204
fname = inspect.getsourcefile(pyobject).replace("\\", "/")
204205
except Exception:
205206
# Either the object could not be loaded or the file was not found.
@@ -216,7 +217,7 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None:
216217
else:
217218
return None # alternatively, link to a maint/version branch
218219
fname = fname.rsplit(f"/{package}/")[1]
219-
url = f"{gh_url}/blob/{branch}/{package}/{fname}#{lines}"
220+
url = f"{gh_url}/blob/{branch}/src/{package}/{fname}#{lines}"
220221
return url
221222

222223

0 commit comments

Comments
 (0)