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

Add Dimension.label replacing global alias state #1083

merged 18 commits into from Jan 30, 2017
Diff settings


Just for now


Add Dimension.alias and Dimensioned.dimensions(label='alias')

  • Loading branch information...
Philipp Rudiger Philipp Rudiger
Philipp Rudiger authored and Philipp Rudiger committed Jan 20, 2017
commit 03cc9fcdb620cd67db3c88375c119a3b21b1fb5a
Copy path View file
@@ -142,10 +142,12 @@ def __init__(self, name, **params):
existing_params = {'name': name}

all_params = dict(existing_params, **params)
alias = all_params['name']
if isinstance(all_params['name'], tuple):
alias, long_name = all_params['name']
all_params['name'] = long_name
self.alias = alias

if not isinstance(params.get('values', None), basestring):
all_params['values'] = sorted(list(unique_array(params.get('values', []))))
@@ -645,6 +647,7 @@ def dimensions(self, selection='all', label=False):
by their type, i.e. 'key' or 'value' dimensions.
By default 'all' dimensions are returned.
label = 'long' if label in [True, 'long'] else ('short' if label else None)
lambdas = {'k': (lambda x: x.kdims, {'full_breadth': False}),
'v': (lambda x: x.vdims, {}),
'c': (lambda x: x.cdims, {})}
@@ -664,7 +667,8 @@ def dimensions(self, selection='all', label=False):
raise KeyError("Invalid selection %r, valid selections include"
"'all', 'value' and 'key' dimensions" % repr(selection))
return [ if label else dim for dim in dims]
return [( if label == 'long' else dim.alias)
if label else dim for dim in dims]

def get_dimension(self, dimension, default=None, strict=False):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.