1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

Pylint Fixes

Update our version of pylint to use the latest version and update the
codebase to comply with the majority of the updates.

For now disable the additional checks for `super-with-arguments`,
`useless-object-inheritance`, `raise-missing-from`, `no-else-raise`,
`no-else-break`, `no-else-continue` to be consistent with the existing
codebase.
This commit is contained in:
Marc Bonnici
2020-10-19 18:07:21 +01:00
committed by setrofim
parent fbd6f4e90c
commit fbb84eca72
22 changed files with 33 additions and 31 deletions

View File

@@ -252,8 +252,7 @@ class ConfigurationPoint(object):
a warning to the user however will continue execution.
"""
self.name = identifier(name)
if kind in KIND_MAP:
kind = KIND_MAP[kind]
kind = KIND_MAP.get(kind, kind)
if kind is not None and not callable(kind):
raise ValueError('Kind must be callable.')
self.kind = kind

View File

@@ -297,7 +297,7 @@ def merge_augmentations(raw):
raise ConfigError(msg.format(value, n, exc))
# Make sure none of the specified aliases conflict with each other
to_check = [e for e in entries]
to_check = list(entries)
while len(to_check) > 1:
check_entry = to_check.pop()
for e in to_check:

View File

@@ -33,6 +33,7 @@ class JobSpecSource(object):
def id(self):
return self.config['id']
@property
def name(self):
raise NotImplementedError()

View File

@@ -449,7 +449,7 @@ class Executor(object):
for status in reversed(Status.levels):
if status in counter:
parts.append('{} {}'.format(counter[status], status))
self.logger.info(status_summary + ', '.join(parts))
self.logger.info('{}{}'.format(status_summary, ', '.join(parts)))
self.logger.info('Results can be found in {}'.format(output.basepath))

View File

@@ -50,6 +50,7 @@ def init_user_directory(overwrite_existing=False): # pylint: disable=R0914
# If running with sudo on POSIX, change the ownership to the real user.
real_user = os.getenv('SUDO_USER')
if real_user:
# pylint: disable=import-outside-toplevel
import pwd # done here as module won't import on win32
user_entry = pwd.getpwnam(real_user)
uid, gid = user_entry.pw_uid, user_entry.pw_gid

View File

@@ -157,6 +157,7 @@ class Alias(object):
raise ConfigError(msg.format(param, self.name, ext.name))
# pylint: disable=bad-mcs-classmethod-argument
class PluginMeta(type):
"""
This basically adds some magic to plugins to make implementing new plugins,
@@ -367,7 +368,7 @@ class Plugin(with_metaclass(PluginMeta, object)):
self._modules.append(module)
def __str__(self):
return self.name
return str(self.name)
def __repr__(self):
params = []

View File

@@ -35,6 +35,7 @@ class __LoaderWrapper(object):
def reset(self):
# These imports cannot be done at top level, because of
# sys.modules manipulation below
# pylint: disable=import-outside-toplevel
from wa.framework.plugin import PluginLoader
from wa.framework.configuration.core import settings
self._loader = PluginLoader(settings.plugin_packages,

View File

@@ -281,7 +281,7 @@ def apk_version_matches(path, version):
version = list_or_string(version)
info = get_cacheable_apk_info(path)
for v in version:
if info.version_name == v or info.version_code == v:
if v in (info.version_name, info.version_code):
return True
if loose_version_matching(v, info.version_name):
return True

View File

@@ -732,7 +732,7 @@ class IdleStateValue(object):
'''Checks passed state and converts to its ID'''
value = caseless_string(value)
for s_id, s_name, s_desc in self.values:
if value == s_id or value == s_name or value == s_desc:
if value in (s_id, s_name, s_desc):
return s_id
msg = 'Invalid IdleState: "{}"; Must be in {}'
raise ValueError(msg.format(value, self.values))