-
Notifications
You must be signed in to change notification settings - Fork 893
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
Extend tools selection syntax #3394
Conversation
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Here's how ChatGPT explains the new regex 🤖 : Here's a breakdown of the key components:
In summary, the regex allows for a combination of "all" or "none" or a sequence of digits and ranges separated by commas. The ranges can be specified as "X-Y", with optional spaces around digits and hyphens. |
I'm also asking it to simplify that new regex without loss in functionality, and it provide that: looks like it make sense |
kedro/framework/cli/starters.py
Outdated
@@ -755,7 +755,7 @@ def _validate_config_file_inputs(config: dict[str, str]): | |||
|
|||
input_tools = config.get("tools", "none") | |||
tools_validation_config = { | |||
"regex_validator": r"^(all|none|(( )*\d*(,\d*)*(,( )*\d*)*( )*|( )*((\d+-\d+)|(\d+ - \d+))( )*))$", | |||
"regex_validator": r"^(all|none|(( )*(\d*|\d( )?-( )?\d)(( )*,( )*(\d*|\d( )?-( )?\d))*( )*))$", |
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.
You wrote a good explanation of the regex in the PR - can you actually include it here? Using re.VERBOSE
:
I think this would allow an input of I'll test |
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
2f4f4de
to
cfee3db
Compare
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
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, @AhdraMeraliQB , very clear description, works well!
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! 👍 Great explanation.
Description
Fixes #3340
TODO: If merged after #3331 add docs changes as part of this PR
Simplified (or, well, shortened, at least) the validation regex
Development notes
Here's a breakdown of the regex to make reading this easier:
"^(all|none|(( )*(\\d*|\\d( )?-( )?\\d)(( )*,( )*(\\d*|\\d( )?-( )?\\d))*( )*))$"
Space repetition:
( )*
-> any number of space charactersComponent A:
(\\d*|\\d( )?-( )?\\d)
-> several consecutive digits or two digits separated by a hyphen with zero or one spaces on each sideComponent B:
(( )*,( )*(\\d*|\\d( )?-( )?\\d))
->(( )*,( )*A)
-> a comma surrounded by any number of spaces, followed by component AAltogether:
"^(all|none|(( )*AB*( )*))$"
The input
all
ornone
or an instance of A followed by any number of instances of B, with any number of space characters preceding or following themDeveloper Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file