From dc4fd1e39b20b0f934def185ee61abc71ce2d44a Mon Sep 17 00:00:00 2001 From: Eric Barrett Date: Fri, 29 Mar 2019 08:59:40 -0400 Subject: [PATCH] Enable Flake8 E12X Errors Flake8 currently ignores the following Errors: E121: continuation line under-indented for hanging indent E123: closing bracket doesn't match indentation of opening bracket E124: closing bracket doesn't match visual indentation E125: continuation line with same indent as next logical line E126: continuation line over-indented for hanging indent E127: continuation line over-indented for visual indent E128: continuation line under-indented for visual indent Enable them for more consistent formatting of code Change-Id: I415d4824a1f335ba3fceb488b0ae60b9861a036a Story: 2004515 Task: 30076 Signed-off-by: Eric Barrett --- .../ceph-manager/ceph_manager/exception.py | 8 ++++---- .../ceph-manager/ceph_manager/monitor.py | 6 +++--- .../hostdata-collectors/scripts/buddyinfo.py | 6 +++--- utilities/logmgmt/logmgmt/logmgmt/logmgmt.py | 14 +++++++------- utilities/logmgmt/logmgmt/setup.py | 13 ++++++------- .../platform_util/license/license.py | 16 ++++++++-------- 6 files changed, 31 insertions(+), 32 deletions(-) diff --git a/ceph/ceph-manager/ceph-manager/ceph_manager/exception.py b/ceph/ceph-manager/ceph-manager/ceph_manager/exception.py index a098a1dd..8fc7c80e 100644 --- a/ceph/ceph-manager/ceph-manager/ceph_manager/exception.py +++ b/ceph/ceph-manager/ceph-manager/ceph_manager/exception.py @@ -33,13 +33,13 @@ class CephManagerException(Exception): class CephPoolSetQuotaFailure(CephManagerException): message = _("Error seting the OSD pool " - "quota %(name)s for %(pool)s to %(value)s") \ - + ": %(reason)s" + "quota %(name)s for %(pool)s to " + "%(value)s") + ": %(reason)s" class CephPoolGetQuotaFailure(CephManagerException): - message = _("Error geting the OSD pool quota for %(pool)s") \ - + ": %(reason)s" + message = _("Error geting the OSD pool quota for " + "%(pool)s") + ": %(reason)s" class CephPoolCreateFailure(CephManagerException): diff --git a/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py b/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py index 11e8c8b8..aef26b22 100644 --- a/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py +++ b/ceph/ceph-manager/ceph-manager/ceph_manager/monitor.py @@ -140,9 +140,9 @@ class HandleUpgradesMixin(object): # unsurpress require_jewel_osds in case upgrade # is aborting if (state in [ - constants.UPGRADE_ABORTING, - constants.UPGRADE_ABORT_COMPLETING, - constants.UPGRADE_ABORTING_ROLLBACK]): + constants.UPGRADE_ABORTING, + constants.UPGRADE_ABORT_COMPLETING, + constants.UPGRADE_ABORTING_ROLLBACK]): self.wait_for_upgrade_complete = False return health diff --git a/tools/engtools/hostdata-collectors/scripts/buddyinfo.py b/tools/engtools/hostdata-collectors/scripts/buddyinfo.py index 11ae079b..ab91a352 100644 --- a/tools/engtools/hostdata-collectors/scripts/buddyinfo.py +++ b/tools/engtools/hostdata-collectors/scripts/buddyinfo.py @@ -88,9 +88,9 @@ class BuddyInfo(object): ret_string += " Zone: %s\n" % zoneinfo.get("zone") ret_string += " Free KiB in zone: %.2f\n" % (sum(zoneinfo.get("usage")) / (1024.0)) ret_string += '\t{0:{align}{width}} {1:{align}{width}} {2:{align}{width}}\n'.format( - "Fragment size", "Free fragments", "Total available KiB", - width=width, - align="<") + "Fragment size", "Free fragments", "Total available KiB", + width=width, + align="<") for idx in range(len(zoneinfo.get("sz_fragment"))): ret_string += '\t{order:{align}{width}} {nr:{align}{width}} {usage:{align}{width}}\n'.format( width=width, diff --git a/utilities/logmgmt/logmgmt/logmgmt/logmgmt.py b/utilities/logmgmt/logmgmt/logmgmt/logmgmt.py index bd0aa008..3553700e 100644 --- a/utilities/logmgmt/logmgmt/logmgmt/logmgmt.py +++ b/utilities/logmgmt/logmgmt/logmgmt/logmgmt.py @@ -90,9 +90,9 @@ class LogMgmtDaemon(): # Use python's log rotation, rather than logrotate handler = logging.handlers.RotatingFileHandler( - LOG_FILE, - maxBytes=LOG_FILE_MAX_BYTES, - backupCount=LOG_FILE_BACKUP_COUNT) + LOG_FILE, + maxBytes=LOG_FILE_MAX_BYTES, + backupCount=LOG_FILE_BACKUP_COUNT) my_logger = logging.getLogger() my_logger.setLevel(level) @@ -147,10 +147,10 @@ class LogMgmtDaemon(): continue # Ignore some files - if '/var/log/puppet' in fname \ - or '/var/log/dmesg' in fname \ - or '/var/log/rabbitmq' in fname \ - or '/var/log/lastlog' in fname: + if ('/var/log/puppet' in fname + or '/var/log/dmesg' in fname + or '/var/log/rabbitmq' in fname + or '/var/log/lastlog' in fname): continue if os.path.exists(fname): diff --git a/utilities/logmgmt/logmgmt/setup.py b/utilities/logmgmt/logmgmt/setup.py index 34db8fb9..deab3ddc 100644 --- a/utilities/logmgmt/logmgmt/setup.py +++ b/utilities/logmgmt/logmgmt/setup.py @@ -10,10 +10,9 @@ SPDX-License-Identifier: Apache-2.0 import setuptools setuptools.setup(name='logmgmt', - version='1.0.0', - description='logmgmt', - license='Apache-2.0', - packages=['logmgmt'], - entry_points={ - } -) + version='1.0.0', + description='logmgmt', + license='Apache-2.0', + packages=['logmgmt'], + entry_points={} + ) diff --git a/utilities/platform-util/platform-util/platform_util/license/license.py b/utilities/platform-util/platform-util/platform_util/license/license.py index 8ab705b7..57c47204 100644 --- a/utilities/platform-util/platform-util/platform_util/license/license.py +++ b/utilities/platform-util/platform-util/platform_util/license/license.py @@ -38,7 +38,7 @@ def get_licenses_info(): features = sm_common.flex_lm_license_get_feature_list() if features.value: feature_list = [feature for feature in features.value.split(',') - if feature.startswith(constants.FEATURE_PREFIX)] + if feature.startswith(constants.FEATURE_PREFIX)] sm_common.flex_lm_license_free(features) lc_attrs_list = [] @@ -66,14 +66,14 @@ def get_licenses_info(): name = constants.LICENSE_MAP.get(feature) if process_license and name: lc_attrs = dict(name=name, status=status, - expiry_date=expiry_date) + expiry_date=expiry_date) else: lc_attrs = dict() if lc_attrs: license_name = lc_attrs.get('name') if (not any(lc.get('name') == license_name - for lc in lc_attrs_list)): + for lc in lc_attrs_list)): # Get the list of license attributes for all valid # licenses and installed expired/invalid licenses lc_attrs_list.append(lc_attrs) @@ -85,8 +85,8 @@ def get_licenses_info(): # not-installed licenses for license_name in licenses: lc_attrs = dict(name=license_name, - status=constants.NOT_INSTALLED, - expiry_date='-') + status=constants.NOT_INSTALLED, + expiry_date='-') lc_attrs_list.append(lc_attrs) # Return the list of license attributes @@ -145,7 +145,7 @@ def verify_feature_license(feature_name, feature_version=None): # Return license attributes of a valid license lc_attrs = dict(name=license_name, status=constants.INSTALLED, - expiry_date=expire_date_text.value) + expiry_date=expire_date_text.value) return lc_attrs @@ -162,7 +162,7 @@ def verify_license(license_file): features = sm_common.flex_lm_license_get_feature_list() if features.value: feature_list = [feature for feature in features.value.split(',') - if feature.startswith(constants.FEATURE_PREFIX)] + if feature.startswith(constants.FEATURE_PREFIX)] sm_common.flex_lm_license_free(features) # Validate license of each feature in the license file @@ -173,7 +173,7 @@ def verify_license(license_file): if system_mode == sysinv_constants.SYSTEM_MODE_SIMPLEX: product_license = constants.AIO_SIMPLEX_SYSTEM_LICENSES elif (system_mode == sysinv_constants.SYSTEM_MODE_DUPLEX or - system_mode == sysinv_constants.SYSTEM_MODE_DUPLEX_DIRECT): + system_mode == sysinv_constants.SYSTEM_MODE_DUPLEX_DIRECT): product_license = constants.AIO_SYSTEM_LICENSES elif system_type == sysinv_constants.TIS_STD_BUILD: product_license = constants.STD_SYSTEM_LICENSES