-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Tightened semantics of Dimension objects #1245
Conversation
holoviews/core/dimension.py
Outdated
raise Exception("Values argument can only be set with the string 'initial'.") | ||
values = params.get('values', []) | ||
if isinstance(values, basestring) and values == 'initial': | ||
self.warning("The 'initial' string for dimension values is no longer supported.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm confused set values
to an empty list here, otherwise param will throw an exception after you've already warned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, you'll get ['a', 'i', 'i', 'i', 'l', 'n', 't']
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9d57a58 (I pushed forced an amended commit)
87a4113
to
9d57a58
Compare
Looks good to me and I'm happy with the pprint. |
Great! I'm happy the tests have passed - I was worried there might be double specification of I am also considering making |
5bbb9f5
to
21443cf
Compare
Rebasing against current master to get the push builds passing (pr builds are green). |
b7640d4
to
24a0e88
Compare
The pr build has now passed for Python 3 and 3. I will now try to eliminate old uses of Note, the next commit is one that I'll use to find where dimensions are cast to strings. It uses some nasty inspection code and I'll keep amending and push forcing that commit till I've caught them all. |
Rebasing again due to recent notebook test data updates. |
59e4bcf
to
2fd9fe3
Compare
2fd9fe3
to
e503ec4
Compare
holoviews/core/dimension.py
Outdated
@@ -64,7 +63,8 @@ def replace_dimensions(dimensions, overrides): | |||
elif isinstance(override, Dimension): | |||
replaced.append(override) | |||
elif isinstance(override, dict): | |||
replaced.append(d(**override)) | |||
replaced.append(d(override.get('name',None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be using .clone
internally now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, __call__
is now an alias to clone but I do want to recommend clone
from now on. Thanks for point it out and I'll fix it shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 99ef6a8
holoviews/core/dimension.py
Outdated
elif (name,) in self.presets.keys(): | ||
existing_params = dict(self.presets[(str(name),)].get_param_values()) | ||
elif spec in self.presets.keys(): | ||
existing_params = dict(self.presets[str(spec)].get_param_values()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right, you check spec
is in presets but then do the lookup with str(spec)
? Same below, also is .keys()
needed in the conditional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 703c01d
Tests have passed and I think this PR is now ready to review. |
holoviews/core/dimension.py
Outdated
if name is not None: settings['name'] = name | ||
return self.__class__(**settings) | ||
spec = spec if (spec is not None) else (overrides.get('name', self.name), | ||
overrides.get('label', self.label)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to check if name or label are supplied along with a spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it matter? If there is a spec, it gets passed through as the first argument, shouldn't matter if it is just a string or just a tuple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, since you're filtering out name and label from kwargs below, those will simply be silently be dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah got you. Fixed in 6d50a8a.
@philippjfr I've addressed your comments and the tests are passing. Any other suggestions for dimension improvements? |
No, should I merge? |
If you are happy with the changes, please do! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR aims to address issue #843 and clean-up the definition of Dimension objects generally.
It is still work in progress and I've started this PR at the first commit just so that I can see the results of the notebook tests as I progress.
Edit: I have copied over the action items from the issue:
name
tospec
.label
as a parameterlabel
to be passed as a kwarg and warning when ambiguous.__call__
method, making it work with(name, label)
tuples__call__
toclone
.spec
property