-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
REF/ENH: subclass TaoCore with interface methods, add special parsers #75
REF/ENH: subclass TaoCore with interface methods, add special parsers #75
Conversation
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.
I like this change and how it was implemented.
Thank you for working on that!
The tests run fine for me locally. |
I'll just put in a separate PR for cleanliness |
This will help with non-Jupyter usage of pytao.
ccece1f
to
fbdc8b7
Compare
I see this in the basic notebook: from pytao import Tao
tao=Tao('-init $ACC_ROOT_DIR/bmad-doc/tao_examples/cesr/tao.init -noplot')
names = tao.lat_list('*', 'ele.name')
Failed to parse string data. Returning raw value.
Traceback (most recent call last):
File "[...pytao/pytao/interface_commands.py", line 68](http://localhost:8889/pytao/interface_commands.py#line=67), in __execute
data = parse_tao_python_data(ret)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[.../pytao/pytao/tao_ctypes/util.py", line 143](http://localhost:8889/pytao/tao_ctypes/util.py#line=142), in parse_tao_python_data
dat.update(parse_tao_python_data1(l, clean_key))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[.../pytao/pytao/tao_ctypes/util.py", line 126](http://localhost:8889/pytao/tao_ctypes/util.py#line=125), in parse_tao_python_data1
name, type, setable = sline[0:3]
^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 3, got 1) |
I tried manually adding a test, which gives the same error when calling directly, but oddly def test_lat_list_3():
tao = Tao("-init $ACC_ROOT_DIR/regression_tests/python_test/cesr/tao.init -noplot")
tao.lat_list(
ix_uni="1", ix_branch="0", elements="Q*", which="design", who="ele.name"
) |
It's not an exception but rather a log message, that's why it doesn't raise. This is a failure of the parser - and the fallback is to return a raw string. Should we instead Edit: if I fail the test on unsuccessful parsing, we have a lot of failures:
|
I wrote a bunch of custom parsers this morning to address those failures. Remaining to do:
|
OK, @ChristopherMayes and @hhslepicka, this PR grew a bit out of proportion. There are no more tao commands silently failing parsing as of the last couple commits. Mind taking another look so we can move on? |
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.
Amazing work @ken-lauer! I just left a small suggestion to fix a typo (not on this PR) and a question about the __version__
.
Co-authored-by: Hugo Slepicka <hhslepicka@users.noreply.github.com>
This reverts commit 28f37ad. This appears to be working on CI (Linux) but failing locally for me (MacOS) with bmad 20240626.0
Changes
Tao
class that users see have interface methodsTao
objectpre-commit
configuration for checking the codebase; follow-up PR will do some reformatting if the maintainers are amenablelogger.exception
in the noted spotContext
I was hoping to get method tab completion in my language server-enabled editor (VSCode, vim + lsp, etc. should all be the same here); interactive Jupyter/IPython have no issue with the current implementation because the instance already exists with the patched-in methods.