From b0bf2a8c597e6ebb8ebff800986529955eb3c09f Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Fri, 4 Oct 2019 14:50:46 +0200 Subject: [PATCH] Fix issues in .apply (#4025) --- holoviews/core/accessors.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/holoviews/core/accessors.py b/holoviews/core/accessors.py index 70fe76d9dd..36717838a1 100644 --- a/holoviews/core/accessors.py +++ b/holoviews/core/accessors.py @@ -65,6 +65,8 @@ def __call__(self, function, streams=[], link_inputs=True, dynamic=None, **kwarg 'and setting dynamic=False is only ' 'possible if key dimensions define ' 'a discrete parameter space.') + if not len(samples): + return self._obj[samples] return HoloMap(self._obj[samples]).apply( function, streams, link_inputs, dynamic, **kwargs) @@ -92,11 +94,13 @@ def function(object, **kwargs): ) if dynamic is None: - dynamic = (bool(streams) or isinstance(self._obj, DynamicMap) or - util.is_param_method(function, has_deps=True) or - params or dependent_kws) + is_dynamic = (bool(streams) or isinstance(self._obj, DynamicMap) or + util.is_param_method(function, has_deps=True) or + params or dependent_kws) + else: + is_dynamic = dynamic - if (applies or isinstance(self._obj, HoloMap)) and dynamic: + if (applies or isinstance(self._obj, HoloMap)) and is_dynamic: return Dynamic(self._obj, operation=function, streams=streams, kwargs=kwargs, link_inputs=link_inputs) elif applies: