mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 11:22:41 +01:00
framework: fix pylint issues
Fix/disable checks for issues reported by pylint under wa/framework.
This commit is contained in:
committed by
Marc Bonnici
parent
9025ea32b1
commit
f74b7ae78c
@@ -13,7 +13,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import re
|
||||
from copy import copy, deepcopy
|
||||
from collections import OrderedDict, defaultdict
|
||||
|
||||
@@ -494,8 +493,10 @@ class MetaConfiguration(Configuration):
|
||||
def additional_packages_file(self):
|
||||
return os.path.join(self.user_directory, 'packages')
|
||||
|
||||
def __init__(self, environ=os.environ):
|
||||
def __init__(self, environ=None):
|
||||
super(MetaConfiguration, self).__init__()
|
||||
if environ is None:
|
||||
environ = os.environ
|
||||
user_directory = environ.pop('WA_USER_DIRECTORY', '')
|
||||
if user_directory:
|
||||
self.set('user_directory', user_directory)
|
||||
@@ -730,6 +731,7 @@ class RunConfiguration(Configuration):
|
||||
|
||||
|
||||
class JobSpec(Configuration):
|
||||
# pylint: disable=access-member-before-definition,attribute-defined-outside-init
|
||||
|
||||
name = "Job Spec"
|
||||
|
||||
@@ -826,7 +828,7 @@ class JobSpec(Configuration):
|
||||
pod['id'] = self.id
|
||||
return pod
|
||||
|
||||
def update_config(self, source, check_mandatory=True):
|
||||
def update_config(self, source, check_mandatory=True): # pylint: disable=arguments-differ
|
||||
self._sources.append(source)
|
||||
values = source.config
|
||||
for k, v in values.items():
|
||||
|
@@ -19,7 +19,7 @@ from itertools import groupby, chain
|
||||
from future.moves.itertools import zip_longest
|
||||
|
||||
from wa.framework.configuration.core import (MetaConfiguration, RunConfiguration,
|
||||
JobGenerator, Status, settings)
|
||||
JobGenerator, settings)
|
||||
from wa.framework.configuration.parsers import ConfigParser
|
||||
from wa.framework.configuration.plugin_cache import PluginCache
|
||||
from wa.framework.exception import NotFoundError
|
||||
@@ -36,7 +36,7 @@ class CombinedConfig(object):
|
||||
instance.run_config = RunConfiguration.from_pod(pod.get('run_config', {}))
|
||||
return instance
|
||||
|
||||
def __init__(self, settings=None, run_config=None):
|
||||
def __init__(self, settings=None, run_config=None): # pylint: disable=redefined-outer-name
|
||||
self.settings = settings
|
||||
self.run_config = run_config
|
||||
|
||||
@@ -78,7 +78,7 @@ class ConfigManager(object):
|
||||
raise RuntimeError(msg)
|
||||
return self._jobs
|
||||
|
||||
def __init__(self, settings=settings):
|
||||
def __init__(self, settings=settings): # pylint: disable=redefined-outer-name
|
||||
self.settings = settings
|
||||
self.run_config = RunConfiguration()
|
||||
self.plugin_cache = PluginCache()
|
||||
@@ -93,7 +93,7 @@ class ConfigManager(object):
|
||||
self._config_parser.load_from_path(self, filepath)
|
||||
self.loaded_config_sources.append(filepath)
|
||||
|
||||
def load_config(self, values, source, wrap_exceptions=True):
|
||||
def load_config(self, values, source):
|
||||
self._config_parser.load(self, values, source)
|
||||
self.loaded_config_sources.append(source)
|
||||
|
||||
@@ -169,7 +169,7 @@ def permute_by_iteration(specs):
|
||||
X.A1, Y.A1, X.B1, Y.B1, X.A2, Y.A2, X.B2, Y.B2
|
||||
|
||||
"""
|
||||
groups = [list(g) for k, g in groupby(specs, lambda s: s.workload_id)]
|
||||
groups = [list(g) for _, g in groupby(specs, lambda s: s.workload_id)]
|
||||
|
||||
all_tuples = []
|
||||
for spec in chain(*groups):
|
||||
@@ -195,7 +195,7 @@ def permute_by_section(specs):
|
||||
X.A1, X.B1, Y.A1, Y.B1, X.A2, X.B2, Y.A2, Y.B2
|
||||
|
||||
"""
|
||||
groups = [list(g) for k, g in groupby(specs, lambda s: s.section_id)]
|
||||
groups = [list(g) for _, g in groupby(specs, lambda s: s.section_id)]
|
||||
|
||||
all_tuples = []
|
||||
for spec in chain(*groups):
|
||||
|
@@ -12,16 +12,17 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# pylint: disable=no-self-use
|
||||
|
||||
import os
|
||||
import logging
|
||||
from functools import reduce # pylint: disable=redefined-builtin
|
||||
|
||||
from wa.framework.configuration.core import JobSpec
|
||||
from wa.framework.exception import ConfigError
|
||||
from wa.utils import log
|
||||
from wa.utils.serializer import json, read_pod, SerializerSyntaxError
|
||||
from wa.utils.types import toggle_set, counter
|
||||
from functools import reduce
|
||||
|
||||
|
||||
logger = logging.getLogger('config')
|
||||
@@ -135,7 +136,7 @@ class AgendaParser(object):
|
||||
logger.debug('Setting run name to "{}"'.format(value))
|
||||
state.run_config.set('run_name', value)
|
||||
|
||||
state.load_config(entry, '{}/{}'.format(source, name), wrap_exceptions=False)
|
||||
state.load_config(entry, '{}/{}'.format(source, name))
|
||||
|
||||
def _pop_sections(self, raw):
|
||||
sections = raw.pop("sections", [])
|
||||
@@ -264,8 +265,8 @@ def merge_augmentations(raw):
|
||||
conflicts = check_entry.conflicts_with(e)
|
||||
if conflicts:
|
||||
msg = '"{}" and "{}" have conflicting entries: {}'
|
||||
conflict_string = ', '.join('"{}"'.format(c.strip("~"))
|
||||
for c in conflicts)
|
||||
conflict_string = ', '.join('"{}"'.format(c.strip("~"))
|
||||
for c in conflicts)
|
||||
raise ConfigError(msg.format(check_entry, e, conflict_string))
|
||||
|
||||
if entries:
|
||||
@@ -354,4 +355,3 @@ def _process_workload_entry(workload, seen_workload_ids, jobs_config):
|
||||
if "workload_name" not in workload:
|
||||
raise ConfigError('No workload name specified in entry {}'.format(workload['id']))
|
||||
return workload
|
||||
|
||||
|
@@ -292,9 +292,9 @@ def update_config_from_source(final_config, source, state):
|
||||
'already been specified more specifically for '
|
||||
'{specific_name} in:\n\t\t{sources}')
|
||||
seen_sources = state.seen_specific_config[name]
|
||||
msg = msg.format(generic_name=generic_name,
|
||||
msg = msg.format(generic_name=state.generic_name,
|
||||
config_name=name,
|
||||
specific_name=specific_name,
|
||||
specific_name=state.specific_name,
|
||||
sources=", ".join(seen_sources))
|
||||
raise ConfigError(msg)
|
||||
value = state.generic_config[source].pop(name)
|
||||
|
Reference in New Issue
Block a user