Skip to content

Commit

Permalink
Allow wrong types to fall through to param checks
Browse files Browse the repository at this point in the history
Let the param system handle (1) a non-string name or label within a
tuple and (2) a non-hashable label, which previously raised "TypeError:
unhashable type" at the membership check.

# Conflicts:
#	holoviews/core/dimension.py
  • Loading branch information
stanwest committed Jun 8, 2022
1 parent dc39b0d commit f0acae2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def __init__(self, spec, **params):
all_params['name'] = spec
all_params['label'] = spec
elif isinstance(spec, tuple):
if not all(isinstance(s, str) for s in spec) or len(spec) != 2:
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
Expand All @@ -276,10 +276,10 @@ def __init__(self, spec, **params):
) from exc
all_params.update(params)

if all_params['name'] == '':
raise ValueError('Dimension name cannot be the empty string')
if all_params['label'] in ['', None]:
raise ValueError('Dimension label cannot be None or the empty string')
if not all_params['name']:
raise ValueError('Dimension name cannot be empty')
if not all_params['label']:
raise ValueError('Dimension label cannot be empty')

values = params.get('values', [])
if isinstance(values, str) and values == 'initial':
Expand Down

0 comments on commit f0acae2

Please sign in to comment.