Skip to content

Commit

Permalink
Fix [source] links in documentation for decorated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
emerali committed Jan 12, 2021
1 parent cf36827 commit 390adf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 7 additions & 7 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# You can set these variables from the command line.
SPHINXOPTS = -j 1 -aT
SPHINXAUTO = \
-z ../qucumber \
-z ../examples \
-i *.swp \
-i **/.~*.ipynb \
-i **/*-checkpoint.ipynb \
-r '_examples/*' \
-i Makefile
--watch '../qucumber' \
--watch '../examples' \
--ignore '*.swp' \
--ignore '**/.~*.ipynb' \
--ignore '**/*-checkpoint.ipynb' \
--re-ignore '_examples/*' \
--ignore Makefile
SPHINXBUILD = sphinx-build
SPHINXPROJ = QuCumber
SOURCEDIR = .
Expand Down
8 changes: 6 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@

project = "QuCumber"
author = "PIQuIL"
copyright = "2018-{}, {}".format(date.today().year, author)
copyright = f"2018-{date.today().year}, {author}"


init_file = {}
with open("../qucumber/__version__.py", "r") as f:
with open("../qucumber/__version__.py") as f:
# The short X.Y.Z version
exec(f.read(), init_file)
version = init_file["__version__"]
Expand Down Expand Up @@ -341,6 +341,10 @@ def linkcode_resolve(domain, info):
module = __import__(info["module"], fromlist=[class_name])
obj = attrgetter(info["fullname"])(module)

# unwrap decorated functions
if hasattr(obj, "__wrapped__"):
obj = obj.__wrapped__

try:
file_name = inspect.getsourcefile(obj)
except Exception:
Expand Down

0 comments on commit 390adf5

Please sign in to comment.