-
Notifications
You must be signed in to change notification settings - Fork 795
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
Parse shorthand when creating the condition 2 #2841
Parse shorthand when creating the condition 2 #2841
Conversation
Two of the failed tests |
@ChristopherDavisUCI Thanks for looking into this! The work you and @joelostblom put into this got me thinking about the whole deep validation approach in general and if there is not a better way using more of the information that |
Closed in favor of #2842 |
@joelostblom I think some of the code here could still be worth considering. In the current master branch, the code
will result in
That inner Also, if we evaluate Would it be worth me opening a new PR with some of this same code? Or do you see any reason this inner wrapping is desirable? @binste I'm also happy to hear your thoughts! |
I agree with you that this looks odd, and the change you suggested looks more appropriate (although both I will reopen this for now so that we can continue the discussion and see the tests passing. Could you rebase it on the current master branch?
Note that this no longer happens after #2842 since we removed the |
Thanks @joelostblom! I think I will investigate a little more the origin of this wrapping. I think it first showed up in #646, but that seems like a pretty major PR, so it's a little hard for me to grasp at first glance. Do you know, when I see an error in the automated tests like the following, is there a good way to tell which of the example files caused this error to be raised? Neither on GitHub nor locally with VS Code is it clear to me how to tell which example file was being used. (I tried running the test with debug mode in VS Code, but so far I have not gotten it to halt when the error is raised.) It seems like code somewhere is expecting |
Thanks @mattijn! I haven't had a chance to experiment yet, but I should have time this week. |
@joelostblom @mattijn I believe this is ready for review. I found the source of the tests failing before... it was a The main sales pitch for this PR is what was described in #2841 (comment). Briefly, I think if The main change in this PR is when an |
altair/utils/core.py
Outdated
@@ -14,7 +14,7 @@ | |||
import pandas as pd | |||
import numpy as np | |||
|
|||
from altair.utils.schemapi import SchemaBase, Undefined | |||
from altair.utils.schemapi import SchemaBase, Undefined # noqa: F401 |
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.
Why do we need this? If this PR removed the only place where Undefined
was used, shouldn't we remove the import instead?
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.
Thanks for checking on this @joelostblom. I left the Undefined
import here because of this line: https://github.com/altair-viz/altair/blob/7bc754e8dd6748a8b4633b6f3cd2345ab7078fb2/altair/utils/__init__.py#L10
Do you think it's worth importing Undefined
directly in that __init__
file instead? I haven't experimented at all, so it's possible other errors will show up if I move it.
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 that would make more sense to me. Could you try that? If it doesn't work and seems laborious to resolve we can just keep it here, but let's give it a quick try first.
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.
That seemed to work @joelostblom in c91468f
My quick tests did not catch any unwanted side effects.
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.
LGTM, thank you!
This is a cleaned up version of #2837
Also updated one test to the new condition handling.