-
Notifications
You must be signed in to change notification settings - Fork 142
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
Util string_to_list with braces #1361
Util string_to_list with braces #1361
Conversation
Wow where did I break that? Thanks for the fix! |
new_list = re.findall(r'([\w|-]+?\{.*?\}|[\w|-]+)', string) | ||
else: | ||
# Convert commas to spaces, then split the string into a list | ||
new_list = string.replace(",", " ").split() |
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 guess whitespace and/or comma is also not such a good idea, right? We should convert this into something more explicit (not necessarily now)
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.
It feels like an "it was good enough at the time" decisions, and generally speaking it's sufficient. I wouldn't want to change anything that would break existing configs, although accepting both commas and spaces is more complex than doing strict space separation.
Honestly @jabdoa2 I couldn't find exactly where it was broken. I tracked the bug based on the logs throwing for unknown slides, widgets, et cetera with names like I then started working back through commits and found that the event player merge was what broke it, but I couldn't find where. Just made a fix instead :) |
* dev: Util string_to_list with braces (missionpinball#1361)
The changes in #1327 caused new evaluations of
Util.string_to_list
that can result in the splitting of conditional events when merging dictionaries.This PR extends the logic of
string_to_list
to maintain spaces within braces when it splits, resulting in the expected behaviorBecause the regex is more computionally demanding than the native
String.replace().split()
, the new logic is only performed if the string has a brace. Otherwise, the old logic is used.