Skip to content
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

Merged
merged 1 commit into from
May 26, 2016
Merged

Add new feature: query frame #7

merged 1 commit into from
May 26, 2016

Conversation

lukas-bednar
Copy link
Member

@lukas-bednar lukas-bednar commented May 20, 2016

if m:
attributes[VALID_VALUES_KEY] = [
v.replace("\\\\", "\\").replace("\\|", "|")
for v in re.split(r'(?<!\\)\|', m.group("valid"))
Copy link
Member Author

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 \\\\|\\\\

Copy link

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.

@lukas-bednar lukas-bednar self-assigned this May 23, 2016
@lukas-bednar lukas-bednar force-pushed the query-frame branch 2 times, most recently from c00f487 to 0075dd3 Compare May 25, 2016 14:44
else:
self.logger.warning(
"The QHidden(%s) has invalid option: "
"%s not in (TRUE, FALSE)", attributes['frame_name'],
Copy link
Member Author

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]>
@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling 101d940 on rhevm-qe-automation:query-frame into e9e5cc3 on rhevm-qe-automation:master.

@cynepco3hahue
Copy link
Collaborator

Looks good for me

@lukas-bednar lukas-bednar merged commit fb27af6 into master May 26, 2016
@lukas-bednar lukas-bednar deleted the query-frame branch May 26, 2016 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants