Skip to content

Commit

Permalink
Fix "PLR5501", # Use elif instead of else then if, to reduce in…
Browse files Browse the repository at this point in the history
…dentation (#1375)

Signed-off-by: Jiri Daněk <jdanek@redhat.com>
  • Loading branch information
jiridanek authored Apr 12, 2024
1 parent 556678d commit 8149ccb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
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

0 comments on commit 8149ccb

Please sign in to comment.