Unverified Commit 6d0df0eb authored by Russell Bryant's avatar Russell Bryant Committed by GitHub
Browse files

[Docs] Generate correct github links for decorated functions (#17125)


Signed-off-by: default avatarRussell Bryant <rbryant@redhat.com>
parent 0fa939e2
...@@ -177,6 +177,11 @@ def linkcode_resolve(domain, info): ...@@ -177,6 +177,11 @@ def linkcode_resolve(domain, info):
for part in info['fullname'].split('.'): for part in info['fullname'].split('.'):
obj = getattr(obj, part) obj = getattr(obj, part)
# Skip decorator wrappers by checking if the object is a function
# and has a __wrapped__ attribute (which decorators typically set)
while hasattr(obj, '__wrapped__'):
obj = obj.__wrapped__
if not (inspect.isclass(obj) or inspect.isfunction(obj) if not (inspect.isclass(obj) or inspect.isfunction(obj)
or inspect.ismethod(obj)): or inspect.ismethod(obj)):
obj = obj.__class__ # Get the class of the instance obj = obj.__class__ # Get the class of the instance
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment