-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Make OptsSpec parser more robust #270
Comments
Can support for comment be added?
|
Support for comments would be fairly trivial although it means the Alternatively, I can imagine that there could be a different comment syntax (e.g |
Ooh, that's tricky. Using a different comment character would be confusing for people, so I would hope that's not necessary. What about allowing # only if it is escaped ( |
That seems like a fairly reasonable approach that could be implemented quite easily... |
@jlstevens In which positions do you expect |
Btw, I hit the same problem which @philippjfr mentioned above, but with a number instead of a string as the value (using the matplotlib backend):
Without having looked at the code it appears to me that the options parser is trying to re-implement parsing of basic Python syntax, but in a somewhat ad-hoc way which misses some corner cases. Is there any value in using |
That is true for some parts of the syntax where Python literals are involved. This is due to the need for pyparsing for the non-standard portions but yes, using |
As reported by @vascotenner in #1035, the parser does not like floats without a value before the decimal points: Works: %%opts HLine (linewidth=1, color=(1,1,1,0.5)) Doesn't work: %%opts HLine (linewidth=1, color=(1,1,1,.5)) |
Also as described by @vascotenner in #1105, the parser is not using the future float division even if you define it. I think for it would be fine if we imported future division in the parser module. Example of the issue: from __future__ import division
assert 0.75 == 3/4
%%opts Raster [aspect=3/4]
hv.Raster(np.random.randint((10,20))
|
Another small bug encountered it seems the parser breaks completely when the specification contains spaces, e.g.:
|
We have pretty much deprecated the magics at this point and do not recommend using the string parser so I'm going to close this. Improving the parser proved to be pretty much impossible. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
OptsSpec
parser for the IPython magic works well for simple types of data but often breaks when you try to pass it more complex data such as dictionaries with string values string keys and values. It is probably a larger project to handle cases like this and won't be tackled any time soon. This issue should be seen as a place to gather examples where the parser gets things wrong so we have a bit more data to work with when someone decides to look at this.One example was highlighted in issue #262:
The text was updated successfully, but these errors were encountered: