Support parameters in slices on hv.dim
@@ -318,6 +318,13 @@ class dim(object):
op_arg = op_arg.param.value
if isinstance(op_arg, dim):
params.update(op_arg.params)
+ elif isinstance(op_arg, slice):
+ if isinstance(op_arg.start, param.Parameter):
+ params[op_arg.start.name+str(id(op_arg.start))] = op_arg.start
+ if isinstance(op_arg.stop, param.Parameter):
+ params[op_arg.stop.name+str(id(op_arg.stop))] = op_arg.stop
+ if isinstance(op_arg.step, param.Parameter):
+ params[op_arg.step.name+str(id(op_arg.step))] = op_arg.step
if (isinstance(op_arg, param.Parameter) and
isinstance(op_arg.owner, param.Parameterized)):
params[op_arg.name+str(id(op_arg))] = op_arg
@@ -552,6 +559,12 @@ class dim(object):
dataset, flat, expanded, ranges, all_values,
keep_index, compute, strict
)
+ elif isinstance(arg, slice):
+ arg = slice(
+ resolve_dependent_value(arg.start),
+ resolve_dependent_value(arg.stop),
+ resolve_dependent_value(arg.step)
+ )
arg = resolve_dependent_value(arg)
fn_args.append(arg)
fn_kwargs = {}
@@ -561,6 +574,12 @@ class dim(object):
dataset, flat, expanded, ranges, all_values,
keep_index, compute, strict
)
+ elif isinstance(v, slice):
+ v = slice(
+ resolve_dependent_value(v.start),
+ resolve_dependent_value(v.stop),
+ resolve_dependent_value(v.step)
+ )
fn_kwargs[k] = resolve_dependent_value(v)
args = tuple(fn_args[::-1] if op['reverse'] else fn_args)
kwargs = dict(fn_kwargs)
