Skip to content

Commit

Permalink
Fix Stream subclassing python-streamz#442
Browse files Browse the repository at this point in the history
  • Loading branch information
florentbr committed Dec 7, 2021
1 parent 7453431 commit 45edc86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions streamz/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45edc86

Please sign in to comment.