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

HGC Parser #68

Merged
merged 9 commits into from
Sep 7, 2021
Merged

HGC Parser #68

merged 9 commits into from
Sep 7, 2021

Conversation

carbonarok
Copy link
Contributor

New HGC parser created

"""Parse HGC subject string."""
data = {}
try:
search = re.search(r"^.+\((.+)\)", subject.replace("\n", ""))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an example of this parser? (easy to understand the regex)

@carbonarok carbonarok requested a review from pke11y as a code owner September 7, 2021 16:49
Comment on lines 27 to 36
try:
search = re.search(r"^.+\((.+)\)", subject.replace("\n", ""))
if search:
data["maintenance_id"] = search.group(1)
else:
split = subject.split(" | ")
data["maintenance_id"] = split[2]
return [data]
except Exception as exc:
raise ParserError from exc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
search = re.search(r"^.+\((.+)\)", subject.replace("\n", ""))
if search:
data["maintenance_id"] = search.group(1)
else:
split = subject.split(" | ")
data["maintenance_id"] = split[2]
return [data]
except Exception as exc:
raise ParserError from exc
search = re.search(r"^.+\((.+)\)", subject.replace("\n", ""))
if search:
data["maintenance_id"] = search.group(1)
else:
split = subject.split(" | ")
data["maintenance_id"] = split[2]
return [data]

the main parse method is taking care of this (merge from develop!)

chadell
chadell previously approved these changes Sep 7, 2021
Copy link
Collaborator

@chadell chadell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM



class HtmlParserHGC2(Html):
"""HGC HTML parser."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""HGC HTML parser."""
"""HGC HTML 2 parser."""



class HtmlParserHGC1(Html):
"""HGC HTML parser."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""HGC HTML parser."""
"""HGC HTML 1 parser."""

Copy link
Collaborator

@chadell chadell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chadell chadell merged commit 4a3eec3 into develop Sep 7, 2021
@chadell chadell deleted the kc_hgc branch September 7, 2021 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants