Skip to content

Commit

Permalink
Merge 13e9abc into b7b37de
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 15, 2020
2 parents b7b37de + 13e9abc commit 51c2225
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions holoviews/streams.py
Expand Up @@ -757,10 +757,22 @@ def update(self, **kwargs):
def contents(self):
if self._watch_only:
return {}
filtered = {(p.owner, p.name): getattr(p.owner, p.name) for p in self.parameters}
return {self._rename.get((o, n), n): v for (o, n), v in filtered.items()
if self._rename.get((o, n), True) is not None}
contents = {}
for p in self.parameters:
key = (p.owner, p.name)
if key in self._rename and self._rename[key] is None:
continue
name = self._rename.get(key, p.name)
if isinstance(p, param.Action):
# Special handling for param.Action, mapping value to True if triggered otherwise False

value = any(p.owner in (event.obj, event.cls) and
p.name == event.name
for event in self._events)
else:
value = getattr(p.owner, p.name)
contents[name] = value
return contents


class ParamMethod(Params):
Expand Down
4 changes: 2 additions & 2 deletions holoviews/tests/teststreams.py
Expand Up @@ -265,7 +265,7 @@ def subscriber(**kwargs):

stream.add_subscriber(subscriber)
inner.action(inner)
self.assertEqual(values, [{'action': inner.action}])
self.assertEqual(values, [{'action': True}])

def test_param_stream_memoization(self):
inner = self.inner_action()
Expand All @@ -282,7 +282,7 @@ def subscriber(**kwargs):
stream.add_subscriber(subscriber)
inner.action(inner)
inner.x = 0
self.assertEqual(values, [{'action': inner.action, 'x': 0}])
self.assertEqual(values, [{'action': True, 'x': 0}])



Expand Down

0 comments on commit 51c2225

Please sign in to comment.