-
Notifications
You must be signed in to change notification settings - Fork 85
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
Implement SetItemObserver for observing mutations on a set #1075
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1075 +/- ##
==========================================
- Coverage 76.15% 73.79% -2.37%
==========================================
Files 54 74 +20
Lines 6493 8353 +1860
Branches 1263 1592 +329
==========================================
+ Hits 4945 6164 +1219
- Misses 1205 1809 +604
- Partials 343 380 +37
Continue to review full report at Codecov.
|
…ll. Remove protection to be consistent with ListItemObserver post-review.
# then | ||
event, = events | ||
self.assertEqual(event.added, set([4])) | ||
self.assertEqual(event.removed, set([])) |
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.
Nitpick: set()
is the usual way to spell the empty set. (Could also use {4}
in the line above.)
|
||
|
||
def create_observer(**kwargs): | ||
""" Convenient function for creating SetItemObserver with default values. |
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.
typo: "Convenient" -> "Convenience"
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.
One typo to fix and merge conflicts to sort out; other than that, I think this is ready to merge. |
This PR implements item 10 of #977 for observing mutations on a set (strictly speaking, TraitSet).
SetChangeEvent
to represent mutations on a setIObserver
interface to- Define the notifier such that
SetChangeEvent
will be created for the user's change handler.- Implement logic for maintaining downstream observers
IObservable
forTraitSet
. With that, any subclass ofTraitSet
can be used with SetItemObserver.Checklist
docs/source/traits_api_reference
)Update User manual (docs/source/traits_user_manual
)Update type annotation hints intraits-stubs