language/core: pass docstrings through kernel decorator

This commit is contained in:
Sebastien Bourdeauducq 2014-09-30 16:43:00 +08:00
parent 5099643f84
commit 05d8dde412
1 changed files with 3 additions and 0 deletions

View File

@ -2,6 +2,7 @@
from collections import namedtuple as _namedtuple
from copy import copy as _copy
from functools import wraps as _wraps
class int64(int):
@ -204,6 +205,7 @@ def kernel(arg):
"""
if isinstance(arg, str):
def real_decorator(k_function):
@_wraps(k_function)
def run_on_core(exp, *k_args, **k_kwargs):
getattr(exp, arg).run(k_function, ((exp,) + k_args), k_kwargs)
run_on_core.k_function_info = _KernelFunctionInfo(
@ -211,6 +213,7 @@ def kernel(arg):
return run_on_core
return real_decorator
else:
@_wraps(arg)
def run_on_core(exp, *k_args, **k_kwargs):
exp.core.run(arg, ((exp,) + k_args), k_kwargs)
run_on_core.k_function_info = _KernelFunctionInfo(