diff --git a/streamz/core.py b/streamz/core.py index f381b632..d5f3579d 100644 --- a/streamz/core.py +++ b/streamz/core.py @@ -157,8 +157,9 @@ def register_api(cls, modifier=identity, attribute_name=None): """ def _(func): @functools.wraps(func) - def wrapped(*args, **kwargs): - return func(*args, **kwargs) + def wrapped(self, *args, **kwargs): + fn = type(name, (type(self), func), dict(func.__dict__)) + return fn(self, *args, **kwargs) name = attribute_name if attribute_name else func.__name__ setattr(cls, name, modifier(wrapped)) return func