-
Notifications
You must be signed in to change notification settings - Fork 94
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
xtriggers: improve parser #5587
Conversation
I did a quick test of your function and it seems to work well for my tests. Obviously some unit tests to confirm a variety of cases have been tested would be good, but I'm sure you have that on the way. Thanks for the quick action on this one, it will help simplify some of the xtriggers we have. |
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.
Looks good, tested. Perhaps you could add a few more cases to the doctests (e.g. no trailing comma, whitespace).
Doctests for Can't think of any other useful examples to test, covered all types, positional/keyword args, w/wo trailing comma. |
We could potentially break it by changing the approach in the future. However, no biggie in this case. |
Added a (pointless 😁) whitespace test, a changelog and rebased. |
Should the following work?
The docs say
|
No, that shouldn't work because xtrigger signatures don't support all Python types (e.g. Lists): cylc-flow/cylc/flow/parsec/validate.py Lines 1108 to 1136 in e550ca4
More info: #5588 |
I've not looked, but are these limitations covered in the documentation? |
Yes:
And you could probably use |
With limitations, including the one initially reported (trailing commas). Since these signatures are intended to look and feel like the Python function signatures which they are ultimately configuring, I think the correct approach is to use Python to parse this signature: This requires dropping support for unquoted "implicit" strings which I think we should probably deprecate as they are hard to support via any implementation. |
Tolerate comas within strings and equals signs withing kwarg strings.
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch (we are skipping 8.1.5)