From 8318b60360b59b354d710e4772b495f1f56eb9c9 Mon Sep 17 00:00:00 2001 From: Bob Fahr <20520336+bfahr@users.noreply.github.com> Date: Mon, 1 Aug 2022 10:58:56 -0500 Subject: [PATCH] New version of flake8 found some errors (#3488) * Version 5.0.2 of flake8 detected some errors that needed to be fixed to allow CI/CD tests to pass Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com> (cherry picked from commit 4e6611a7150507b0d2c8c85c562fd671ee1ac502) --- insights/client/utilities.py | 2 +- insights/parsers/__init__.py | 2 +- insights/parsers/passenger_status.py | 2 +- insights/parsers/sealert.py | 2 +- insights/parsers/uname.py | 2 +- insights/tests/parsers/test_satellite_postgresql_query.py | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/insights/client/utilities.py b/insights/client/utilities.py index bfcdc3b727..78cda6a49d 100644 --- a/insights/client/utilities.py +++ b/insights/client/utilities.py @@ -473,7 +473,7 @@ def largest_spec_in_archive(archive_file): abs_fname = os.path.join('.', data_top, fname) # get the archives from inside data directory data_file = tar_file.getmember(abs_fname) - if(data_file.size > largest_fsize): + if (data_file.size > largest_fsize): largest_fsize = data_file.size largest_file_name = fname largest_spec = specs_metadata["name"] diff --git a/insights/parsers/__init__.py b/insights/parsers/__init__.py index 301dd6ae8d..a618e6bed6 100644 --- a/insights/parsers/__init__.py +++ b/insights/parsers/__init__.py @@ -284,7 +284,7 @@ def calc_offset(lines, target, invert_search=False, require_all=False): return offset else: return offset - elif invert_search and not(line == '' or found_any): + elif invert_search and not (line == '' or found_any): return offset # If we get here then we didn't find any of the targets diff --git a/insights/parsers/passenger_status.py b/insights/parsers/passenger_status.py index 736bcec464..a93dbdc2d7 100644 --- a/insights/parsers/passenger_status.py +++ b/insights/parsers/passenger_status.py @@ -84,7 +84,7 @@ def parse_content(self, content): group_list['p_list'].append(p_dict) l = line.lstrip('* ') # parse each key: value pair - while(':' in l and l.index(':') != l.rindex(':')): + while (':' in l and l.index(':') != l.rindex(':')): k, l = [i.strip() for i in l.split(':', 1)] v, l = [i.strip() for i in l.split(None, 1)] p_dict[k] = v diff --git a/insights/parsers/sealert.py b/insights/parsers/sealert.py index 08708e5b0e..7ca958ccec 100644 --- a/insights/parsers/sealert.py +++ b/insights/parsers/sealert.py @@ -29,7 +29,7 @@ def lines_stripped(self): lines = self.lines[:] for index in range(len(self.lines) - 1, -1, -1): if lines[index] == '': - del(lines[index]) + del (lines[index]) else: break return lines diff --git a/insights/parsers/uname.py b/insights/parsers/uname.py index 33d3175f58..c580363221 100644 --- a/insights/parsers/uname.py +++ b/insights/parsers/uname.py @@ -445,7 +445,7 @@ def __ne__(self, other): See the `__eq__` operator for a detailed description. """ - return not(self == other) + return not (self == other) def __lt__(self, other): """ diff --git a/insights/tests/parsers/test_satellite_postgresql_query.py b/insights/tests/parsers/test_satellite_postgresql_query.py index b7d4997501..2e8c3b62ae 100644 --- a/insights/tests/parsers/test_satellite_postgresql_query.py +++ b/insights/tests/parsers/test_satellite_postgresql_query.py @@ -221,12 +221,12 @@ def test_basic_output_with_satellite_admin_setting(): def test_satellite_admin_settings(): settings = satellite_postgresql_query.SatelliteAdminSettings(context_wrap(SATELLITE_SETTINGS_2)) - assert(len(settings)) == 2 + assert (len(settings)) == 2 assert not settings.get_setting('unregister_delete_host') assert settings.get_setting('destroy_vm_on_host_delete') settings = satellite_postgresql_query.SatelliteAdminSettings(context_wrap(SATELLITE_SETTINGS_3)) - assert(len(settings)) == 2 + assert (len(settings)) == 2 assert not settings.get_setting('unregister_delete_host') assert not settings.get_setting('destroy_vm_on_host_delete') assert settings.get_setting('non_exist_column') is None