Skip to content

Commit 565af9d

Browse files
russellbMu Huai
authored and
Mu Huai
committed
[Docs] Generate correct github links for decorated functions (vllm-project#17125)
Signed-off-by: Russell Bryant <[email protected]> Signed-off-by: Mu Huai <[email protected]>
1 parent 88ae14d commit 565af9d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ def linkcode_resolve(domain, info):
177177
for part in info['fullname'].split('.'):
178178
obj = getattr(obj, part)
179179

180+
# Skip decorator wrappers by checking if the object is a function
181+
# and has a __wrapped__ attribute (which decorators typically set)
182+
while hasattr(obj, '__wrapped__'):
183+
obj = obj.__wrapped__
184+
180185
if not (inspect.isclass(obj) or inspect.isfunction(obj)
181186
or inspect.ismethod(obj)):
182187
obj = obj.__class__ # Get the class of the instance

0 commit comments

Comments
 (0)