1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

framework: pep8 fixes

Fix issues reported by flake8.
This commit is contained in:
Sergei Trofimov
2018-07-05 14:02:05 +01:00
committed by Marc Bonnici
parent 88c5005b38
commit 03eafe6b33
20 changed files with 435 additions and 389 deletions

View File

@@ -144,12 +144,14 @@ class LoggingConfig(dict):
def to_pod(self):
return self
def expanded_path(path):
"""
Ensure that the provided path has been expanded if applicable
"""
return os.path.expanduser(str(path))
def get_type_name(kind):
typename = str(kind)
if '\'' in typename:
@@ -377,12 +379,11 @@ class Configuration(object):
name))
try:
self.configuration[name].set_value(self, value,
check_mandatory=check_mandatory)
check_mandatory=check_mandatory)
except (TypeError, ValueError, ConfigError) as e:
msg = 'Invalid value "{}" for "{}": {}'
raise ConfigError(msg.format(value, name, e))
def update_config(self, values, check_mandatory=True):
for k, v in values.items():
self.set(k, v, check_mandatory=check_mandatory)
@@ -899,7 +900,6 @@ class JobSpec(Configuration):
self.label = self.workload_name
# This is used to construct the list of Jobs WA will run
class JobGenerator(object):

View File

@@ -18,12 +18,14 @@ from wa.framework.configuration.plugin_cache import PluginCache
from wa.utils.serializer import yaml
from wa.utils.doc import strip_inlined_text
DEFAULT_AUGMENTATIONS = ['execution_time',
'interrupts',
'cpufreq',
'status',
'csv'
]
DEFAULT_AUGMENTATIONS = [
'execution_time',
'interrupts',
'cpufreq',
'status',
'csv',
]
def _format_yaml_comment(param, short_description=False):

View File

@@ -84,7 +84,6 @@ class ConfigParser(object):
log.dedent()
class AgendaParser(object):
def load_from_path(self, state, filepath):
@@ -244,7 +243,7 @@ def merge_augmentations(raw):
"""
cfg_point = JobSpec.configuration['augmentations']
names = [cfg_point.name,] + cfg_point.aliases
names = [cfg_point.name, ] + cfg_point.aliases
entries = []
for n in names:
@@ -253,9 +252,9 @@ def merge_augmentations(raw):
value = raw.pop(n)
try:
entries.append(toggle_set(value))
except TypeError as e:
except TypeError as exc:
msg = 'Invalid value "{}" for "{}": {}'
raise ConfigError(msg.format(value, n, e))
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]

View File

@@ -81,7 +81,7 @@ class PluginCache(object):
if caseless_string(plugin_name) in ['global', 'config']:
msg = '"{}" entry specified inside config/global section; If this is ' \
'defined in a config file, move the entry content into the top level'
'defined in a config file, move the entry content into the top level'
raise ConfigError(msg.format((plugin_name)))
if (not self.loader.has_plugin(plugin_name) and
@@ -270,7 +270,6 @@ class PluginCache(object):
raise AttributeError(name)
class MergeState(object):
def __init__(self):
@@ -289,13 +288,13 @@ def update_config_from_source(final_config, source, state):
if name in state.generic_config[source]:
if name in state.seen_specific_config:
msg = ('"{generic_name}" configuration "{config_name}" has '
'already been specified more specifically for '
'{specific_name} in:\n\t\t{sources}')
'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=state.generic_name,
config_name=name,
specific_name=state.specific_name,
sources=", ".join(seen_sources))
config_name=name,
specific_name=state.specific_name,
sources=", ".join(seen_sources))
raise ConfigError(msg)
value = state.generic_config[source].pop(name)
cfg_point.set_value(final_config, value, check_mandatory=False)