From 768b83a84056f91e5f3f1fd2e4155d37a4219f9b Mon Sep 17 00:00:00 2001 From: Jean-Luc Stevens Date: Thu, 15 Jun 2017 14:11:49 -0500 Subject: [PATCH] hv.output now saves while respecting all settings (#1548) --- holoviews/ipython/magics.py | 2 +- holoviews/util/__init__.py | 7 ++++++- holoviews/util/settings.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/holoviews/ipython/magics.py b/holoviews/ipython/magics.py index 6df0af4fdf..c66ced395b 100644 --- a/holoviews/ipython/magics.py +++ b/holoviews/ipython/magics.py @@ -91,7 +91,7 @@ def output(self, line, cell=None): print("\nFor help with the %output magic, call %output?") return - def cell_runner(cell): + def cell_runner(cell,renderer): self.shell.run_cell(cell, store_history=STORE_HISTORY) def warnfn(msg): diff --git a/holoviews/util/__init__.py b/holoviews/util/__init__.py index b0ca4bd46f..f21b6cb290 100644 --- a/holoviews/util/__init__.py +++ b/holoviews/util/__init__.py @@ -134,8 +134,13 @@ def __call__(self, *args, **options): if isinstance(obj, Dimensioned): if line: options = Store.output_settings.extract_keywords(line, {}) + for k in options.keys(): + if k not in Store.output_settings.allowed: + raise KeyError('Invalid keyword: %s' % k) if 'filename' in options: - Store.renderers[Store.current_backend].save(obj, options['filename']) + def save_fn(obj, renderer): renderer.save(obj, options['filename']) + Store.output_settings.output(line=line, cell=obj, cell_runner=save_fn, + help_prompt=help_prompt, **options) return obj elif obj is not None: return obj diff --git a/holoviews/util/settings.py b/holoviews/util/settings.py index 768a0e8e8b..eea8ab64b7 100644 --- a/holoviews/util/settings.py +++ b/holoviews/util/settings.py @@ -295,7 +295,7 @@ def output(cls, line=None, cell=None, cell_runner=None, return if cell is not None: - if cell_runner: cell_runner(cell) + if cell_runner: cell_runner(cell,renderer) # After cell restore previous options and restore # temporarily selected renderer OutputSettings.options = prev_restore