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

Fix "PLR5501", # Use elif instead of else then if, to reduce indentation #1375

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ods_ci/libs/Helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ def parse_file_for_tolerations(self, filename):
print(tolerations)
elif line.startswith("Events:"):
break
elif saving is True:
tolerations.append(line.strip())
print(line)
print(tolerations)
else:
if saving is True:
tolerations.append(line.strip())
print(line)
print(tolerations)
else:
continue
continue
return tolerations

@keyword
Expand Down Expand Up @@ -196,9 +195,8 @@ def _inference_object_comparison(expected, received, threshold):
if expected.split("__")[0] != received.split("__")[0]:
failures.append([expected, received])
# else compare values are equal
else:
if not expected == received:
failures.append([expected, received])
elif not expected == received:
failures.append([expected, received])

_inference_object_comparison(expected, received, threshold)
if len(failures) > 0:
Expand Down
25 changes: 12 additions & 13 deletions ods_ci/utils/scripts/ocm/ocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,19 +1158,18 @@ def compare_with_old_version_file(self):
new_data["RUN"] = None
write_data_in_json(filename=self.osd_latest_version_data, data=old_data)
return None
else:
if self.osd_major_version not in old_data.keys() and self.osd_major_version in new_data.keys():
old_data[self.osd_major_version] = {"0": "0"}
log.info(old_data.keys())
lst_to_trigger_job = compare_dicts(
new_data[self.osd_major_version],
old_data[self.osd_major_version],
)
elif self.osd_major_version in old_data.keys():
lst_to_trigger_job = compare_dicts(
new_data[self.osd_major_version],
old_data[self.osd_major_version],
)
elif self.osd_major_version not in old_data.keys() and self.osd_major_version in new_data.keys():
old_data[self.osd_major_version] = {"0": "0"}
log.info(old_data.keys())
lst_to_trigger_job = compare_dicts(
new_data[self.osd_major_version],
old_data[self.osd_major_version],
)
elif self.osd_major_version in old_data.keys():
lst_to_trigger_job = compare_dicts(
new_data[self.osd_major_version],
old_data[self.osd_major_version],
)

old_data.update(new_data)
if self.new_run == "True":
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ ignore = [
"PERF401", # Use a list comprehension to create a transformed list
"PLC0415", # `import` should be at the top-level of a file
"PLC1901", # `filter_value != ""` can be simplified to `filter_value` as an empty string is falsey
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
"PLR6201", # Use a `set` literal when testing for membership
"PLR6301", # Method `_render_template` could be a function, class method, or static method
"PLW1514", # `codecs.open` in text mode without explicit `encoding` argument
Expand Down
Loading