Skip to content

Commit

Permalink
object -> emitter
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Aug 27, 2015
1 parent 2d69059 commit 2beadc3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions traitlets/traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def __call__(self, change):
elif self.nargs == 3:
self.cb(change['name'], change['old'], change['new'])
elif self.nargs == 4:
self.cb(change['name'], change['old'], change['new'], change['object'])
self.cb(change['name'], change['old'], change['new'], change['emitter'])

def _callback_wrapper(cb):
if isinstance(cb, _CallbackWrapper):
Expand Down Expand Up @@ -795,7 +795,7 @@ def _notify_trait(self, name, old_value, new_value):
if nargs == 0:
c()
elif nargs == 1:
c({'name': name, 'old': old_value, 'new': new_value, 'object': self})
c({'name': name, 'old': old_value, 'new': new_value, 'emitter': self})
else:
raise TraitError('an observe change callback '
'must have 0-1 arguments.')
Expand Down Expand Up @@ -868,7 +868,7 @@ def observe(self, handler, name=None):
A callable that is called when a trait changes. Its
signature can be handler() or handler(change), where change is a
dictionary with the following keys:
- object : the HasTraits instance
- emitter : the HasTraits instance
- old : the old value of the modified trait attribute
- new : the new value of the modified trait attribute
- name : the name of the modified trait attribute.
Expand All @@ -889,13 +889,7 @@ def unobserve(self, handler, name=None):
Parameters
----------
handler : callable
A callable that is called when a trait changes. Its
signature can be handler() or handler(change), where change is a
dictionary with the following keys:
- object : the HasTraits instance
- old : the old value of the modified trait attribute
- new : the new value of the modified trait attribute
- name : the name of the modified trait attribute.
The callable called when a trait attribute changes.
name : list, str, None
If None, all change handlers for the specified name are
uninstalled.
Expand Down

0 comments on commit 2beadc3

Please sign in to comment.