-
Notifications
You must be signed in to change notification settings - Fork 1
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
notify_on normalized #58
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 45.97% 46.30% +0.33%
==========================================
Files 3 3
Lines 1601 1611 +10
Branches 410 413 +3
==========================================
+ Hits 736 746 +10
Misses 790 790
Partials 75 75
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
if "NOTIFY_ON" in data_fixed["JOBS"][job_section]: | ||
if type(data_fixed["JOBS"][job_section]["NOTIFY_ON"]) is str: | ||
if "," in data_fixed["JOBS"][job_section]["NOTIFY_ON"]: | ||
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split(",")] | ||
else: | ||
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split()] | ||
else: | ||
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"]] |
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.
if "NOTIFY_ON" in data_fixed["JOBS"][job_section]: | |
if type(data_fixed["JOBS"][job_section]["NOTIFY_ON"]) is str: | |
if "," in data_fixed["JOBS"][job_section]["NOTIFY_ON"]: | |
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split(",")] | |
else: | |
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"].split()] | |
else: | |
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in data_fixed["JOBS"][job_section]["NOTIFY_ON"]] | |
notify_on = data_fixed["JOBS"][job_section].get("NOTIFY_ON", "") | |
if notify_on: | |
if type(notify_on) is str: | |
if "," in notify_on: | |
notify_on = notify_on.split(",") | |
else: | |
notify_on = notify_on.split() | |
data_fixed["JOBS"][job_section]["NOTIFY_ON"] = [status.strip(" ").upper() for status in notify_on] |
I think the test should pass with this one too. The previous code has 166 lines of bytecode on godbolt, while the alternative has 78 lines. But I think it doesn't matter unless this function is called a lot.
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 added! Merging...
Associated with https://earth.bsc.es/gitlab/es/autosubmit/-/merge_requests/532
This normalizes the job.notify_on value to a list