-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add new feature: query frame #7
Conversation
if m: | ||
attributes[VALID_VALUES_KEY] = [ | ||
v.replace("\\\\", "\\").replace("\\|", "|") | ||
for v in re.split(r'(?<!\\)\|', m.group("valid")) |
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 will behave wrong for \\\\|\\\\
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 think the correct way to parse this should be something like:
Create an array of records, each has {char, type} where type is one of {plain, unparsed }
Initialize it with the input string and type=unparsed for all chars.
Then loop over:
Replace each [('', unparsed), ('', unparsed)] with ('', plain)
Replace each [('', unparsed), ('|', unparsed)] with ('|', plain)
split the result on [('', unparsed), ('|', unparsed)]
Or something like that, didn't actually try this :-)
It might be possible to do using plain re/string replace, not sure.
It seems to me that if you do not keep per char whether it was already parsed ("plain"), you risk breaking on some corner cases.
c00f487
to
0075dd3
Compare
else: | ||
self.logger.warning( | ||
"The QHidden(%s) has invalid option: " | ||
"%s not in (TRUE, FALSE)", attributes['frame_name'], |
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.
Maybe I should add FRAME_NAME_KEY as well
Signed-off-by: Lukas Bednar <[email protected]>
Looks good for me |
https://gerrit.ovirt.org/56955
Signed-off-by: Lukas Bednar [email protected]