Skip to content

Commit

Permalink
Handle unqualified Options objects (#4032)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Oct 6, 2019
1 parent 3ae9b7a commit 63551b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions holoviews/core/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,14 @@ def _dynamicmap_opts(self, *args, **kwargs):


def _base_opts(self, *args, **kwargs):
apply_groups, options, new_kwargs = util.deprecated_opts_signature(args, kwargs)
from .options import Options

new_args = []
for arg in args:
if isinstance(arg, Options) and arg.key is None:
arg = arg(key=type(self._obj).__name__)
new_args.append(arg)
apply_groups, options, new_kwargs = util.deprecated_opts_signature(new_args, kwargs)

# By default do not clone in .opts method
clone = kwargs.get('clone', None)
Expand All @@ -536,4 +543,4 @@ def _base_opts(self, *args, **kwargs):
return opts.apply_groups(self._obj, **dict(kwargs, **new_kwargs))

kwargs['clone'] = False if clone is None else clone
return self._obj.options(*args, **kwargs)
return self._obj.options(*new_args, **kwargs)
4 changes: 3 additions & 1 deletion holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,11 @@ def __call__(self, allowed_keywords=None, **kwargs):
"""
Create a new Options object that inherits the parent options.
"""
if 'key' not in kwargs:
kwargs['key'] = self.key
allowed_keywords=self.allowed_keywords if allowed_keywords in [None,[]] else allowed_keywords
inherited_style = dict(allowed_keywords=allowed_keywords, **kwargs)
return self.__class__(key=self.key, **dict(self.kwargs, **inherited_style))
return self.__class__(**dict(self.kwargs, **inherited_style))


def keys(self):
Expand Down

0 comments on commit 63551b1

Please sign in to comment.