From 45edc869119e9462e861a19f9bded9b12f65bf2f Mon Sep 17 00:00:00 2001 From: florentbr Date: Tue, 7 Dec 2021 16:49:06 +0100 Subject: [PATCH] Fix Stream subclassing #442 --- streamz/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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