1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

Merge pull request #496 from bjackman/docstring-tweaks

Misc clarifications/cleanups
This commit is contained in:
setrofim 2017-10-04 15:56:58 +01:00 committed by GitHub
commit 24d96c2397
2 changed files with 16 additions and 18 deletions

View File

@ -73,25 +73,23 @@ class PluginCache(object):
if self.is_global_alias(plugin_name): if self.is_global_alias(plugin_name):
self.add_global_alias(plugin_name, values, source) self.add_global_alias(plugin_name, values, source)
return return
for name, value in values.iteritems():
self.add_config(plugin_name, name, value, source)
def add_config(self, plugin_name, name, value, source):
if source not in self.sources: if source not in self.sources:
msg = "Source '{}' has not been added to the plugin cache." msg = "Source '{}' has not been added to the plugin cache."
raise RuntimeError(msg.format(source)) raise RuntimeError(msg.format(source))
if (not self.loader.has_plugin(plugin_name) and if (not self.loader.has_plugin(plugin_name) and
plugin_name not in GENERIC_CONFIGS): plugin_name not in GENERIC_CONFIGS):
msg = 'configuration provided for unknown plugin "{}"' msg = 'configuration provided for unknown plugin "{}"'
raise ConfigError(msg.format(plugin_name)) raise ConfigError(msg.format(plugin_name))
if (plugin_name not in GENERIC_CONFIGS and for name, value in values.iteritems():
name not in self.get_plugin_parameters(plugin_name)): if (plugin_name not in GENERIC_CONFIGS and
msg = "'{}' is not a valid parameter for '{}'" name not in self.get_plugin_parameters(plugin_name)):
raise ConfigError(msg.format(name, plugin_name)) msg = "'{}' is not a valid parameter for '{}'"
raise ConfigError(msg.format(name, plugin_name))
self.plugin_configs[plugin_name][source][name] = value self.plugin_configs[plugin_name][source][name] = value
def is_global_alias(self, name): def is_global_alias(self, name):
return name in self._list_of_global_aliases return name in self._list_of_global_aliases
@ -158,7 +156,7 @@ class PluginCache(object):
return params return params
# pylint: disable=too-many-nested-blocks, too-many-branches # pylint: disable=too-many-nested-blocks, too-many-branches
def _merge_using_priority_specificity(self, specific_name, def _merge_using_priority_specificity(self, specific_name,
generic_name, merged_config, is_final=True): generic_name, merged_config, is_final=True):
""" """
WA configuration can come from various sources of increasing priority, WA configuration can come from various sources of increasing priority,
@ -181,7 +179,7 @@ class PluginCache(object):
:param generic_name: The name of the generic configuration :param generic_name: The name of the generic configuration
e.g ``device_config`` e.g ``device_config``
:param merge_config: A dict of ``ConfigurationPoint``s to be used when :param merge_config: A dict of ``ConfigurationPoint``s to be used when
merging configuration. keys=config point name, merging configuration. keys=config point name,
values=config point values=config point
:param is_final: if ``True`` (the default) make sure that mandatory :param is_final: if ``True`` (the default) make sure that mandatory
parameters are set. parameters are set.

View File

@ -75,7 +75,7 @@ def instantiate_assistant(tdesc, params, target):
class TargetDescription(object): class TargetDescription(object):
def __init__(self, name, source, description=None, target=None, platform=None, def __init__(self, name, source, description=None, target=None, platform=None,
conn=None, assistant=None, target_params=None, platform_params=None, conn=None, assistant=None, target_params=None, platform_params=None,
conn_params=None, assistant_params=None): conn_params=None, assistant_params=None):
self.name = name self.name = name
@ -122,7 +122,7 @@ class TargetDescriptor(Plugin):
COMMON_TARGET_PARAMS = [ COMMON_TARGET_PARAMS = [
Parameter('working_directory', kind=str, Parameter('working_directory', kind=str,
description=''' description='''
On-target working directory that will be used by WA. This On-target working directory that will be used by WA. This
directory must be writable by the user WA logs in as without directory must be writable by the user WA logs in as without
the need for privilege elevation. the need for privilege elevation.
'''), '''),
@ -143,7 +143,7 @@ COMMON_TARGET_PARAMS = [
If additional modules need to be loaded, they may be specified If additional modules need to be loaded, they may be specified
using this parameter. using this parameter.
Please see ``devlab`` documentation for information on the available Please see ``devlib`` documentation for information on the available
modules. modules.
'''), '''),
Parameter('load_default_modules', kind=bool, default=True, Parameter('load_default_modules', kind=bool, default=True,
@ -153,10 +153,10 @@ COMMON_TARGET_PARAMS = [
``True`` would suppress that, ensuring that only the base Target ``True`` would suppress that, ensuring that only the base Target
interface is initialized. interface is initialized.
You may want to set this if there is a problem with one or more default You may want to set this to ``False`` if there is a problem with one
modules on your platform (e.g. your device is unrooted and cpufreq is or more default modules on your platform (e.g. your device is
not accessible to unprivileged users), or if Target initialization is unrooted and cpufreq is not accessible to unprivileged users), or
taking too long for your platform. if ``Target`` initialization is taking too long for your platform.
'''), '''),
] ]