Skip to content

Commit

Permalink
Improve handling of name and label in tuple
Browse files Browse the repository at this point in the history
# Conflicts:
#	holoviews/core/dimension.py
  • Loading branch information
stanwest committed Jun 8, 2022
1 parent f0acae2 commit 28b7cc2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,17 @@ def __init__(self, spec, **params):
all_params['name'] = spec
all_params['label'] = spec
elif isinstance(spec, tuple):
if len(spec) != 2:
raise ValueError("Dimensions specified as a tuple must be a tuple "
"consisting of the name and label not: %s" % str(spec))
name, label = spec
all_params['name'] = name
all_params['label'] = label
if 'label' in params and (label != params['label']):
if params['label'] != label:
self.param.warning(
'Using label as supplied by keyword ({!r}), ignoring '
'tuple value {!r}'.format(params['label'], label))
try:
all_params['name'], all_params['label'] = spec
except ValueError as exc:
raise ValueError(
"Dimensions specified as a tuple must be a tuple "
"consisting of the name and label not: %s" % str(spec)
) from exc
if 'label' in params and params['label'] != all_params['label']:
self.param.warning(
'Using label as supplied by keyword ({!r}), ignoring '
'tuple value {!r}'.format(params['label'], all_params['label']))
elif isinstance(spec, dict):
all_params.update(spec)
try:
Expand Down

0 comments on commit 28b7cc2

Please sign in to comment.