From 6d0df0ebebd4e347e1ebcdea4be010a4b54b901b Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 24 Apr 2025 13:39:43 -0400 Subject: [PATCH] [Docs] Generate correct github links for decorated functions (#17125) Signed-off-by: Russell Bryant --- docs/source/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index a83ad76412..c2ad6f9fa3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -177,6 +177,11 @@ def linkcode_resolve(domain, info): for part in info['fullname'].split('.'): 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) or inspect.ismethod(obj)): obj = obj.__class__ # Get the class of the instance