Skip to content

Commit

Permalink
Update set_param to update (#5713)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored May 9, 2023
1 parent 783c7ac commit f4c4c12
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Version 1.16.0
==============
**May 8, 2023**
**May 9, 2023**

This release includes many new features, improvements, and bug fixes. Among the highlights are support for Bokeh 3.1 and Panel 1.0, both of which come with a wide range of new features and enhancements. Time series support has also been improved, with auto-ranging along one axis, a new downsample algorithm, and having WebGL enabled by default. In addition, the release includes various other enhancements and bug fixes.

Expand Down
2 changes: 1 addition & 1 deletion doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Version 1.16
Version 1.16.0
**************

**May 8, 2023**
**May 9, 2023**

This release includes many new features, improvements, and bug fixes.
Among the highlights are support for Bokeh 3.1 and Panel 1.0, both of
Expand Down
4 changes: 2 additions & 2 deletions examples/user_guide/Exporting_and_Archiving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@
"source": [
"The ``hv.archive`` object provides numerous parameters that can be changed. You can e.g.:\n",
"\n",
"- output the whole directory to a single compressed ZIP or tar archive file (e.g. ``hv.archive.set_param(pack=False, archive_format='zip')`` or ``archive_format='tar'``)\n",
"- output the whole directory to a single compressed ZIP or tar archive file (e.g. ``hv.archive.param.update(pack=False, archive_format='zip')`` or ``archive_format='tar'``)\n",
"\n",
"- generate a new directory or archive every time the notebook is run (``hv.archive.uniq_name=True``); otherwise the old output directory is erased each time \n",
"\n",
"- choose your own name for the output directory or archive (e.g. ``hv.archive.export_name=\"{timestamp}\"``)\n",
"\n",
"- change the format of the optional timestamp (e.g. to retain snapshots hourly, ``archive.set_param(export_name=\"{timestamp}\", timestamp_format=\"%Y_%m_%d-%H\")``)\n",
"- change the format of the optional timestamp (e.g. to retain snapshots hourly, ``archive.param.update(export_name=\"{timestamp}\", timestamp_format=\"%Y_%m_%d-%H\")``)\n",
"\n",
"- select PNG output, at a specified rendering resolution: ``hv.archive.exporters=[hv.renderer('bokeh').instance(size=50)])\n",
"``\n",
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/pprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __call__(self, obj, filter_fn=None):
filtered = {k:v for k,v in instance_params
if (k in obj_proxy.param)
and not obj_proxy.param.objects('existing')[k].constant}
obj_proxy.param.set_param(**filtered)
obj_proxy.param.update(**filtered)
return obj_proxy

@param.parameterized.bothmethod
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Config(param.ParameterizedFunction):
1.14.0, the default value was the 'RdYlBu_r' colormap.""")

def __call__(self, **params):
self.param.set_param(**params)
self.param.update(**params)
return self

config = Config()
Expand Down
2 changes: 1 addition & 1 deletion holoviews/ipython/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def auto(self, enabled=True, clear=False, **kwargs):
display(Javascript(cmd))
time.sleep(0.5)
self._auto=enabled
self.param.set_param(**kwargs)
self.param.update(**kwargs)
tstamp = time.strftime(" [%Y-%m-%d %H:%M:%S]", self._timestamp)
# When clear == True, it clears the archive, in order to start a new auto capture in a clean archive
if clear:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __call__(self, obj, **params):
streams = params.pop('streams')
else:
streams = [RangeXY()]
self.param.set_param(**params)
self.param.update(**params)
if not self.predicate:
raise ValueError(
'Must provide a predicate function to determine when '
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_batched_data(self, element, ranges):
has_angles = False
for (key, el), zorder in zip(element.data.items(), zorders):
el_opts = self.lookup_options(el, 'plot').options
self.param.set_param(**{k: v for k, v in el_opts.items()
self.param.update(**{k: v for k, v in el_opts.items()
if k not in OverlayPlot._propagate_options})
style = self.lookup_options(element.last, 'style')
style = style.max_cycles(len(self.ordering))[zorder]
Expand Down Expand Up @@ -379,7 +379,7 @@ def get_batched_data(self, overlay, ranges):
zorders = self._updated_zorders(overlay)
for (key, el), zorder in zip(overlay.data.items(), zorders):
el_opts = self.lookup_options(el, 'plot').options
self.param.set_param(**{k: v for k, v in el_opts.items()
self.param.update(**{k: v for k, v in el_opts.items()
if k not in OverlayPlot._propagate_options})
style = self.lookup_options(el, 'style')
style = style.max_cycles(len(self.ordering))[zorder]
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ def update_frame(self, key, ranges=None, plot=None, element=None):
ranges = self.compute_ranges(self.hmap, key, ranges)
else:
self.ranges.update(ranges)
self.param.set_param(**self.lookup_options(style_element, 'plot').options)
self.param.update(**self.lookup_options(style_element, 'plot').options)
ranges = util.match_spec(style_element, ranges)
self.current_ranges = ranges
plot = self.handles['plot']
Expand Down Expand Up @@ -2574,7 +2574,7 @@ def update_frame(self, key, ranges=None, element=None):
self._propagate_options,
defaults=False)
plot_opts.update(**{k: v[0] for k, v in inherited.items() if k not in plot_opts})
self.param.set_param(**plot_opts)
self.param.update(**plot_opts)

if not self.overlaid and not self.tabs and not self.batched:
self._update_ranges(element, ranges)
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_batched_data(self, element, ranges=None):
zorders = self._updated_zorders(element)
for (key, el), zorder in zip(element.data.items(), zorders):
el_opts = self.lookup_options(el, 'plot').options
self.param.set_param(**{k: v for k, v in el_opts.items()
self.param.update(**{k: v for k, v in el_opts.items()
if k not in OverlayPlot._propagate_options})
style = self.lookup_options(el, 'style')
style = style.max_cycles(len(self.ordering))[zorder]
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def update_frame(self, key, ranges=None, plot=None):
to the key.
"""
element = self._get_frame(key)
self.param.set_param(**self.lookup_options(element, 'plot').options)
self.param.update(**self.lookup_options(element, 'plot').options)
self._get_title_div(key, '12pt')

# Cache frame object id to skip updating data if unchanged
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/mpl/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def update_frame(self, key, ranges=None, element=None):
self.current_frame = element

if element is not None:
self.param.set_param(**self.lookup_options(element, 'plot').options)
self.param.update(**self.lookup_options(element, 'plot').options)
axis = self.handles['axis']

axes_visible = element is not None or self.overlaid
Expand Down Expand Up @@ -1204,7 +1204,7 @@ def update_frame(self, key, ranges=None, element=None):
defaults=False)
plot_opts.update(**{k: v[0] for k, v in inherited.items()
if k not in plot_opts})
self.param.set_param(**plot_opts)
self.param.update(**plot_opts)

if self.show_legend and not empty:
self._adjust_legend(element, axis)
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def __init__(self, element, keys=None, ranges=None, dimensions=None,
self.ordering = util.layer_sort(self.hmap)
overlay_opts = self.lookup_options(self.hmap.last, 'plot').options.items()
opts = {k: v for k, v in overlay_opts if k in self.param}
self.param.set_param(**opts)
self.param.update(**opts)
self.style = self.lookup_options(plot_element, 'style').max_cycles(len(self.ordering))
else:
self.ordering = []
Expand Down
6 changes: 3 additions & 3 deletions holoviews/plotting/plotly/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def generate_plot(self, key, ranges, element=None, is_geo=False):

# Set plot options
plot_opts = self.lookup_options(element, 'plot').options
self.param.set_param(**{k: v for k, v in plot_opts.items()
self.param.update(**{k: v for k, v in plot_opts.items()
if k in self.param})

# Get ranges
Expand Down Expand Up @@ -695,7 +695,7 @@ def generate_plot(self, key, ranges, element=None, is_geo=False):
self._propagate_options,
defaults=False)
plot_opts.update(**{k: v[0] for k, v in inherited.items() if k not in plot_opts})
self.param.set_param(**plot_opts)
self.param.update(**plot_opts)

ranges = self.compute_ranges(self.hmap, key, ranges)
figure = None
Expand All @@ -719,7 +719,7 @@ def generate_plot(self, key, ranges, element=None, is_geo=False):
el = None

# propagate plot options to subplots
subplot.param.set_param(**plot_opts)
subplot.param.update(**plot_opts)

fig = subplot.generate_plot(key, ranges, el, is_geo=is_geo)
if figure is None:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def clear_stream_history(resetting, stream=selection_expr_seq.history_stream):

def __call__(self, hvobj, **kwargs):
# Apply kwargs as params
self.param.set_param(**kwargs)
self.param.update(**kwargs)

if Store.current_backend not in Store.renderers:
raise RuntimeError("Cannot perform link_selections operation "
Expand Down
6 changes: 3 additions & 3 deletions holoviews/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def _set_stream_parameters(self, **kwargs):
constant.
"""
with util.disable_constant(self):
self.param.set_param(**kwargs)
self.param.update(**kwargs)

def event(self, **kwargs):
"""
Expand Down Expand Up @@ -793,12 +793,12 @@ def update(self, **kwargs):
if isinstance(owner, Stream):
owner.update(**updates)
else:
owner.param.set_param(**updates)
owner.param.update(**updates)
elif isinstance(self.parameterized, Stream):
self.parameterized.update(**kwargs)
return
else:
self.parameterized.param.set_param(**kwargs)
self.parameterized.param.update(**kwargs)

@property
def contents(self):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ class extension(_pyviz_extension):
def __call__(self, *args, **params):
# Get requested backends
config = params.pop('config', {})
util.config.param.set_param(**config)
util.config.param.update(**config)
imports = [(arg, self._backends[arg]) for arg in args
if arg in self._backends]
for p, val in sorted(params.items()):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,4 @@ def _set_render_options(cls, options, backend=None):
options['widget_mode'] = options['widgets']
renderer = Store.renderers[backend]
render_options = {k: options[k] for k in cls.render_params if k in options}
renderer.param.set_param(**render_options)
renderer.param.update(**render_options)

0 comments on commit f4c4c12

Please sign in to comment.