-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Observe Traits Via Metadata #111
Conversation
Needs tests for new functionality. |
I like this idea - it will help with certain patterns. Question: does the example above mean that the |
👍 |
It is a problem of argument pass-through. Since the corresponding call to |
Begs the question of whether 1ae7d72 is reasonable as well. |
type : str or All (default: 'change') | ||
The type of notification to filter by. If All, the specified handler | ||
is uninstalled from the list of notifiers corresponding to all types. | ||
""" | ||
names = parse_notifier_name(names) | ||
if tags: | ||
names.extend(self.trait_names(**tags)) |
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.
If I understand this well, if names
is All
, then you end up listening to the "All" event and the filtered tags. I would rather compute a list of names from tags before calling parse_notifier_name
.
d654654
to
48679e4
Compare
48679e4 is a pretty drastic change, but it solves the problem of associating arbitrary notifiers with tags. Given that, I need to think on it to be sure it isn't fundamentally flawed, but feedback would be appreciated @SylvainCorlay, @minrk, @ellisonbg. The gist of it:
I have a feeling the |
This is quite a big and non-trivial change. Can we work on pushing 4.1/5.0 first and get this in later? I am 👍 on the feature. |
+1 on waiting then On Thu, Oct 22, 2015 at 10:44 AM, Sylvain Corlay notifications@github.com
Brian E. Granger |
8156a35
to
3386ca2
Compare
I've cleaned this up significantly and added a heuristic for triggering change types other than But yes, probably best to wait. |
5602beb
to
fcc360f
Compare
fcc360f
to
e434501
Compare
f2be7c0
to
2383466
Compare
1559adb
to
45ad032
Compare
@minrk, @SylvainCorlay I think I've brought this to a point where it might be worth doing some review. These changes are quite drastic in order to incorporate all the features that tags can (but perhaps shouldn't necessarily) introduce to observing to traits. To hide away some of the nastier heuristics and keep the main file as simple as possible, I created For a more complete demonstration of the new features see
At this point, everything is included and functional, so we can trim features as we see fit. |
Allows the use of metadata as a way to observe traits
For a more complete demonstration of the new features see
test_traitlets.py
:test_observe_decorator_via_tags
test_observe_via_tags
test_unobserve_via_tags