Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unqualified Options objects #4032

Merged
merged 1 commit into from
Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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