-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplified how Event subscribers are handled #1235
Conversation
@philippjfr I think it is ready for review - I'm expecting the tests to pass. |
Addresses #1168 |
holoviews/core/spaces.py
Outdated
stream.update(**dict({k:kwargs[k] for k in overlap}, trigger=False)) | ||
updated_streams.append(stream) | ||
rkwargs = util.rename_stream_kwargs(stream, kwargs, reverse=True) | ||
stream.update(**dict(rkwargs, trigger=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm not following the logic correctly in the utilities but won't this try to send the supplied kwargs to all the streams even though they may not apply? That's what the overlap bit was for I assume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that has helped me realize what we need:
-
An initial loop over
set(kwargs.keys()) - set(all_streams)
to raise an exception for anything in that difference set: these are kwargs that cannot be applicable to any stream. Previously invalid kwargs were silently ignored and I think this is bad behavior unless you have reasons to say otherwise. -
util.rename_stream_kwargs(stream, {k:v for k,v in kwargs.items() if k in set(stream.contents.keys())}, reverse=True)
to filter the kwargs to the applicable ones.
Do you agree that this is the right approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 79b7de1
Looks good now, will merge when tests pass. |
Tests now passing except for one transient error. |
Will merge, since the PR build has passed. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR offers
clear
andadd_subscriber
methods toEvent
and does away with_hidden_subscribers
. Thesubscribers
attribute is now in fact a read-only property which means the correct way to add subscribers is with theadd_subscribers
method.Outstanding items to address:
DynamicMap.event
andStream.update
methods support names before or after renaming.