Skip to content

Commit 91039cf

Browse files
authored
Carry over more metadata for class decorators. (#260)
1 parent 86e6aec commit 91039cf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

python/cocoindex/op.py

+9
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ def __call__(self, *args, **kwargs):
181181
return to_engine_value(output)
182182

183183
_WrappedClass.__name__ = executor_cls.__name__
184+
_WrappedClass.__doc__ = executor_cls.__doc__
185+
_WrappedClass.__module__ = executor_cls.__module__
186+
_WrappedClass.__qualname__ = executor_cls.__qualname__
187+
_WrappedClass.__wrapped__ = executor_cls
184188

185189
if category == OpCategory.FUNCTION:
186190
_engine.register_function_factory(
@@ -234,7 +238,12 @@ def __call__(self, *args, **kwargs):
234238

235239
class _Spec(FunctionSpec):
236240
pass
241+
237242
_Spec.__name__ = op_name
243+
_Spec.__doc__ = fn.__doc__
244+
_Spec.__module__ = fn.__module__
245+
_Spec.__qualname__ = fn.__qualname__
246+
_Spec.__wrapped__ = fn
238247

239248
_register_op_factory(
240249
category=OpCategory.FUNCTION,

0 commit comments

Comments
 (0)